WIP editor color stuff support (broken)

This commit is contained in:
Anuken
2025-07-27 15:46:58 -04:00
parent 5691d46199
commit bdf521bd1c
3 changed files with 26 additions and 1 deletions

View File

@@ -47,7 +47,7 @@ public enum EditorTool{
}
},
//the "under liquid" rendering is too buggy to make public
pencil(KeyCode.b, "replace", "square", "drawteams"/*, "underliquid"*/){
pencil(KeyCode.b, "replace", "square", "drawteams", "underliquid"){
{
edit = true;
draggable = true;

View File

@@ -155,13 +155,16 @@ public class MapEditor{
Cons<Tile> drawer = tile -> {
if(!tester.get(tile)) return;
boolean changed = false;
if(isFloor){
if(forceOverlay){
tile.setOverlay(drawBlock.asFloor());
changed = true;
}else{
if(!(drawBlock.asFloor().wallOre && !tile.block().solid)){
tile.setFloor(drawBlock.asFloor());
changed = true;
}
}
}else if(!(tile.block().isMultiblock() && !drawBlock.isMultiblock())){
@@ -170,11 +173,17 @@ public class MapEditor{
}
tile.setBlock(drawBlock, drawTeam, rotation);
changed = !drawBlock.synthetic();
if(drawBlock.synthetic()){
addTileOp(TileOp.get(tile.x, tile.y, DrawOperation.opTeam, (byte)drawTeam.id));
}
}
if(changed && drawBlock.saveConfig){
drawBlock.placeEnded(tile, null, editor.rotation, drawBlock.lastConfig);
renderer.updateStatic(tile.x, tile.y);
}
};
if(square){

View File

@@ -787,6 +787,9 @@ public class MapEditorDialog extends Dialog implements Disposable{
}
});
Table[] configTable = {null};
Block[] lastBlock = {null};
cont.table(search -> {
search.image(Icon.zoom).padRight(8);
search.field("", this::rebuildBlockSelection).growX()
@@ -795,6 +798,19 @@ public class MapEditorDialog extends Dialog implements Disposable{
cont.row();
cont.table(Tex.underline, extra -> extra.labelWrap(() -> editor.drawBlock.localizedName).width(200f).center()).growX();
cont.row();
cont.collapser(t -> {
configTable[0] = t;
}, () -> editor.drawBlock != null && editor.drawBlock.editorConfigurable).with(c -> c.setEnforceMinSize(true)).update(col -> {
if(lastBlock[0] != editor.drawBlock){
configTable[0].clear();
if(editor.drawBlock != null){
editor.drawBlock.buildEditorConfig(configTable[0]);
col.invalidateHierarchy();
}
lastBlock[0] = editor.drawBlock;
}
}).growX().row();
cont.add(pane).expandY().growX().top().left();
rebuildBlockSelection("");