From 489fdc1893b4bf479a2b503abcde1adaa0c27793 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 23 Sep 2012 17:15:16 +1200 Subject: [PATCH] add CloakInfo.UncloakOnMove option --- OpenRA.Mods.RA/Cloak.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/OpenRA.Mods.RA/Cloak.cs b/OpenRA.Mods.RA/Cloak.cs index 8002adee7f..e60f1107a8 100644 --- a/OpenRA.Mods.RA/Cloak.cs +++ b/OpenRA.Mods.RA/Cloak.cs @@ -23,6 +23,7 @@ namespace OpenRA.Mods.RA public string CloakSound = "subshow1.aud"; public string UncloakSound = "subshow1.aud"; public readonly string Palette = "cloak"; + public readonly bool UncloakOnMove = false; public object Create(ActorInitializer init) { return new Cloak(init.self, this); } } @@ -34,6 +35,7 @@ namespace OpenRA.Mods.RA Actor self; CloakInfo info; + CPos? lastPos; public Cloak(Actor self, CloakInfo info) { @@ -83,6 +85,12 @@ namespace OpenRA.Mods.RA Sound.Play(info.CloakSound, self.CenterLocation); if (self.IsDisabled()) Uncloak(); + + if (info.UncloakOnMove && (lastPos == null || lastPos.Value != self.Location)) + { + Uncloak(); + lastPos = self.Location; + } } public bool IsVisible(Actor self)