Add facings support to projectile trails and SmokeTrailWhenDamaged
This commit is contained in:
@@ -182,7 +182,7 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
if (!string.IsNullOrEmpty(info.Trail) && --smokeTicks < 0)
|
if (!string.IsNullOrEmpty(info.Trail) && --smokeTicks < 0)
|
||||||
{
|
{
|
||||||
var delayedPos = WPos.LerpQuadratic(args.Source, target, angle, ticks - info.TrailDelay, length);
|
var delayedPos = WPos.LerpQuadratic(args.Source, target, angle, ticks - info.TrailDelay, length);
|
||||||
world.AddFrameEndTask(w => w.Add(new Smoke(w, delayedPos, info.Trail, trailPalette, info.TrailSequences.Random(world.SharedRandom))));
|
world.AddFrameEndTask(w => w.Add(new Smoke(w, delayedPos, () => GetEffectiveFacing(), info.Trail, trailPalette, info.TrailSequences.Random(world.SharedRandom))));
|
||||||
smokeTicks = info.TrailInterval;
|
smokeTicks = info.TrailInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -805,7 +805,7 @@ namespace OpenRA.Mods.Common.Effects
|
|||||||
// Create the smoke trail effect
|
// Create the smoke trail effect
|
||||||
if (!string.IsNullOrEmpty(info.TrailImage) && --ticksToNextSmoke < 0 && (state != States.Freefall || info.TrailWhenDeactivated))
|
if (!string.IsNullOrEmpty(info.TrailImage) && --ticksToNextSmoke < 0 && (state != States.Freefall || info.TrailWhenDeactivated))
|
||||||
{
|
{
|
||||||
world.AddFrameEndTask(w => w.Add(new Smoke(w, pos - 3 * move / 2, info.TrailImage, trailPalette, info.TrailSequence)));
|
world.AddFrameEndTask(w => w.Add(new Smoke(w, pos - 3 * move / 2, () => renderFacing, info.TrailImage, trailPalette, info.TrailSequence)));
|
||||||
ticksToNextSmoke = info.TrailInterval;
|
ticksToNextSmoke = info.TrailInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
using OpenRA.Mods.Common.Effects;
|
using OpenRA.Mods.Common.Effects;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
|
||||||
@@ -31,12 +32,19 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
readonly SmokeTrailWhenDamagedInfo info;
|
readonly SmokeTrailWhenDamagedInfo info;
|
||||||
readonly BodyOrientation body;
|
readonly BodyOrientation body;
|
||||||
|
readonly Func<int> getFacing;
|
||||||
int ticks;
|
int ticks;
|
||||||
|
|
||||||
public SmokeTrailWhenDamaged(Actor self, SmokeTrailWhenDamagedInfo info)
|
public SmokeTrailWhenDamaged(Actor self, SmokeTrailWhenDamagedInfo info)
|
||||||
{
|
{
|
||||||
this.info = info;
|
this.info = info;
|
||||||
body = self.Trait<BodyOrientation>();
|
body = self.Trait<BodyOrientation>();
|
||||||
|
var facing = self.TraitOrDefault<IFacing>();
|
||||||
|
|
||||||
|
if (facing != null)
|
||||||
|
getFacing = () => facing.Facing;
|
||||||
|
else
|
||||||
|
getFacing = () => 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Tick(Actor self)
|
public void Tick(Actor self)
|
||||||
@@ -48,7 +56,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
var offset = info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation));
|
var offset = info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation));
|
||||||
var pos = position + body.LocalToWorld(offset);
|
var pos = position + body.LocalToWorld(offset);
|
||||||
self.World.AddFrameEndTask(w => w.Add(new Smoke(w, pos, info.Sprite, info.Palette, info.Sequence)));
|
self.World.AddFrameEndTask(w => w.Add(new Smoke(w, pos, getFacing, info.Sprite, info.Palette, info.Sequence)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ticks = info.Interval;
|
ticks = info.Interval;
|
||||||
|
|||||||
Reference in New Issue
Block a user