mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-02-06 08:57:45 +07:00
Command hotkeys
This commit is contained in:
parent
f2bb712860
commit
2286b54011
@ -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),
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user