Prevent turrets from firing until they are aligned with the target.

This commit is contained in:
RoosterDragon
2016-03-12 20:41:35 +00:00
parent 4598b0de43
commit 163688fc39
2 changed files with 9 additions and 1 deletions

View File

@@ -186,6 +186,9 @@ namespace OpenRA.Mods.Common.Traits
if (ammoPool != null && !ammoPool.HasAmmo())
return null;
if (turret != null && !turret.HasAchievedDesiredFacing)
return null;
if (!target.IsInRange(self.CenterPosition, MaxRange()))
return null;

View File

@@ -113,7 +113,12 @@ namespace OpenRA.Mods.Common.Traits
var delta = target.CenterPosition - self.CenterPosition;
DesiredFacing = delta.HorizontalLengthSquared != 0 ? delta.Yaw.Facing : TurretFacing;
MoveTurret();
return TurretFacing == DesiredFacing.Value;
return HasAchievedDesiredFacing;
}
public bool HasAchievedDesiredFacing
{
get { return DesiredFacing != null && TurretFacing == DesiredFacing.Value; }
}
// Turret offset in world-space