From 76f7e87633b0dc1210ae3a024089ce2d087ffa14 Mon Sep 17 00:00:00 2001 From: Curtis Shmyr Date: Sun, 16 Mar 2014 19:14:16 -0600 Subject: [PATCH 1/2] 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; From cc8284740cc4d0e7ab62212c77f97d5826c5eca0 Mon Sep 17 00:00:00 2001 From: Curtis Shmyr Date: Sun, 16 Mar 2014 19:32:44 -0600 Subject: [PATCH 2/2] Fixed team health colors and spy disguise interaction --- CHANGELOG | 1 + OpenRA.Game/Traits/Selectable.cs | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index d21165516a..980a2704ae 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -66,6 +66,7 @@ NEW: Removed the submarine detection ability from Cruiser and Transport. Added the submarine detection ability to Submarines and Missile Subs. Increased the submarine detection range of Gunboat from 3 to 4. + Fixed Spies having an enemy color health bar when disguised as a friendly unit (occurred using the Team Health Colors setting). Tiberian Dawn: Chinook rotors now counter-rotate. Commando can now plant C4 on bridges. diff --git a/OpenRA.Game/Traits/Selectable.cs b/OpenRA.Game/Traits/Selectable.cs index 4d19bcb8a2..80dfa10f15 100644 --- a/OpenRA.Game/Traits/Selectable.cs +++ b/OpenRA.Game/Traits/Selectable.cs @@ -181,8 +181,11 @@ namespace OpenRA.Traits Color GetHealthColor(Health health) { if (Game.Settings.Game.TeamHealthColors) - return self.Owner.IsAlliedWith(self.World.LocalPlayer) ? Color.LimeGreen : - self.Owner.NonCombatant ? Color.Tan : Color.Red; + { + var isAlly = self.Owner.IsAlliedWith(self.World.LocalPlayer) + || (self.IsDisguised() && self.World.LocalPlayer.IsAlliedWith(self.EffectiveOwner.Owner)); + return isAlly ? Color.LimeGreen : self.Owner.NonCombatant ? Color.Tan : Color.Red; + } else return health.DamageState == DamageState.Critical ? Color.Red : health.DamageState == DamageState.Heavy ? Color.Yellow : Color.LimeGreen;