From a8d849a1cb606bd312e50d5584820046df3f0178 Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Mon, 21 Feb 2011 22:27:00 +1300 Subject: [PATCH] support TrailInterval on bullets too --- OpenRA.Mods.RA/Effects/Bullet.cs | 19 +++++++++++++------ OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/OpenRA.Mods.RA/Effects/Bullet.cs b/OpenRA.Mods.RA/Effects/Bullet.cs index f16215494a..99b73c38c4 100755 --- a/OpenRA.Mods.RA/Effects/Bullet.cs +++ b/OpenRA.Mods.RA/Effects/Bullet.cs @@ -28,7 +28,8 @@ namespace OpenRA.Mods.RA.Effects public readonly int Arm = 0; public readonly bool Shadow = false; public readonly bool Proximity = false; - public readonly float Angle = 0; + public readonly float Angle = 0; + public readonly int TrailInterval = 2; public IEffect Create(ProjectileArgs args) { return new Bullet( this, args ); } } @@ -81,7 +82,9 @@ namespace OpenRA.Mods.RA.Effects return (int)(rawFacing < 128 ? rawFacing - scale * attitude : rawFacing + scale * attitude); - } + } + + int ticksToNextSmoke; public void Tick( World world ) { @@ -99,10 +102,14 @@ namespace OpenRA.Mods.RA.Effects var highPos = (Info.High || Info.Angle > 0) ? (pos - new float2(0, GetAltitude())) - : pos; - - world.AddFrameEndTask(w => w.Add( - new Smoke(w, highPos.ToInt2(), Info.Trail))); + : pos; + + if (--ticksToNextSmoke < 0) + { + world.AddFrameEndTask(w => w.Add( + new Smoke(w, highPos.ToInt2(), Info.Trail))); + ticksToNextSmoke = Info.TrailInterval; + } } if (!Info.High) // check for hitting a wall diff --git a/OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs b/OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs index b3cbaf3a04..2a086b375b 100644 --- a/OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs +++ b/OpenRA.Mods.RA/SmokeTrailWhenDamaged.cs @@ -16,7 +16,7 @@ namespace OpenRA.Mods.RA class SmokeTrailWhenDamagedInfo : ITraitInfo { public readonly int[] Offset = { 0, 0 }; - public readonly int Interval = 1; + public readonly int Interval = 3; public object Create(ActorInitializer init) { return new SmokeTrailWhenDamaged(init.self, this); } }