Unit factory command UI cleanup

This commit is contained in:
Anuken 2024-10-11 21:54:41 -04:00
parent d9d5c8733b
commit d6073201bb

View File

@ -197,7 +197,9 @@ public class UnitFactory extends UnitBlock{
public boolean canSetCommand(){ public boolean canSetCommand(){
var output = unit(); var output = unit();
return output != null && output.commands.length > 1 && output.allowChangeCommands; return output != null && output.commands.length > 1 && output.allowChangeCommands &&
//to avoid cluttering UI, don't show command selection for "standard" units that only have two commands.
!(output.commands.length == 2 && output.commands[1] == UnitCommand.enterPayloadCommand);
} }
@Override @Override
@ -247,12 +249,13 @@ public class UnitFactory extends UnitBlock{
Table commands = new Table(); Table commands = new Table();
commands.top().left(); commands.top().left();
commands.background(Styles.black6);
Runnable rebuildCommands = () -> { Runnable rebuildCommands = () -> {
commands.clear(); commands.clear();
commands.background(null);
var unit = unit(); var unit = unit();
if(unit != null && canSetCommand()){ if(unit != null && canSetCommand()){
commands.background(Styles.black6);
var group = new ButtonGroup<ImageButton>(); var group = new ButtonGroup<ImageButton>();
group.setMinCheckCount(0); group.setMinCheckCount(0);
int i = 0, columns = Mathf.clamp(units.size, 2, selectionColumns); int i = 0, columns = Mathf.clamp(units.size, 2, selectionColumns);