diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index d0090c5895..3932feba16 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -538,6 +538,8 @@ toolmode.eraseores = Erase Ores toolmode.eraseores.description = Erase only ores. toolmode.fillteams = Fill Teams 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.description = Draw teams instead of blocks. #unused diff --git a/core/src/mindustry/editor/EditorTool.java b/core/src/mindustry/editor/EditorTool.java index 1ea88bd7ac..aa26a7b10f 100644 --- a/core/src/mindustry/editor/EditorTool.java +++ b/core/src/mindustry/editor/EditorTool.java @@ -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 tester; + Cons 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); + } } }