From 58e474ec80eab04b298b21f735ce40356f5a3e19 Mon Sep 17 00:00:00 2001 From: reaperrr Date: Sat, 19 Sep 2015 20:30:22 +0200 Subject: [PATCH] Make repair overlay invisible when not repairing --- OpenRA.Mods.Common/Traits/Render/WithRepairOverlay.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Render/WithRepairOverlay.cs b/OpenRA.Mods.Common/Traits/Render/WithRepairOverlay.cs index 0276d63150..370bfb4fd1 100644 --- a/OpenRA.Mods.Common/Traits/Render/WithRepairOverlay.cs +++ b/OpenRA.Mods.Common/Traits/Render/WithRepairOverlay.cs @@ -39,6 +39,7 @@ namespace OpenRA.Mods.Common.Traits { readonly Animation overlay; bool buildComplete; + bool visible; public WithRepairOverlay(Actor self, WithRepairOverlayInfo info) { @@ -47,11 +48,11 @@ namespace OpenRA.Mods.Common.Traits buildComplete = !self.Info.HasTraitInfo(); // always render instantly for units overlay = new Animation(self.World, rs.GetImage(self)); - overlay.Play(info.Sequence); + overlay.PlayThen(info.Sequence, () => visible = false); var anim = new AnimationWithOffset(overlay, () => body.LocalToWorld(info.Offset.Rotate(body.QuantizeOrientation(self, self.Orientation))), - () => !buildComplete, + () => !visible || !buildComplete, () => info.PauseOnLowPower && self.IsDisabled(), p => WithTurret.ZOffsetFromCenter(self, p, 1)); @@ -77,7 +78,8 @@ namespace OpenRA.Mods.Common.Traits public void Repairing(Actor self, Actor host) { - overlay.Play(overlay.CurrentSequence.Name); + visible = true; + overlay.PlayThen(overlay.CurrentSequence.Name, () => visible = false); } } } \ No newline at end of file