Added "select all units" keybind

This commit is contained in:
Anuken
2022-10-30 14:52:12 -04:00
parent 4b97814955
commit 0ee054b310
4 changed files with 21 additions and 9 deletions

View File

@@ -19,6 +19,8 @@ public enum Binding implements KeyBind{
deselect(KeyCode.mouseRight),
break_block(KeyCode.mouseRight),
select_all_units(KeyCode.g),
pickupCargo(KeyCode.leftBracket),
dropCargo(KeyCode.rightBracket),

View File

@@ -254,6 +254,15 @@ public class DesktopInput extends InputHandler{
//validate commanding units
selectedUnits.removeAll(u -> !u.isCommandable() || !u.isValid());
if(commandMode && input.keyTap(Binding.select_all_units) && !scene.hasField() && !scene.hasDialog()){
selectedUnits.clear();
for(var unit : player.team().data().units){
if(unit.isCommandable()){
selectedUnits.add(unit);
}
}
}
if(!scene.hasMouse() && !locked && state.rules.possessionAllowed){
if(Core.input.keyDown(Binding.control) && Core.input.keyTap(Binding.select)){
Unit on = selectedUnit();