Make aircraft turn speed scale with speed modifiers
This commit is contained in:
@@ -68,7 +68,7 @@ namespace OpenRA.Mods.Common.Activities
|
|||||||
move = moveOverride;
|
move = moveOverride;
|
||||||
|
|
||||||
var oldFacing = aircraft.Facing;
|
var oldFacing = aircraft.Facing;
|
||||||
var turnSpeed = idleTurn ? aircraft.IdleTurnSpeed ?? aircraft.TurnSpeed : aircraft.TurnSpeed;
|
var turnSpeed = aircraft.GetTurnSpeed(idleTurn);
|
||||||
aircraft.Facing = Util.TickFacing(aircraft.Facing, desiredFacing, turnSpeed);
|
aircraft.Facing = Util.TickFacing(aircraft.Facing, desiredFacing, turnSpeed);
|
||||||
|
|
||||||
var roll = idleTurn ? aircraft.Info.IdleRoll ?? aircraft.Info.Roll : aircraft.Info.Roll;
|
var roll = idleTurn ? aircraft.Info.IdleRoll ?? aircraft.Info.Roll : aircraft.Info.Roll;
|
||||||
|
|||||||
@@ -268,6 +268,18 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public WAngle TurnSpeed => IsTraitDisabled || IsTraitPaused ? WAngle.Zero : Info.TurnSpeed;
|
public WAngle TurnSpeed => IsTraitDisabled || IsTraitPaused ? WAngle.Zero : Info.TurnSpeed;
|
||||||
public WAngle? IdleTurnSpeed => IsTraitDisabled || IsTraitPaused ? null : Info.IdleTurnSpeed;
|
public WAngle? IdleTurnSpeed => IsTraitDisabled || IsTraitPaused ? null : Info.IdleTurnSpeed;
|
||||||
|
|
||||||
|
public WAngle GetTurnSpeed(bool isIdleTurn)
|
||||||
|
{
|
||||||
|
// A MovementSpeed of zero indicates either a speed modifier of zero percent or that the trait is paused or disabled.
|
||||||
|
// Bail early in that case.
|
||||||
|
if ((isIdleTurn && IdleMovementSpeed == 0) || MovementSpeed == 0)
|
||||||
|
return WAngle.Zero;
|
||||||
|
|
||||||
|
var turnSpeed = isIdleTurn ? IdleTurnSpeed ?? TurnSpeed : TurnSpeed;
|
||||||
|
|
||||||
|
return new WAngle(Util.ApplyPercentageModifiers(turnSpeed.Angle, speedModifiers).Clamp(1, 1024));
|
||||||
|
}
|
||||||
|
|
||||||
public Actor ReservedActor { get; private set; }
|
public Actor ReservedActor { get; private set; }
|
||||||
public bool MayYieldReservation { get; private set; }
|
public bool MayYieldReservation { get; private set; }
|
||||||
public bool ForceLanding { get; private set; }
|
public bool ForceLanding { get; private set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user