From 76f7e87633b0dc1210ae3a024089ce2d087ffa14 Mon Sep 17 00:00:00 2001 From: Curtis Shmyr Date: Sun, 16 Mar 2014 19:14:16 -0600 Subject: [PATCH] Add Actor.IsDisguised --- OpenRA.Game/Actor.cs | 5 +++++ OpenRA.Mods.RA/ActorExts.cs | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/OpenRA.Game/Actor.cs b/OpenRA.Game/Actor.cs index a356a4198f..5e3a65c928 100755 --- a/OpenRA.Game/Actor.cs +++ b/OpenRA.Game/Actor.cs @@ -228,6 +228,11 @@ namespace OpenRA return (health.Value == null) ? false : health.Value.IsDead; } + public bool IsDisguised() + { + return effectiveOwner.Value != null && effectiveOwner.Value.Disguised; + } + public void Kill(Actor attacker) { if (health.Value == null) diff --git a/OpenRA.Mods.RA/ActorExts.cs b/OpenRA.Mods.RA/ActorExts.cs index 31ec3dc988..e1b3c59d49 100644 --- a/OpenRA.Mods.RA/ActorExts.cs +++ b/OpenRA.Mods.RA/ActorExts.cs @@ -21,7 +21,7 @@ namespace OpenRA.Mods.RA if (stance == Stance.Ally) return true; - if (self.EffectiveOwner != null && self.EffectiveOwner.Disguised && !toActor.HasTrait()) + if (self.IsDisguised() && !toActor.HasTrait()) return toActor.Owner.Stances[self.EffectiveOwner.Owner] == Stance.Ally; return stance == Stance.Ally; @@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA if (stance == Stance.Ally) return false; /* otherwise, we'll hate friendly disguised spies */ - if (self.EffectiveOwner != null && self.EffectiveOwner.Disguised && !toActor.HasTrait()) + if (self.IsDisguised() && !toActor.HasTrait()) return toActor.Owner.Stances[self.EffectiveOwner.Owner] == Stance.Enemy; return stance == Stance.Enemy;