more tesla hax?

This commit is contained in:
Chris Forbes
2010-07-31 18:12:30 +12:00
parent 960dddc048
commit d202e27f79
2 changed files with 12 additions and 8 deletions

View File

@@ -10,12 +10,12 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing;
using System.Linq; using System.Linq;
using OpenRA.Effects; using OpenRA.Effects;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.GameRules; using OpenRA.GameRules;
using OpenRA.Traits; using OpenRA.Traits;
using System.Drawing;
namespace OpenRA.Mods.RA namespace OpenRA.Mods.RA
{ {

View File

@@ -20,7 +20,7 @@ namespace OpenRA.Mods.RA
public override object Create(ActorInitializer init) { return new AttackTesla(init.self); } public override object Create(ActorInitializer init) { return new AttackTesla(init.self); }
} }
class AttackTesla : AttackOmni, ITick class AttackTesla : AttackOmni, ITick, INotifyAttack
{ {
int charges; int charges;
int timeToRecharge; int timeToRecharge;
@@ -51,21 +51,25 @@ namespace OpenRA.Mods.RA
} }
Actor previousTarget; Actor previousTarget;
public override int FireDelay( Actor self, AttackBaseInfo info ) public override int FireDelay( Actor self, AttackBaseInfo info )
{ {
foreach( var w in Weapons ) return target.Actor == previousTarget ? 3 : base.FireDelay(self, info);
}
public void Attacking(Actor self)
{
foreach (var w in Weapons)
w.FireDelay = 8; w.FireDelay = 8;
timeToRecharge = Weapons[0].Info.ROF; timeToRecharge = Weapons[0].Info.ROF;
--charges; --charges;
if( target.Actor != previousTarget ) if (target.Actor != previousTarget)
{ {
previousTarget = target.Actor; previousTarget = target.Actor;
self.traits.Get<RenderBuildingCharge>().PlayCharge( self ); self.traits.Get<RenderBuildingCharge>().PlayCharge(self);
return base.FireDelay( self, info );
} }
else
return 3;
} }
} }
} }