Wall generation
This commit is contained in:
@@ -161,6 +161,10 @@ public class Block extends BlockStorage{
|
||||
this.solid = false;
|
||||
}
|
||||
|
||||
public boolean isAir(){
|
||||
return id == 0;
|
||||
}
|
||||
|
||||
public boolean canBreak(Tile tile){
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -7,8 +7,9 @@ import java.util.*;
|
||||
|
||||
/** A tile container. */
|
||||
public class Tiles implements Iterable<Tile>{
|
||||
public final int width, height;
|
||||
|
||||
private final Tile[] array;
|
||||
private final int width, height;
|
||||
private final TileIterator iterator = new TileIterator();
|
||||
|
||||
public Tiles(int width, int height){
|
||||
@@ -63,14 +64,6 @@ public class Tiles implements Iterable<Tile>{
|
||||
return get(Pos.x(pos), Pos.y(pos));
|
||||
}
|
||||
|
||||
public int width(){
|
||||
return width;
|
||||
}
|
||||
|
||||
public int height(){
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Tile> iterator(){
|
||||
iterator.index = 0;
|
||||
|
||||
@@ -6,8 +6,8 @@ import arc.graphics.g2d.*;
|
||||
import arc.graphics.g2d.TextureAtlas.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import arc.struct.*;
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.graphics.*;
|
||||
@@ -16,7 +16,7 @@ import mindustry.type.*;
|
||||
import mindustry.ui.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.Vars.tilesize;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class Floor extends Block{
|
||||
/** number of different variant regions to use */
|
||||
@@ -57,6 +57,8 @@ public class Floor extends Block{
|
||||
public boolean oreDefault = false;
|
||||
/** Ore generation params. */
|
||||
public float oreScale = 24f, oreThreshold = 0.828f;
|
||||
/** Wall variant of this block. May be Blocks.air if not found. */
|
||||
public Block wall = Blocks.air;
|
||||
|
||||
protected TextureRegion[][] edges;
|
||||
protected byte eq = 0;
|
||||
@@ -92,6 +94,20 @@ public class Floor extends Block{
|
||||
edgeRegion = Core.atlas.find("edge");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(){
|
||||
super.init();
|
||||
|
||||
if(wall == Blocks.air){
|
||||
wall = content.block(name + "Rocks");
|
||||
if(wall == null) wall = content.block(name + "rocks");
|
||||
if(wall == null) wall = content.block(name.replace("darksand", "dune") + "rocks");
|
||||
}
|
||||
|
||||
//keep default value if not found...
|
||||
if(wall == null) wall = Blocks.air;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createIcons(MultiPacker packer){
|
||||
super.createIcons(packer);
|
||||
|
||||
Reference in New Issue
Block a user