Fix aircraft failing to reload

This commit is contained in:
Gustas
2025-09-23 14:18:51 +03:00
committed by Paul Chote
parent 24a09a94fe
commit dff7cd3bbf
2 changed files with 21 additions and 8 deletions

View File

@@ -134,11 +134,15 @@ namespace OpenRA.Mods.Common.Activities
if (source == AttackSource.AttackMove) if (source == AttackSource.AttackMove)
return true; return true;
// AbortOnResupply cancels the current activity (after resupplying) plus any queued activities
if (attackAircraft.Info.AbortOnResupply) if (attackAircraft.Info.AbortOnResupply)
{
// AbortOnResupply cancels the current activity (after resupplying) plus any queued activities
NextActivity?.Cancel(self); NextActivity?.Cancel(self);
Queue(new ReturnToBase(self));
}
else
QueueChild(new ReturnToBase(self));
QueueChild(new ReturnToBase(self));
returnToBase = true; returnToBase = true;
return attackAircraft.Info.AbortOnResupply; return attackAircraft.Info.AbortOnResupply;
} }

View File

@@ -373,12 +373,9 @@ namespace OpenRA.Mods.Common.Traits
if (source == AttackSource.AttackMove) if (source == AttackSource.AttackMove)
return true; return true;
// AbortOnResupply cancels the current activity (after resupplying) plus any queued activities Activity rearmActivity = null;
if (attack.Info.AbortOnResupply)
NextActivity?.Cancel(self);
if (isAircraft) if (isAircraft)
QueueChild(new ReturnToBase(self)); rearmActivity = new ReturnToBase(self);
else else
{ {
var target = self.World.ActorsHavingTrait<Reservable>() var target = self.World.ActorsHavingTrait<Reservable>()
@@ -390,9 +387,21 @@ namespace OpenRA.Mods.Common.Traits
.FirstOrDefault(); .FirstOrDefault();
if (target != null) if (target != null)
QueueChild(new Resupply(self, target, new WDist(512))); rearmActivity = new Resupply(self, target, new WDist(512));
} }
if (rearmActivity == null)
return true;
if (attack.Info.AbortOnResupply)
{
// AbortOnResupply cancels the current activity (after resupplying) plus any queued activities
NextActivity?.Cancel(self);
Queue(rearmActivity);
}
else
QueueChild(rearmActivity);
returnToBase = true; returnToBase = true;
return attack.Info.AbortOnResupply; return attack.Info.AbortOnResupply;
} }