Have turrets actively track targets, even when not ready to attack.

This commit is contained in:
RoosterDragon
2016-03-11 19:26:44 +00:00
parent f8b61782a1
commit 4598b0de43
2 changed files with 6 additions and 4 deletions

View File

@@ -79,7 +79,7 @@ namespace OpenRA.Mods.Cnc.Traits
return false; return false;
} }
return turret.FaceTarget(self, target); return true;
} }
public void TickIdle(Actor self) public void TickIdle(Actor self)

View File

@@ -32,14 +32,16 @@ namespace OpenRA.Mods.Common.Traits
protected override bool CanAttack(Actor self, Target target) protected override bool CanAttack(Actor self, Target target)
{ {
if (!base.CanAttack(self, target)) if (target.Type == TargetType.Invalid)
return false; return false;
// Don't break early from this loop - we want to bring all turrets to bear!
var turretReady = false;
foreach (var t in turrets) foreach (var t in turrets)
if (t.FaceTarget(self, target)) if (t.FaceTarget(self, target))
return true; turretReady = true;
return false; return turretReady && base.CanAttack(self, target);
} }
} }
} }