From 9e2da0d2dfda89b63bf17dc4c08f274697baf767 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sat, 21 Mar 2015 16:18:25 +0100 Subject: [PATCH] Add support for player color explosions to CreateEffectWarhead --- OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs b/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs index f2abe59f0d..968bf0150f 100644 --- a/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs @@ -25,6 +25,9 @@ namespace OpenRA.Mods.Common.Warheads [Desc("Palette to use for explosion effect.")] public readonly string ExplosionPalette = "effect"; + [Desc("Remap explosion effect to player color, if art supports it.")] + public readonly bool UsePlayerPalette = false; + [Desc("Sound to play on impact.")] public readonly string ImpactSound = null; @@ -80,8 +83,12 @@ namespace OpenRA.Mods.Common.Warheads if ((!world.Map.Contains(targetTile)) || (!isValid)) return; + var palette = ExplosionPalette; + if (UsePlayerPalette) + palette += firedBy.Owner.InternalName; + if (Explosion != null) - world.AddFrameEndTask(w => w.Add(new Explosion(w, pos, Explosion, ExplosionPalette))); + world.AddFrameEndTask(w => w.Add(new Explosion(w, pos, Explosion, palette))); if (ImpactSound != null) Sound.Play(ImpactSound, pos);