Bugfixes for reconstructor config

This commit is contained in:
Anuken
2023-05-30 20:15:44 -04:00
parent b97e6ef84c
commit 1a0edf80f1

View File

@@ -41,6 +41,8 @@ public class Reconstructor extends UnitBlock{
commandable = true;
ambientSound = Sounds.respawning;
configurable = true;
config(UnitCommand.class, (ReconstructorBuild build, UnitCommand command) -> build.command = command);
configClear((ReconstructorBuild build) -> build.command = null);
}
@Override
@@ -197,11 +199,11 @@ public class Reconstructor extends UnitBlock{
var list = unit().commands;
for(var item : list){
ImageButton button = table.button(item.getIcon(), Styles.clearNoneTogglei, 40f, () -> {
command = (command == item ? null : item);
configure(item);
deselect();
}).tooltip(item.localized()).group(group).get();
button.update(() -> button.setChecked(command == item));
button.update(() -> button.setChecked(command == item || (command == null && unit.defaultCommand == item)));
if(++i % columns == 0){
table.row();
@@ -340,6 +342,11 @@ public class Reconstructor extends UnitBlock{
return constructing() && enabled;
}
@Override
public Object config(){
return command;
}
public UnitType unit(){
if(payload == null) return null;