Fix Obelisk not dropping targets when they move out of range.
This commit is contained in:
@@ -26,23 +26,25 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public override Activity GetAttackActivity(Actor self, Target newTarget, bool allowMove, bool forceAttack)
|
public override Activity GetAttackActivity(Actor self, Target newTarget, bool allowMove, bool forceAttack)
|
||||||
{
|
{
|
||||||
return new SetTarget(this, newTarget);
|
return new SetTarget(this, newTarget, allowMove);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class SetTarget : Activity
|
protected class SetTarget : Activity
|
||||||
{
|
{
|
||||||
readonly Target target;
|
readonly Target target;
|
||||||
readonly AttackOmni attack;
|
readonly AttackOmni attack;
|
||||||
|
readonly bool allowMove;
|
||||||
|
|
||||||
public SetTarget(AttackOmni attack, Target target)
|
public SetTarget(AttackOmni attack, Target target, bool allowMove)
|
||||||
{
|
{
|
||||||
this.target = target;
|
this.target = target;
|
||||||
this.attack = attack;
|
this.attack = attack;
|
||||||
|
this.allowMove = allowMove;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Activity Tick(Actor self)
|
public override Activity Tick(Actor self)
|
||||||
{
|
{
|
||||||
if (IsCanceled || !target.IsValidFor(self))
|
if (IsCanceled || !target.IsValidFor(self) || !attack.IsReachableTarget(target, allowMove))
|
||||||
return NextActivity;
|
return NextActivity;
|
||||||
|
|
||||||
attack.DoAttack(self, target);
|
attack.DoAttack(self, target);
|
||||||
|
|||||||
Reference in New Issue
Block a user