From 1c5427c86f7faea9bcffd4330f11ee03dd150e14 Mon Sep 17 00:00:00 2001 From: atlimit8 Date: Thu, 16 Mar 2017 12:15:45 -0500 Subject: [PATCH] Convert WithIdleOverlay from actor disabled to pausable-conditional. --- OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs | 9 +++------ mods/d2k/rules/structures.yaml | 2 +- mods/ts/rules/gdi-structures.yaml | 2 +- mods/ts/rules/nod-structures.yaml | 2 +- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs index 169baf6d30..89eb8d15ed 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithIdleOverlay.cs @@ -18,7 +18,7 @@ using OpenRA.Traits; namespace OpenRA.Mods.Common.Traits.Render { [Desc("Renders a decorative animation on units and buildings.")] - public class WithIdleOverlayInfo : ConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires, Requires + public class WithIdleOverlayInfo : PausableConditionalTraitInfo, IRenderActorPreviewSpritesInfo, Requires, Requires { [Desc("Animation to play when the actor is created.")] [SequenceReference] public readonly string StartSequence = null; @@ -35,8 +35,6 @@ namespace OpenRA.Mods.Common.Traits.Render [Desc("Custom palette is a player palette BaseName")] public readonly bool IsPlayerPalette = false; - public readonly bool PauseOnLowPower = false; - public override object Create(ActorInitializer init) { return new WithIdleOverlay(init.Self, this); } public IEnumerable RenderPreviewSprites(ActorPreviewInitializer init, RenderSpritesInfo rs, string image, int facings, PaletteReference p) @@ -72,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits.Render } } - public class WithIdleOverlay : ConditionalTrait, INotifyDamageStateChanged, INotifyBuildComplete, INotifySold, INotifyTransform + public class WithIdleOverlay : PausableConditionalTrait, INotifyDamageStateChanged, INotifyBuildComplete, INotifySold, INotifyTransform { readonly Animation overlay; bool buildComplete; @@ -84,8 +82,7 @@ namespace OpenRA.Mods.Common.Traits.Render var body = self.Trait(); buildComplete = !self.Info.HasTraitInfo(); // always render instantly for units - overlay = new Animation(self.World, rs.GetImage(self), - () => (info.PauseOnLowPower && self.IsDisabled()) || !buildComplete); + overlay = new Animation(self.World, rs.GetImage(self), () => IsTraitPaused || !buildComplete); if (info.StartSequence != null) overlay.PlayThen(RenderSprites.NormalizeSequence(overlay, self.GetDamageState(), info.StartSequence), () => overlay.PlayRepeating(RenderSprites.NormalizeSequence(overlay, self.GetDamageState(), info.Sequence))); diff --git a/mods/d2k/rules/structures.yaml b/mods/d2k/rules/structures.yaml index 163a28219b..13877510c2 100644 --- a/mods/d2k/rules/structures.yaml +++ b/mods/d2k/rules/structures.yaml @@ -525,7 +525,7 @@ outpost: mercenary: outpost.ordos WithIdleOverlay@DISH: Sequence: idle-dish - PauseOnLowPower: true + PauseOnCondition: disabled RequiresCondition: !severe-damaged GrantConditionOnDamageState@STOPDISH: Condition: severe-damaged diff --git a/mods/ts/rules/gdi-structures.yaml b/mods/ts/rules/gdi-structures.yaml index 082b8fc440..5186956da9 100644 --- a/mods/ts/rules/gdi-structures.yaml +++ b/mods/ts/rules/gdi-structures.yaml @@ -326,7 +326,7 @@ GARADR: MaxHeightDelta: 3 WithIdleOverlay@DISH: Sequence: idle-dish - PauseOnLowPower: yes + PauseOnCondition: disabled Targetable: TargetTypes: Ground, C4, SpyInfiltrate Power: diff --git a/mods/ts/rules/nod-structures.yaml b/mods/ts/rules/nod-structures.yaml index afd1cb6ab6..c377ff1f8e 100644 --- a/mods/ts/rules/nod-structures.yaml +++ b/mods/ts/rules/nod-structures.yaml @@ -285,7 +285,7 @@ NARADR: MaxHeightDelta: 3 WithIdleOverlay@DISH: Sequence: idle-dish - PauseOnLowPower: true + PauseOnCondition: disabled Targetable: TargetTypes: Ground, C4, SpyInfiltrate Power: