diff --git a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj index 3bb01cbe2c..cde0f5ceef 100644 --- a/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj +++ b/OpenRA.Mods.Common/OpenRA.Mods.Common.csproj @@ -366,6 +366,7 @@ + diff --git a/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs b/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs new file mode 100644 index 0000000000..68ad69aedc --- /dev/null +++ b/OpenRA.Mods.Common/Traits/Render/LeavesTrails.cs @@ -0,0 +1,53 @@ +#region Copyright & License Information +/* + * Copyright 2007-2015 The OpenRA Developers (see AUTHORS) + * This file is part of OpenRA, which is free software. It is made + * available to you under the terms of the GNU General Public License + * as published by the Free Software Foundation. For more information, + * see COPYING. + */ +#endregion + +using System.Linq; +using OpenRA.Effects; +using OpenRA.Traits; + +namespace OpenRA.Mods.Common.Traits +{ + [Desc("Renders a sprite effect when leaving a cell.")] + public class LeavesTrailsInfo : ITraitInfo + { + public readonly string Image = null; + public readonly string Palette = "effect"; + + [Desc("Only do so when the terrain types match with the previous cell.")] + public readonly string[] TerrainTypes = { }; + + public object Create(ActorInitializer init) { return new LeavesTrails(this, init.Self); } + } + + public class LeavesTrails : ITick + { + readonly LeavesTrailsInfo info; + + public LeavesTrails(LeavesTrailsInfo info, Actor self) + { + this.info = info; + } + + CPos cachedLocation; + + public void Tick(Actor self) + { + if (cachedLocation != self.Location) + { + var type = self.World.Map.GetTerrainInfo(cachedLocation).Type; + var pos = self.World.Map.CenterOfCell(cachedLocation); + if (info.TerrainTypes.Contains(type) && !string.IsNullOrEmpty(info.Image)) + self.World.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, self.World, info.Image, info.Palette))); + + cachedLocation = self.Location; + } + } + } +} diff --git a/mods/ts/rules/gdi-vehicles.yaml b/mods/ts/rules/gdi-vehicles.yaml index 52526792b1..425fe5ff76 100644 --- a/mods/ts/rules/gdi-vehicles.yaml +++ b/mods/ts/rules/gdi-vehicles.yaml @@ -70,6 +70,10 @@ HVR: WithVoxelBody: WithVoxelTurret: Hovers: + LeavesTrails: + Image: wake + Palette: effect + TerrainTypes: Water SMECH: Inherits: ^Tank diff --git a/mods/ts/sequences/misc.yaml b/mods/ts/sequences/misc.yaml index 0cfbb06d39..3e90be66d5 100644 --- a/mods/ts/sequences/misc.yaml +++ b/mods/ts/sequences/misc.yaml @@ -220,6 +220,11 @@ moveflsh: Length: * Tick: 30 +wake: + idle: wake2 + Length: * + Tick: 180 + resources: Defaults: UseTilesetExtension: true