Always clear requested targets when exiting AttackActivity/Flyattack.
This commit is contained in:
@@ -258,11 +258,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public override bool Tick(Actor self)
|
||||
{
|
||||
if (IsCanceling)
|
||||
{
|
||||
// Cancel the requested target, but keep firing on it while in range
|
||||
attack.ClearRequestedTarget();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check that AttackFollow hasn't cancelled the target by modifying attack.Target
|
||||
// Having both this and AttackFollow modify that field is a horrible hack.
|
||||
@@ -315,10 +311,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
// If we are ticking again after previously sequencing a MoveWithRange then that move must have completed
|
||||
// Either we are in range and can see the target, or we've lost track of it and should give up
|
||||
if (wasMovingWithinRange && targetIsHiddenActor)
|
||||
{
|
||||
attack.ClearRequestedTarget();
|
||||
return true;
|
||||
}
|
||||
|
||||
// Update target lines if required
|
||||
if (useLastVisibleTarget != oldUseLastVisibleTarget)
|
||||
@@ -326,10 +319,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
// Target is hidden or dead, and we don't have a fallback position to move towards
|
||||
if (useLastVisibleTarget && !lastVisibleTarget.IsValidFor(self))
|
||||
{
|
||||
attack.ClearRequestedTarget();
|
||||
return true;
|
||||
}
|
||||
|
||||
var pos = self.CenterPosition;
|
||||
var checkTarget = useLastVisibleTarget ? lastVisibleTarget : target;
|
||||
@@ -339,26 +329,26 @@ namespace OpenRA.Mods.Common.Traits
|
||||
if (checkTarget.IsInRange(pos, maxRange) && !checkTarget.IsInRange(pos, minRange))
|
||||
{
|
||||
if (useLastVisibleTarget)
|
||||
{
|
||||
attack.ClearRequestedTarget();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// We can't move into range, so give up
|
||||
if (move == null || maxRange == WDist.Zero || maxRange < minRange)
|
||||
{
|
||||
attack.ClearRequestedTarget();
|
||||
return true;
|
||||
}
|
||||
|
||||
wasMovingWithinRange = true;
|
||||
QueueChild(move.MoveWithinRange(target, minRange, maxRange, checkTarget.CenterPosition, Color.Red));
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override void OnLastRun(Actor self)
|
||||
{
|
||||
// Cancel the requested target, but keep firing on it while in range
|
||||
attack.ClearRequestedTarget();
|
||||
}
|
||||
|
||||
void IActivityNotifyStanceChanged.StanceChanged(Actor self, AutoTarget autoTarget, UnitStance oldStance, UnitStance newStance)
|
||||
{
|
||||
// Cancel non-forced targets when switching to a more restrictive stance if they are no longer valid for auto-targeting
|
||||
|
||||
Reference in New Issue
Block a user