additional checks to avoid giving dead actors a rank sign

closes #4134
This commit is contained in:
Matthias Mailänder
2013-11-17 15:20:13 +01:00
parent 5d3987dee3
commit 8a13cd6c6a
4 changed files with 16 additions and 13 deletions

View File

@@ -170,7 +170,8 @@ namespace OpenRA.Traits
{
public static bool IsDead(this Actor self)
{
if (self.Destroyed) return true;
if (self.Destroyed)
return true;
var health = self.TraitOrDefault<Health>();
return (health == null) ? false : health.IsDead;
@@ -178,7 +179,8 @@ namespace OpenRA.Traits
public static DamageState GetDamageState(this Actor self)
{
if (self.Destroyed) return DamageState.Dead;
if (self.Destroyed)
return DamageState.Dead;
var health = self.TraitOrDefault<Health>();
return (health == null) ? DamageState.Undamaged : health.DamageState;

View File

@@ -181,7 +181,7 @@ namespace OpenRA
public void Add(IEffect b) { effects.Add(b); }
public void Remove(IEffect b) { effects.Remove(b); }
public void AddFrameEndTask( Action<World> a ) { frameEndActions.Enqueue( a ); }
public void AddFrameEndTask(Action<World> a) { frameEndActions.Enqueue(a); }
public event Action<Actor> ActorAdded = _ => { };
public event Action<Actor> ActorRemoved = _ => { };