add TrailInterval support for Missile

This commit is contained in:
Chris Forbes
2011-02-21 22:14:11 +13:00
parent b90a90f8cc
commit 551c94b77c

View File

@@ -30,7 +30,8 @@ namespace OpenRA.Mods.RA.Effects
public readonly string Image = null;
public readonly int ROT = 5;
public readonly int RangeLimit = 0;
public readonly bool TurboBoost = false;
public readonly bool TurboBoost = false;
public readonly int TrailInterval = 2;
public IEffect Create(ProjectileArgs args) { return new Missile( this, args ); }
}
@@ -69,8 +70,8 @@ namespace OpenRA.Mods.RA.Effects
}
// In pixels
const int MissileCloseEnough = 7;
const int MissileCloseEnough = 7;
int ticksToNextSmoke;
public void Tick( World world )
{
@@ -106,8 +107,13 @@ namespace OpenRA.Mods.RA.Effects
if (Info.Trail != null)
{
var sp = (SubPxPosition - (move * 3) / 2) / 1024 - new int2(0, Altitude);
world.AddFrameEndTask(w => w.Add(new Smoke(w, sp, Info.Trail)));
var sp = (SubPxPosition - (move * 3) / 2) / 1024 - new int2(0, Altitude);
if (--ticksToNextSmoke < 0)
{
world.AddFrameEndTask(w => w.Add(new Smoke(w, sp, Info.Trail)));
ticksToNextSmoke = Info.TrailInterval;
}
}
if (Info.RangeLimit != 0 && t > Info.RangeLimit * 40)