Zombie prevention

This commit is contained in:
Paul Chote
2010-07-30 10:21:19 +12:00
parent 0580dc4adf
commit 48c5803198
2 changed files with 5 additions and 1 deletions

View File

@@ -59,8 +59,9 @@ namespace OpenRA.Mods.RA
return inRange return inRange
.Where(a => a != self && self.Owner.Stances[ a.Owner ] == Stance.Ally) .Where(a => a != self && self.Owner.Stances[ a.Owner ] == Stance.Ally)
.Where(a => Combat.HasAnyValidWeapons(self, Target.FromActor(a))) .Where(a => !a.IsDead())
.Where(a => a.traits.Contains<Health>() && a.GetExtendedDamageState() < ExtendedDamageState.Undamaged) .Where(a => a.traits.Contains<Health>() && a.GetExtendedDamageState() < ExtendedDamageState.Undamaged)
.Where(a => Combat.HasAnyValidWeapons(self, Target.FromActor(a)))
.OrderBy(a => (a.Location - self.Location).LengthSquared) .OrderBy(a => (a.Location - self.Location).LengthSquared)
.FirstOrDefault(); .FirstOrDefault();
} }

View File

@@ -26,6 +26,9 @@ namespace OpenRA.Mods.RA
public void Tick(Actor self) public void Tick(Actor self)
{ {
if (self.IsDead())
return;
var info = self.Info.Traits.Get<SelfHealingInfo>(); var info = self.Info.Traits.Get<SelfHealingInfo>();
if (self.traits.Get<Health>().HPFraction >= info.HealIfBelow) if (self.traits.Get<Health>().HPFraction >= info.HealIfBelow)
return; return;