Pathfinding bugfixes / Logic dialog hiding "unfixed"

This commit is contained in:
Anuken
2023-08-09 13:05:19 -04:00
parent 19f34c14a0
commit f1172d45eb
5 changed files with 17 additions and 13 deletions

View File

@@ -233,7 +233,7 @@ public class ControlPathfinder{
req.curId = pathId; req.curId = pathId;
//check for the unit getting stuck every N seconds //check for the unit getting stuck every N seconds
if((req.stuckTimer += Time.delta) >= 60f * 1.5f){ if(req.done && (req.stuckTimer += Time.delta) >= 60f * 1.5f){
req.stuckTimer = 0f; req.stuckTimer = 0f;
//force recalculate //force recalculate
if(req.lastPos.within(unit, 1.5f)){ if(req.lastPos.within(unit, 1.5f)){

View File

@@ -220,6 +220,14 @@ public class LStatements{
row(s); row(s);
fields(s, "rotation", p3, v -> p3 = v); fields(s, "rotation", p3, v -> p3 = v);
} }
//TODO
/*
case character -> {
fields(s, "x", x, v -> x = v);
fields(s, "y", y, v -> y = v);
row(s);
fields(s, "char", p1, v -> p1 = v);
}*/
} }
}).expand().left(); }).expand().left();
} }

View File

@@ -228,20 +228,11 @@ public class LogicDialog extends BaseDialog{
} }
public void show(String code, LExecutor executor, boolean privileged, Cons<String> modified){ public void show(String code, LExecutor executor, boolean privileged, Cons<String> modified){
show(code, executor, privileged, null, modified);
}
public void show(String code, LExecutor executor, boolean privileged, @Nullable Building build, Cons<String> modified){
this.executor = executor; this.executor = executor;
this.privileged = privileged; this.privileged = privileged;
canvas.statements.clearChildren(); canvas.statements.clearChildren();
canvas.rebuild(); canvas.rebuild();
canvas.privileged = privileged; canvas.privileged = privileged;
update(() -> {
if(build != null && (!build.isValid() || !state.isGame())){
hide();
}
});
try{ try{
canvas.load(code); canvas.load(code);
}catch(Throwable t){ }catch(Throwable t){

View File

@@ -577,7 +577,7 @@ public class LogicBlock extends Block{
@Override @Override
public void buildConfiguration(Table table){ public void buildConfiguration(Table table){
table.button(Icon.pencil, Styles.cleari, () -> { table.button(Icon.pencil, Styles.cleari, () -> {
ui.logic.show(code, executor, privileged, this, code -> configure(compress(code, relativeConnections()))); ui.logic.show(code, executor, privileged, code -> configure(compress(code, relativeConnections())));
}).size(40); }).size(40);
} }

View File

@@ -27,7 +27,8 @@ public class LogicDisplay extends Block{
commandPoly = 7, commandPoly = 7,
commandLinePoly = 8, commandLinePoly = 8,
commandTriangle = 9, commandTriangle = 9,
commandImage = 10; commandImage = 10,
commandCharacter = 11;
public int maxSides = 25; public int maxSides = 25;
@@ -102,6 +103,9 @@ public class LogicDisplay extends Block{
var icon = Fonts.logicIcon(p1); var icon = Fonts.logicIcon(p1);
Draw.rect(Fonts.logicIcon(p1), x, y, p2, p2 / icon.ratio(), p3); Draw.rect(Fonts.logicIcon(p1), x, y, p2, p2 / icon.ratio(), p3);
} }
case commandCharacter -> {
//TODO
}
} }
} }
@@ -146,7 +150,8 @@ public class LogicDisplay extends Block{
poly, poly,
linePoly, linePoly,
triangle, triangle,
image,; image,
;//character;
public static final GraphicsType[] all = values(); public static final GraphicsType[] all = values();
} }