diff --git a/OpenRa.Game/Graphics/Animation.cs b/OpenRa.Game/Graphics/Animation.cs index 8ef35e229c..6155ef979e 100644 --- a/OpenRa.Game/Graphics/Animation.cs +++ b/OpenRa.Game/Graphics/Animation.cs @@ -95,6 +95,8 @@ namespace OpenRa.Game.Graphics Tick( 40 ); // tick one frame } + public bool HasSequence(string seq) { return SequenceProvider.HasSequence( name, seq ); } + public void Tick( int t ) { if( tickAlways ) diff --git a/OpenRa.Game/Graphics/SequenceProvider.cs b/OpenRa.Game/Graphics/SequenceProvider.cs index b27ba4d02b..6228d84831 100644 --- a/OpenRa.Game/Graphics/SequenceProvider.cs +++ b/OpenRa.Game/Graphics/SequenceProvider.cs @@ -65,6 +65,11 @@ namespace OpenRa.Game.Graphics } } + public static bool HasSequence(string unit, string seq) + { + return units[unit].ContainsKey(seq); + } + public static CursorSequence GetCursorSequence(string cursor) { return cursors[cursor]; diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 2d1dc29d4e..1a0a0e3c6f 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -163,6 +163,7 @@ + diff --git a/OpenRa.Game/Traits/AttackBase.cs b/OpenRa.Game/Traits/AttackBase.cs index 30c36908a1..f558267770 100644 --- a/OpenRa.Game/Traits/AttackBase.cs +++ b/OpenRa.Game/Traits/AttackBase.cs @@ -106,6 +106,7 @@ namespace OpenRa.Game.Traits var firePos = self.CenterLocation.ToInt2() + Util.GetTurretPosition(self, unit, offset, 0f).ToInt2(); var thisTarget = target; + ScheduleDelayedAction(self.Info.FireDelay, () => { if( weapon.RenderAsTesla ) diff --git a/OpenRa.Game/Traits/RenderBuildingCharge.cs b/OpenRa.Game/Traits/RenderBuildingCharge.cs new file mode 100644 index 0000000000..abad68e9d8 --- /dev/null +++ b/OpenRa.Game/Traits/RenderBuildingCharge.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace OpenRa.Game.Traits +{ + /* used for tesla */ + class RenderBuildingCharge : RenderBuilding, INotifyAttack + { + public RenderBuildingCharge(Actor self) + : base(self) + { + } + + public void Attacking(Actor self) + { + var prev = anim.CurrentSequence.Name; + Sound.Play("tslachg2.aud"); + anim.PlayThen("active", () => anim.PlayRepeating(prev)); + } + } +} diff --git a/units.ini b/units.ini index 75ce224f38..269dfa8da3 100755 --- a/units.ini +++ b/units.ini @@ -200,10 +200,11 @@ Footprint=x SelectionPriority=3 [TSLA] Description=Tesla Coil -Traits=Building, Turreted, RenderBuilding, AttackTurreted, AutoTarget +Traits=Building, Turreted, RenderBuildingCharge, AttackTurreted, AutoTarget Dimensions=1,2 Footprint=_ x SelectionPriority=3 +FireDelay=8 [GUN] Description=Turret Traits=Building, Turreted, RenderBuildingTurreted, AttackTurreted, AutoTarget