Adds select all unit production hotkey (#7824)

Co-authored-by: Garen7 <Garen7@users.noreply.github.com>
This commit is contained in:
Garen7
2022-11-04 19:34:44 -04:00
committed by GitHub
co-authored by Garen7
parent e7b7fc971a
commit 82fffb1285
3 changed files with 13 additions and 0 deletions
+1
View File
@@ -1142,6 +1142,7 @@ keybind.diagonal_placement.name = Diagonal Placement
keybind.pick.name = Pick Block keybind.pick.name = Pick Block
keybind.break_block.name = Break Block keybind.break_block.name = Break Block
keybind.select_all_units = Select All Units keybind.select_all_units = Select All Units
keybind.select_all_unit_factories = Select All Unit Factories
keybind.deselect.name = Deselect keybind.deselect.name = Deselect
keybind.pickupCargo.name = Pickup Cargo keybind.pickupCargo.name = Pickup Cargo
keybind.dropCargo.name = Drop Cargo keybind.dropCargo.name = Drop Cargo
+1
View File
@@ -20,6 +20,7 @@ public enum Binding implements KeyBind{
break_block(KeyCode.mouseRight), break_block(KeyCode.mouseRight),
select_all_units(KeyCode.g), select_all_units(KeyCode.g),
select_all_unit_factories(KeyCode.h),
pickupCargo(KeyCode.leftBracket), pickupCargo(KeyCode.leftBracket),
dropCargo(KeyCode.rightBracket), dropCargo(KeyCode.rightBracket),
@@ -279,6 +279,7 @@ public class DesktopInput extends InputHandler{
if(commandMode && input.keyTap(Binding.select_all_units) && !scene.hasField() && !scene.hasDialog()){ if(commandMode && input.keyTap(Binding.select_all_units) && !scene.hasField() && !scene.hasDialog()){
selectedUnits.clear(); selectedUnits.clear();
commandBuildings.clear();
for(var unit : player.team().data().units){ for(var unit : player.team().data().units){
if(unit.isCommandable()){ if(unit.isCommandable()){
selectedUnits.add(unit); selectedUnits.add(unit);
@@ -286,6 +287,16 @@ public class DesktopInput extends InputHandler{
} }
} }
if(commandMode && input.keyTap(Binding.select_all_unit_factories) && !scene.hasField() && !scene.hasDialog()){
selectedUnits.clear();
commandBuildings.clear();
for(var build : player.team().data().buildings){
if(build.block.commandable){
commandBuildings.add(build);
}
}
}
if(!scene.hasMouse() && !locked && state.rules.possessionAllowed){ if(!scene.hasMouse() && !locked && state.rules.possessionAllowed){
if(Core.input.keyDown(Binding.control) && Core.input.keyTap(Binding.select)){ if(Core.input.keyDown(Binding.control) && Core.input.keyTap(Binding.select)){
Unit on = selectedUnit(); Unit on = selectedUnit();