Unacquire invalid AI targets.

This commit is contained in:
Paul Chote
2013-08-22 19:01:41 +12:00
parent bc5c11e44f
commit 6e13cb7f3b
2 changed files with 12 additions and 9 deletions

View File

@@ -99,7 +99,7 @@ namespace OpenRA.Mods.RA.AI
HackyAI bot;
XRandom random;
Actor target;
Target target;
StateMachine fsm;
//fuzzy
@@ -113,7 +113,8 @@ namespace OpenRA.Mods.RA.AI
this.world = bot.world;
this.random = bot.random;
this.type = type;
this.target = target;
this.target = Traits.Target.FromActor(target);
fsm = new StateMachine(this);
switch (type)
@@ -144,14 +145,13 @@ namespace OpenRA.Mods.RA.AI
public Actor Target
{
get { return target; }
set { target = value; }
get { return target.Actor; }
set { target = Traits.Target.FromActor(value); }
}
public bool TargetIsValid
{
get { return (target != null && !target.IsDead() && !target.Destroyed
&& target.IsInWorld && !target.HasTrait<Husk>()); }
get { return target.IsValidFor(units.FirstOrDefault()) && !target.Actor.HasTrait<Husk>(); }
}
//**********************************************************************************