diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-11-autotile1.png b/core/assets-raw/sprites/blocks/environment/crux-floor-11-autotile1.png new file mode 100644 index 0000000000..3a5f16377b Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/crux-floor-11-autotile1.png differ diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-11-autotile2.png b/core/assets-raw/sprites/blocks/environment/crux-floor-11-autotile2.png new file mode 100644 index 0000000000..c7eb393e2e Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/crux-floor-11-autotile2.png differ diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-11-autotile3.png b/core/assets-raw/sprites/blocks/environment/crux-floor-11-autotile3.png new file mode 100644 index 0000000000..cd7e4d7b39 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/crux-floor-11-autotile3.png differ diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-11.aseprite b/core/assets-raw/sprites/blocks/environment/crux-floor-11.aseprite new file mode 100644 index 0000000000..545f8a629a Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/crux-floor-11.aseprite differ diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-12-autotile1.png b/core/assets-raw/sprites/blocks/environment/crux-floor-12-autotile1.png new file mode 100644 index 0000000000..b318f30eff Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/crux-floor-12-autotile1.png differ diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-12-autotile2.png b/core/assets-raw/sprites/blocks/environment/crux-floor-12-autotile2.png new file mode 100644 index 0000000000..e70ee57e22 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/crux-floor-12-autotile2.png differ diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-12-autotile3.png b/core/assets-raw/sprites/blocks/environment/crux-floor-12-autotile3.png new file mode 100644 index 0000000000..3a83d7cf96 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/crux-floor-12-autotile3.png differ diff --git a/core/assets-raw/sprites/blocks/environment/crux-floor-12-autotile4.png b/core/assets-raw/sprites/blocks/environment/crux-floor-12-autotile4.png new file mode 100644 index 0000000000..e70ee57e22 Binary files /dev/null and b/core/assets-raw/sprites/blocks/environment/crux-floor-12-autotile4.png differ diff --git a/core/assets/icons/icons.properties b/core/assets/icons/icons.properties index 4d5a8d6afb..6ec07cd35a 100755 --- a/core/assets/icons/icons.properties +++ b/core/assets/icons/icons.properties @@ -612,3 +612,5 @@ 63070=crux-floor-9|block-crux-floor-9-ui 63069=crux-floor-10|block-crux-floor-10-ui 63068=colored-wall|block-colored-wall-ui +63067=crux-floor-11|block-crux-floor-11-ui +63066=crux-floor-12|block-crux-floor-12-ui diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 12390fe663..19ddda6744 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -60,8 +60,11 @@ public class Blocks{ arkyicBoulder, crystalCluster, vibrantCrystalCluster, crystalBlocks, crystalOrbs, crystallineBoulder, redIceBoulder, rhyoliteBoulder, redStoneBoulder, metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5, basalt, magmarock, hotrock, snowWall, saltWall, + //old metal floors + darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal, + //new metal floors - darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal, cruxFloor1, cruxFloor2, cruxFloor3, cruxFloor4, cruxFloor5, cruxFloor6, cruxFloor7, cruxFloor8, cruxFloor9, cruxFloor10, + cruxFloor1, cruxFloor2, cruxFloor3, cruxFloor4, cruxFloor5, cruxFloor6, cruxFloor7, cruxFloor8, cruxFloor9, cruxFloor10, cruxFloor11, cruxFloor12, //colored coloredFloor, coloredWall, @@ -881,6 +884,23 @@ public class Blocks{ drawEdgeIn = false; }}; + cruxFloor11 = new Floor("crux-floor-11"){{ + autotile = true; + drawEdgeOut = false; + drawEdgeIn = false; + autotileVariants = 3; + }}; + + cruxFloor12 = new Floor("crux-floor-12"){{ + autotile = true; + drawEdgeOut = false; + drawEdgeIn = false; + autotileVariants = 4; + emitLight = true; + lightRadius = 30f; + lightColor = Team.crux.color.cpy().a(0.3f); + }}; + coloredFloor = new ColoredFloor("colored-floor"){{ autotile = true; drawEdgeOut = false; diff --git a/core/src/mindustry/world/blocks/TileBitmask.java b/core/src/mindustry/world/blocks/TileBitmask.java index b8ebacf6a9..b27660ffaf 100644 --- a/core/src/mindustry/world/blocks/TileBitmask.java +++ b/core/src/mindustry/world/blocks/TileBitmask.java @@ -31,4 +31,15 @@ public class TileBitmask{ } return regions; } + + public static TextureRegion[][] loadVariants(String name, int variants){ + var regions = new TextureRegion[variants][47]; + for(int v = 0; v < variants; v++){ + for(int i = 0; i < 47; i++){ + regions[v][i] = Core.atlas.find(name + "-" + (v+1) + "-" + i); + } + } + + return regions; + } } diff --git a/core/src/mindustry/world/blocks/environment/Floor.java b/core/src/mindustry/world/blocks/environment/Floor.java index d72565bc53..e00c183ec7 100644 --- a/core/src/mindustry/world/blocks/environment/Floor.java +++ b/core/src/mindustry/world/blocks/environment/Floor.java @@ -82,6 +82,8 @@ public class Floor extends Block{ public boolean autotile = false; /** If >1, the middle region of the autotile has random variants. */ public int autotileMidVariants = 1; + /** Variants of the main autotile sprite. */ + public int autotileVariants = 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. */ @@ -89,6 +91,7 @@ public class Floor extends Block{ protected TextureRegion[][][] tilingRegions; protected TextureRegion[] autotileRegions, autotileMidRegions; + protected TextureRegion[][] autotileVariantRegions; protected int tilingSize; protected TextureRegion[][] edges; protected Seq blenders = new Seq<>(); @@ -148,6 +151,9 @@ public class Floor extends Block{ if(autotile){ autotileRegions = TileBitmask.load(name); + if(autotileVariants > 1){ + autotileVariantRegions = TileBitmask.loadVariants(name, autotileVariants); + } if(autotileMidVariants > 1){ autotileMidRegions = new TextureRegion[autotileMidVariants]; for(int i = 0; i < autotileMidVariants; i++){ @@ -235,6 +241,8 @@ public class Floor extends Block{ }else if(autotile){ int bits = 0; + TextureRegion[] regions = autotileVariants > 1 ? autotileVariantRegions[variant(tile.x, tile.y, autotileVariantRegions.length)] : autotileRegions; + for(int i = 0; i < 8; i++){ Tile other = tile.nearby(Geometry.d8[i]); if(checkAutotileSame(tile, other)){ @@ -243,7 +251,7 @@ public class Floor extends Block{ } int bit = TileBitmask.values[bits]; - TextureRegion region = bit == 13 && autotileMidVariants > 1 ? autotileMidRegions[variant(tile.x, tile.y, autotileMidRegions.length)] : autotileRegions[bit]; + TextureRegion region = bit == 13 && autotileMidVariants > 1 ? autotileMidRegions[variant(tile.x, tile.y, autotileMidRegions.length)] : regions[bit]; Draw.rect(region, tile.worldx(), tile.worldy()); }else{ diff --git a/tools/src/mindustry/tools/Generators.java b/tools/src/mindustry/tools/Generators.java index 4c5a847e6d..b092275e12 100644 --- a/tools/src/mindustry/tools/Generators.java +++ b/tools/src/mindustry/tools/Generators.java @@ -71,32 +71,36 @@ public class Generators{ generate("autotiles", () -> { for(Block block : content.blocks().select(b -> (b.isFloor() && b.asFloor().autotile) || (b instanceof StaticWall && ((StaticWall)b).autotile))){ - Fi basePath = new Fi("../../../assets-raw/sprites_out/blocks/environment/" + block.name + "-autotile.png"), iconPath = basePath.parent().child(block.name + ".png"); + int variants = block instanceof Floor f && f.autotileVariants > 1 ? f.autotileVariants : 1; + for(int v = 0; v < variants; v++){ + Fi basePath = new Fi("../../../assets-raw/sprites_out/blocks/environment/" + block.name + "-autotile" + (variants <= 1 ? "" : "" + (v+1)) + ".png"), iconPath = basePath.parent().child(block.name + ".png"); - if(basePath.exists()){ - //theoretically this might not finish in time, but I doubt that will ever happen - mainExecutor.submit(() -> { - try{ - ImageTileGenerator.generate(basePath, block.name, new Fi("../../../assets-raw/sprites_out/blocks/environment/" + block.name)); - }catch(Throwable e){ - Log.err("Failed to autotile: " + block.name, e); - }finally{ - //the raw autotile source image must never be included, it isn't useful - basePath.delete(); + if(basePath.exists()){ + int variant = v; + //theoretically this might not finish in time, but I doubt that will ever happen + mainExecutor.submit(() -> { + try{ + ImageTileGenerator.generate(basePath, block.name + (variants <= 1 ? "" : "-" + (variant+1)), new Fi("../../../assets-raw/sprites_out/blocks/environment/" + (block.name + (variants <= 1 ? "" : "-" + (variant+1))))); + }catch(Throwable e){ + Log.err("Failed to autotile: " + block.name, e); + }finally{ + //the raw autotile source image must never be included, it isn't useful + basePath.delete(); + } + }); + + if(!iconPath.exists() && v == 0){ + //save the bottom right region as the "main" sprite for previews + Pixmap out = new Pixmap(basePath); + Pixmap cropped = out.crop(32, 32, 32, 32); + iconPath.writePng(cropped); + iconPath.parent().parent().parent().child("editor").child("editor-" + block.name + ".png").writePng(cropped); + out.dispose(); + gens.put(block, cropped); } - }); - - if(!iconPath.exists()){ - //save the bottom right region as the "main" sprite for previews - Pixmap out = new Pixmap(basePath); - Pixmap cropped = out.crop(32, 32, 32, 32); - iconPath.writePng(cropped); - iconPath.parent().parent().parent().child("editor").child("editor-" + block.name + ".png").writePng(cropped); - out.dispose(); - gens.put(block, cropped); + }else{ + Log.warn("Autotile floor '@' not found: @", block.name, basePath.absolutePath()); } - }else{ - Log.warn("Autotile floor '@' not found: @", block.name, basePath.absolutePath()); } } });