From 7145ffaf28049212e698ef2d350a0facce763f2b Mon Sep 17 00:00:00 2001 From: Joshua Fan Date: Sun, 21 Mar 2021 11:08:53 -0700 Subject: [PATCH] Add block info keybind (#4284) * Add block info keybind * Change block info keybind to backtick * Change block info keybind to F1 --- core/assets/bundles/bundle.properties | 1 + core/src/mindustry/input/Binding.java | 1 + core/src/mindustry/ui/fragments/PlacementFragment.java | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index cc2604ff7b..b1f8687fcf 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -941,6 +941,7 @@ keybind.pause_building.name = Pause/Resume Building keybind.minimap.name = Minimap keybind.planet_map.name = Planet Map keybind.research.name = Research +keybind.block_info.name = Block Info keybind.chat.name = Chat keybind.player_list.name = Player List keybind.console.name = Console diff --git a/core/src/mindustry/input/Binding.java b/core/src/mindustry/input/Binding.java index 6291012259..de9aa56d04 100644 --- a/core/src/mindustry/input/Binding.java +++ b/core/src/mindustry/input/Binding.java @@ -60,6 +60,7 @@ public enum Binding implements KeyBind{ minimap(KeyCode.m), research(KeyCode.b), planet_map(KeyCode.n), + block_info(KeyCode.f1), toggle_menus(KeyCode.c), screenshot(KeyCode.p), toggle_power_lines(KeyCode.f5), diff --git a/core/src/mindustry/ui/fragments/PlacementFragment.java b/core/src/mindustry/ui/fragments/PlacementFragment.java index 220ba91310..cf51957878 100644 --- a/core/src/mindustry/ui/fragments/PlacementFragment.java +++ b/core/src/mindustry/ui/fragments/PlacementFragment.java @@ -189,6 +189,14 @@ public class PlacementFragment extends Fragment{ return true; } + if(Core.input.keyTap(Binding.block_info)){ + Block displayBlock = menuHoverBlock != null ? menuHoverBlock : input.block; + if(displayBlock != null){ + ui.content.show(displayBlock); + Events.fire(new BlockInfoEvent()); + } + } + return false; }