diff --git a/OpenRA.Mods.Common/Activities/Air/Fly.cs b/OpenRA.Mods.Common/Activities/Air/Fly.cs index a5486e5fc2..594afa496c 100644 --- a/OpenRA.Mods.Common/Activities/Air/Fly.cs +++ b/OpenRA.Mods.Common/Activities/Air/Fly.cs @@ -129,7 +129,7 @@ namespace OpenRA.Mods.Common.Activities if (aircraft.Info.CanHover && !skipHeightAdjustment && dat != aircraft.Info.CruiseAltitude) { if (dat <= aircraft.LandAltitude) - QueueChild(new TakeOff(self, target)); + QueueChild(new TakeOff(self)); else VerticalTakeOffOrLandTick(self, aircraft, aircraft.Facing, aircraft.Info.CruiseAltitude); @@ -140,7 +140,7 @@ namespace OpenRA.Mods.Common.Activities } else if (dat <= aircraft.LandAltitude) { - QueueChild(new TakeOff(self, target)); + QueueChild(new TakeOff(self)); return false; } diff --git a/OpenRA.Mods.Common/Activities/Air/TakeOff.cs b/OpenRA.Mods.Common/Activities/Air/TakeOff.cs index d9e14389e1..38a854a34b 100644 --- a/OpenRA.Mods.Common/Activities/Air/TakeOff.cs +++ b/OpenRA.Mods.Common/Activities/Air/TakeOff.cs @@ -21,19 +21,13 @@ namespace OpenRA.Mods.Common.Activities { readonly Aircraft aircraft; readonly IMove move; - Target fallbackTarget; - bool movedToTarget = false; - public TakeOff(Actor self, Target fallbackTarget) + public TakeOff(Actor self) { aircraft = self.Trait(); move = self.Trait(); - this.fallbackTarget = fallbackTarget; } - public TakeOff(Actor self) - : this(self, Target.Invalid) { } - protected override void OnFirstRun(Actor self) { if (aircraft.ForceLanding) @@ -73,24 +67,7 @@ namespace OpenRA.Mods.Common.Activities return false; } - // Only move to the fallback target if we don't have anything better to do - if (NextActivity == null && fallbackTarget.IsValidFor(self) && !movedToTarget) - { - QueueChild(new AttackMoveActivity(self, () => move.MoveToTarget(self, fallbackTarget, targetLineColor: Color.OrangeRed))); - movedToTarget = true; - return false; - } - return true; } - - public override IEnumerable TargetLineNodes(Actor self) - { - if (ChildActivity != null) - foreach (var n in ChildActivity.TargetLineNodes(self)) - yield return n; - else - yield return new TargetLineNode(fallbackTarget, Color.OrangeRed); - } } } diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index 663d40bea2..11ca8a91fe 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -521,10 +521,9 @@ namespace OpenRA.Mods.Common.Traits if (takeOff && self.World.Map.DistanceAboveTerrain(CenterPosition).Length <= LandAltitude.Length) { + self.QueueActivity(new TakeOff(self)); if (rp != null) - self.QueueActivity(new TakeOff(self, Target.FromCell(self.World, rp.Location))); - else - self.QueueActivity(new TakeOff(self)); + self.QueueActivity(new AttackMoveActivity(self, () => MoveTo(rp.Location, null, targetLineColor: Color.OrangeRed))); } }