diff --git a/core/src/mindustry/input/Binding.java b/core/src/mindustry/input/Binding.java index 9cc1a323f7..2a9126dbfc 100644 --- a/core/src/mindustry/input/Binding.java +++ b/core/src/mindustry/input/Binding.java @@ -50,6 +50,16 @@ public enum Binding implements KeyBind{ unit_stance_4(KeyCode.unset), unit_stance_5(KeyCode.unset), + unit_command_1(KeyCode.unset), + unit_command_2(KeyCode.unset), + unit_command_3(KeyCode.unset), + unit_command_4(KeyCode.unset), + unit_command_5(KeyCode.unset), + unit_command_6(KeyCode.unset), + unit_command_7(KeyCode.unset), + unit_command_8(KeyCode.unset), + unit_command_9(KeyCode.unset), + category_prev(KeyCode.comma, "blocks"), category_next(KeyCode.period), diff --git a/core/src/mindustry/ui/dialogs/PlanetDialog.java b/core/src/mindustry/ui/dialogs/PlanetDialog.java index 37fce56880..02dbfa99bc 100644 --- a/core/src/mindustry/ui/dialogs/PlanetDialog.java +++ b/core/src/mindustry/ui/dialogs/PlanetDialog.java @@ -509,7 +509,7 @@ public class PlanetDialog extends BaseDialog implements PlanetInterfaceRenderer{ sec.isAttacked() ? Fonts.getLargeIcon("warning") : !sec.hasBase() && sec.preset != null && sec.preset.unlocked() && preficon == null ? Fonts.getLargeIcon("terrain") : - sec.preset != null && sec.preset.locked() && sec.preset.techNode != null && !sec.preset.techNode.parent.content.locked() ? Fonts.getLargeIcon("lock") : + sec.preset != null && sec.preset.locked() && sec.preset.techNode != null && (sec.preset.techNode.parent == null || !sec.preset.techNode.parent.content.locked()) ? Fonts.getLargeIcon("lock") : preficon; var color = sec.preset != null && !sec.hasBase() ? Team.derelict.color : Team.sharded.color; diff --git a/core/src/mindustry/ui/fragments/PlacementFragment.java b/core/src/mindustry/ui/fragments/PlacementFragment.java index 72d8c9b32e..b457a9a27a 100644 --- a/core/src/mindustry/ui/fragments/PlacementFragment.java +++ b/core/src/mindustry/ui/fragments/PlacementFragment.java @@ -77,6 +77,18 @@ public class PlacementFragment{ Binding.unit_stance_5, }; + Binding[] commandBindings = { + Binding.unit_command_1, + Binding.unit_command_2, + Binding.unit_command_3, + Binding.unit_command_4, + Binding.unit_command_5, + Binding.unit_command_6, + Binding.unit_command_7, + Binding.unit_command_8, + Binding.unit_command_9, + }; + public PlacementFragment(){ Events.on(WorldLoadEvent.class, event -> { Core.app.post(() -> { @@ -601,6 +613,13 @@ public class PlacementFragment{ Call.setUnitStance(player, control.input.selectedUnits.mapInt(un -> un.id).toArray(), stances.get(i)); } } + + for(int i = 0; i < Math.min(commandBindings.length, commands.size); i++){ + //first stance must always be the stop stance + if(Core.input.keyTap(commandBindings[i])){ + Call.setUnitCommand(player, control.input.selectedUnits.mapInt(un -> un.id).toArray(), commands.get(i)); + } + } } }); rebuildCommand.run();