Merge branch 'master' into do-you-hear-the-voices-too

This commit is contained in:
Mythril382
2024-05-28 00:40:31 +08:00
committed by GitHub
129 changed files with 3164 additions and 1263 deletions

View File

@@ -164,6 +164,12 @@ public class LCanvas extends Table{
this.statements.layout();
}
public void clearStatements(){
jumps.clear();
statements.clearChildren();
statements.layout();
}
StatementElem checkHovered(){
Element e = Core.scene.hit(Core.input.mouseX(), Core.input.mouseY(), true);
if(e != null){

View File

@@ -1480,7 +1480,7 @@ public class LExecutor{
if(t == null) t = Team.derelict;
if(tile.block() != b || tile.team() != t){
tile.setNet(b, t, Mathf.clamp(exec.numi(rotation), 0, 3));
tile.setBlock(b, t, Mathf.clamp(exec.numi(rotation), 0, 3));
}
}
}

View File

@@ -17,6 +17,7 @@ import mindustry.logic.LExecutor.*;
import mindustry.logic.LStatements.*;
import mindustry.ui.*;
import mindustry.ui.dialogs.*;
import mindustry.world.blocks.logic.*;
import static mindustry.Vars.*;
import static mindustry.logic.LCanvas.*;
@@ -92,11 +93,29 @@ public class LogicDialog extends BaseDialog{
TextButtonStyle style = Styles.flatt;
t.defaults().size(280f, 60f).left();
if(privileged && executor != null && executor.build != null && !ui.editor.isShown()){
t.button("@editor.worldprocessors.editname", Icon.edit, style, () -> {
ui.showTextInput("", "@editor.name", LogicBlock.maxNameLength, executor.build.tag == null ? "" : executor.build.tag, tag -> {
if(privileged && executor != null && executor.build != null){
executor.build.configure(tag);
//just in case of privilege shenanigans...
executor.build.tag = tag;
}
});
dialog.hide();
}).marginLeft(12f).row();
}
t.button("@clear", Icon.cancel, style, () -> {
ui.showConfirm("@logic.clear.confirm", () -> canvas.clearStatements());
dialog.hide();
}).marginLeft(12f).row();
t.button("@schematic.copy", Icon.copy, style, () -> {
dialog.hide();
Core.app.setClipboardText(canvas.save());
}).marginLeft(12f);
t.row();
}).marginLeft(12f).row();
t.button("@schematic.copy.import", Icon.download, style, () -> {
dialog.hide();
try{