From 9bfd82e868c76a9048547832ebb1fc7a84ed45e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 7 Dec 2014 16:39:09 +0100 Subject: [PATCH] fix infantry without idle animation not returning to stand --- OpenRA.Mods.RA/Render/RenderInfantry.cs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/OpenRA.Mods.RA/Render/RenderInfantry.cs b/OpenRA.Mods.RA/Render/RenderInfantry.cs index 840c47a594..a18e1f0286 100644 --- a/OpenRA.Mods.RA/Render/RenderInfantry.cs +++ b/OpenRA.Mods.RA/Render/RenderInfantry.cs @@ -82,7 +82,7 @@ namespace OpenRA.Mods.RA.Render protected virtual bool AllowIdleAnimation(Actor self) { - return info.IdleAnimations.Length > 0 && !isModifyingSequence; + return !isModifyingSequence; } public void Attacking(Actor self, Target target) @@ -136,16 +136,24 @@ namespace OpenRA.Mods.RA.Render idleDelay = self.World.SharedRandom.Next(info.MinIdleWaitTicks, info.MaxIdleWaitTicks); } } - else if (AllowIdleAnimation(self) && idleDelay > 0 && --idleDelay == 0) + else if (AllowIdleAnimation(self)) { - if (DefaultAnimation.HasSequence(idleSequence)) + if (idleSequence != null && DefaultAnimation.HasSequence(idleSequence)) { - state = AnimationState.IdleAnimating; - DefaultAnimation.PlayThen(idleSequence, () => + if (idleDelay > 0 && --idleDelay == 0) { - DefaultAnimation.PlayRepeating(NormalizeInfantrySequence(self, info.StandAnimations.Random(Game.CosmeticRandom))); - state = AnimationState.Waiting; - }); + state = AnimationState.IdleAnimating; + DefaultAnimation.PlayThen(idleSequence, () => + { + DefaultAnimation.PlayRepeating(NormalizeInfantrySequence(self, info.StandAnimations.Random(Game.CosmeticRandom))); + state = AnimationState.Waiting; + }); + } + } + else + { + DefaultAnimation.PlayRepeating(NormalizeInfantrySequence(self, info.StandAnimations.Random(Game.CosmeticRandom))); + state = AnimationState.Waiting; } } }