Logic tweaks
This commit is contained in:
@@ -5,6 +5,7 @@ import arc.struct.*;
|
||||
/** Setter/getter enum for logic-controlled objects. */
|
||||
public enum LAccess{
|
||||
totalItems,
|
||||
firstItem,
|
||||
totalLiquids,
|
||||
totalPower,
|
||||
itemCapacity,
|
||||
|
||||
@@ -194,6 +194,21 @@ public class LExecutor{
|
||||
}
|
||||
}
|
||||
|
||||
/** Binds the processor to a unit based on some filters. */
|
||||
public static class UnitLocateI implements LInstruction{
|
||||
|
||||
@Override
|
||||
public void run(LExecutor exec){
|
||||
Object unitObj = exec.obj(varUnit);
|
||||
LogicAI ai = UnitControlI.checkLogicAI(exec, unitObj);
|
||||
|
||||
if(unitObj instanceof Unit unit && ai != null){
|
||||
ai.controlTimer = LogicAI.logicControlTimeout;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Controls the unit based on some parameters. */
|
||||
public static class UnitControlI implements LInstruction{
|
||||
public LUnitControl type = LUnitControl.move;
|
||||
|
||||
@@ -709,7 +709,28 @@ public class LStatements{
|
||||
public void build(Table table){
|
||||
table.add(" type ");
|
||||
|
||||
field(table, type, str -> type = str);
|
||||
TextField field = field(table, type, str -> type = str).get();
|
||||
|
||||
table.button(b -> {
|
||||
b.image(Icon.pencilSmall);
|
||||
b.clicked(() -> showSelectTable(b, (t, hide) -> {
|
||||
t.row();
|
||||
t.table(i -> {
|
||||
i.left();
|
||||
int c = 0;
|
||||
for(UnitType item : Vars.content.units()){
|
||||
if(!item.unlockedNow() || item.isHidden()) continue;
|
||||
i.button(new TextureRegionDrawable(item.icon(Cicon.small)), Styles.cleari, () -> {
|
||||
type = "@" + item.name;
|
||||
field.setText(type);
|
||||
hide.run();
|
||||
}).size(40f);
|
||||
|
||||
if(++c % 6 == 0) i.row();
|
||||
}
|
||||
}).colspan(3).width(240f).left();
|
||||
}));
|
||||
}, Styles.logict, () -> {}).size(40f).padLeft(-2).color(table.color);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user