Yet another floor

This commit is contained in:
Anuken
2025-07-15 14:45:50 -04:00
parent b714651055
commit cb7e027b2b
13 changed files with 70 additions and 25 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

@@ -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

View File

@@ -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;

View File

@@ -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;
}
}

View File

@@ -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<Floor> 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{