diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 5dad7ac1ab..d3c6ee66cf 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -241,6 +241,7 @@ + diff --git a/OpenRa.Game/Traits/RenderSimple.cs b/OpenRa.Game/Traits/RenderSimple.cs index b27d49f887..e2a3523454 100644 --- a/OpenRa.Game/Traits/RenderSimple.cs +++ b/OpenRa.Game/Traits/RenderSimple.cs @@ -15,7 +15,7 @@ namespace OpenRa.Game.Traits abstract class RenderSimple : IRender, ITick { public Dictionary anims = new Dictionary(); - public Animation anim { get { return anims[ "" ].Animation; } } + public Animation anim { get { return anims[""].Animation; } protected set { anims[""].Animation = anim; } } public string GetImage(Actor self) { diff --git a/OpenRa.Game/Traits/RenderSpy.cs b/OpenRa.Game/Traits/RenderSpy.cs new file mode 100644 index 0000000000..c09bdc6859 --- /dev/null +++ b/OpenRa.Game/Traits/RenderSpy.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using OpenRa.Game.Graphics; + +namespace OpenRa.Game.Traits +{ + class RenderSpyInfo : ITraitInfo + { + public object Create(Actor self) { return new RenderSpy(self); } + } + + class RenderSpy : RenderInfantry, IRenderModifier + { + public RenderSpy(Actor self) + : base(self) + { + if (self.Owner != Game.LocalPlayer) + anim = new Animation("e1"); + } + + public IEnumerable ModifyRender(Actor self, IEnumerable r) + { + if (self.Owner == Game.LocalPlayer) + return r; + + return r.Select(a => a.WithPalette(Game.LocalPlayer.Palette)); + } + } +} diff --git a/OpenRa.Game/Traits/Spy.cs b/OpenRa.Game/Traits/Spy.cs index 5d77b84ab2..ad89697422 100644 --- a/OpenRa.Game/Traits/Spy.cs +++ b/OpenRa.Game/Traits/Spy.cs @@ -13,7 +13,7 @@ namespace OpenRa.Game.Traits public Order IssueOrder(Actor self, int2 xy, MouseInput mi, Actor underCursor) { if (mi.Button != MouseButton.Right) return null; - if (underCursor != null) return null; + if (underCursor == null) return null; if (underCursor.traits.Contains()) return null; return new Order("Infiltrate", self, underCursor, int2.Zero, null); diff --git a/units.ini b/units.ini index 85717ccbdf..9edf088fa8 100644 --- a/units.ini +++ b/units.ini @@ -586,7 +586,7 @@ SelectionSize=12,17,0,-9 [SPY] Description=Spy Voice=SpyVoice -Traits=Unit, Mobile, RenderInfantry, TakeCover, SquishByTank, Passenger, Spy +Traits=Unit, Mobile, RenderSpy, TakeCover, SquishByTank, Passenger, Spy LongDesc=Infiltrates enemy structures to gather \nintelligence. Exact effect depends on the \nbuilding infiltrated.\n Strong vs Nothing\n Weak vs Everything\n Special Ability: Disguised SelectionSize=12,17,0,-9 [THF]