From de81fc2acac98ca5a355dc08bf2199b8291a0666 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 8 May 2020 12:07:52 +0200 Subject: [PATCH] Minor CreateEffectWarhead optimization Palette only matters if we actually display an explosion. --- OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs b/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs index 687da8461d..e2ea1c2b00 100644 --- a/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs +++ b/OpenRA.Mods.Common/Warheads/CreateEffectWarhead.cs @@ -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))); }