Add support for multiple explosions to CreateEffectWarhead
Have the engine pick one explosion at random from the provided list.
This commit is contained in:
@@ -17,11 +17,11 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
{
|
||||
public class CreateEffectWarhead : Warhead
|
||||
{
|
||||
[Desc("Explosion effect to use.")]
|
||||
public readonly string Explosion = null;
|
||||
[Desc("List of explosion effects that can be used.")]
|
||||
public readonly string[] Explosions = new string[0];
|
||||
|
||||
[Desc("Palette to use for explosion effect.")]
|
||||
[PaletteReference("UsePlayerPalette")] public readonly string ExplosionPalette = "effect";
|
||||
[Desc("Palette to use for explosion effect."), PaletteReference("UsePlayerPalette")]
|
||||
public readonly string ExplosionPalette = "effect";
|
||||
|
||||
[Desc("Remap explosion effect to player color, if art supports it.")]
|
||||
public readonly bool UsePlayerPalette = false;
|
||||
@@ -99,8 +99,9 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
if (UsePlayerPalette)
|
||||
palette += firedBy.Owner.InternalName;
|
||||
|
||||
if (Explosion != null)
|
||||
world.AddFrameEndTask(w => w.Add(new Explosion(w, pos, Explosion, palette)));
|
||||
var explosion = Explosions.RandomOrDefault(Game.CosmeticRandom);
|
||||
if (explosion != null)
|
||||
world.AddFrameEndTask(w => w.Add(new Explosion(w, pos, explosion, palette)));
|
||||
|
||||
if (ImpactSound != null)
|
||||
Game.Sound.Play(ImpactSound, pos);
|
||||
|
||||
Reference in New Issue
Block a user