Processor list bugfixes
This commit is contained in:
@@ -92,7 +92,7 @@ public class MapProcessorsDialog extends BaseDialog{
|
|||||||
|
|
||||||
t.button((log.tag == null ? "<no name>\n" : "[accent]" + log.tag + "\n") + "[lightgray][[" + log.tile.x + ", " + log.tile.y + "]", Styles.grayt, () -> {
|
t.button((log.tag == null ? "<no name>\n" : "[accent]" + log.tag + "\n") + "[lightgray][[" + log.tile.x + ", " + log.tile.y + "]", Styles.grayt, () -> {
|
||||||
//TODO: bug: if you edit name inside of the edit dialog, it won't show up in the list properly
|
//TODO: bug: if you edit name inside of the edit dialog, it won't show up in the list properly
|
||||||
log.showEditDialog();
|
log.showEditDialog(true);
|
||||||
}).size(Vars.mobile ? 390f : 450f, h).margin(10f).with(b -> {
|
}).size(Vars.mobile ? 390f : 450f, h).margin(10f).with(b -> {
|
||||||
b.getLabel().setAlignment(Align.left, Align.left);
|
b.getLabel().setAlignment(Align.left, Align.left);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public class LogicDialog extends BaseDialog{
|
|||||||
TextButtonStyle style = Styles.flatt;
|
TextButtonStyle style = Styles.flatt;
|
||||||
t.defaults().size(280f, 60f).left();
|
t.defaults().size(280f, 60f).left();
|
||||||
|
|
||||||
if(privileged && executor != null && executor.build != null){// && !ui.editor.isShown()
|
if(privileged && executor != null && executor.build != null && !ui.editor.isShown()){
|
||||||
t.button("@editor.worldprocessors.editname", Icon.edit, style, () -> {
|
t.button("@editor.worldprocessors.editname", Icon.edit, style, () -> {
|
||||||
ui.showTextInput("", "@editor.name", LogicBlock.maxNameLength, executor.build.tag == null ? "" : executor.build.tag, tag -> {
|
ui.showTextInput("", "@editor.name", LogicBlock.maxNameLength, executor.build.tag == null ? "" : executor.build.tag, tag -> {
|
||||||
if(privileged && executor != null && executor.build != null){
|
if(privileged && executor != null && executor.build != null){
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public class LogicBlock extends Block{
|
|||||||
build.readCompressed(data, true);
|
build.readCompressed(data, true);
|
||||||
});
|
});
|
||||||
|
|
||||||
config(String.class,(LogicBuild build, String data) -> {
|
config(String.class, (LogicBuild build, String data) -> {
|
||||||
if(!accessible() || !privileged) return;
|
if(!accessible() || !privileged) return;
|
||||||
|
|
||||||
if(data != null && data.length() < maxNameLength){
|
if(data != null && data.length() < maxNameLength){
|
||||||
@@ -68,6 +68,12 @@ public class LogicBlock extends Block{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
config(Character.class, (LogicBuild build, Character data) -> {
|
||||||
|
if(!accessible() || !privileged) return;
|
||||||
|
|
||||||
|
build.iconTag = data;
|
||||||
|
});
|
||||||
|
|
||||||
config(Integer.class, (LogicBuild entity, Integer pos) -> {
|
config(Integer.class, (LogicBuild entity, Integer pos) -> {
|
||||||
if(!accessible()) return;
|
if(!accessible()) return;
|
||||||
|
|
||||||
@@ -634,7 +640,17 @@ public class LogicBlock extends Block{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void showEditDialog(){
|
public void showEditDialog(){
|
||||||
ui.logic.show(code, executor, privileged, code -> configure(compress(code, relativeConnections())));
|
showEditDialog(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void showEditDialog(boolean forceEditor){
|
||||||
|
ui.logic.show(code, executor, privileged, code -> {
|
||||||
|
boolean prev = state.rules.editor;
|
||||||
|
//this is a hack to allow configuration to work correctly in the editor for privileged processors
|
||||||
|
if(forceEditor) state.rules.editor = true;
|
||||||
|
configure(compress(code, relativeConnections()));
|
||||||
|
state.rules.editor = prev;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user