Add ForceDisplayAtGroundLevel to CreateEffectWarhead
Allows to force the effect to always play at ground level, regardless of explosion altitude.
This commit is contained in:
@@ -32,6 +32,9 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
[Desc("Remap explosion effect to player color, if art supports it.")]
|
||||
public readonly bool UsePlayerPalette = false;
|
||||
|
||||
[Desc("Display explosion effect at ground level, regardless of explosion altitude.")]
|
||||
public readonly bool ForceDisplayAtGroundLevel = false;
|
||||
|
||||
[Desc("List of sounds that can be played on impact.")]
|
||||
public readonly string[] ImpactSounds = new string[0];
|
||||
|
||||
@@ -117,7 +120,15 @@ namespace OpenRA.Mods.Common.Warheads
|
||||
|
||||
var explosion = Explosions.RandomOrDefault(Game.CosmeticRandom);
|
||||
if (Image != null && explosion != null)
|
||||
{
|
||||
if (ForceDisplayAtGroundLevel)
|
||||
{
|
||||
var dat = world.Map.DistanceAboveTerrain(pos);
|
||||
pos = new WPos(pos.X, pos.Y, pos.Z - dat.Length);
|
||||
}
|
||||
|
||||
world.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, w, Image, explosion, palette)));
|
||||
}
|
||||
|
||||
var impactSound = ImpactSounds.RandomOrDefault(Game.CosmeticRandom);
|
||||
if (impactSound != null)
|
||||
|
||||
Reference in New Issue
Block a user