From f9fb59fb0642d3fd24fa9b6a8e43959f0b34276b Mon Sep 17 00:00:00 2001 From: RushieWashie <57391931+JiroCab@users.noreply.github.com> Date: Tue, 29 Apr 2025 22:18:30 +0800 Subject: [PATCH] Unit Transport And on Screen selecting instead (#10740) * Select all Transport Hotkey, - hotkey for selecting Payloadc units - Changed all select all keys to be only select units on screen * s * Inverse * maybe actually set the temp var * overlap * blindness --- core/assets/bundles/bundle.properties | 2 ++ core/assets/contributors | 1 + core/src/mindustry/input/Binding.java | 2 ++ core/src/mindustry/input/DesktopInput.java | 31 +++++++++++++++++++--- 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 972e41e21d..95d88a6dac 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -1359,6 +1359,8 @@ keybind.pick.name = Pick Block keybind.break_block.name = Break Block keybind.select_all_units.name = Select All Units keybind.select_all_unit_factories.name = Select All Unit Factories +keybind.select_all_unit_transport.name = Select All Unit Transports +keybind.select_across_screen.name = Select Across Screen (Hold) keybind.deselect.name = Deselect keybind.pickupCargo.name = Pickup Cargo keybind.dropCargo.name = Drop Cargo diff --git a/core/assets/contributors b/core/assets/contributors index 91823bb8aa..46cca7615e 100644 --- a/core/assets/contributors +++ b/core/assets/contributors @@ -179,3 +179,4 @@ cardillan Justacommonegg IchMagSchokolade MonoChronos +RushieWashie diff --git a/core/src/mindustry/input/Binding.java b/core/src/mindustry/input/Binding.java index 10a5dd6a26..fe4f698afd 100644 --- a/core/src/mindustry/input/Binding.java +++ b/core/src/mindustry/input/Binding.java @@ -42,6 +42,8 @@ public class Binding{ selectAllUnits = KeyBind.add("select_all_units", KeyCode.g), selectAllUnitFactories = KeyBind.add("select_all_unit_factories", KeyCode.h), + selectAllUnitTransport = KeyBind.add("select_all_unit_transport", KeyCode.unset), + selectAcrossScreen = KeyBind.add("select_across_screen", KeyCode.altLeft), cancelOrders = KeyBind.add("cancel_orders", KeyCode.unset), diff --git a/core/src/mindustry/input/DesktopInput.java b/core/src/mindustry/input/DesktopInput.java index a7c556b30a..eeca7177aa 100644 --- a/core/src/mindustry/input/DesktopInput.java +++ b/core/src/mindustry/input/DesktopInput.java @@ -294,9 +294,30 @@ public class DesktopInput extends InputHandler{ if(input.keyTap(Binding.selectAllUnits)){ selectedUnits.clear(); commandBuildings.clear(); - for(var unit : player.team().data().units){ - if(unit.allowCommand()){ - selectedUnits.add(unit); + if(input.keyDown(Binding.selectAcrossScreen)){ + camera.bounds(Tmp.r1); + selectedUnits.set(selectedCommandUnits(Tmp.r1.x, Tmp.r1.y, Tmp.r1.width, Tmp.r1.height)); + }else { + for(var unit : player.team().data().units){ + if(unit.allowCommand()){ + selectedUnits.add(unit); + } + } + } + + } + + if(input.keyTap(Binding.selectAllUnitTransport)){ + selectedUnits.clear(); + commandBuildings.clear(); + if(input.keyDown(Binding.selectAcrossScreen)){ + camera.bounds(Tmp.r1); + selectedUnits.set(selectedCommandUnits(Tmp.r1.x, Tmp.r1.y, Tmp.r1.width, Tmp.r1.height, u -> u instanceof Payloadc)); + }else { + for(var unit : player.team().data().units){ + if(unit.allowCommand() && unit instanceof Payloadc){ + selectedUnits.add(unit); + } } } } @@ -309,6 +330,10 @@ public class DesktopInput extends InputHandler{ commandBuildings.add(build); } } + if(input.keyDown(Binding.selectAcrossScreen)){ + camera.bounds(Tmp.r1); + commandBuildings.retainAll(b -> Tmp.r1.overlaps(b.x - (b.hitSize() /2), b.y - (b.hitSize() /2), b.hitSize(), b.hitSize())); + } } for(int i = 0; i < controlGroupBindings.length; i++){