Replace various Aircraft fields with FlightDynamics
Replaces various booleans with a FlightDynamics flag list.
This commit is contained in:
@@ -53,7 +53,8 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
public static void FlyTick(Actor self, Aircraft aircraft, int desiredFacing, WDist desiredAltitude, WVec moveOverride, int turnSpeedOverride = -1)
|
public static void FlyTick(Actor self, Aircraft aircraft, int desiredFacing, WDist desiredAltitude, WVec moveOverride, int turnSpeedOverride = -1)
|
||||||
{
|
{
|
||||||
var dat = self.World.Map.DistanceAboveTerrain(aircraft.CenterPosition);
|
var dat = self.World.Map.DistanceAboveTerrain(aircraft.CenterPosition);
|
||||||
var move = aircraft.Info.CanHover ? aircraft.FlyStep(desiredFacing) : aircraft.FlyStep(aircraft.Facing);
|
var isSlider = aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.Slide);
|
||||||
|
var move = isSlider ? aircraft.FlyStep(desiredFacing) : aircraft.FlyStep(aircraft.Facing);
|
||||||
if (moveOverride != WVec.Zero)
|
if (moveOverride != WVec.Zero)
|
||||||
move = moveOverride;
|
move = moveOverride;
|
||||||
|
|
||||||
@@ -115,7 +116,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
// If the aircraft lands when idle and is idle, we let the default idle handler manage this.
|
// If the aircraft lands when idle and is idle, we let the default idle handler manage this.
|
||||||
// TODO: Remove this after fixing all activities to work properly with arbitrary starting altitudes.
|
// TODO: Remove this after fixing all activities to work properly with arbitrary starting altitudes.
|
||||||
var skipHeightAdjustment = aircraft.Info.LandWhenIdle && self.CurrentActivity.IsCanceling && self.CurrentActivity.NextActivity == null;
|
var skipHeightAdjustment = aircraft.Info.LandWhenIdle && self.CurrentActivity.IsCanceling && self.CurrentActivity.NextActivity == null;
|
||||||
if (aircraft.Info.CanHover && !skipHeightAdjustment && dat != aircraft.Info.CruiseAltitude)
|
if (aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.Hover) && !skipHeightAdjustment && dat != aircraft.Info.CruiseAltitude)
|
||||||
{
|
{
|
||||||
if (dat <= aircraft.LandAltitude)
|
if (dat <= aircraft.LandAltitude)
|
||||||
QueueChild(new TakeOff(self, target));
|
QueueChild(new TakeOff(self, target));
|
||||||
@@ -160,19 +161,22 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (insideMaxRange && !insideMinRange)
|
if (insideMaxRange && !insideMinRange)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var move = aircraft.Info.CanHover ? aircraft.FlyStep(desiredFacing) : aircraft.FlyStep(aircraft.Facing);
|
var isSlider = aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.Slide);
|
||||||
|
var move = isSlider ? aircraft.FlyStep(desiredFacing) : aircraft.FlyStep(aircraft.Facing);
|
||||||
|
|
||||||
// Inside the minimum range, so reverse if CanHover
|
// Inside the minimum range, so reverse if we have Slide flag
|
||||||
if (aircraft.Info.CanHover && insideMinRange)
|
if (isSlider && insideMinRange)
|
||||||
{
|
{
|
||||||
FlyTick(self, aircraft, desiredFacing, aircraft.Info.CruiseAltitude, -move);
|
FlyTick(self, aircraft, desiredFacing, aircraft.Info.CruiseAltitude, -move);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The next move would overshoot, so consider it close enough or set final position if CanHover
|
// The next move would overshoot, so consider it close enough or set final position if we have Slide flag
|
||||||
if (delta.HorizontalLengthSquared < move.HorizontalLengthSquared)
|
if (delta.HorizontalLengthSquared < move.HorizontalLengthSquared)
|
||||||
{
|
{
|
||||||
if (aircraft.Info.CanHover)
|
// For VTOL landing to succeed, it must reach the exact target position,
|
||||||
|
// so for the final move it needs to behave as if it had the Slide flag.
|
||||||
|
if (isSlider || aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.VTOL))
|
||||||
{
|
{
|
||||||
// Set final (horizontal) position
|
// Set final (horizontal) position
|
||||||
if (delta.HorizontalLengthSquared != 0)
|
if (delta.HorizontalLengthSquared != 0)
|
||||||
@@ -193,7 +197,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aircraft.Info.CanHover)
|
if (!isSlider)
|
||||||
{
|
{
|
||||||
// Using the turn rate, compute a hypothetical circle traced by a continuous turn.
|
// Using the turn rate, compute a hypothetical circle traced by a continuous turn.
|
||||||
// If it contains the destination point, it's unreachable without more complex manuvering.
|
// If it contains the destination point, it's unreachable without more complex manuvering.
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
// We can't possibly turn this fast
|
// We can't possibly turn this fast
|
||||||
var desiredFacing = aircraft.Facing + 64;
|
var desiredFacing = aircraft.Facing + 64;
|
||||||
|
|
||||||
// This override is necessary, otherwise CanHover aircraft would circle sideways
|
// This override is necessary, otherwise aircraft with Slide flag would circle sideways
|
||||||
var move = aircraft.FlyStep(aircraft.Facing);
|
var move = aircraft.FlyStep(aircraft.Facing);
|
||||||
|
|
||||||
Fly.FlyTick(self, aircraft, desiredFacing, aircraft.Info.CruiseAltitude, move, turnSpeedOverride);
|
Fly.FlyTick(self, aircraft, desiredFacing, aircraft.Info.CruiseAltitude, move, turnSpeedOverride);
|
||||||
|
|||||||
@@ -84,7 +84,9 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
// otherwise if it is hidden or dead we give up
|
// otherwise if it is hidden or dead we give up
|
||||||
if (checkTarget.IsInRange(pos, maxRange) && !checkTarget.IsInRange(pos, minRange))
|
if (checkTarget.IsInRange(pos, maxRange) && !checkTarget.IsInRange(pos, minRange))
|
||||||
{
|
{
|
||||||
|
if (!aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.Hover))
|
||||||
Fly.FlyTick(self, aircraft, aircraft.Facing, aircraft.Info.CruiseAltitude);
|
Fly.FlyTick(self, aircraft, aircraft.Facing, aircraft.Info.CruiseAltitude);
|
||||||
|
|
||||||
return useLastVisibleTarget;
|
return useLastVisibleTarget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
// NOTE: desiredFacing = -1 means we should not prefer any particular facing and instead just
|
// NOTE: desiredFacing = -1 means we should not prefer any particular facing and instead just
|
||||||
// use whatever facing gives us the most direct path to the landing site.
|
// use whatever facing gives us the most direct path to the landing site.
|
||||||
if (facing == -1 && aircraft.Info.TurnToLand)
|
if (facing == -1 && aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.TurnToLand))
|
||||||
desiredFacing = aircraft.Info.InitialFacing;
|
desiredFacing = aircraft.Info.InitialFacing;
|
||||||
else
|
else
|
||||||
desiredFacing = facing;
|
desiredFacing = facing;
|
||||||
@@ -130,7 +130,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Move towards landing location
|
// Move towards landing location
|
||||||
if (aircraft.Info.VTOL && (pos - targetPosition).HorizontalLengthSquared != 0)
|
if (aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.VTOL) && (pos - targetPosition).HorizontalLengthSquared != 0)
|
||||||
{
|
{
|
||||||
QueueChild(new Fly(self, Target.FromPos(targetPosition)));
|
QueueChild(new Fly(self, Target.FromPos(targetPosition)));
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!aircraft.Info.VTOL && !finishedApproach)
|
if (!aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.VTOL) && !finishedApproach)
|
||||||
{
|
{
|
||||||
// Calculate approach trajectory
|
// Calculate approach trajectory
|
||||||
var altitude = aircraft.Info.CruiseAltitude.Length;
|
var altitude = aircraft.Info.CruiseAltitude.Length;
|
||||||
@@ -207,7 +207,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (!aircraft.CanLand(blockingCells, target.Actor))
|
if (!aircraft.CanLand(blockingCells, target.Actor))
|
||||||
{
|
{
|
||||||
// Maintain holding pattern.
|
// Maintain holding pattern.
|
||||||
if (aircraft.Info.CanHover)
|
if (aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.Hover))
|
||||||
QueueChild(new Wait(25));
|
QueueChild(new Wait(25));
|
||||||
else
|
else
|
||||||
QueueChild(new FlyCircle(self, 25));
|
QueueChild(new FlyCircle(self, 25));
|
||||||
@@ -226,7 +226,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Final descent.
|
// Final descent.
|
||||||
if (aircraft.Info.VTOL)
|
if (aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.VTOL))
|
||||||
{
|
{
|
||||||
var landAltitude = self.World.Map.DistanceAboveTerrain(targetPosition) + aircraft.LandAltitude;
|
var landAltitude = self.World.Map.DistanceAboveTerrain(targetPosition) + aircraft.LandAltitude;
|
||||||
if (Fly.VerticalTakeOffOrLandTick(self, aircraft, aircraft.Facing, landAltitude))
|
if (Fly.VerticalTakeOffOrLandTick(self, aircraft, aircraft.Facing, landAltitude))
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
|
|
||||||
if (nearestResupplier != null)
|
if (nearestResupplier != null)
|
||||||
{
|
{
|
||||||
if (aircraft.Info.CanHover)
|
if (aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.Hover))
|
||||||
{
|
{
|
||||||
var distanceFromResupplier = (nearestResupplier.CenterPosition - self.CenterPosition).HorizontalLength;
|
var distanceFromResupplier = (nearestResupplier.CenterPosition - self.CenterPosition).HorizontalLength;
|
||||||
var distanceLength = aircraft.Info.WaitDistanceFromResupplyBase.Length;
|
var distanceLength = aircraft.Info.WaitDistanceFromResupplyBase.Length;
|
||||||
@@ -113,15 +113,15 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
{
|
{
|
||||||
var exit = dest.FirstExitOrDefault(null);
|
var exit = dest.FirstExitOrDefault(null);
|
||||||
var offset = exit != null ? exit.Info.SpawnOffset : WVec.Zero;
|
var offset = exit != null ? exit.Info.SpawnOffset : WVec.Zero;
|
||||||
if (aircraft.Info.TurnToDock)
|
if (aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.TurnToDock))
|
||||||
facing = aircraft.Info.InitialFacing;
|
facing = aircraft.Info.InitialFacing;
|
||||||
if (!aircraft.Info.VTOL)
|
if (!aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.VTOL))
|
||||||
facing = 192;
|
facing = 192;
|
||||||
|
|
||||||
aircraft.MakeReservation(dest);
|
aircraft.MakeReservation(dest);
|
||||||
QueueChild(new Land(self, Target.FromActor(dest), offset, facing));
|
QueueChild(new Land(self, Target.FromActor(dest), offset, facing));
|
||||||
QueueChild(new Resupply(self, dest, WDist.Zero));
|
QueueChild(new Resupply(self, dest, WDist.Zero));
|
||||||
if (aircraft.Info.TakeOffOnResupply && !alwaysLand)
|
if (aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.TakeOffOnResupply) && !alwaysLand)
|
||||||
QueueChild(new TakeOff(self));
|
QueueChild(new TakeOff(self));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
if (dat < aircraft.Info.CruiseAltitude)
|
if (dat < aircraft.Info.CruiseAltitude)
|
||||||
{
|
{
|
||||||
// If we're a VTOL, rise before flying forward
|
// If we're a VTOL, rise before flying forward
|
||||||
if (aircraft.Info.VTOL)
|
if (aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.VTOL))
|
||||||
{
|
{
|
||||||
Fly.VerticalTakeOffOrLandTick(self, aircraft, aircraft.Facing, aircraft.Info.CruiseAltitude);
|
Fly.VerticalTakeOffOrLandTick(self, aircraft, aircraft.Facing, aircraft.Info.CruiseAltitude);
|
||||||
return false;
|
return false;
|
||||||
@@ -90,7 +90,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
// Checking for NextActivity == null again in case another activity was queued while taking off
|
// Checking for NextActivity == null again in case another activity was queued while taking off
|
||||||
if (moveToRallyPoint && NextActivity == null)
|
if (moveToRallyPoint && NextActivity == null)
|
||||||
{
|
{
|
||||||
if (!aircraft.Info.VTOL && assignTargetOnFirstRun)
|
if (!aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.VTOL) && assignTargetOnFirstRun)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
QueueChild(new AttackMoveActivity(self, () => move.MoveToTarget(self, target)));
|
QueueChild(new AttackMoveActivity(self, () => move.MoveToTarget(self, target)));
|
||||||
|
|||||||
@@ -21,9 +21,34 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
|
[Flags]
|
||||||
|
public enum FlightDynamic
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
MoveIntoShroud = 1,
|
||||||
|
Slide = 2,
|
||||||
|
Hover = 4,
|
||||||
|
VTOL = 8,
|
||||||
|
TurnToLand = 16,
|
||||||
|
TurnToDock = 32,
|
||||||
|
TakeOffOnResupply = 64,
|
||||||
|
TakeOffOnCreation = 128,
|
||||||
|
}
|
||||||
|
|
||||||
public class AircraftInfo : ITraitInfo, IPositionableInfo, IFacingInfo, IMoveInfo, ICruiseAltitudeInfo,
|
public class AircraftInfo : ITraitInfo, IPositionableInfo, IFacingInfo, IMoveInfo, ICruiseAltitudeInfo,
|
||||||
IActorPreviewInitInfo, IEditorActorOptions, IObservesVariablesInfo
|
IActorPreviewInitInfo, IEditorActorOptions, IObservesVariablesInfo
|
||||||
{
|
{
|
||||||
|
[Desc("List of flags that alter the movement behavior. Options:",
|
||||||
|
"MoveIntoShroud = Can be ordered to move into shroud.",
|
||||||
|
"Slide = Changes direction immediately, independently of current facing. Without this flag, needs to fly a curve.",
|
||||||
|
"Hover = Able to statically hover in air while idle or waiting. Without this flag, aircraft will fly in circles.",
|
||||||
|
"VTOL = Vertical-only take-off/land. Without this flag, lands/takes off diagonally.",
|
||||||
|
"TurnToLand = Does the aircraft need to turn towards InitialFacing before landing on terrain? No effect if VTOL flag is missing.",
|
||||||
|
"TurnToDock = Does the aircraft need to turn towards InitialFacing before landing on dock? No effect if VTOL flag is missing.",
|
||||||
|
"TakeOffOnResupply = Take off as soon as resupplies/repairs are finished.",
|
||||||
|
"TakeOffOnCreation = Take off from creator when spawned.")]
|
||||||
|
public readonly FlightDynamic FlightDynamics = FlightDynamic.TakeOffOnCreation | FlightDynamic.MoveIntoShroud;
|
||||||
|
|
||||||
public readonly WDist CruiseAltitude = new WDist(1280);
|
public readonly WDist CruiseAltitude = new WDist(1280);
|
||||||
|
|
||||||
[Desc("Whether the aircraft can be repulsed.")]
|
[Desc("Whether the aircraft can be repulsed.")]
|
||||||
@@ -49,9 +74,6 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public readonly HashSet<string> LandableTerrainTypes = new HashSet<string>();
|
public readonly HashSet<string> LandableTerrainTypes = new HashSet<string>();
|
||||||
|
|
||||||
[Desc("Can the actor be ordered to move in to shroud?")]
|
|
||||||
public readonly bool MoveIntoShroud = true;
|
|
||||||
|
|
||||||
[Desc("e.g. crate, wall, infantry")]
|
[Desc("e.g. crate, wall, infantry")]
|
||||||
public readonly BitSet<CrushClass> Crushes = default(BitSet<CrushClass>);
|
public readonly BitSet<CrushClass> Crushes = default(BitSet<CrushClass>);
|
||||||
|
|
||||||
@@ -69,30 +91,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("The condition to grant to self while at cruise altitude.")]
|
[Desc("The condition to grant to self while at cruise altitude.")]
|
||||||
public readonly string CruisingCondition = null;
|
public readonly string CruisingCondition = null;
|
||||||
|
|
||||||
[Desc("Can the actor hover in place mid-air? If not, then the actor will have to remain in motion (circle around).")]
|
|
||||||
public readonly bool CanHover = false;
|
|
||||||
|
|
||||||
[Desc("Does the actor land and take off vertically?")]
|
|
||||||
public readonly bool VTOL = false;
|
|
||||||
|
|
||||||
[Desc("Will this actor try to land after it has no more commands?")]
|
[Desc("Will this actor try to land after it has no more commands?")]
|
||||||
public readonly bool LandWhenIdle = true;
|
public readonly bool LandWhenIdle = true;
|
||||||
|
|
||||||
[Desc("Does this VTOL actor need to turn before landing (on terrain)?")]
|
|
||||||
public readonly bool TurnToLand = false;
|
|
||||||
|
|
||||||
[Desc("Does this VTOL actor need to turn before landing on a resupplier?")]
|
|
||||||
public readonly bool TurnToDock = true;
|
|
||||||
|
|
||||||
[Desc("Does this actor cancel its previous activity after resupplying?")]
|
[Desc("Does this actor cancel its previous activity after resupplying?")]
|
||||||
public readonly bool AbortOnResupply = true;
|
public readonly bool AbortOnResupply = true;
|
||||||
|
|
||||||
[Desc("Does this actor automatically take off after resupplying?")]
|
|
||||||
public readonly bool TakeOffOnResupply = false;
|
|
||||||
|
|
||||||
[Desc("Does this actor automatically take off after creation?")]
|
|
||||||
public readonly bool TakeOffOnCreation = true;
|
|
||||||
|
|
||||||
[Desc("Altitude at which the aircraft considers itself landed.")]
|
[Desc("Altitude at which the aircraft considers itself landed.")]
|
||||||
public readonly WDist LandAltitude = WDist.Zero;
|
public readonly WDist LandAltitude = WDist.Zero;
|
||||||
|
|
||||||
@@ -344,7 +348,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
MakeReservation(host);
|
MakeReservation(host);
|
||||||
|
|
||||||
if (Info.TakeOffOnCreation)
|
if (Info.FlightDynamics.HasFlag(FlightDynamic.TakeOffOnCreation))
|
||||||
self.QueueActivity(new TakeOff(self));
|
self.QueueActivity(new TakeOff(self));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,7 +444,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
repulsionForce += new WVec(1024, 0, 0).Rotate(WRot.FromYaw((self.CenterPosition - center).Yaw));
|
repulsionForce += new WVec(1024, 0, 0).Rotate(WRot.FromYaw((self.CenterPosition - center).Yaw));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Info.CanHover)
|
if (Info.FlightDynamics.HasFlag(FlightDynamic.Slide))
|
||||||
return repulsionForce;
|
return repulsionForce;
|
||||||
|
|
||||||
// Non-hovering actors mush always keep moving forward, so they need extra calculations.
|
// Non-hovering actors mush always keep moving forward, so they need extra calculations.
|
||||||
@@ -681,18 +685,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var isCircler = !Info.FlightDynamics.HasFlag(FlightDynamic.Hover);
|
||||||
if (!atLandAltitude && Info.LandWhenIdle && Info.LandableTerrainTypes.Count > 0)
|
if (!atLandAltitude && Info.LandWhenIdle && Info.LandableTerrainTypes.Count > 0)
|
||||||
self.QueueActivity(new Land(self));
|
self.QueueActivity(new Land(self));
|
||||||
else if (!Info.CanHover && !atLandAltitude)
|
else if (isCircler && !atLandAltitude)
|
||||||
self.QueueActivity(new FlyCircle(self, -1, Info.IdleTurnSpeed > -1 ? Info.IdleTurnSpeed : TurnSpeed));
|
self.QueueActivity(new FlyCircle(self, -1, Info.IdleTurnSpeed > -1 ? Info.IdleTurnSpeed : TurnSpeed));
|
||||||
else if (atLandAltitude && !CanLand(self.Location) && ReservedActor == null)
|
else if (atLandAltitude && !CanLand(self.Location) && ReservedActor == null)
|
||||||
self.QueueActivity(new TakeOff(self));
|
self.QueueActivity(new TakeOff(self));
|
||||||
else if (Info.CanHover && Info.IdleTurnSpeed > 0)
|
|
||||||
{
|
|
||||||
// Temporary HACK for the AutoCarryall special case (needs CanHover, but also FlyCircle on idle).
|
|
||||||
// Will go away soon (in a separate PR) with the arrival of ActionsWhenIdle.
|
|
||||||
self.QueueActivity(new FlyCircle(self, -1, Info.IdleTurnSpeed > -1 ? Info.IdleTurnSpeed : TurnSpeed));
|
|
||||||
}
|
|
||||||
else if (!atLandAltitude && altitude != Info.CruiseAltitude && !Info.LandWhenIdle)
|
else if (!atLandAltitude && altitude != Info.CruiseAltitude && !Info.LandWhenIdle)
|
||||||
self.QueueActivity(new TakeOff(self));
|
self.QueueActivity(new TakeOff(self));
|
||||||
}
|
}
|
||||||
@@ -834,12 +833,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public Activity MoveFollow(Actor self, Target target, WDist minRange, WDist maxRange,
|
public Activity MoveFollow(Actor self, Target target, WDist minRange, WDist maxRange,
|
||||||
WPos? initialTargetPosition = null, Color? targetLineColor = null)
|
WPos? initialTargetPosition = null, Color? targetLineColor = null)
|
||||||
{
|
{
|
||||||
if (!Info.CanHover)
|
|
||||||
return new FlyFollow(self, target, minRange, maxRange,
|
return new FlyFollow(self, target, minRange, maxRange,
|
||||||
initialTargetPosition, targetLineColor);
|
initialTargetPosition, targetLineColor);
|
||||||
|
|
||||||
return new Follow(self, target, minRange, maxRange,
|
|
||||||
initialTargetPosition, targetLineColor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Activity MoveIntoWorld(Actor self, CPos cell, SubCell subCell = SubCell.Any)
|
public Activity MoveIntoWorld(Actor self, CPos cell, SubCell subCell = SubCell.Any)
|
||||||
@@ -943,7 +938,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
case "Land":
|
case "Land":
|
||||||
case "Move":
|
case "Move":
|
||||||
if (!Info.MoveIntoShroud && order.Target.Type != TargetType.Invalid)
|
if (!Info.FlightDynamics.HasFlag(FlightDynamic.MoveIntoShroud) && order.Target.Type != TargetType.Invalid)
|
||||||
{
|
{
|
||||||
var cell = self.World.Map.CellContaining(order.Target.CenterPosition);
|
var cell = self.World.Map.CellContaining(order.Target.CenterPosition);
|
||||||
if (!self.Owner.Shroud.IsExplored(cell))
|
if (!self.Owner.Shroud.IsExplored(cell))
|
||||||
@@ -968,7 +963,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (orderString == "Move")
|
if (orderString == "Move")
|
||||||
{
|
{
|
||||||
var cell = self.World.Map.Clamp(self.World.Map.CellContaining(order.Target.CenterPosition));
|
var cell = self.World.Map.Clamp(self.World.Map.CellContaining(order.Target.CenterPosition));
|
||||||
if (!Info.MoveIntoShroud && !self.Owner.Shroud.IsExplored(cell))
|
if (!Info.FlightDynamics.HasFlag(FlightDynamic.MoveIntoShroud) && !self.Owner.Shroud.IsExplored(cell))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!order.Queued)
|
if (!order.Queued)
|
||||||
@@ -981,7 +976,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
else if (orderString == "Land")
|
else if (orderString == "Land")
|
||||||
{
|
{
|
||||||
var cell = self.World.Map.Clamp(self.World.Map.CellContaining(order.Target.CenterPosition));
|
var cell = self.World.Map.Clamp(self.World.Map.CellContaining(order.Target.CenterPosition));
|
||||||
if (!Info.MoveIntoShroud && !self.Owner.Shroud.IsExplored(cell))
|
if (!Info.FlightDynamics.HasFlag(FlightDynamic.MoveIntoShroud) && !self.Owner.Shroud.IsExplored(cell))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!order.Queued)
|
if (!order.Queued)
|
||||||
@@ -1011,7 +1006,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
// Aircraft with TakeOffOnResupply would immediately take off again, so there's no point in automatically forcing
|
// Aircraft with TakeOffOnResupply would immediately take off again, so there's no point in automatically forcing
|
||||||
// them to land on a resupplier. For aircraft without it, it makes more sense to land than to idle above a
|
// them to land on a resupplier. For aircraft without it, it makes more sense to land than to idle above a
|
||||||
// free resupplier.
|
// free resupplier.
|
||||||
var forceLand = orderString == "ForceEnter" || !Info.TakeOffOnResupply;
|
var forceLand = orderString == "ForceEnter" || !Info.FlightDynamics.HasFlag(FlightDynamic.TakeOffOnResupply);
|
||||||
self.QueueActivity(order.Queued, new ReturnToBase(self, targetActor, forceLand));
|
self.QueueActivity(order.Queued, new ReturnToBase(self, targetActor, forceLand));
|
||||||
}
|
}
|
||||||
else if (orderString == "Stop")
|
else if (orderString == "Stop")
|
||||||
@@ -1036,7 +1031,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
// Aircraft with TakeOffOnResupply would immediately take off again, so there's no point in forcing them to land
|
// Aircraft with TakeOffOnResupply would immediately take off again, so there's no point in forcing them to land
|
||||||
// on a resupplier. For aircraft without it, it makes more sense to land than to idle above a free resupplier.
|
// on a resupplier. For aircraft without it, it makes more sense to land than to idle above a free resupplier.
|
||||||
self.QueueActivity(order.Queued, new ReturnToBase(self, null, !Info.TakeOffOnResupply));
|
self.QueueActivity(order.Queued, new ReturnToBase(self, null, !Info.FlightDynamics.HasFlag(FlightDynamic.TakeOffOnResupply)));
|
||||||
}
|
}
|
||||||
else if (orderString == "Scatter")
|
else if (orderString == "Scatter")
|
||||||
Nudge(self);
|
Nudge(self);
|
||||||
@@ -1154,7 +1149,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);
|
IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);
|
||||||
|
|
||||||
if (!explored && !aircraft.Info.MoveIntoShroud)
|
if (!explored && !aircraft.Info.FlightDynamics.HasFlag(FlightDynamic.MoveIntoShroud))
|
||||||
cursor = "move-blocked";
|
cursor = "move-blocked";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -293,7 +293,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
if (order.OrderString == "DeliverUnit")
|
if (order.OrderString == "DeliverUnit")
|
||||||
{
|
{
|
||||||
var cell = self.World.Map.Clamp(self.World.Map.CellContaining(order.Target.CenterPosition));
|
var cell = self.World.Map.Clamp(self.World.Map.CellContaining(order.Target.CenterPosition));
|
||||||
if (!aircraftInfo.MoveIntoShroud && !self.Owner.Shroud.IsExplored(cell))
|
if (!aircraftInfo.FlightDynamics.HasFlag(FlightDynamic.MoveIntoShroud) && !self.Owner.Shroud.IsExplored(cell))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var targetLocation = move.NearestMoveableCell(cell);
|
var targetLocation = move.NearestMoveableCell(cell);
|
||||||
@@ -406,7 +406,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);
|
IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue);
|
||||||
|
|
||||||
if (!explored && !aircraftInfo.MoveIntoShroud)
|
if (!explored && !aircraftInfo.FlightDynamics.HasFlag(FlightDynamic.MoveIntoShroud))
|
||||||
cursor = info.DropOffBlockedCursor;
|
cursor = info.DropOffBlockedCursor;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user