Merge pull request #11029 from pchote/work-around-target-cancel
Fix Turreted units not dropping cancelled targets.
This commit is contained in:
@@ -66,6 +66,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
readonly Target target;
|
readonly Target target;
|
||||||
readonly bool forceAttack;
|
readonly bool forceAttack;
|
||||||
readonly bool onRailsHack;
|
readonly bool onRailsHack;
|
||||||
|
bool hasTicked;
|
||||||
|
|
||||||
public AttackActivity(Actor self, Target target, bool allowMove, bool forceAttack)
|
public AttackActivity(Actor self, Target target, bool allowMove, bool forceAttack)
|
||||||
{
|
{
|
||||||
@@ -103,7 +104,13 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var maxRange = targetIsMobile ? new WDist(Math.Max(weapon.Weapon.MinRange.Length, modifiedRange.Length - 1024))
|
var maxRange = targetIsMobile ? new WDist(Math.Max(weapon.Weapon.MinRange.Length, modifiedRange.Length - 1024))
|
||||||
: modifiedRange;
|
: modifiedRange;
|
||||||
|
|
||||||
|
// Check that AttackFollow hasn't cancelled the target by modifying attack.Target
|
||||||
|
// Having both this and AttackFollow modify that field is a horrible hack.
|
||||||
|
if (hasTicked && attack.Target.Type == TargetType.Invalid)
|
||||||
|
return NextActivity;
|
||||||
|
|
||||||
attack.Target = target;
|
attack.Target = target;
|
||||||
|
hasTicked = true;
|
||||||
|
|
||||||
if (move != null)
|
if (move != null)
|
||||||
return ActivityUtils.SequenceActivities(move.MoveFollow(self, target, weapon.Weapon.MinRange, maxRange), this);
|
return ActivityUtils.SequenceActivities(move.MoveFollow(self, target, weapon.Weapon.MinRange, maxRange), this);
|
||||||
|
|||||||
Reference in New Issue
Block a user