diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index b25d8b6c87..5c7e4c1d40 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -158,6 +158,7 @@ + diff --git a/OpenRa.Game/Traits/AttackBase.cs b/OpenRa.Game/Traits/AttackBase.cs index e2aef26186..10d3e4550f 100644 --- a/OpenRa.Game/Traits/AttackBase.cs +++ b/OpenRa.Game/Traits/AttackBase.cs @@ -19,6 +19,11 @@ namespace OpenRa.Game.Traits return target != null; } + public bool IsReloading() + { + return (primaryFireDelay > 0) || (secondaryFireDelay > 0); + } + public virtual void Tick(Actor self) { if (primaryFireDelay > 0) --primaryFireDelay; diff --git a/OpenRa.Game/Traits/RenderUnitReload.cs b/OpenRa.Game/Traits/RenderUnitReload.cs new file mode 100644 index 0000000000..c7e6fa5339 --- /dev/null +++ b/OpenRa.Game/Traits/RenderUnitReload.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace OpenRa.Game.Traits +{ + class RenderUnitReload : RenderUnit + { + public RenderUnitReload(Actor self) + : base(self) { } + + public override void Tick(Actor self) + { + base.Tick(self); + var attack = self.traits.WithInterface().FirstOrDefault(); + if (attack != null) + anim.ReplaceAnim(attack.IsReloading() ? "empty-idle" : "idle"); + } + } +} diff --git a/units.ini b/units.ini index e7612499e7..89b8bb7586 100755 --- a/units.ini +++ b/units.ini @@ -15,7 +15,7 @@ MNLY [V2RL] Description=V2 Rocket -Traits=Unit, Mobile, AttackBase, RenderUnit +Traits=Unit, Mobile, AttackBase, RenderUnitReload [1TNK] Description=Light Tank Traits=Unit, Mobile, Turreted, AttackTurreted, RenderUnitTurreted