Add IdleSpeed to aircraft trait.
This commit is contained in:
@@ -48,10 +48,12 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
foreach (var tickIdle in tickIdles)
|
foreach (var tickIdle in tickIdles)
|
||||||
tickIdle.TickIdle(self);
|
tickIdle.TickIdle(self);
|
||||||
|
|
||||||
if (!aircraft.Info.CanHover)
|
if (aircraft.Info.IdleSpeed > 0 || (!aircraft.Info.CanHover && aircraft.Info.IdleSpeed < 0))
|
||||||
{
|
{
|
||||||
|
var speed = aircraft.Info.IdleSpeed < 0 ? aircraft.Info.Speed : aircraft.Info.IdleSpeed;
|
||||||
|
|
||||||
// This override is necessary, otherwise aircraft with CanSlide would circle sideways
|
// This override is necessary, otherwise aircraft with CanSlide would circle sideways
|
||||||
var move = aircraft.FlyStep(aircraft.Facing);
|
var move = aircraft.FlyStep(speed, aircraft.Facing);
|
||||||
|
|
||||||
// We can't possibly turn this fast
|
// We can't possibly turn this fast
|
||||||
var desiredFacing = aircraft.Facing + new WAngle(256);
|
var desiredFacing = aircraft.Facing + new WAngle(256);
|
||||||
|
|||||||
@@ -56,8 +56,12 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Turn speed to apply when aircraft flies in circles while idle. Defaults to TurnSpeed if undefined.")]
|
[Desc("Turn speed to apply when aircraft flies in circles while idle. Defaults to TurnSpeed if undefined.")]
|
||||||
public readonly WAngle? IdleTurnSpeed = null;
|
public readonly WAngle? IdleTurnSpeed = null;
|
||||||
|
|
||||||
|
[Desc("Maximum flight speed")]
|
||||||
public readonly int Speed = 1;
|
public readonly int Speed = 1;
|
||||||
|
|
||||||
|
[Desc("If non-negative, force the aircraft to move in circles at this speed when idle (a speed of 0 means don't move), ignoring CanHover.")]
|
||||||
|
public readonly int IdleSpeed = -1;
|
||||||
|
|
||||||
[Desc("Body pitch when flying forwards. Only relevant for voxel aircraft.")]
|
[Desc("Body pitch when flying forwards. Only relevant for voxel aircraft.")]
|
||||||
public readonly WAngle Pitch = WAngle.Zero;
|
public readonly WAngle Pitch = WAngle.Zero;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user