From 70f4c51a17896a37db9c7edb3deee8f1feaa28df Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Tue, 22 Jan 2019 00:01:51 +0000 Subject: [PATCH] Add AttackMove workaround for Aircraft. --- OpenRA.Mods.Common/Traits/Air/Aircraft.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs index d456afc305..09f32ea2d1 100644 --- a/OpenRA.Mods.Common/Traits/Air/Aircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/Aircraft.cs @@ -174,6 +174,7 @@ namespace OpenRA.Mods.Common.Traits RepairableInfo repairableInfo; RearmableInfo rearmableInfo; + AttackMove attackMove; ConditionManager conditionManager; IDisposable reservation; IEnumerable speedModifiers; @@ -231,6 +232,7 @@ namespace OpenRA.Mods.Common.Traits { repairableInfo = self.Info.TraitInfoOrDefault(); rearmableInfo = self.Info.TraitInfoOrDefault(); + attackMove = self.TraitOrDefault(); conditionManager = self.TraitOrDefault(); speedModifiers = self.TraitsImplementing().ToArray().Select(sm => sm.GetSpeedModifier()); cachedPosition = self.CenterPosition; @@ -522,7 +524,12 @@ namespace OpenRA.Mods.Common.Traits void INotifyBecomingIdle.OnBecomingIdle(Actor self) { - OnBecomingIdle(self); + // HACK: Work around AttackMove relying on INotifyIdle.TickIdle to continue its path + // AttackMoveActivity needs to be rewritten to use child activities instead! + if (attackMove != null && attackMove.TargetLocation.HasValue) + ((INotifyIdle)attackMove).TickIdle(self); + else + OnBecomingIdle(self); } protected virtual void OnBecomingIdle(Actor self)