diff --git a/OpenRa.Game/Effects/PowerDownIndicator.cs b/OpenRa.Game/Effects/PowerDownIndicator.cs index 185366a078..55858a6f54 100644 --- a/OpenRa.Game/Effects/PowerDownIndicator.cs +++ b/OpenRa.Game/Effects/PowerDownIndicator.cs @@ -9,7 +9,10 @@ namespace OpenRa.Game.Effects Actor a; Building b; Animation anim = new Animation("powerdown"); - + bool removeNextFrame = false; + bool indicatorState = true; + int stateTicks = 0; + public PowerDownIndicator(Actor a) { this.a = a; @@ -19,8 +22,19 @@ namespace OpenRa.Game.Effects public void Tick() { - if (!b.Disabled || a.IsDead) + if (removeNextFrame == true) Game.world.AddFrameEndTask(w => w.Remove(this)); + + // Fix off-by one frame bug with undisabling causing low-power + if (!b.Disabled || a.IsDead) + removeNextFrame = true; + + // Flash power icon + if (++stateTicks == 15) + { + stateTicks = 0; + indicatorState = !indicatorState; + } } public IEnumerable Render() @@ -28,7 +42,7 @@ namespace OpenRa.Game.Effects foreach (var r in a.Render()) yield return r.WithPalette(PaletteType.Disabled); - if (b.ManuallyDisabled) + if (b.ManuallyDisabled && indicatorState) yield return new Renderable(anim.Image, a.CenterLocation - .5f * anim.Image.size, PaletteType.Chrome); }