fixed #75 missiles fly forever

This commit is contained in:
Chris Forbes
2010-02-26 20:43:17 +13:00
parent ab9ab13bad
commit b976447d67
4 changed files with 21 additions and 55 deletions

View File

@@ -81,13 +81,7 @@ namespace OpenRa.Effects
var dist = Target.CenterLocation - Pos;
if (dist.LengthSquared < MissileCloseEnough * MissileCloseEnough || Target.IsDead)
{
world.AddFrameEndTask(w => w.Remove(this));
if (t > Projectile.Arm * 40) /* don't blow up in our launcher's face! */
Combat.DoImpact(Pos.ToInt2(), Pos.ToInt2(), Weapon, Projectile, Warhead, FiredBy);
return;
}
Explode(world);
var speed = Scale * Weapon.Speed * ((targetAltitude > 0 && Weapon.TurboBoost) ? 1.5f : 1f);
@@ -99,7 +93,17 @@ namespace OpenRa.Effects
world.AddFrameEndTask(w => w.Add(
new Smoke(w, (Pos - 1.5f * move - new int2( 0, Altitude )).ToInt2(), Projectile.Trail)));
// todo: running out of fuel
if (Projectile.RangeLimit != 0 && t > Projectile.RangeLimit * 40)
Explode(world);
}
void Explode(World world)
{
world.AddFrameEndTask(w => w.Remove(this));
if (t > Projectile.Arm * 40) /* don't blow up in our launcher's face! */
Combat.DoImpact(Pos.ToInt2(), Pos.ToInt2(), Weapon, Projectile, Warhead, FiredBy);
return;
}
public IEnumerable<Renderable> Render()

View File

@@ -25,25 +25,21 @@ namespace OpenRa.GameRules
public readonly bool AA = false;
public readonly bool AG = true;
public readonly bool ASW = false;
public readonly string Trail = null;
public readonly bool Arcing = false;
public readonly int Arm = 0;
public readonly bool Degenerates = false;
public readonly bool Dropping = false;
public readonly int Frames = 1;
public readonly bool Gigundo = false;
public readonly bool High = false;
public readonly string Image = null;
public readonly bool Inaccurate = false;
public readonly bool Inviso = false;
public readonly bool Parachuted = false;
public readonly bool Proximity = false;
public readonly int ROT = 0;
public readonly bool Ranged = false;
public readonly bool Rotates = false;
public readonly bool Shadow = true;
public readonly bool Translucent = false;
public readonly bool UnderWater = false;
public readonly int RangeLimit = 0;
// OpenRA-specific:
public readonly string Trail = null;
}
}

View File

@@ -74,8 +74,6 @@ HeatSeeker
Cannon
[Invisible]
Inviso=yes
Image=none
[HeatSeeker]
Arm=2
@@ -83,13 +81,12 @@ High=yes
Shadow=no
Proximity=yes
Trail=smokey
Ranged=yes
Inaccurate=yes
AA=yes
Image=DRAGON
ROT=5
Rotates=yes
Translucent=yes
RangeLimit=6
[Cannon]
Image=120MM

View File

@@ -456,35 +456,27 @@ Report=MISSILE1
; AA = Can this weapon fire upon flying aircraft (def=no)?
; AG = Can this weapon fire upon ground objects (def=yes)?
; ASW = Is this an Anti-Submarine-Warfare projectile (def=no)?
; Animates = Does it animate [this means smoke puffs] (def=no)?
; Arcing = Does it have a ballistic trajectory (def=no)?
; Arm = arming delay (def=0)
; Degenerates = Does the bullet strength weaken as it travels (def=no)?
; Dropping = Does it fall from a starting height (def=no)?
; Frames = number of image frames for animation purposes (def=1)
; Gigundo = Is the projectile larger than normal (def=no)?
; High = Can it fly over walls (def=no)?
; Image = image to use during flight
; Inaccurate = Is it inherently inaccurate (def=no)?
; Inviso = Is the projectile invisible as it travels (def=no)?
; Parachuted = Equipped with a parachute for dropping from plane (def=no)?
; Proximity = Does it blow up when near its target (def=no)?
; ROT = Rate Of Turn [non zero implies homing] (def=0)
; Ranged = Can it run out of fuel (def=no)?
; Rotates = Does the projectile have rotation specific imagery (def=no)?
; Shadow = If High, does this bullet need to have a shadow drawn? (def = yes)
; Translucent = Are translucent colors used in artwork (def=no)?
; UnderWater = Does the projectile travel under water?
; Trail = image to use for smoke puffs etc (def=null)
; RangeLimit = maximum flight time (def=0=unlimited)
; invisible flight to target
[Invisible]
Inviso=yes
Image=none
; special case for dog
[LeapDog]
Image=DOGBULLT
Translucent=yes
Rotates=yes
Proximity=yes
ROT=20
@@ -495,8 +487,6 @@ Image=120MM
; anti aircraft artillery projectile
[Ack]
Image=none
Inviso=yes
AA=true
AG=false
@@ -514,7 +504,6 @@ High=yes
Shadow=no
Proximity=yes
Trail=smokey
Ranged=yes
Inaccurate=yes
Image=V2
Rotates=yes
@@ -526,13 +515,12 @@ High=yes
Shadow=no
Proximity=yes
Trail=smokey
Ranged=yes
Inaccurate=yes
AA=yes
Image=DRAGON
ROT=5
Rotates=yes
Translucent=yes
RangeLimit=5
; small missile with deadly accuracy
[LaserGuided]
@@ -541,12 +529,11 @@ High=yes
Shadow=no
Proximity=yes
Trail=smokey
Ranged=yes
AA=yes
Image=DRAGON
ROT=20
Rotates=yes
Translucent=yes
RangeLimit=5
; anti aircraft missile
[AAMissile]
@@ -555,13 +542,12 @@ High=yes
Shadow=no
Proximity=yes
Trail=smokey
Ranged=yes
AA=yes
AG=no
Image=MISSILE
ROT=20
Rotates=yes
Translucent=yes
RangeLimit=5
; lobbed tumbling grenade
[Lobbed]
@@ -569,8 +555,6 @@ High=yes
Arcing=yes
Inaccurate=yes
Image=BOMB
Frames=8
Translucent=yes
; Depth charge catapult
[Catapult]
@@ -578,20 +562,15 @@ High=yes
Arcing=yes
Inaccurate=yes
Image=BOMB
Frames=8
ASW=yes
AG=no
Translucent=yes
; dropped from plane tumbling object
[Bomblet]
Arm=24
RangeLimit=24
High=yes
Dropping=yes
Image=BOMBLET
Frames=6
Translucent=yes
; arcing ballistic projectile
[Ballistic]
@@ -605,37 +584,27 @@ Image=120MM
Arm=24
RangeLimit=24
High=yes
Dropping=yes
Parachuted=yes
;Image=PARABOMB
; Allied free radar (GPS satellite)
[GPSSatellite]
Gigundo=yes
High=yes
Image=SPUTNIK
Frames=4
; Nuclear missile, flying up
[NukeUp]
Gigundo=yes
High=yes
Image=ATOMICUP
Frames=4
; Nuclear missile, flying down
[NukeDown]
Gigundo=yes
High=yes
Image=ATOMICDN
Frames=4
; wizard's fireball
[Fireball]
Trail=fb2
Image=FB1
Frames=8
; ******* Warhead Characteristics *******
; This is what gives the "rock, paper, scissors" character to the game.