Yet another floor
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 7.1 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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{
|
||||
|
||||