Add IdleSpeed to aircraft trait.

This commit is contained in:
tovl
2020-06-21 21:32:20 +02:00
committed by reaperrr
parent 6cfa27c33b
commit 5e62fe86fc
2 changed files with 8 additions and 2 deletions

View File

@@ -48,10 +48,12 @@ namespace OpenRA.Mods.Common.Activities
foreach (var tickIdle in tickIdles)
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
var move = aircraft.FlyStep(aircraft.Facing);
var move = aircraft.FlyStep(speed, aircraft.Facing);
// We can't possibly turn this fast
var desiredFacing = aircraft.Facing + new WAngle(256);

View File

@@ -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.")]
public readonly WAngle? IdleTurnSpeed = null;
[Desc("Maximum flight speed")]
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.")]
public readonly WAngle Pitch = WAngle.Zero;