From 78e47ea70ada95fa8326dc0fd446612b1e07f52d Mon Sep 17 00:00:00 2001 From: abcdefg30 Date: Mon, 28 Oct 2024 20:58:09 +0100 Subject: [PATCH] Support using player palettes as effect palette for SpawnActorPower --- .../Traits/SupportPowers/SpawnActorPower.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SpawnActorPower.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SpawnActorPower.cs index b08a1d4834..6ee3cf88a1 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SpawnActorPower.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SpawnActorPower.cs @@ -43,9 +43,11 @@ namespace OpenRA.Mods.Common.Traits [SequenceReference(nameof(EffectImage))] public readonly string EffectSequence = null; - [PaletteReference] + [PaletteReference(nameof(EffectPaletteIsPlayerPalette))] public readonly string EffectPalette = null; + public readonly bool EffectPaletteIsPlayerPalette = false; + public override object Create(ActorInitializer init) { return new SpawnActorPower(init.Self, this); } } @@ -71,7 +73,13 @@ namespace OpenRA.Mods.Common.Traits Game.Sound.Play(SoundType.World, info.DeploySound, position); if (!string.IsNullOrEmpty(info.EffectSequence) && !string.IsNullOrEmpty(info.EffectPalette)) - w.Add(new SpriteEffect(position, w, info.EffectImage, info.EffectSequence, info.EffectPalette)); + { + var palette = info.EffectPalette; + if (info.EffectPaletteIsPlayerPalette) + palette += self.Owner.InternalName; + + w.Add(new SpriteEffect(position, w, info.EffectImage, info.EffectSequence, palette)); + } var actor = w.CreateActor(info.Actor, new TypeDictionary {