Make aircraft continue attack on same target after re-arming

This commit is contained in:
Oliver Brakmann
2016-09-04 12:08:20 +02:00
parent e7d07e5a01
commit 7f64495d6f
2 changed files with 3 additions and 4 deletions

View File

@@ -40,10 +40,9 @@ namespace OpenRA.Mods.Common.Activities
if (!target.IsValidFor(self)) if (!target.IsValidFor(self))
return NextActivity; return NextActivity;
// Move to the next activity only if all ammo pools are depleted and none reload automatically
// TODO: This should check whether there is ammo left that is actually suitable for the target // TODO: This should check whether there is ammo left that is actually suitable for the target
if (ammoPools.All(x => !x.Info.SelfReloads && !x.HasAmmo())) if (ammoPools.All(x => !x.Info.SelfReloads && !x.HasAmmo()))
return ActivityUtils.SequenceActivities(new ReturnToBase(self), NextActivity); return ActivityUtils.SequenceActivities(new ReturnToBase(self), this);
if (attackPlane != null) if (attackPlane != null)
attackPlane.DoAttack(self, target); attackPlane.DoAttack(self, target);

View File

@@ -65,9 +65,9 @@ namespace OpenRA.Mods.Common.Activities
return ActivityUtils.SequenceActivities(new HeliFly(self, newTarget)); return ActivityUtils.SequenceActivities(new HeliFly(self, newTarget));
} }
// If any AmmoPool is depleted and no weapon is valid against target, return to helipad to reload and then move to next activity // If any AmmoPool is depleted and no weapon is valid against target, return to helipad to reload and then resume the activity
if (ammoPools.Any(x => !x.Info.SelfReloads && !x.HasAmmo()) && !attackHeli.HasAnyValidWeapons(target)) if (ammoPools.Any(x => !x.Info.SelfReloads && !x.HasAmmo()) && !attackHeli.HasAnyValidWeapons(target))
return ActivityUtils.SequenceActivities(new HeliReturnToBase(self), NextActivity); return ActivityUtils.SequenceActivities(new HeliReturnToBase(self), this);
var dist = target.CenterPosition - self.CenterPosition; var dist = target.CenterPosition - self.CenterPosition;