Fix aircraft that don't rearm stalling over invalid targets

This commit is contained in:
tjk-ws
2024-06-16 19:00:28 -05:00
committed by Gustas
parent cf0e73e75e
commit 6a7159e9a1

View File

@@ -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;