Prevent turrets from firing until they are aligned with the target.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user