make AttackMoveActivity a bit less aggressive about pwning the tick perf

This commit is contained in:
Chris Forbes
2011-05-04 23:06:00 +12:00
parent 375eb90a88
commit b22bb84349

View File

@@ -76,11 +76,19 @@ namespace OpenRA.Mods.RA
class AttackMoveActivity : Activity class AttackMoveActivity : Activity
{ {
Activity inner; Activity inner;
int scanTicks;
const int ScanInterval = 7;
public AttackMoveActivity( Activity inner ) { this.inner = inner; } public AttackMoveActivity( Activity inner ) { this.inner = inner; }
public override Activity Tick( Actor self ) public override Activity Tick( Actor self )
{ {
self.Trait<AutoTarget>().ScanAndAttack(self, true, false); if (--scanTicks <= 0)
{
self.Trait<AutoTarget>().ScanAndAttack(self, true, false);
scanTicks = ScanInterval;
}
if( inner == null ) if( inner == null )
return NextActivity; return NextActivity;