From 551c94b77cdfd520e9d354072416a48df5dc2ad9 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 21 Feb 2011 22:14:11 +1300 Subject: [PATCH] add TrailInterval support for Missile --- OpenRA.Mods.RA/Effects/Missile.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/OpenRA.Mods.RA/Effects/Missile.cs b/OpenRA.Mods.RA/Effects/Missile.cs index 7a55890154..231975712a 100755 --- a/OpenRA.Mods.RA/Effects/Missile.cs +++ b/OpenRA.Mods.RA/Effects/Missile.cs @@ -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)