Refactored Missile.RangeLimit from ticks to WDist
Changed default from 'unlimited' fuel to weapon range.
This commit is contained in:
@@ -82,8 +82,8 @@ namespace OpenRA.Mods.Common.Effects
|
||||
[Desc("Gravity applied while in free fall.")]
|
||||
public readonly int Gravity = 10;
|
||||
|
||||
[Desc("Run out of fuel after being activated this many ticks. Zero for unlimited fuel.")]
|
||||
public readonly int RangeLimit = 0;
|
||||
[Desc("Run out of fuel after covering this distance. Zero for defaulting to weapon range. Negative for unlimited fuel.")]
|
||||
public readonly WDist RangeLimit = WDist.Zero;
|
||||
|
||||
[Desc("Explode when running out of fuel.")]
|
||||
public readonly bool ExplodeWhenEmpty = true;
|
||||
@@ -181,6 +181,8 @@ namespace OpenRA.Mods.Common.Effects
|
||||
WVec velocity;
|
||||
int speed;
|
||||
int loopRadius;
|
||||
WDist distanceCovered;
|
||||
WDist rangeLimit;
|
||||
|
||||
int renderFacing;
|
||||
[Sync] int hFacing;
|
||||
@@ -198,6 +200,7 @@ namespace OpenRA.Mods.Common.Effects
|
||||
hFacing = args.Facing;
|
||||
gravity = new WVec(0, 0, -info.Gravity);
|
||||
targetPosition = args.PassiveTarget;
|
||||
rangeLimit = info.RangeLimit != WDist.Zero ? info.RangeLimit : args.Weapon.Range;
|
||||
|
||||
var world = args.SourceActor.World;
|
||||
|
||||
@@ -766,7 +769,7 @@ namespace OpenRA.Mods.Common.Effects
|
||||
}
|
||||
|
||||
// Switch from homing mode to freefall mode
|
||||
if (info.RangeLimit != 0 && ticks == info.RangeLimit + 1)
|
||||
if (rangeLimit >= WDist.Zero && distanceCovered > rangeLimit)
|
||||
{
|
||||
state = States.Freefall;
|
||||
velocity = new WVec(0, -speed, 0)
|
||||
@@ -824,11 +827,12 @@ namespace OpenRA.Mods.Common.Effects
|
||||
if (info.ContrailLength > 0)
|
||||
contrail.Update(pos);
|
||||
|
||||
distanceCovered += new WDist(speed);
|
||||
var cell = world.Map.CellContaining(pos);
|
||||
var height = world.Map.DistanceAboveTerrain(pos);
|
||||
shouldExplode |= height.Length < 0 // Hit the ground
|
||||
|| relTarDist < info.CloseEnough.Length // Within range
|
||||
|| (info.ExplodeWhenEmpty && info.RangeLimit != 0 && ticks > info.RangeLimit) // Ran out of fuel
|
||||
|| (info.ExplodeWhenEmpty && rangeLimit >= WDist.Zero && distanceCovered > rangeLimit) // Ran out of fuel
|
||||
|| !world.Map.Contains(cell) // This also avoids an IndexOutOfRangeException in GetTerrainInfo below.
|
||||
|| (!string.IsNullOrEmpty(info.BoundToTerrainType) && world.Map.GetTerrainInfo(cell).Type != info.BoundToTerrainType) // Hit incompatible terrain
|
||||
|| (height.Length < info.AirburstAltitude.Length && relTarHorDist < info.CloseEnough.Length); // Airburst
|
||||
|
||||
@@ -13,7 +13,7 @@ Rockets:
|
||||
TrailImage: smokey
|
||||
ContrailLength: 8
|
||||
Speed: 298
|
||||
RangeLimit: 20
|
||||
RangeLimit: 7c204
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 128
|
||||
Damage: 35
|
||||
@@ -46,7 +46,7 @@ BikeRockets:
|
||||
TrailImage: smokey
|
||||
ContrailLength: 8
|
||||
Speed: 213
|
||||
RangeLimit: 30
|
||||
RangeLimit: 7c204
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 128
|
||||
Damage: 30
|
||||
@@ -80,7 +80,7 @@ OrcaAGMissiles:
|
||||
TrailImage: smokey
|
||||
ContrailLength: 8
|
||||
Speed: 256
|
||||
RangeLimit: 30
|
||||
RangeLimit: 6c0
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 128
|
||||
Damage: 25
|
||||
@@ -114,7 +114,7 @@ OrcaAAMissiles:
|
||||
TrailImage: smokey
|
||||
ContrailLength: 8
|
||||
Speed: 298
|
||||
RangeLimit: 30
|
||||
RangeLimit: 6c0
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 128
|
||||
Damage: 25
|
||||
@@ -145,7 +145,7 @@ MammothMissiles:
|
||||
TrailImage: smokey
|
||||
ContrailLength: 8
|
||||
Speed: 341
|
||||
RangeLimit: 35
|
||||
RangeLimit: 6c0
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 298
|
||||
Damage: 45
|
||||
@@ -218,7 +218,7 @@ MammothMissiles:
|
||||
TrailImage: smokey
|
||||
ContrailLength: 8
|
||||
Speed: 213
|
||||
RangeLimit: 40
|
||||
RangeLimit: 8c409
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 128
|
||||
Damage: 60
|
||||
@@ -250,7 +250,7 @@ BoatMissile:
|
||||
TrailImage: smokey
|
||||
ContrailLength: 8
|
||||
Speed: 170
|
||||
RangeLimit: 60
|
||||
RangeLimit: 9c614
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 256
|
||||
Damage: 60
|
||||
@@ -285,7 +285,7 @@ TowerMissle:
|
||||
TrailImage: smokey
|
||||
ContrailLength: 8
|
||||
Speed: 298
|
||||
RangeLimit: 40
|
||||
RangeLimit: 8c409
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 683
|
||||
Damage: 25
|
||||
@@ -313,7 +313,7 @@ SAMMissile:
|
||||
Image: MISSILE
|
||||
HorizontalRateOfTurn: 20
|
||||
Speed: 426
|
||||
RangeLimit: 35
|
||||
RangeLimit: 9c614
|
||||
TrailImage: smokey
|
||||
ContrailLength: 8
|
||||
Warhead@1Dam: SpreadDamage
|
||||
@@ -374,7 +374,7 @@ Patriot:
|
||||
ContrailLength: 8
|
||||
HorizontalRateOfTurn: 20
|
||||
Speed: 300
|
||||
RangeLimit: 30
|
||||
RangeLimit: 10c819
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 682
|
||||
ValidTargets: Air
|
||||
|
||||
@@ -10,7 +10,7 @@ Bazooka:
|
||||
TrailImage: bazooka_trail2
|
||||
TrailPalette: effect75alpha
|
||||
TrailInterval: 1
|
||||
RangeLimit: 35
|
||||
RangeLimit: 3c614
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 192
|
||||
Falloff: 100, 50, 25, 0
|
||||
@@ -43,7 +43,7 @@ Rocket:
|
||||
TrailPalette: effect75alpha
|
||||
TrailInterval: 1
|
||||
Speed: 343
|
||||
RangeLimit: 35
|
||||
RangeLimit: 4c204
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 160
|
||||
Falloff: 100, 50, 25, 0
|
||||
@@ -76,7 +76,7 @@ TowerMissile:
|
||||
Blockable: false
|
||||
Shadow: true
|
||||
HorizontalRateOfTurn: 1
|
||||
RangeLimit: 50
|
||||
RangeLimit: 6c614
|
||||
Inaccuracy: 384
|
||||
Image: MISSILE2
|
||||
TrailImage: large_trail
|
||||
@@ -112,7 +112,7 @@ mtank_pri:
|
||||
ValidTargets: Ground, Air
|
||||
Projectile: Missile
|
||||
Speed: 281
|
||||
RangeLimit: 50
|
||||
RangeLimit: 7c204
|
||||
HorizontalRateOfTurn: 3
|
||||
Blockable: false
|
||||
Shadow: yes
|
||||
@@ -147,7 +147,7 @@ DeviatorMissile:
|
||||
Report: MISSLE1.WAV
|
||||
Projectile: Missile
|
||||
Speed: 281
|
||||
RangeLimit: 40
|
||||
RangeLimit: 6c0
|
||||
HorizontalRateOfTurn: 3
|
||||
Blockable: false
|
||||
Shadow: yes
|
||||
|
||||
@@ -28,7 +28,7 @@ MammothTusk:
|
||||
ContrailLength: 150
|
||||
Inaccuracy: 0c853
|
||||
ROT: 10
|
||||
RangeLimit: 80
|
||||
RangeLimit: 12c0
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 640
|
||||
ValidTargets: Ground, Air
|
||||
|
||||
@@ -15,7 +15,7 @@ Maverick:
|
||||
Image: DRAGON
|
||||
HorizontalRateOfTurn: 5
|
||||
CruiseAltitude: 2c0
|
||||
RangeLimit: 60
|
||||
RangeLimit: 10c819
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 128
|
||||
Damage: 70
|
||||
@@ -52,7 +52,7 @@ Dragon:
|
||||
Inaccuracy: 128
|
||||
Image: DRAGON
|
||||
HorizontalRateOfTurn: 5
|
||||
RangeLimit: 35
|
||||
RangeLimit: 6c0
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 128
|
||||
Damage: 50
|
||||
@@ -90,7 +90,7 @@ HellfireAG:
|
||||
Inaccuracy: 128
|
||||
Image: DRAGON
|
||||
HorizontalRateOfTurn: 10
|
||||
RangeLimit: 20
|
||||
RangeLimit: 4c819
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 128
|
||||
Damage: 60
|
||||
@@ -128,7 +128,7 @@ HellfireAA:
|
||||
Inaccuracy: 128
|
||||
Image: DRAGON
|
||||
HorizontalRateOfTurn: 10
|
||||
RangeLimit: 20
|
||||
RangeLimit: 4c819
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 128
|
||||
Damage: 40
|
||||
@@ -164,7 +164,7 @@ MammothTusk:
|
||||
Inaccuracy: 128
|
||||
Image: DRAGON
|
||||
HorizontalRateOfTurn: 15
|
||||
RangeLimit: 40
|
||||
RangeLimit: 9c614
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 256
|
||||
Damage: 50
|
||||
@@ -201,7 +201,7 @@ Nike:
|
||||
ContrailLength: 10
|
||||
Image: MISSILE
|
||||
HorizontalRateOfTurn: 25
|
||||
RangeLimit: 50
|
||||
RangeLimit: 9c0
|
||||
Speed: 341
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 128
|
||||
@@ -229,7 +229,7 @@ RedEye:
|
||||
ContrailLength: 10
|
||||
Image: MISSILE
|
||||
HorizontalRateOfTurn: 20
|
||||
RangeLimit: 30
|
||||
RangeLimit: 9c0
|
||||
Speed: 298
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 128
|
||||
@@ -293,7 +293,7 @@ Stinger:
|
||||
ContrailLength: 10
|
||||
Image: DRAGON
|
||||
HorizontalRateOfTurn: 20
|
||||
RangeLimit: 65
|
||||
RangeLimit: 10c819
|
||||
Speed: 170
|
||||
CloseEnough: 149
|
||||
Warhead@1Dam: SpreadDamage
|
||||
@@ -334,7 +334,7 @@ StingerAA:
|
||||
ContrailLength: 10
|
||||
Image: DRAGON
|
||||
HorizontalRateOfTurn: 20
|
||||
RangeLimit: 50
|
||||
RangeLimit: 10c819
|
||||
Speed: 255
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 128
|
||||
@@ -374,7 +374,7 @@ TorpTube:
|
||||
Speed: 85
|
||||
TrailImage: bubbles
|
||||
HorizontalRateOfTurn: 1
|
||||
RangeLimit: 160
|
||||
RangeLimit: 10c819
|
||||
BoundToTerrainType: Water
|
||||
Palette: shadow
|
||||
Warhead@1Dam: SpreadDamage
|
||||
@@ -451,7 +451,7 @@ APTusk:
|
||||
Inaccuracy: 128
|
||||
Image: DRAGON
|
||||
HorizontalRateOfTurn: 10
|
||||
RangeLimit: 22
|
||||
RangeLimit: 7c204
|
||||
Warhead@1Dam: SpreadDamage
|
||||
Spread: 128
|
||||
Damage: 30
|
||||
|
||||
@@ -12,7 +12,7 @@ Bazooka:
|
||||
Image: DRAGON
|
||||
TrailImage: small_smoke_trail
|
||||
HorizontalRateOfTurn: 8
|
||||
RangeLimit: 50
|
||||
RangeLimit: 7c204
|
||||
Palette: ra
|
||||
MinimumLaunchSpeed: 75
|
||||
Speed: 384
|
||||
@@ -58,7 +58,7 @@ HoverMissile:
|
||||
Image: DRAGON
|
||||
TrailImage: small_smoke_trail
|
||||
HorizontalRateOfTurn: 8
|
||||
RangeLimit: 35
|
||||
RangeLimit: 9c614
|
||||
Palette: ra
|
||||
MinimumLaunchSpeed: 75
|
||||
Speed: 384
|
||||
@@ -103,7 +103,7 @@ MammothTusk:
|
||||
TrailImage: small_smoke_trail
|
||||
HorizontalRateOfTurn: 10
|
||||
MaximumLaunchSpeed: 213
|
||||
RangeLimit: 50
|
||||
RangeLimit: 7c204
|
||||
Palette: ra
|
||||
MinimumLaunchSpeed: 75
|
||||
Speed: 384
|
||||
@@ -144,7 +144,7 @@ BikeMissile:
|
||||
TrailImage: small_smoke_trail
|
||||
HorizontalRateOfTurn: 8
|
||||
MaximumLaunchSpeed: 213
|
||||
RangeLimit: 50
|
||||
RangeLimit: 6c0
|
||||
Palette: ra
|
||||
MinimumLaunchSpeed: 75
|
||||
Speed: 384
|
||||
@@ -186,7 +186,7 @@ Dragon:
|
||||
Image: DRAGON
|
||||
TrailImage: small_smoke_trail
|
||||
HorizontalRateOfTurn: 8
|
||||
RangeLimit: 50
|
||||
RangeLimit: 7c204
|
||||
Palette: ra
|
||||
MinimumLaunchSpeed: 75
|
||||
Speed: 384
|
||||
@@ -232,7 +232,7 @@ Hellfire:
|
||||
Image: DRAGON
|
||||
TrailImage: small_smoke_trail
|
||||
HorizontalRateOfTurn: 8
|
||||
RangeLimit: 35
|
||||
RangeLimit: 7c204
|
||||
Palette: ra
|
||||
MinimumLaunchSpeed: 75
|
||||
Speed: 384
|
||||
@@ -277,7 +277,7 @@ RedEye2:
|
||||
Image: DRAGON
|
||||
TrailImage: small_smoke_trail
|
||||
HorizontalRateOfTurn: 5
|
||||
RangeLimit: 100
|
||||
RangeLimit: 18c0
|
||||
Palette: ra
|
||||
MinimumLaunchSpeed: 75
|
||||
Speed: 384
|
||||
|
||||
@@ -11,7 +11,7 @@ MultiCluster:
|
||||
Inaccuracy: 128
|
||||
Image: DRAGON
|
||||
HorizontalRateOfTurn: 8
|
||||
RangeLimit: 35
|
||||
RangeLimit: 7c204
|
||||
Palette: ra
|
||||
MinimumLaunchSpeed: 75
|
||||
Speed: 384
|
||||
|
||||
Reference in New Issue
Block a user