From 281a87acbc4731f885e861fa096421b8f202c892 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sat, 8 Aug 2015 17:00:38 +0200 Subject: [PATCH] Fix WithAttackAnimation breaking WithMoveAnimation --- OpenRA.Mods.Common/Traits/Render/WithAttackAnimation.cs | 2 +- OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/OpenRA.Mods.Common/Traits/Render/WithAttackAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithAttackAnimation.cs index 12c2dc0e15..dac2522e12 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithAttackAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithAttackAnimation.cs @@ -49,7 +49,7 @@ namespace OpenRA.Mods.Common.Traits public void Attacking(Actor self, Target target, Armament a, Barrel barrel) { if (!string.IsNullOrEmpty(info.AttackSequence)) - wsb.PlayCustomAnimation(self, info.AttackSequence); + wsb.PlayCustomAnimation(self, info.AttackSequence, () => wsb.CancelCustomAnimation(self)); } public void Tick(Actor self) diff --git a/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs b/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs index 0bbcd71e38..b60f53a2a5 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs @@ -95,6 +95,11 @@ namespace OpenRA.Mods.Common.Traits }); } + public void CancelCustomAnimation(Actor self) + { + DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence)); + } + public virtual void DamageStateChanged(Actor self, AttackInfo e) { if (DefaultAnimation.CurrentSequence != null)