Merge pull request #10777 from reaperrr/fix-missile-cruise
Fix missiles not moving to CruiseAltitude if launched above it
This commit is contained in:
@@ -664,6 +664,11 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
// of vertical facing bound by the maximum vertical rate of turn
|
// of vertical facing bound by the maximum vertical rate of turn
|
||||||
var vDist = new WVec(-diffClfMslHgt - info.CruiseAltitude.Length, -speed, 0);
|
var vDist = new WVec(-diffClfMslHgt - info.CruiseAltitude.Length, -speed, 0);
|
||||||
desiredVFacing = (sbyte)vDist.HorizontalLengthSquared != 0 ? vDist.Yaw.Facing : vFacing;
|
desiredVFacing = (sbyte)vDist.HorizontalLengthSquared != 0 ? vDist.Yaw.Facing : vFacing;
|
||||||
|
|
||||||
|
// If the missile is launched above CruiseAltitude, it has to descend instead of climbing
|
||||||
|
if (-diffClfMslHgt > info.CruiseAltitude.Length)
|
||||||
|
desiredVFacing = -desiredVFacing;
|
||||||
|
|
||||||
desiredVFacing = desiredVFacing.Clamp(-info.VerticalRateOfTurn, info.VerticalRateOfTurn);
|
desiredVFacing = desiredVFacing.Clamp(-info.VerticalRateOfTurn, info.VerticalRateOfTurn);
|
||||||
|
|
||||||
ChangeSpeed();
|
ChangeSpeed();
|
||||||
@@ -675,6 +680,11 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
// of vertical facing bound by the maximum vertical rate of turn
|
// of vertical facing bound by the maximum vertical rate of turn
|
||||||
var vDist = new WVec(-diffClfMslHgt - info.CruiseAltitude.Length, -speed, 0);
|
var vDist = new WVec(-diffClfMslHgt - info.CruiseAltitude.Length, -speed, 0);
|
||||||
desiredVFacing = (sbyte)vDist.HorizontalLengthSquared != 0 ? vDist.Yaw.Facing : vFacing;
|
desiredVFacing = (sbyte)vDist.HorizontalLengthSquared != 0 ? vDist.Yaw.Facing : vFacing;
|
||||||
|
|
||||||
|
// If the missile is launched above CruiseAltitude, it has to descend instead of climbing
|
||||||
|
if (-diffClfMslHgt > info.CruiseAltitude.Length)
|
||||||
|
desiredVFacing = -desiredVFacing;
|
||||||
|
|
||||||
desiredVFacing = desiredVFacing.Clamp(-info.VerticalRateOfTurn, info.VerticalRateOfTurn);
|
desiredVFacing = desiredVFacing.Clamp(-info.VerticalRateOfTurn, info.VerticalRateOfTurn);
|
||||||
|
|
||||||
ChangeSpeed();
|
ChangeSpeed();
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ Maverick:
|
|||||||
Inaccuracy: 512
|
Inaccuracy: 512
|
||||||
Image: DRAGON
|
Image: DRAGON
|
||||||
HorizontalRateOfTurn: 5
|
HorizontalRateOfTurn: 5
|
||||||
|
CruiseAltitude: 2c0
|
||||||
RangeLimit: 60
|
RangeLimit: 60
|
||||||
Warhead@1Dam: SpreadDamage
|
Warhead@1Dam: SpreadDamage
|
||||||
Spread: 128
|
Spread: 128
|
||||||
|
|||||||
Reference in New Issue
Block a user