From 6a7159e9a159f67ef1a18d6bcdccd28173089330 Mon Sep 17 00:00:00 2001 From: tjk-ws <67940579+tjk-ws@users.noreply.github.com> Date: Sun, 16 Jun 2024 19:00:28 -0500 Subject: [PATCH] Fix aircraft that don't rearm stalling over invalid targets --- OpenRA.Mods.Common/Activities/Air/FlyAttack.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Activities/Air/FlyAttack.cs b/OpenRA.Mods.Common/Activities/Air/FlyAttack.cs index f2546fab62..8b5fe82f95 100644 --- a/OpenRA.Mods.Common/Activities/Air/FlyAttack.cs +++ b/OpenRA.Mods.Common/Activities/Air/FlyAttack.cs @@ -119,10 +119,14 @@ namespace OpenRA.Mods.Common.Activities if (useLastVisibleTarget && !lastVisibleTarget.IsValidFor(self)) return true; - // If all valid weapons have depleted their ammo and Rearmable trait exists, return to RearmActor to reload - // 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))) + // If all weapons are invalid against the target + if (!useLastVisibleTarget && attackAircraft.Armaments.All(x => x.IsTraitPaused || !x.Weapon.IsValidAgainst(target, self.World, self))) { + // If Rearmable trait exists, return to RearmActor to reload and resume the activity after + // reloading if AbortOnResupply is set to 'false'. + if (rearmable == null) + return true; + // Attack moves never resupply if (source == AttackSource.AttackMove) return true;