diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-7-autotile.png b/core/assets-raw/sprites/blocks/environment/crux-floor-7-autotile.png index eba9b8cb2b..53c3136338 100644 Binary files a/core/assets-raw/sprites/blocks/environment/crux-floor-7-autotile.png and b/core/assets-raw/sprites/blocks/environment/crux-floor-7-autotile.png differ diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-2.png b/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-2.png new file mode 100644 index 0000000000..b2528814b0 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-2.png differ diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-3.png b/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-3.png new file mode 100644 index 0000000000..235d30cb7c Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-3.png differ diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-4.png b/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-4.png new file mode 100644 index 0000000000..d7650d8789 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-4.png differ diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-5.png b/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-5.png new file mode 100644 index 0000000000..54a79297d9 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-5.png differ diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-6.png b/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-6.png new file mode 100644 index 0000000000..6ab458be62 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-6.png differ diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-7.png b/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-7.png new file mode 100644 index 0000000000..b2528814b0 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-7.png differ diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-8.png b/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-8.png new file mode 100644 index 0000000000..b2528814b0 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-8.png differ diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-9.png b/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-9.png new file mode 100644 index 0000000000..1c1918d087 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/crux-floor-7-mid-9.png differ diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 7c68a43226..aeb94adadb 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -854,6 +854,7 @@ public class Blocks{ autotile = true; drawEdgeOut = false; drawEdgeIn = false; + autotileMidVariants = 9; }}; coloredFloor = new ColoredFloor("colored-floor"){{ diff --git a/core/src/mindustry/world/blocks/environment/Floor.java b/core/src/mindustry/world/blocks/environment/Floor.java index e14a517f5b..da9b0154f3 100644 --- a/core/src/mindustry/world/blocks/environment/Floor.java +++ b/core/src/mindustry/world/blocks/environment/Floor.java @@ -80,13 +80,15 @@ public class Floor extends Block{ public int tilingVariants = 0; /** If true, this floor uses autotiling; variants are not supported. See https://github.com/GglLfr/tile-gen*/ public boolean autotile = false; + /** If >1, the middle region of the autotile has random variants. */ + public int autotileMidVariants = 1; /** If true (default), this floor will draw edges of other floors on itself. */ public boolean drawEdgeIn = true; /** If true (default), this floor will draw its edges onto other floors. */ public boolean drawEdgeOut = true; protected TextureRegion[][][] tilingRegions; - protected TextureRegion[] autotileRegions; + protected TextureRegion[] autotileRegions, autotileMidRegions; protected int tilingSize; protected TextureRegion[][] edges; protected Seq blenders = new Seq<>(); @@ -146,6 +148,12 @@ public class Floor extends Block{ if(autotile){ autotileRegions = TileBitmask.load(name); + if(autotileMidVariants > 1){ + autotileMidRegions = new TextureRegion[autotileMidVariants]; + for(int i = 0; i < autotileMidVariants; i++){ + autotileMidRegions[i] = Core.atlas.find((i == 0 ? name + "-13" : name + "-mid-" + (i + 1))); + } + } } if(Core.atlas.has(name + "-edge")){ @@ -234,7 +242,10 @@ public class Floor extends Block{ } } - Draw.rect(autotileRegions[TileBitmask.values[bits]], tile.worldx(), tile.worldy()); + int bit = TileBitmask.values[bits]; + TextureRegion region = bit == 13 && autotileMidVariants > 1 ? autotileMidRegions[variant(tile.x, tile.y, autotileMidRegions.length)] : autotileRegions[bit]; + + Draw.rect(region, tile.worldx(), tile.worldy()); }else{ Draw.rect(variantRegions[variant(tile.x, tile.y)], tile.worldx(), tile.worldy()); } @@ -251,7 +262,11 @@ public class Floor extends Block{ } public int variant(int x, int y){ - return Mathf.randomSeed(Point2.pack(x, y), 0, Math.max(0, variantRegions.length - 1)); + return variant(x, y, variantRegions.length); + } + + public int variant(int x, int y, int max){ + return Mathf.randomSeed(Point2.pack(x, y), 0, Math.max(0, max - 1)); } public void drawOverlay(Tile tile){