From 53304b3de2195945539ca7fecd4df37e066e584a Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Thu, 22 Jul 2010 20:33:54 +1200 Subject: [PATCH] Cloaked units (not) on radar; untested but is simple enough that it should work --- OpenRA.Game/Traits/Cloak.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/OpenRA.Game/Traits/Cloak.cs b/OpenRA.Game/Traits/Cloak.cs index ca12637d13..f6b12a4f88 100644 --- a/OpenRA.Game/Traits/Cloak.cs +++ b/OpenRA.Game/Traits/Cloak.cs @@ -24,7 +24,7 @@ namespace OpenRA.Traits public object Create(ActorInitializer init) { return new Cloak(init.self); } } - public class Cloak : IRenderModifier, INotifyAttack, ITick, INotifyDamage + public class Cloak : IRenderModifier, INotifyAttack, ITick, INotifyDamage, IRadarVisibilityModifier { [Sync] int remainingTime; @@ -78,6 +78,12 @@ namespace OpenRA.Traits public bool Cloaked { get { return remainingTime > 0; } } + + public bool VisibleOnRadar(Actor self) + { + return !Cloaked || self.Owner == self.World.LocalPlayer; + } + public void Decloak(int time) { DoSurface();