diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index 41def41e4f..6072c45537 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -593,6 +593,8 @@ 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.fillcliffs = Fill Cliffs +toolmode.fillcliffs.description = Turns walls into cliffs. 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 67f902fa68..753d227fe9 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", "fillerase"){ + fill(KeyCode.g, "replaceall", "fillteams", "fillerase", "fillcliffs"){ { edit = true; } @@ -185,6 +185,27 @@ public enum EditorTool{ if(setter != null){ fill(x, y, false, tester, setter); } + }else if(mode == 3){ //cliff fill + if(!tile.block().isStatic() || tile.block() == Blocks.cliff) return; + Bits wasStatic = new Bits(editor.width() * editor.height()); + fill(x, y, false, t -> t.block().isStatic() && t.block() != Blocks.cliff, t -> { + int rotation = 0; + for(int i = 0; i < 8; i++){ + Tile other = world.tiles.get(t.x + Geometry.d8[i].x, t.y + Geometry.d8[i].y); + if(other != null && !other.block().isStatic() && !wasStatic.get(other.array())){ + rotation |= (1 << i); + } + } + + if(rotation != 0){ + t.setBlock(Blocks.cliff); + }else{ + t.setBlock(Blocks.air); + wasStatic.set(t.array()); + } + + t.data = (byte)rotation; + }); } } diff --git a/core/src/mindustry/editor/MapEditorDialog.java b/core/src/mindustry/editor/MapEditorDialog.java index 4aebc8b9db..5f648b9c71 100644 --- a/core/src/mindustry/editor/MapEditorDialog.java +++ b/core/src/mindustry/editor/MapEditorDialog.java @@ -700,12 +700,6 @@ public class MapEditorDialog extends Dialog implements Disposable{ t.button("@editor.center", Icon.move, Styles.flatt, view::center).growX().margin(9f); }).growX().top(); } - - mid.row(); - - mid.table(t -> { - t.button("@editor.cliffs", Icon.terrain, Styles.flatt, editor::addCliffs).growX().margin(9f); - }).growX().top(); }).margin(0).left().growY();