diff --git a/OpenRa.Game/Traits/AttackTurreted.cs b/OpenRa.Game/Traits/AttackTurreted.cs index b422490a24..78085f1288 100755 --- a/OpenRa.Game/Traits/AttackTurreted.cs +++ b/OpenRa.Game/Traits/AttackTurreted.cs @@ -5,7 +5,7 @@ using System.Text; namespace OpenRa.Game.Traits { - abstract class AttackBase : IOrder + abstract class AttackBase : IOrder, ITick { public Actor target; @@ -14,14 +14,16 @@ namespace OpenRa.Game.Traits protected int secondaryFireDelay = 0; protected bool CanAttack( Actor self ) - { - if( primaryFireDelay > 0 ) --primaryFireDelay; - if( secondaryFireDelay > 0 ) --secondaryFireDelay; - - if( target != null && target.IsDead ) target = null; /* he's dead, jim. */ - if( target == null ) return false; - - return true; + { + return target != null; + } + + public virtual void Tick(Actor self) + { + if (primaryFireDelay > 0) --primaryFireDelay; + if (secondaryFireDelay > 0) --secondaryFireDelay; + + if (target != null && target.IsDead) target = null; /* he's dead, jim. */ } protected void DoAttack( Actor self ) @@ -75,12 +77,14 @@ namespace OpenRa.Game.Traits } } - class AttackTurreted : AttackBase, ITick + class AttackTurreted : AttackBase { public AttackTurreted( Actor self ) { self.traits.Get(); } - public void Tick(Actor self) - { + public override void Tick(Actor self) + { + base.Tick(self); + if( !CanAttack( self ) ) return; var turreted = self.traits.Get();