tesla works better now.

This commit is contained in:
Bob
2010-03-21 22:00:18 +12:00
parent 3a51fc0629
commit 826908d747
7 changed files with 98 additions and 19 deletions

18
OpenRA.Game/Traits/Attack/AttackTurreted.cs Normal file → Executable file
View File

@@ -31,20 +31,22 @@ namespace OpenRA.Traits
{
public AttackTurreted(Actor self) : base(self) { }
public override void Tick(Actor self)
protected override bool CanAttack( Actor self )
{
base.Tick(self);
if( !CanAttack( self ) ) return;
if (self.traits.Contains<Building>() && !buildComplete)
return; /* base defenses can't do anything until they finish building !*/
if( self.traits.Contains<Building>() && !buildComplete )
return false;
var turreted = self.traits.Get<Turreted>();
turreted.desiredFacing = Util.GetFacing( target.CenterLocation - self.CenterLocation, turreted.turretFacing );
if( turreted.desiredFacing != turreted.turretFacing )
return;
return false;
return base.CanAttack( self );
}
public override void Tick(Actor self)
{
base.Tick(self);
DoAttack( self );
}