Skip to content

Commit 5b6ebaa

Browse files
committed
Switch menu type when picking block
1 parent e3bb657 commit 5b6ebaa

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/testing/editor/PainterTool.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public void touched(int x, int y){
1919
if(!Structs.inBounds(x, y, painter.width(), painter.height())) return;
2020

2121
Tile tile = painter.tile(x, y);
22-
painter.drawBlock = tile.block() == Blocks.air || !tile.block().inEditor ? tile.overlay() == Blocks.air ? tile.floor() : tile.overlay() : tile.block();
22+
painter.setDrawBlock(tile.block() == Blocks.air || !tile.block().inEditor ? tile.overlay() == Blocks.air ? tile.floor() : tile.overlay() : tile.block());
2323
}
2424
},
2525
line("replace", "orthogonal"){

src/testing/editor/TerrainPainter.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import mindustry.game.*;
1313
import mindustry.world.*;
1414
import mindustry.world.blocks.environment.*;
15+
import testing.util.*;
1516

1617
import static mindustry.Vars.*;
1718
import static testing.util.TUVars.*;
@@ -85,6 +86,11 @@ public float brushSize(){
8586
return drawBlock instanceof SteamVent ? 2 : brushSize;
8687
}
8788

89+
public void setDrawBlock(Block block){
90+
drawBlock = block;
91+
Setup.terrainFrag.updateMenu();
92+
}
93+
8894
public void drawBlocksReplace(int x, int y){
8995
drawBlocks(x, y, data -> data.block() != Blocks.air || drawBlock.isFloor());
9096
}

src/testing/ui/TerrainPainterFragment.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@ private void rebuild(){
314314
}).fillX().left().padBottom(10);
315315
}
316316

317+
public void updateMenu(){
318+
buildings = isBuilding(painter.drawBlock);
319+
rebuild();
320+
}
321+
317322
private boolean blockFilter(Block b){
318323
if(buildings){
319324
return isBuilding(b);

0 commit comments

Comments
 (0)