From 7a403c9af5edb6f3c3fd62dc97fd99bea9081df4 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 10 May 2019 15:24:58 +0200 Subject: [PATCH] Play StartSequence when With*SpriteBody is enabled Not only on actor creation. --- OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs b/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs index d4b234320b..1761a96ef1 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs @@ -76,12 +76,6 @@ namespace OpenRA.Mods.Common.Traits.Render // Cache the bounds from the default sequence to avoid flickering when the animation changes boundsAnimation = new Animation(init.World, rs.GetImage(init.Self), baseFacing, paused); boundsAnimation.PlayRepeating(info.Sequence); - - if (info.StartSequence != null) - PlayCustomAnimation(init.Self, info.StartSequence, - () => DefaultAnimation.PlayRepeating(NormalizeSequence(init.Self, info.Sequence))); - else - DefaultAnimation.PlayRepeating(NormalizeSequence(init.Self, info.Sequence)); } public string NormalizeSequence(Actor self, string sequence) @@ -91,7 +85,11 @@ namespace OpenRA.Mods.Common.Traits.Render protected override void TraitEnabled(Actor self) { - DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence)); + if (Info.StartSequence != null) + PlayCustomAnimation(self, Info.StartSequence, + () => DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence))); + else + DefaultAnimation.PlayRepeating(NormalizeSequence(self, Info.Sequence)); } public virtual void PlayCustomAnimation(Actor self, string name, Action after = null)