@@ -32,6 +32,7 @@ namespace OpenRA.Mods.RA
|
||||
Info = info;
|
||||
|
||||
var anim = new Animation("fire", () => 0);
|
||||
anim.IsDecoration = true;
|
||||
anim.PlayRepeating(Info.Anim);
|
||||
self.Trait<RenderSprites>().anims.Add("fire", anim);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.RA.Move;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -25,7 +26,7 @@ namespace OpenRA.Mods.RA
|
||||
public int GetInitialFacing() { return 128; }
|
||||
}
|
||||
|
||||
class Husk : IPositionable, IFacing, ISync, INotifyAddedToWorld, INotifyRemovedFromWorld
|
||||
class Husk : IPositionable, IFacing, ISync, INotifyAddedToWorld, INotifyRemovedFromWorld, IDisable
|
||||
{
|
||||
readonly HuskInfo info;
|
||||
readonly Actor self;
|
||||
@@ -100,6 +101,11 @@ namespace OpenRA.Mods.RA
|
||||
self.World.ActorMap.RemovePosition(self, this);
|
||||
self.World.ScreenMap.Remove(self);
|
||||
}
|
||||
|
||||
public bool Disabled
|
||||
{
|
||||
get { return true; }
|
||||
}
|
||||
}
|
||||
|
||||
public class HuskSpeedInit : IActorInit<int>
|
||||
|
||||
36
OpenRA.Mods.RA/Modifiers/DisabledOverlay.cs
Normal file
36
OpenRA.Mods.RA/Modifiers/DisabledOverlay.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA
|
||||
{
|
||||
[Desc("Use together with CanPowerDown/RequiresPower on buildings or Husk for vehicles.")]
|
||||
public class DisabledOverlayInfo : TraitInfo<DisabledOverlay> { }
|
||||
|
||||
public class DisabledOverlay : IRenderModifier
|
||||
{
|
||||
public IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r)
|
||||
{
|
||||
var disabled = self.IsDisabled();
|
||||
foreach (var a in r)
|
||||
{
|
||||
yield return a;
|
||||
if (disabled && !a.IsDecoration)
|
||||
yield return a.WithPalette(wr.Palette("disabled"))
|
||||
.WithZOffset(a.ZOffset + 1)
|
||||
.AsDecoration();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -495,6 +495,7 @@
|
||||
<Compile Include="Buildings\Demolishable.cs" />
|
||||
<Compile Include="Widgets\Logic\DisconnectWatcherLogic.cs" />
|
||||
<Compile Include="Activities\FlyFollow.cs" />
|
||||
<Compile Include="Modifiers\DisabledOverlay.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
}
|
||||
}
|
||||
|
||||
public class RenderBuilding : RenderSimple, INotifyDamageStateChanged, IRenderModifier
|
||||
public class RenderBuilding : RenderSimple, INotifyDamageStateChanged
|
||||
{
|
||||
public RenderBuilding(ActorInitializer init, RenderBuildingInfo info)
|
||||
: this(init, info, () => 0) { }
|
||||
@@ -54,19 +54,6 @@ namespace OpenRA.Mods.RA.Render
|
||||
self.QueueActivity(new CallFunc(() => Complete(self)));
|
||||
}
|
||||
|
||||
public IEnumerable<IRenderable> ModifyRender(Actor self, WorldRenderer wr, IEnumerable<IRenderable> r)
|
||||
{
|
||||
var disabled = self.IsDisabled();
|
||||
foreach (var a in r)
|
||||
{
|
||||
yield return a;
|
||||
if (disabled && !a.IsDecoration)
|
||||
yield return a.WithPalette(wr.Palette("disabled"))
|
||||
.WithZOffset(a.ZOffset + 1)
|
||||
.AsDecoration();
|
||||
}
|
||||
}
|
||||
|
||||
void Complete(Actor self)
|
||||
{
|
||||
anim.PlayRepeating(NormalizeSequence(self, "idle"));
|
||||
|
||||
Reference in New Issue
Block a user