Minor CreateEffectWarhead optimization

Palette only matters if we actually display an explosion.
This commit is contained in:
reaperrr
2020-05-08 12:07:52 +02:00
committed by abcdefg30
parent b514e0a6e7
commit de81fc2aca

View File

@@ -118,10 +118,6 @@ namespace OpenRA.Mods.Common.Warheads
if ((!world.Map.Contains(targetTile)) || (!isValid))
return;
var palette = ExplosionPalette;
if (UsePlayerPalette)
palette += firedBy.Owner.InternalName;
var explosion = Explosions.RandomOrDefault(world.LocalRandom);
if (Image != null && explosion != null)
{
@@ -131,6 +127,10 @@ namespace OpenRA.Mods.Common.Warheads
pos = new WPos(pos.X, pos.Y, pos.Z - dat.Length);
}
var palette = ExplosionPalette;
if (UsePlayerPalette)
palette += firedBy.Owner.InternalName;
world.AddFrameEndTask(w => w.Add(new SpriteEffect(pos, w, Image, explosion, palette)));
}