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

@@ -538,6 +538,8 @@ toolmode.eraseores = Erase Ores
toolmode.eraseores.description = Erase only ores. toolmode.eraseores.description = Erase only ores.
toolmode.fillteams = Fill Teams toolmode.fillteams = Fill Teams
toolmode.fillteams.description = Fill teams instead of blocks. toolmode.fillteams.description = Fill teams instead of blocks.
toolmode.fillerase = Fill Erase
toolmode.fillerase.description = Erase blocks of the same type.
toolmode.drawteams = Draw Teams toolmode.drawteams = Draw Teams
toolmode.drawteams.description = Draw teams instead of blocks. toolmode.drawteams.description = Draw teams instead of blocks.
#unused #unused

View File

@@ -92,7 +92,7 @@ public enum EditorTool{
}); });
} }
}, },
fill(KeyCode.g, "replaceall", "fillteams"){ fill(KeyCode.g, "replaceall", "fillteams", "fillerase"){
{ {
edit = true; edit = true;
} }
@@ -110,7 +110,7 @@ public enum EditorTool{
return; 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){ if(mode == 0 || mode == -1){
//can't fill parts or multiblocks //can't fill parts or multiblocks
if(tile.block().isMultiblock()){ if(tile.block().isMultiblock()){
@@ -147,6 +147,27 @@ public enum EditorTool{
if(dest == editor.drawTeam) return; if(dest == editor.drawTeam) return;
fill(x, y, true, t -> t.getTeamID() == dest.id && t.synthetic(), t -> t.setTeam(editor.drawTeam)); 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);
}
} }
} }