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;
}
}