Fix FlyAttack invalid target crash.
This commit is contained in:
@@ -221,10 +221,16 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnFirstRun(Actor self)
|
protected override void OnFirstRun(Actor self)
|
||||||
|
{
|
||||||
|
// The target may have died while this activity was queued
|
||||||
|
if (target.IsValidFor(self))
|
||||||
{
|
{
|
||||||
QueueChild(new Fly(self, target, target.CenterPosition));
|
QueueChild(new Fly(self, target, target.CenterPosition));
|
||||||
QueueChild(new Fly(self, target, exitRange, WDist.MaxValue, target.CenterPosition));
|
QueueChild(new Fly(self, target, exitRange, WDist.MaxValue, target.CenterPosition));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
Cancel(self);
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Tick(Actor self)
|
public override bool Tick(Actor self)
|
||||||
{
|
{
|
||||||
@@ -260,10 +266,16 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnFirstRun(Actor self)
|
protected override void OnFirstRun(Actor self)
|
||||||
|
{
|
||||||
|
// The target may have died while this activity was queued
|
||||||
|
if (target.IsValidFor(self))
|
||||||
{
|
{
|
||||||
QueueChild(new Fly(self, target, target.CenterPosition));
|
QueueChild(new Fly(self, target, target.CenterPosition));
|
||||||
QueueChild(new Fly(self, target, exitRange, WDist.MaxValue, target.CenterPosition));
|
QueueChild(new Fly(self, target, exitRange, WDist.MaxValue, target.CenterPosition));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
Cancel(self);
|
||||||
|
}
|
||||||
|
|
||||||
public override bool Tick(Actor self)
|
public override bool Tick(Actor self)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user