From 5acc1032424dfc83130d3c777467a4de84bd7243 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Fri, 19 Jun 2015 22:10:28 +0200 Subject: [PATCH] Fixes infantry sequence modifier for good --- OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs b/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs index 4ba8c30ea3..d06ac20c50 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithInfantryBody.cs @@ -48,16 +48,16 @@ namespace OpenRA.Mods.Common.Traits } } - public class WithInfantryBody : UpgradableTrait, ITick, INotifyAttack, INotifyIdle + public class WithInfantryBody : UpgradableTrait, ITick, INotifyAttack, INotifyIdle, INotifyCreated { readonly IMove move; - readonly IRenderInfantrySequenceModifier rsm; protected readonly Animation DefaultAnimation; bool dirty; string idleSequence; int idleDelay; AnimationState state; + IRenderInfantrySequenceModifier rsm; bool IsModifyingSequence { get { return rsm != null && rsm.IsModifyingSequence; } } bool wasModifying; @@ -74,7 +74,11 @@ namespace OpenRA.Mods.Common.Traits DefaultAnimation.PlayFetchIndex(NormalizeInfantrySequence(init.Self, info.StandSequences.Random(Game.CosmeticRandom)), () => 0); state = AnimationState.Waiting; move = init.Self.Trait(); - rsm = init.Self.TraitOrDefault(); + } + + public void Created(Actor self) + { + rsm = self.TraitOrDefault(); } protected virtual string NormalizeInfantrySequence(Actor self, string baseSequence)