New environmental metal wall blocks
This commit is contained in:
@@ -63,7 +63,9 @@ public class Blocks{
|
||||
//old metal floors
|
||||
darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal,
|
||||
//new metal floors
|
||||
metalTiles1, metalTiles2, metalTiles3, metalTiles4, metalTiles5, metalTiles6, metalTiles7, metalTiles8, metalTiles9, metalTiles10, metalTiles11, metalTiles12,
|
||||
metalTiles1, metalTiles2, metalTiles3, metalTiles4, metalTiles5, metalTiles6, metalTiles7, metalTiles8, metalTiles9, metalTiles10, metalTiles11, metalTiles12, metalTiles13,
|
||||
//new metal walls
|
||||
metalWall1, metalWall2, metalWall3, metalWall4,
|
||||
|
||||
//colored
|
||||
coloredFloor, coloredWall,
|
||||
@@ -908,6 +910,26 @@ public class Blocks{
|
||||
lightColor = Team.crux.color.cpy().a(0.3f);
|
||||
}};
|
||||
|
||||
metalTiles13 = new Floor("metal-tiles-13"){{
|
||||
autotile = true;
|
||||
drawEdgeOut = false;
|
||||
drawEdgeIn = false;
|
||||
autotileMidVariants = 6;
|
||||
}};
|
||||
|
||||
metalWall1 = new StaticWall("metal-wall-1"){{
|
||||
autotile = true;
|
||||
}};
|
||||
|
||||
metalWall2 = new StaticWall("metal-wall-2"){{
|
||||
autotile = true;
|
||||
autotileMidVariants = 2;
|
||||
}};
|
||||
|
||||
metalWall3 = new StaticWall("metal-wall-3"){{
|
||||
autotile = true;
|
||||
}};
|
||||
|
||||
coloredFloor = new ColoredFloor("colored-floor"){{
|
||||
autotile = true;
|
||||
drawEdgeOut = false;
|
||||
|
||||
@@ -388,7 +388,7 @@ public class ErekirTechTree{
|
||||
node(basin, Seq.with(new SectorComplete(atlas)), () -> {
|
||||
node(marsh, Seq.with(new SectorComplete(basin)), () -> {
|
||||
node(ravine, Seq.with(new SectorComplete(marsh), new Research(Liquids.slag)), () -> {
|
||||
node(caldera, Seq.with(new SectorComplete(peaks), new Research(heatRedirector)), () -> {
|
||||
node(caldera, Seq.with(new SectorComplete(peaks), new SectorComplete(ravine), new Research(heatRedirector)), () -> {
|
||||
node(stronghold, Seq.with(new SectorComplete(caldera), new Research(coreCitadel)), () -> {
|
||||
node(crevice, Seq.with(new SectorComplete(stronghold)), () -> {
|
||||
node(siege, Seq.with(new SectorComplete(crevice)), () -> {
|
||||
|
||||
@@ -57,11 +57,11 @@ public class LExecutor{
|
||||
public IntSet linkIds = new IntSet();
|
||||
public Team team = Team.derelict;
|
||||
public boolean privileged = false;
|
||||
//maps variable name to index in vars; lazily initialized
|
||||
protected @Nullable ObjectIntMap<String> nameMap;
|
||||
|
||||
//yes, this is a minor memory leak, but it's probably not significant enough to matter
|
||||
protected static IntFloatMap unitTimeouts = new IntFloatMap();
|
||||
//lookup variable by name, lazy init.
|
||||
protected @Nullable ObjectIntMap<String> nameMap;
|
||||
|
||||
static{
|
||||
Events.on(ResetEvent.class, e -> unitTimeouts.clear());
|
||||
|
||||
@@ -18,8 +18,10 @@ public class StaticWall extends Prop{
|
||||
public TextureRegion[][] split;
|
||||
/** If true, this wall uses autotiling; variants are not supported. See https://github.com/GglLfr/tile-gen*/
|
||||
public boolean autotile;
|
||||
/** If >1, the middle region of the autotile has random variants. */
|
||||
public int autotileMidVariants = 1;
|
||||
|
||||
protected TextureRegion[] autotileRegions;
|
||||
protected TextureRegion[] autotileRegions, autotileMidRegions;
|
||||
|
||||
public StaticWall(String name){
|
||||
super(name);
|
||||
@@ -46,7 +48,11 @@ public class StaticWall extends Prop{
|
||||
}
|
||||
}
|
||||
|
||||
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{
|
||||
int rx = tile.x / 2 * 2;
|
||||
int ry = tile.y / 2 * 2;
|
||||
@@ -66,6 +72,10 @@ public class StaticWall extends Prop{
|
||||
}
|
||||
}
|
||||
|
||||
public int variant(int x, int y, int max){
|
||||
return Mathf.randomSeed(Point2.pack(x, y), 0, Math.max(0, max - 1));
|
||||
}
|
||||
|
||||
public boolean checkAutotileSame(Tile tile, @Nullable Tile other){
|
||||
return other != null && other.block() == this;
|
||||
}
|
||||
@@ -85,6 +95,13 @@ public class StaticWall extends Prop{
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user