Command hotkeys
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user