Add support for player color explosions to CreateEffectWarhead
This commit is contained in:
@@ -25,6 +25,9 @@ namespace OpenRA.Mods.Common.Warheads
|
|||||||
[Desc("Palette to use for explosion effect.")]
|
[Desc("Palette to use for explosion effect.")]
|
||||||
public readonly string ExplosionPalette = "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.")]
|
[Desc("Sound to play on impact.")]
|
||||||
public readonly string ImpactSound = null;
|
public readonly string ImpactSound = null;
|
||||||
|
|
||||||
@@ -80,8 +83,12 @@ namespace OpenRA.Mods.Common.Warheads
|
|||||||
if ((!world.Map.Contains(targetTile)) || (!isValid))
|
if ((!world.Map.Contains(targetTile)) || (!isValid))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var palette = ExplosionPalette;
|
||||||
|
if (UsePlayerPalette)
|
||||||
|
palette += firedBy.Owner.InternalName;
|
||||||
|
|
||||||
if (Explosion != null)
|
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)
|
if (ImpactSound != null)
|
||||||
Sound.Play(ImpactSound, pos);
|
Sound.Play(ImpactSound, pos);
|
||||||
|
|||||||
Reference in New Issue
Block a user