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())
|
if (ammoPool != null && !ammoPool.HasAmmo())
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
if (turret != null && !turret.HasAchievedDesiredFacing)
|
||||||
|
return null;
|
||||||
|
|
||||||
if (!target.IsInRange(self.CenterPosition, MaxRange()))
|
if (!target.IsInRange(self.CenterPosition, MaxRange()))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|||||||
@@ -113,7 +113,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
var delta = target.CenterPosition - self.CenterPosition;
|
var delta = target.CenterPosition - self.CenterPosition;
|
||||||
DesiredFacing = delta.HorizontalLengthSquared != 0 ? delta.Yaw.Facing : TurretFacing;
|
DesiredFacing = delta.HorizontalLengthSquared != 0 ? delta.Yaw.Facing : TurretFacing;
|
||||||
MoveTurret();
|
MoveTurret();
|
||||||
return TurretFacing == DesiredFacing.Value;
|
return HasAchievedDesiredFacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasAchievedDesiredFacing
|
||||||
|
{
|
||||||
|
get { return DesiredFacing != null && TurretFacing == DesiredFacing.Value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Turret offset in world-space
|
// Turret offset in world-space
|
||||||
|
|||||||
Reference in New Issue
Block a user