From ea7638adfa598f996b0457258d248354d46f69e6 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 28 Dec 2009 10:23:44 +1300 Subject: [PATCH] mines are invisible to others --- OpenRa.Game/OpenRa.Game.csproj | 1 + OpenRa.Game/Traits/InvisibleToOthers.cs | 18 ++++++++++++++++++ OpenRa.Game/Traits/Mobile.cs | 2 +- units.ini | 4 ++-- 4 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 OpenRa.Game/Traits/InvisibleToOthers.cs diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index af63cacf7b..0c8a467e2c 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -181,6 +181,7 @@ + diff --git a/OpenRa.Game/Traits/InvisibleToOthers.cs b/OpenRa.Game/Traits/InvisibleToOthers.cs new file mode 100644 index 0000000000..f04dbe7555 --- /dev/null +++ b/OpenRa.Game/Traits/InvisibleToOthers.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace OpenRa.Game.Traits +{ + class InvisibleToOthers : IRenderModifier + { + public InvisibleToOthers(Actor self) { } + + public IEnumerable ModifyRender(Actor self, IEnumerable r) + { + return Game.LocalPlayer == self.Owner + ? r : new Renderable[] { }; + } + } +} diff --git a/OpenRa.Game/Traits/Mobile.cs b/OpenRa.Game/Traits/Mobile.cs index e1fd485391..cb389f4cc6 100644 --- a/OpenRa.Game/Traits/Mobile.cs +++ b/OpenRa.Game/Traits/Mobile.cs @@ -83,7 +83,7 @@ namespace OpenRa.Game.Traits case "Plane": return UnitMovementType.Fly; default: - throw new InvalidOperationException("GetMovementType on unit that shouldn't be aable to move."); + throw new InvalidOperationException("GetMovementType on unit that shouldn't be able to move."); } } diff --git a/units.ini b/units.ini index c963d7cfab..5024eb410e 100755 --- a/units.ini +++ b/units.ini @@ -508,11 +508,11 @@ LongDesc=Looks like a Radar Dome [MINV] -Traits=Unit,RenderUnit,ATMine,BelowUnits +Traits=Unit,RenderUnit,ATMine,BelowUnits,InvisibleToOthers Selectable=no [MINP] -Traits=Unit,RenderUnit,APMine,BelowUnits +Traits=Unit,RenderUnit,APMine,BelowUnits,InvisibleToOthers Selectable=no [InfantryTypes]