support TrailInterval on bullets too

This commit is contained in:
Chris Forbes
2011-02-21 22:27:00 +13:00
parent 551c94b77c
commit a8d849a1cb
2 changed files with 14 additions and 7 deletions

View File

@@ -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

View File

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