From f24a966f53b4c1b0632e042a6448c2cfb3fa0b5d Mon Sep 17 00:00:00 2001 From: dnqbob Date: Sat, 27 Apr 2024 23:01:16 +0800 Subject: [PATCH] WithAttackOverlay: support specifc Armament to play animation. --- OpenRA.Mods.Common/Traits/Render/WithAttackOverlay.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Render/WithAttackOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithAttackOverlay.cs index 97aef2199f..d5cfa8b116 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithAttackOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithAttackOverlay.cs @@ -17,6 +17,9 @@ namespace OpenRA.Mods.Common.Traits.Render [Desc("Rendered together with an attack.")] public class WithAttackOverlayInfo : TraitInfo, Requires { + [Desc("Armament that will play the animation. Set to null to allow all armaments.")] + public readonly string Armament = null; + [SequenceReference] [FieldLoader.Require] [Desc("Sequence name to use")] @@ -69,7 +72,7 @@ namespace OpenRA.Mods.Common.Traits.Render void INotifyAttack.Attacking(Actor self, in Target target, Armament a, Barrel barrel) { - if (info.DelayRelativeTo == AttackDelayType.Attack) + if (info.DelayRelativeTo == AttackDelayType.Attack && (string.IsNullOrEmpty(info.Armament) || info.Armament == a.Info.Name)) { if (info.Delay > 0) tick = info.Delay; @@ -80,7 +83,7 @@ namespace OpenRA.Mods.Common.Traits.Render void INotifyAttack.PreparingAttack(Actor self, in Target target, Armament a, Barrel barrel) { - if (info.DelayRelativeTo == AttackDelayType.Preparation) + if (info.DelayRelativeTo == AttackDelayType.Preparation && (string.IsNullOrEmpty(info.Armament) || info.Armament == a.Info.Name)) { if (info.Delay > 0) tick = info.Delay;