Drop FlyAttackRun targets when we don't have valid armaments against them
This commit is contained in:
@@ -173,7 +173,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
else if (attackAircraft.Info.AttackType == AirAttackType.Strafe)
|
||||
QueueChild(new StrafeAttackRun(self, attackAircraft, aircraft, target, strafeDistance != WDist.Zero ? strafeDistance : lastVisibleMaximumRange));
|
||||
else if (attackAircraft.Info.AttackType == AirAttackType.Default && !aircraft.Info.CanHover)
|
||||
QueueChild(new FlyAttackRun(self, target, lastVisibleMaximumRange));
|
||||
QueueChild(new FlyAttackRun(self, target, lastVisibleMaximumRange, attackAircraft));
|
||||
|
||||
// Turn to face the target if required.
|
||||
else if (!attackAircraft.TargetInFiringArc(self, target, attackAircraft.Info.FacingTolerance))
|
||||
@@ -214,17 +214,19 @@ namespace OpenRA.Mods.Common.Activities
|
||||
|
||||
class FlyAttackRun : Activity
|
||||
{
|
||||
readonly AttackAircraft attack;
|
||||
readonly WDist exitRange;
|
||||
|
||||
Target target;
|
||||
bool targetIsVisibleActor;
|
||||
|
||||
public FlyAttackRun(Actor self, in Target t, WDist exitRange)
|
||||
public FlyAttackRun(Actor self, in Target t, WDist exitRange, AttackAircraft attack)
|
||||
{
|
||||
ChildHasPriority = false;
|
||||
|
||||
target = t;
|
||||
this.exitRange = exitRange;
|
||||
this.attack = attack;
|
||||
}
|
||||
|
||||
protected override void OnFirstRun(Actor self)
|
||||
@@ -252,7 +254,7 @@ namespace OpenRA.Mods.Common.Activities
|
||||
target = target.Recalculate(self.Owner, out var targetIsHiddenActor);
|
||||
targetIsVisibleActor = target.Type == TargetType.Actor && !targetIsHiddenActor;
|
||||
|
||||
if (targetWasVisibleActor && !target.IsValidFor(self))
|
||||
if (targetWasVisibleActor && (!target.IsValidFor(self) || !attack.HasAnyValidWeapons(target)))
|
||||
Cancel(self);
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user