fixing some spy bugs
This commit is contained in:
@@ -241,6 +241,7 @@
|
||||
<Compile Include="Traits\LimitedAmmo.cs" />
|
||||
<Compile Include="Traits\Passenger.cs" />
|
||||
<Compile Include="Traits\ProvidesRadar.cs" />
|
||||
<Compile Include="Traits\RenderSpy.cs" />
|
||||
<Compile Include="Traits\Repairable.cs" />
|
||||
<Compile Include="Traits\Reservable.cs" />
|
||||
<Compile Include="Traits\Selectable.cs" />
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace OpenRa.Game.Traits
|
||||
abstract class RenderSimple : IRender, ITick
|
||||
{
|
||||
public Dictionary<string, AnimationWithOffset> anims = new Dictionary<string, AnimationWithOffset>();
|
||||
public Animation anim { get { return anims[ "" ].Animation; } }
|
||||
public Animation anim { get { return anims[""].Animation; } protected set { anims[""].Animation = anim; } }
|
||||
|
||||
public string GetImage(Actor self)
|
||||
{
|
||||
|
||||
31
OpenRa.Game/Traits/RenderSpy.cs
Normal file
31
OpenRa.Game/Traits/RenderSpy.cs
Normal file
@@ -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<Renderable> ModifyRender(Actor self, IEnumerable<Renderable> r)
|
||||
{
|
||||
if (self.Owner == Game.LocalPlayer)
|
||||
return r;
|
||||
|
||||
return r.Select(a => a.WithPalette(Game.LocalPlayer.Palette));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<IAcceptSpy>()) return null;
|
||||
|
||||
return new Order("Infiltrate", self, underCursor, int2.Zero, null);
|
||||
|
||||
Reference in New Issue
Block a user