Closes Anuken/Mindustry-Suggestions/issues/4457

This commit is contained in:
Anuken
2023-06-02 12:06:06 -04:00
parent afee374a66
commit dde7b77de6
2 changed files with 25 additions and 2 deletions

View File

@@ -92,7 +92,7 @@ public enum EditorTool{
});
}
},
fill(KeyCode.g, "replaceall", "fillteams"){
fill(KeyCode.g, "replaceall", "fillteams", "fillerase"){
{
edit = true;
}
@@ -110,7 +110,7 @@ public enum EditorTool{
return;
}
//mode 0 or 1, fill everything with the floor/tile or replace it
//mode 0 or standard, fill everything with the floor/tile or replace it
if(mode == 0 || mode == -1){
//can't fill parts or multiblocks
if(tile.block().isMultiblock()){
@@ -147,6 +147,27 @@ public enum EditorTool{
if(dest == editor.drawTeam) return;
fill(x, y, true, t -> t.getTeamID() == dest.id && t.synthetic(), t -> t.setTeam(editor.drawTeam));
}
}else if(mode == 2){ //erase mode
Boolf<Tile> tester;
Cons<Tile> setter;
if(tile.block() != Blocks.air){
Block dest = tile.block();
tester = t -> t.block() == dest;
setter = t -> t.setBlock(Blocks.air);
}else if(tile.overlay() != Blocks.air){
Block dest = tile.overlay();
tester = t -> t.overlay() == dest;
setter = t -> t.setOverlay(Blocks.air);
}else{
//trying to erase floor (no)
tester = null;
setter = null;
}
if(setter != null){
fill(x, y, false, tester, setter);
}
}
}