diff --git a/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs b/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs index 519f2b76c2..ad2accf7aa 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithSpriteBody.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Default trait for rendering sprite-based actors.")] - public class WithSpriteBodyInfo : ConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires + public class WithSpriteBodyInfo : PausableConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires { [Desc("Animation to play when the actor is created."), SequenceReference] public readonly string StartSequence = null; @@ -26,9 +26,6 @@ namespace OpenRA.Mods.Common.Traits.Render [Desc("Animation to play when the actor is idle."), SequenceReference] public readonly string Sequence = "idle"; - [Desc("Pause animation when actor is disabled.")] - public readonly bool PauseAnimationWhenDisabled = false; - [Desc("Identifier used to assign modifying traits to this sprite body.")] public readonly string Name = "body"; @@ -46,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits.Render } } - public class WithSpriteBody : ConditionalTrait, INotifyDamageStateChanged, INotifyBuildComplete + public class WithSpriteBody : PausableConditionalTrait, INotifyDamageStateChanged, INotifyBuildComplete { public readonly Animation DefaultAnimation; @@ -58,9 +55,7 @@ namespace OpenRA.Mods.Common.Traits.Render { var rs = init.Self.Trait(); - Func paused = null; - if (info.PauseAnimationWhenDisabled) - paused = () => init.Self.IsDisabled() && + Func paused = () => IsTraitPaused && DefaultAnimation.CurrentSequence.Name == NormalizeSequence(init.Self, Info.Sequence); DefaultAnimation = new Animation(init.World, rs.GetImage(init.Self), baseFacing, paused);