diff --git a/core/assets-raw/sprites/blocks/environment/cliff.png b/core/assets-raw/sprites/blocks/environment/cliff.png index 9d76c62084..0ea51ef09b 100644 Binary files a/core/assets-raw/sprites/blocks/environment/cliff.png and b/core/assets-raw/sprites/blocks/environment/cliff.png differ diff --git a/core/assets/sprites/block_colors.png b/core/assets/sprites/block_colors.png index 3e19c96e61..e8845aa072 100644 Binary files a/core/assets/sprites/block_colors.png and b/core/assets/sprites/block_colors.png differ diff --git a/core/assets/sprites/fallback/sprites5.png b/core/assets/sprites/fallback/sprites5.png index e413db1a18..87ee3a7b46 100644 Binary files a/core/assets/sprites/fallback/sprites5.png and b/core/assets/sprites/fallback/sprites5.png differ diff --git a/core/assets/sprites/fallback/sprites6.png b/core/assets/sprites/fallback/sprites6.png index 94069305e4..a47c2d47eb 100644 Binary files a/core/assets/sprites/fallback/sprites6.png and b/core/assets/sprites/fallback/sprites6.png differ diff --git a/core/assets/sprites/fallback/sprites7.png b/core/assets/sprites/fallback/sprites7.png index 9e083fdec4..dd3d40dc80 100644 Binary files a/core/assets/sprites/fallback/sprites7.png and b/core/assets/sprites/fallback/sprites7.png differ diff --git a/core/assets/sprites/fallback/sprites8.png b/core/assets/sprites/fallback/sprites8.png index 4c47261514..212d169c38 100644 Binary files a/core/assets/sprites/fallback/sprites8.png and b/core/assets/sprites/fallback/sprites8.png differ diff --git a/core/assets/sprites/sprites2.png b/core/assets/sprites/sprites2.png index fba6d8fe48..4a26e4dbe9 100644 Binary files a/core/assets/sprites/sprites2.png and b/core/assets/sprites/sprites2.png differ diff --git a/core/assets/sprites/sprites3.png b/core/assets/sprites/sprites3.png index 6e26e044e2..627f4e763c 100644 Binary files a/core/assets/sprites/sprites3.png and b/core/assets/sprites/sprites3.png differ diff --git a/core/assets/sprites/sprites4.png b/core/assets/sprites/sprites4.png index 4a76287a49..20eed12539 100644 Binary files a/core/assets/sprites/sprites4.png and b/core/assets/sprites/sprites4.png differ diff --git a/core/assets/sprites/sprites5.png b/core/assets/sprites/sprites5.png index a85adcfbb9..2fe5605d60 100644 Binary files a/core/assets/sprites/sprites5.png and b/core/assets/sprites/sprites5.png differ diff --git a/core/src/mindustry/Vars.java b/core/src/mindustry/Vars.java index 3c8b57e7c5..2653b55975 100644 --- a/core/src/mindustry/Vars.java +++ b/core/src/mindustry/Vars.java @@ -36,6 +36,8 @@ public class Vars implements Loadable{ public static boolean loadLocales = true; /** Whether the logger is loaded. */ public static boolean loadedLogger = false, loadedFileLogger = false; + /** Whether to show the cliff button in the editor*/ + public static boolean addCliffButton = false; /** Maximum extra padding around deployment schematics. */ public static final int maxLoadoutSchematicPad = 5; /** Maximum schematic size.*/ diff --git a/core/src/mindustry/editor/MapEditor.java b/core/src/mindustry/editor/MapEditor.java index 49d174779b..1c33964e08 100644 --- a/core/src/mindustry/editor/MapEditor.java +++ b/core/src/mindustry/editor/MapEditor.java @@ -4,6 +4,7 @@ import arc.files.*; import arc.func.*; import arc.graphics.*; import arc.math.*; +import arc.math.geom.*; import arc.struct.*; import mindustry.content.*; import mindustry.editor.DrawOperation.*; @@ -180,6 +181,52 @@ public class MapEditor{ return false; } + public void addCliffs(){ + for(Tile tile : world.tiles){ + if(!tile.block().isStatic() || tile.block() == Blocks.cliff) continue; + + int rotation = 0; + for(int i = 0; i < 8; i++){ + Tile other = world.tiles.get(tile.x + Geometry.d8[i].x, tile.y + Geometry.d8[i].y); + if(other != null && !other.block().isStatic()){ + rotation |= (1 << i); + } + } + + if(rotation != 0){ + tile.setBlock(Blocks.cliff); + } + + tile.data = (byte)rotation; + } + + for(Tile tile : world.tiles){ + if(tile.block() != Blocks.cliff && tile.block().isStatic()){ + tile.setBlock(Blocks.air); + } + } + } + + public void addFloorCliffs(){ + for(Tile tile : world.tiles){ + if(!tile.floor().hasSurface() || tile.block() == Blocks.cliff) continue; + + int rotation = 0; + for(int i = 0; i < 8; i++){ + Tile other = world.tiles.get(tile.x + Geometry.d8[i].x, tile.y + Geometry.d8[i].y); + if(other != null && !other.floor().hasSurface()){ + rotation |= (1 << i); + } + } + + if(rotation != 0){ + tile.setBlock(Blocks.cliff); + } + + tile.data = (byte)rotation; + } + } + public void drawCircle(int x, int y, Cons drawer){ for(int rx = -brushSize; rx <= brushSize; rx++){ for(int ry = -brushSize; ry <= brushSize; ry++){ diff --git a/core/src/mindustry/editor/MapEditorDialog.java b/core/src/mindustry/editor/MapEditorDialog.java index dda95c6ed2..dfad7c03ab 100644 --- a/core/src/mindustry/editor/MapEditorDialog.java +++ b/core/src/mindustry/editor/MapEditorDialog.java @@ -561,7 +561,15 @@ public class MapEditorDialog extends Dialog implements Disposable{ if(!mobile){ mid.table(t -> { - t.button("@editor.center", Icon.move, Styles.cleart, () -> view.center()).growX().margin(9f); + t.button("@editor.center", Icon.move, Styles.cleart, view::center).growX().margin(9f); + }).growX().top(); + } + + if(addCliffButton){ + mid.row(); + + mid.table(t -> { + t.button("Cliffs", Icon.terrain, Styles.cleart, editor::addCliffs).growX().margin(9f); }).growX().top(); } }).margin(0).left().growY(); diff --git a/core/src/mindustry/mod/ContentParser.java b/core/src/mindustry/mod/ContentParser.java index 2d5310d325..c8085ae8c8 100644 --- a/core/src/mindustry/mod/ContentParser.java +++ b/core/src/mindustry/mod/ContentParser.java @@ -288,7 +288,8 @@ public class ContentParser{ //read extra default waves if(value.has("waves")){ - SpawnGroup[] groups = parser.readValue(SpawnGroup[].class, value.get("waves")); + JsonValue waves = value.remove("waves"); + SpawnGroup[] groups = parser.readValue(SpawnGroup[].class, waves); for(SpawnGroup group : groups){ group.type = unit; }