diff --git a/OpenRA.Mods.Common/Activities/Air/FlyAttack.cs b/OpenRA.Mods.Common/Activities/Air/FlyAttack.cs index 65b0b72c1b..e119f4b064 100644 --- a/OpenRA.Mods.Common/Activities/Air/FlyAttack.cs +++ b/OpenRA.Mods.Common/Activities/Air/FlyAttack.cs @@ -23,6 +23,7 @@ namespace OpenRA.Mods.Common.Activities readonly Aircraft aircraft; readonly AttackAircraft attackAircraft; readonly Rearmable rearmable; + readonly AttackSource source; readonly bool forceAttack; readonly Color? targetLineColor; readonly WDist strafeDistance; @@ -36,8 +37,9 @@ namespace OpenRA.Mods.Common.Activities bool hasTicked; bool returnToBase; - public FlyAttack(Actor self, Target target, bool forceAttack, Color? targetLineColor) + public FlyAttack(Actor self, AttackSource source, Target target, bool forceAttack, Color? targetLineColor) { + this.source = source; this.target = target; this.forceAttack = forceAttack; this.targetLineColor = targetLineColor; @@ -122,6 +124,14 @@ namespace OpenRA.Mods.Common.Activities // and resume the activity after reloading if AbortOnResupply is set to 'false' if (rearmable != null && !useLastVisibleTarget && attackAircraft.Armaments.All(x => x.IsTraitPaused || !x.Weapon.IsValidAgainst(target, self.World, self))) { + // Attack moves never resupply + if (source == AttackSource.AttackMove) + return true; + + // AbortOnResupply cancels the current activity (after resupplying) plus any queued activities + if (attackAircraft.Info.AbortOnResupply && NextActivity != null) + NextActivity.Cancel(self); + QueueChild(new ReturnToBase(self)); returnToBase = true; return attackAircraft.Info.AbortOnResupply; diff --git a/OpenRA.Mods.Common/Traits/Air/AttackAircraft.cs b/OpenRA.Mods.Common/Traits/Air/AttackAircraft.cs index f3a963cc4c..3000e00296 100644 --- a/OpenRA.Mods.Common/Traits/Air/AttackAircraft.cs +++ b/OpenRA.Mods.Common/Traits/Air/AttackAircraft.cs @@ -50,7 +50,7 @@ namespace OpenRA.Mods.Common.Traits public override Activity GetAttackActivity(Actor self, AttackSource source, Target newTarget, bool allowMove, bool forceAttack, Color? targetLineColor = null) { - return new FlyAttack(self, newTarget, forceAttack, targetLineColor); + return new FlyAttack(self, source, newTarget, forceAttack, targetLineColor); } protected override bool CanAttack(Actor self, Target target)