diff --git a/OpenRA.Mods.Common/Traits/Render/WithRepairAnimation.cs b/OpenRA.Mods.Common/Traits/Render/WithRepairAnimation.cs index 5805878016..f9de5e9e49 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithRepairAnimation.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithRepairAnimation.cs @@ -14,32 +14,29 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Replaces the building animation when it repairs a unit.")] - public class WithRepairAnimationInfo : ITraitInfo, Requires + public class WithRepairAnimationInfo : ConditionalTraitInfo, Requires { [Desc("Sequence name to use")] [SequenceReference] public readonly string Sequence = "active"; - public readonly bool PauseOnLowPower = false; - - public object Create(ActorInitializer init) { return new WithRepairAnimation(init.Self, this); } + public override object Create(ActorInitializer init) { return new WithRepairAnimation(init.Self, this); } } - public class WithRepairAnimation : INotifyRepair, INotifyBuildComplete, INotifySold + public class WithRepairAnimation : ConditionalTrait, INotifyRepair, INotifyBuildComplete, INotifySold { - readonly WithRepairAnimationInfo info; readonly WithSpriteBody spriteBody; bool buildComplete; public WithRepairAnimation(Actor self, WithRepairAnimationInfo info) + : base(info) { - this.info = info; spriteBody = self.TraitOrDefault(); } void INotifyRepair.Repairing(Actor self, Actor target) { - if (buildComplete && spriteBody != null && !(info.PauseOnLowPower && self.IsDisabled())) - spriteBody.PlayCustomAnimation(self, info.Sequence, () => spriteBody.CancelCustomAnimation(self)); + if (buildComplete && spriteBody != null && !IsTraitDisabled) + spriteBody.PlayCustomAnimation(self, Info.Sequence, () => spriteBody.CancelCustomAnimation(self)); } void INotifyBuildComplete.BuildingComplete(Actor self)