From 852c98f00422a3781654c0db2b911adcd8b24d03 Mon Sep 17 00:00:00 2001 From: Joshua Fan Date: Sun, 7 Feb 2021 13:58:42 -0800 Subject: [PATCH] "[E] to enable building" hint while building is paused (#3857) * Show building hints while building is paused * Add hint: [E] to enable building * Remove .left() * Fix build enable hint display inconsistencies when changing build auto-pause setting * Combine building hint tables * Fix indentation --- core/assets/bundles/bundle.properties | 1 + core/src/mindustry/input/DesktopInput.java | 17 ++++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 9150b552c5..996ae67354 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -312,6 +312,7 @@ cancelbuilding = [accent][[{0}][] to clear plan selectschematic = [accent][[{0}][] to select+copy pausebuilding = [accent][[{0}][] to pause building resumebuilding = [scarlet][[{0}][] to resume building +enablebuilding = [scarlet][[{0}][] to enable building showui = UI hidden.\nPress [accent][[{0}][] to show UI. wave = [accent]Wave {0} wave.cap = [accent]Wave {0}/{1} diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index 592869b4d1..2f36e87ffe 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -42,7 +42,7 @@ public class DesktopInput extends InputHandler{ /** Selected build request for movement. */ public @Nullable BuildPlan sreq; /** Whether player is currently deleting removal requests. */ - public boolean deleting = false, shouldShoot = false, panning = false; + public boolean deleting = false, wasBuilding = true, shouldShoot = false, panning = false; /** Mouse pan speed. */ public float panScale = 0.005f, panSpeed = 4.5f, panBoostSpeed = 11f; @@ -62,18 +62,19 @@ public class DesktopInput extends InputHandler{ group.fill(t -> { t.bottom(); t.visible(() -> { - t.color.a = Mathf.lerpDelta(t.color.a, player.unit().isBuilding() ? 1f : 0f, 0.15f); + t.color.a = Mathf.lerpDelta(t.color.a, !isBuilding && !Core.settings.getBool("buildautopause") || player.unit().isBuilding() ? 1f : 0f, 0.15f); return ui.hudfrag.shown && Core.settings.getBool("hints") && selectRequests.isEmpty() && t.color.a > 0.01f; }); t.touchable(() -> t.color.a < 0.1f ? Touchable.disabled : Touchable.childrenOnly); t.table(Styles.black6, b -> { b.defaults().left(); - b.label(() -> Core.bundle.format(!isBuilding ? "resumebuilding" : "pausebuilding", Core.keybinds.get(Binding.pause_building).key.toString())).style(Styles.outlineLabel); - b.row(); - b.label(() -> Core.bundle.format("cancelbuilding", Core.keybinds.get(Binding.clear_building).key.toString())).style(Styles.outlineLabel); - b.row(); - b.label(() -> Core.bundle.format("selectschematic", Core.keybinds.get(Binding.schematic_select).key.toString())).style(Styles.outlineLabel); + b.label(() -> ((!isBuilding || !wasBuilding) && !Core.settings.getBool("buildautopause") && !player.unit().isBuilding() ? + Core.bundle.format("enablebuilding", Core.keybinds.get(Binding.pause_building).key.toString()) : + Core.bundle.format(isBuilding ? "pausebuilding" : "resumebuilding", Core.keybinds.get(Binding.pause_building).key.toString()) + + "\n" + Core.bundle.format("cancelbuilding", Core.keybinds.get(Binding.clear_building).key.toString()) + + "\n" + Core.bundle.format("selectschematic", Core.keybinds.get(Binding.schematic_select).key.toString()) + )).style(Styles.outlineLabel); }).margin(10f); }); @@ -454,6 +455,7 @@ public class DesktopInput extends InputHandler{ buildWasAutoPaused = false; if(isBuilding){ + wasBuilding = player.unit().isBuilding(); player.shooting = false; } } @@ -561,6 +563,7 @@ public class DesktopInput extends InputHandler{ } mode = none; + wasBuilding = true; } if(Core.input.keyTap(Binding.toggle_block_status)){