diff --git a/OpenRA.Mods.Common/Activities/Air/Fly.cs b/OpenRA.Mods.Common/Activities/Air/Fly.cs index 6d0b976e1a..ec08bee863 100644 --- a/OpenRA.Mods.Common/Activities/Air/Fly.cs +++ b/OpenRA.Mods.Common/Activities/Air/Fly.cs @@ -117,6 +117,13 @@ namespace OpenRA.Mods.Common.Activities Cancel(self); var dat = self.World.Map.DistanceAboveTerrain(aircraft.CenterPosition); + var isLanded = dat <= aircraft.LandAltitude; + + // HACK: Prevent paused (for example, EMP'd) aircraft from taking off. + // This is necessary until the TODOs in the IsCanceling block below are adressed. + if (isLanded && aircraft.IsTraitPaused) + return false; + if (IsCanceling) { // We must return the actor to a sensible height before continuing. @@ -128,7 +135,7 @@ namespace OpenRA.Mods.Common.Activities var skipHeightAdjustment = landWhenIdle && self.CurrentActivity.IsCanceling && self.CurrentActivity.NextActivity == null; if (aircraft.Info.CanHover && !skipHeightAdjustment && dat != aircraft.Info.CruiseAltitude) { - if (dat <= aircraft.LandAltitude) + if (isLanded) QueueChild(new TakeOff(self)); else VerticalTakeOffOrLandTick(self, aircraft, aircraft.Facing, aircraft.Info.CruiseAltitude); @@ -138,7 +145,7 @@ namespace OpenRA.Mods.Common.Activities return true; } - else if (dat <= aircraft.LandAltitude) + else if (isLanded) { QueueChild(new TakeOff(self)); return false; diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index 8f01b38da1..5363a34eb5 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -213,7 +213,7 @@ namespace OpenRA.Mods.Common.Traits public WPos CenterPosition { get; private set; } public CPos TopLeft { get { return self.World.Map.CellContaining(CenterPosition); } } - public int TurnSpeed { get { return Info.TurnSpeed; } } + public int TurnSpeed { get { return !IsTraitDisabled && !IsTraitPaused ? Info.TurnSpeed : 0; } } public Actor ReservedActor { get; private set; } public bool MayYieldReservation { get; private set; } public bool ForceLanding { get; private set; } @@ -548,7 +548,7 @@ namespace OpenRA.Mods.Common.Traits public int MovementSpeed { - get { return Util.ApplyPercentageModifiers(Info.Speed, speedModifiers); } + get { return !IsTraitDisabled && !IsTraitPaused ? Util.ApplyPercentageModifiers(Info.Speed, speedModifiers) : 0; } } public Pair[] OccupiedCells() @@ -953,7 +953,8 @@ namespace OpenRA.Mods.Common.Traits public Order IssueOrder(Actor self, IOrderTargeter order, Target target, bool queued) { - if (order.OrderID == "Enter" || order.OrderID == "Move" || order.OrderID == "Land" || order.OrderID == "ForceEnter") + if (!IsTraitDisabled && + (order.OrderID == "Enter" || order.OrderID == "Move" || order.OrderID == "Land" || order.OrderID == "ForceEnter")) return new Order(order.OrderID, self, target, queued); return null; @@ -961,7 +962,7 @@ namespace OpenRA.Mods.Common.Traits Order IIssueDeployOrder.IssueDeployOrder(Actor self, bool queued) { - if (rearmable == null || !rearmable.Info.RearmActors.Any()) + if (IsTraitDisabled || rearmable == null || !rearmable.Info.RearmActors.Any()) return null; return new Order("ReturnToBase", self, queued); @@ -971,6 +972,9 @@ namespace OpenRA.Mods.Common.Traits public string VoicePhraseForOrder(Actor self, Order order) { + if (IsTraitDisabled) + return null; + switch (order.OrderString) { case "Land": @@ -996,6 +1000,9 @@ namespace OpenRA.Mods.Common.Traits public void ResolveOrder(Actor self, Order order) { + if (IsTraitDisabled) + return; + var orderString = order.OrderString; if (orderString == "Move") { @@ -1085,6 +1092,9 @@ namespace OpenRA.Mods.Common.Traits void Nudge(Actor self) { + if (IsTraitDisabled || IsTraitPaused || requireForceMove) + return; + // Disable nudging if the aircraft is outside the map if (!self.World.Map.Contains(self.Location)) return; @@ -1204,15 +1214,12 @@ namespace OpenRA.Mods.Common.Traits OrderID = "Land"; } - var explored = self.Owner.Shroud.IsExplored(location); - cursor = self.World.Map.Contains(location) ? - (self.World.Map.GetTerrainInfo(location).CustomCursor ?? "move") : - "move-blocked"; - IsQueued = modifiers.HasModifier(TargetModifiers.ForceQueue); - if (!explored && !aircraft.Info.MoveIntoShroud) - cursor = "move-blocked"; + var explored = self.Owner.Shroud.IsExplored(location); + cursor = !aircraft.IsTraitPaused && (explored || aircraft.Info.MoveIntoShroud) && self.World.Map.Contains(location) ? + (self.World.Map.GetTerrainInfo(location).CustomCursor ?? "move") : + "move-blocked"; return true; }