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)