Wall generation
This commit is contained in:
@@ -302,6 +302,7 @@ public class Blocks implements ContentList{
|
|||||||
|
|
||||||
icerocks = new StaticWall("icerocks"){{
|
icerocks = new StaticWall("icerocks"){{
|
||||||
variants = 2;
|
variants = 2;
|
||||||
|
iceSnow.asFloor().wall = this;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
snowrocks = new StaticWall("snowrocks"){{
|
snowrocks = new StaticWall("snowrocks"){{
|
||||||
@@ -365,11 +366,13 @@ public class Blocks implements ContentList{
|
|||||||
moss = new Floor("moss"){{
|
moss = new Floor("moss"){{
|
||||||
variants = 3;
|
variants = 3;
|
||||||
attributes.set(Attribute.spores, 0.15f);
|
attributes.set(Attribute.spores, 0.15f);
|
||||||
|
wall = sporePine;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
sporeMoss = new Floor("spore-moss"){{
|
sporeMoss = new Floor("spore-moss"){{
|
||||||
variants = 3;
|
variants = 3;
|
||||||
attributes.set(Attribute.spores, 0.3f);
|
attributes.set(Attribute.spores, 0.3f);
|
||||||
|
wall = sporerocks;
|
||||||
}};
|
}};
|
||||||
|
|
||||||
metalFloor = new Floor("metal-floor"){{
|
metalFloor = new Floor("metal-floor"){{
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ public class UnitTypes implements ContentList{
|
|||||||
public static @EntityDef({Unitc.class}) UnitType spirit;
|
public static @EntityDef({Unitc.class}) UnitType spirit;
|
||||||
public static @EntityDef({Unitc.class, Builderc.class}) UnitType phantom;
|
public static @EntityDef({Unitc.class, Builderc.class}) UnitType phantom;
|
||||||
|
|
||||||
|
//TODO remove
|
||||||
public static UnitType alpha, delta, tau, omega, dart, javelin, trident, glaive;
|
public static UnitType alpha, delta, tau, omega, dart, javelin, trident, glaive;
|
||||||
public static UnitType starter;
|
public static UnitType starter;
|
||||||
|
|
||||||
|
|||||||
@@ -233,6 +233,10 @@ public class ContentLoader{
|
|||||||
return (Block)getByID(ContentType.block, id);
|
return (Block)getByID(ContentType.block, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Block block(String name){
|
||||||
|
return (Block)getByName(ContentType.block, name);
|
||||||
|
}
|
||||||
|
|
||||||
public Array<Item> items(){
|
public Array<Item> items(){
|
||||||
return getBy(ContentType.item);
|
return getBy(ContentType.item);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import arc.math.geom.*;
|
|||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import mindustry.content.*;
|
|
||||||
import mindustry.core.GameState.*;
|
import mindustry.core.GameState.*;
|
||||||
import mindustry.game.EventType.*;
|
import mindustry.game.EventType.*;
|
||||||
import mindustry.game.*;
|
import mindustry.game.*;
|
||||||
@@ -69,11 +68,11 @@ public class World{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int width(){
|
public int width(){
|
||||||
return tiles.width();
|
return tiles.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int height(){
|
public int height(){
|
||||||
return tiles.height();
|
return tiles.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int unitWidth(){
|
public int unitWidth(){
|
||||||
@@ -130,7 +129,7 @@ public class World{
|
|||||||
public Tiles resize(int width, int height){
|
public Tiles resize(int width, int height){
|
||||||
clearTileEntities();
|
clearTileEntities();
|
||||||
|
|
||||||
if(tiles.width() != width || tiles.height() != height){
|
if(tiles.width != width || tiles.height != height){
|
||||||
tiles = new Tiles(width, height);
|
tiles = new Tiles(width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +163,7 @@ public class World{
|
|||||||
addDarkness(tiles);
|
addDarkness(tiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
Groups.resize(-finalWorldBounds, -finalWorldBounds, tiles.width() * tilesize + finalWorldBounds * 2, tiles.height() * tilesize + finalWorldBounds * 2);
|
Groups.resize(-finalWorldBounds, -finalWorldBounds, tiles.width * tilesize + finalWorldBounds * 2, tiles.height * tilesize + finalWorldBounds * 2);
|
||||||
|
|
||||||
generating = false;
|
generating = false;
|
||||||
Events.fire(new WorldLoadEvent());
|
Events.fire(new WorldLoadEvent());
|
||||||
@@ -207,8 +206,7 @@ public class World{
|
|||||||
sector.planet.generator.generate(position, gen);
|
sector.planet.generator.generate(position, gen);
|
||||||
tiles.set(x, y, new Tile(x, y, gen.floor, gen.overlay, gen.block));
|
tiles.set(x, y, new Tile(x, y, gen.floor, gen.overlay, gen.block));
|
||||||
});
|
});
|
||||||
|
sector.planet.generator.decorate(tiles);
|
||||||
tiles.get(size/2, size/2).setBlock(Blocks.coreShard, Team.sharded);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,8 +298,8 @@ public class World{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addDarkness(Tiles tiles){
|
public void addDarkness(Tiles tiles){
|
||||||
byte[] dark = new byte[tiles.width() * tiles.height()];
|
byte[] dark = new byte[tiles.width * tiles.height];
|
||||||
byte[] writeBuffer = new byte[tiles.width() * tiles.height()];
|
byte[] writeBuffer = new byte[tiles.width * tiles.height];
|
||||||
|
|
||||||
byte darkIterations = 4;
|
byte darkIterations = 4;
|
||||||
|
|
||||||
@@ -314,11 +312,11 @@ public class World{
|
|||||||
|
|
||||||
for(int i = 0; i < darkIterations; i++){
|
for(int i = 0; i < darkIterations; i++){
|
||||||
for(Tile tile : tiles){
|
for(Tile tile : tiles){
|
||||||
int idx = tile.y * tiles.width() + tile.x;
|
int idx = tile.y * tiles.width + tile.x;
|
||||||
boolean min = false;
|
boolean min = false;
|
||||||
for(Point2 point : Geometry.d4){
|
for(Point2 point : Geometry.d4){
|
||||||
int newX = tile.x + point.x, newY = tile.y + point.y;
|
int newX = tile.x + point.x, newY = tile.y + point.y;
|
||||||
int nidx = newY * tiles.width() + newX;
|
int nidx = newY * tiles.width + newX;
|
||||||
if(tiles.in(newX, newY) && dark[nidx] < dark[idx]){
|
if(tiles.in(newX, newY) && dark[nidx] < dark[idx]){
|
||||||
min = true;
|
min = true;
|
||||||
break;
|
break;
|
||||||
@@ -331,7 +329,7 @@ public class World{
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(Tile tile : tiles){
|
for(Tile tile : tiles){
|
||||||
int idx = tile.y * tiles.width() + tile.x;
|
int idx = tile.y * tiles.width + tile.x;
|
||||||
|
|
||||||
if(tile.isDarkened()){
|
if(tile.isDarkened()){
|
||||||
tile.rotation(dark[idx]);
|
tile.rotation(dark[idx]);
|
||||||
@@ -341,7 +339,7 @@ public class World{
|
|||||||
boolean full = true;
|
boolean full = true;
|
||||||
for(Point2 p : Geometry.d4){
|
for(Point2 p : Geometry.d4){
|
||||||
int px = p.x + tile.x, py = p.y + tile.y;
|
int px = p.x + tile.x, py = p.y + tile.y;
|
||||||
int nidx = py * tiles.width() + px;
|
int nidx = py * tiles.width + px;
|
||||||
if(tiles.in(px, py) && !(tile.isDarkened() && dark[nidx] == 4)){
|
if(tiles.in(px, py) && !(tile.isDarkened() && dark[nidx] == 4)){
|
||||||
full = false;
|
full = false;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -120,4 +120,9 @@ public class PlanetRenderer implements PlanetGenerator{
|
|||||||
public void generate(Vec3 position, TileGen tile){
|
public void generate(Vec3 position, TileGen tile){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void decorate(Tiles tiles){
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ public class MapIO{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Pixmap generatePreview(Tiles tiles){
|
public static Pixmap generatePreview(Tiles tiles){
|
||||||
Pixmap pixmap = new Pixmap(tiles.width(), tiles.height(), Format.RGBA8888);
|
Pixmap pixmap = new Pixmap(tiles.width, tiles.height, Format.RGBA8888);
|
||||||
for(int x = 0; x < pixmap.getWidth(); x++){
|
for(int x = 0; x < pixmap.getWidth(); x++){
|
||||||
for(int y = 0; y < pixmap.getHeight(); y++){
|
for(int y = 0; y < pixmap.getHeight(); y++){
|
||||||
Tile tile = tiles.getn(x, y);
|
Tile tile = tiles.getn(x, y);
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ public abstract class BasicGenerator extends RandomGenerator{
|
|||||||
Tile end = tiles.getn(endX, endY);
|
Tile end = tiles.getn(endX, endY);
|
||||||
GridBits closed = new GridBits(width, height);
|
GridBits closed = new GridBits(width, height);
|
||||||
IntFloatMap costs = new IntFloatMap();
|
IntFloatMap costs = new IntFloatMap();
|
||||||
PriorityQueue<Tile> queue = new PriorityQueue<>(tiles.width() * tiles.height()/4, (a, b) -> Float.compare(costs.get(a.pos(), 0f) + dh.cost(a.x, a.y, end.x, end.y), costs.get(b.pos(), 0f) + dh.cost(b.x, b.y, end.x, end.y)));
|
PriorityQueue<Tile> queue = new PriorityQueue<>(tiles.width * tiles.height /4, (a, b) -> Float.compare(costs.get(a.pos(), 0f) + dh.cost(a.x, a.y, end.x, end.y), costs.get(b.pos(), 0f) + dh.cost(b.x, b.y, end.x, end.y)));
|
||||||
queue.add(start);
|
queue.add(start);
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
while(!queue.isEmpty()){
|
while(!queue.isEmpty()){
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class MapGenerator extends Generator{
|
|||||||
for(Tile tile : tiles){
|
for(Tile tile : tiles){
|
||||||
if(tile.overlay() == Blocks.spawn){
|
if(tile.overlay() == Blocks.spawn){
|
||||||
int rad = 10;
|
int rad = 10;
|
||||||
Geometry.circle(tile.x, tile.y, tiles.width(), tiles.height(), rad, (wx, wy) -> {
|
Geometry.circle(tile.x, tile.y, tiles.width, tiles.height, rad, (wx, wy) -> {
|
||||||
if(tile.overlay().itemDrop != null){
|
if(tile.overlay().itemDrop != null){
|
||||||
tile.clearOverlay();
|
tile.clearOverlay();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,11 +20,14 @@ public abstract class RandomGenerator extends Generator{
|
|||||||
public void generate(Tiles tiles){
|
public void generate(Tiles tiles){
|
||||||
for(int x = 0; x < width; x++){
|
for(int x = 0; x < width; x++){
|
||||||
for(int y = 0; y < height; y++){
|
for(int y = 0; y < height; y++){
|
||||||
floor = Blocks.air;
|
Tile prev = tiles.getn(x, y);
|
||||||
block = Blocks.air;
|
floor = prev.floor();
|
||||||
ore = Blocks.air;
|
block = prev.block();
|
||||||
|
ore = prev.overlay();
|
||||||
generate(x, y);
|
generate(x, y);
|
||||||
tiles.set(x, y, new Tile(x, y, floor, ore, block));
|
prev.setFloor(floor.asFloor());
|
||||||
|
prev.setBlock(block);
|
||||||
|
prev.setOverlay(ore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,4 +8,5 @@ public interface PlanetGenerator{
|
|||||||
float getHeight(Vec3 position);
|
float getHeight(Vec3 position);
|
||||||
Color getColor(Vec3 position);
|
Color getColor(Vec3 position);
|
||||||
void generate(Vec3 position, TileGen tile);
|
void generate(Vec3 position, TileGen tile);
|
||||||
|
void decorate(Tiles tiles);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,14 @@ package mindustry.maps.planet;
|
|||||||
import arc.graphics.*;
|
import arc.graphics.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
|
import arc.struct.*;
|
||||||
import arc.util.*;
|
import arc.util.*;
|
||||||
import arc.util.noise.*;
|
import arc.util.noise.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
|
import mindustry.game.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
|
||||||
|
//TODO refactor into generic planet class
|
||||||
public class TestPlanetGenerator implements PlanetGenerator{
|
public class TestPlanetGenerator implements PlanetGenerator{
|
||||||
Simplex noise = new Simplex();
|
Simplex noise = new Simplex();
|
||||||
float scl = 5f;
|
float scl = 5f;
|
||||||
@@ -53,6 +56,57 @@ public class TestPlanetGenerator implements PlanetGenerator{
|
|||||||
@Override
|
@Override
|
||||||
public void generate(Vec3 position, TileGen tile){
|
public void generate(Vec3 position, TileGen tile){
|
||||||
tile.floor = getBlock(position);
|
tile.floor = getBlock(position);
|
||||||
|
tile.block = tile.floor.asFloor().wall;
|
||||||
|
|
||||||
|
if(noise.octaveNoise3D(5, 0.6, 8.0, position.x, position.y, position.z) > 0.65){
|
||||||
|
tile.block = Blocks.air;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void decorate(Tiles tiles){
|
||||||
|
//OvergrowthGenerator generator = new OvergrowthGenerator(tiles.width, tiles.height);
|
||||||
|
//generator.init(Loadouts.basicNucleus);
|
||||||
|
//generator.generate(tiles);
|
||||||
|
GridBits write = new GridBits(tiles.width, tiles.height);
|
||||||
|
GridBits read = new GridBits(tiles.width, tiles.height);
|
||||||
|
|
||||||
|
//double removalChance = 0.2;
|
||||||
|
//remove random tiles
|
||||||
|
//tiles.each((x, y) -> {
|
||||||
|
|
||||||
|
//});
|
||||||
|
|
||||||
|
tiles.each((x, y) -> read.set(x, y, !tiles.get(x, y).block().isAir()));
|
||||||
|
|
||||||
|
int iterations = 4, birthLimit = 16, deathLimit = 16, radius = 3;
|
||||||
|
|
||||||
|
for(int i = 0; i < iterations; i++){
|
||||||
|
tiles.each((x, y) -> {
|
||||||
|
int alive = 0;
|
||||||
|
|
||||||
|
for(int cx = -radius; cx <= radius; cx++){
|
||||||
|
for(int cy = -radius; cy <= radius; cy++){
|
||||||
|
if((cx == 0 && cy == 0) || !Mathf.within(cx, cy, radius)) continue;
|
||||||
|
if(!Structs.inBounds(x + cx, y + cy, tiles.width, tiles.height) || read.get(x + cx, y + cy)){
|
||||||
|
alive++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(read.get(x, y)){
|
||||||
|
write.set(x, y, alive >= deathLimit);
|
||||||
|
}else{
|
||||||
|
write.set(x, y, alive > birthLimit);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//flush results.
|
||||||
|
tiles.each((x, y) -> read.set(x, y, write.get(x, y)));
|
||||||
|
}
|
||||||
|
|
||||||
|
tiles.each((x, y) -> tiles.get(x, y).setBlock(!write.get(x, y) ? Blocks.air : tiles.get(x, y).floor().wall));
|
||||||
|
tiles.get(tiles.width /2, tiles.height /2).setBlock(Blocks.coreShard, Team.sharded);
|
||||||
}
|
}
|
||||||
|
|
||||||
Block getBlock(Vec3 position){
|
Block getBlock(Vec3 position){
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import mindustry.world.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.schematics;
|
import static mindustry.Vars.schematics;
|
||||||
|
|
||||||
|
//TODO remove
|
||||||
public class DesertWastesGenerator extends BasicGenerator{
|
public class DesertWastesGenerator extends BasicGenerator{
|
||||||
|
|
||||||
public DesertWastesGenerator(int width, int height){
|
public DesertWastesGenerator(int width, int height){
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import mindustry.world.*;
|
|||||||
|
|
||||||
import static mindustry.Vars.schematics;
|
import static mindustry.Vars.schematics;
|
||||||
|
|
||||||
|
//TODO remove
|
||||||
public class OvergrowthGenerator extends BasicGenerator{
|
public class OvergrowthGenerator extends BasicGenerator{
|
||||||
|
|
||||||
public OvergrowthGenerator(int width, int height){
|
public OvergrowthGenerator(int width, int height){
|
||||||
@@ -15,13 +16,12 @@ public class OvergrowthGenerator extends BasicGenerator{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void generate(int x, int y){
|
public void generate(int x, int y){
|
||||||
floor = Blocks.moss;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void decorate(Tiles tiles){
|
public void decorate(Tiles tiles){
|
||||||
ores(tiles);
|
ores(tiles);
|
||||||
terrain(tiles, Blocks.sporePine, 70f, 1.4f, 1f);
|
//terrain(tiles, Blocks.sporePine, 70f, 1.4f, 1f);
|
||||||
|
|
||||||
int rand = 40;
|
int rand = 40;
|
||||||
int border = 25;
|
int border = 25;
|
||||||
@@ -36,7 +36,7 @@ public class OvergrowthGenerator extends BasicGenerator{
|
|||||||
distort(tiles, 20f, 4f);
|
distort(tiles, 20f, 4f);
|
||||||
inverseFloodFill(tiles, tiles.getn(spawnX, spawnY), Blocks.sporerocks);
|
inverseFloodFill(tiles, tiles.getn(spawnX, spawnY), Blocks.sporerocks);
|
||||||
|
|
||||||
noise(tiles, Blocks.darksandTaintedWater, Blocks.duneRocks, 4, 0.7f, 120f, 0.64f);
|
//noise(tiles, Blocks.darksandTaintedWater, Blocks.duneRocks, 4, 0.7f, 120f, 0.64f);
|
||||||
//scatter(tiles, Blocks.sporePine, Blocks.whiteTreeDead, 1f);
|
//scatter(tiles, Blocks.sporePine, Blocks.whiteTreeDead, 1f);
|
||||||
|
|
||||||
tiles.getn(endX, endY).setOverlay(Blocks.spawn);
|
tiles.getn(endX, endY).setOverlay(Blocks.spawn);
|
||||||
|
|||||||
@@ -161,6 +161,10 @@ public class Block extends BlockStorage{
|
|||||||
this.solid = false;
|
this.solid = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isAir(){
|
||||||
|
return id == 0;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canBreak(Tile tile){
|
public boolean canBreak(Tile tile){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ import java.util.*;
|
|||||||
|
|
||||||
/** A tile container. */
|
/** A tile container. */
|
||||||
public class Tiles implements Iterable<Tile>{
|
public class Tiles implements Iterable<Tile>{
|
||||||
|
public final int width, height;
|
||||||
|
|
||||||
private final Tile[] array;
|
private final Tile[] array;
|
||||||
private final int width, height;
|
|
||||||
private final TileIterator iterator = new TileIterator();
|
private final TileIterator iterator = new TileIterator();
|
||||||
|
|
||||||
public Tiles(int width, int height){
|
public Tiles(int width, int height){
|
||||||
@@ -63,14 +64,6 @@ public class Tiles implements Iterable<Tile>{
|
|||||||
return get(Pos.x(pos), Pos.y(pos));
|
return get(Pos.x(pos), Pos.y(pos));
|
||||||
}
|
}
|
||||||
|
|
||||||
public int width(){
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int height(){
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Iterator<Tile> iterator(){
|
public Iterator<Tile> iterator(){
|
||||||
iterator.index = 0;
|
iterator.index = 0;
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import arc.graphics.g2d.*;
|
|||||||
import arc.graphics.g2d.TextureAtlas.*;
|
import arc.graphics.g2d.TextureAtlas.*;
|
||||||
import arc.math.*;
|
import arc.math.*;
|
||||||
import arc.math.geom.*;
|
import arc.math.geom.*;
|
||||||
import arc.util.ArcAnnotate.*;
|
|
||||||
import arc.struct.*;
|
import arc.struct.*;
|
||||||
|
import arc.util.ArcAnnotate.*;
|
||||||
import mindustry.content.*;
|
import mindustry.content.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
import mindustry.graphics.*;
|
import mindustry.graphics.*;
|
||||||
@@ -16,7 +16,7 @@ import mindustry.type.*;
|
|||||||
import mindustry.ui.*;
|
import mindustry.ui.*;
|
||||||
import mindustry.world.*;
|
import mindustry.world.*;
|
||||||
|
|
||||||
import static mindustry.Vars.tilesize;
|
import static mindustry.Vars.*;
|
||||||
|
|
||||||
public class Floor extends Block{
|
public class Floor extends Block{
|
||||||
/** number of different variant regions to use */
|
/** number of different variant regions to use */
|
||||||
@@ -57,6 +57,8 @@ public class Floor extends Block{
|
|||||||
public boolean oreDefault = false;
|
public boolean oreDefault = false;
|
||||||
/** Ore generation params. */
|
/** Ore generation params. */
|
||||||
public float oreScale = 24f, oreThreshold = 0.828f;
|
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 TextureRegion[][] edges;
|
||||||
protected byte eq = 0;
|
protected byte eq = 0;
|
||||||
@@ -92,6 +94,20 @@ public class Floor extends Block{
|
|||||||
edgeRegion = Core.atlas.find("edge");
|
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
|
@Override
|
||||||
public void createIcons(MultiPacker packer){
|
public void createIcons(MultiPacker packer){
|
||||||
super.createIcons(packer);
|
super.createIcons(packer);
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
org.gradle.daemon=true
|
org.gradle.daemon=true
|
||||||
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
org.gradle.jvmargs=-Xms256m -Xmx1024m
|
||||||
archash=0b2f044e5955ff700650eebecfb3dfcb629d7a8b
|
archash=d20c0312e740a9845a358fc4571926ad784c0bbc
|
||||||
|
|||||||
@@ -388,14 +388,14 @@ public class ApplicationTests{
|
|||||||
Tiles tiles = world.resize(256*2 + 20, 10);
|
Tiles tiles = world.resize(256*2 + 20, 10);
|
||||||
|
|
||||||
world.beginMapLoad();
|
world.beginMapLoad();
|
||||||
for(int x = 0; x < tiles.width(); x++){
|
for(int x = 0; x < tiles.width; x++){
|
||||||
for(int y = 0; y < tiles.height(); y++){
|
for(int y = 0; y < tiles.height; y++){
|
||||||
tiles.set(x, y, new Tile(x, y, Blocks.stone, Blocks.air, Blocks.air));
|
tiles.set(x, y, new Tile(x, y, Blocks.stone, Blocks.air, Blocks.air));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for(int x = 5; x < tiles.width() && i < content.blocks().size; ){
|
for(int x = 5; x < tiles.width && i < content.blocks().size; ){
|
||||||
Block block = content.block(i++);
|
Block block = content.block(i++);
|
||||||
if(block.isBuildable()){
|
if(block.isBuildable()){
|
||||||
x += block.size;
|
x += block.size;
|
||||||
@@ -405,8 +405,8 @@ public class ApplicationTests{
|
|||||||
}
|
}
|
||||||
world.endMapLoad();
|
world.endMapLoad();
|
||||||
|
|
||||||
for(int x = 0; x < tiles.width(); x++){
|
for(int x = 0; x < tiles.width; x++){
|
||||||
for(int y = 0; y < tiles.height(); y++){
|
for(int y = 0; y < tiles.height; y++){
|
||||||
Tile tile = world.rawTile(x, y);
|
Tile tile = world.rawTile(x, y);
|
||||||
if(tile.entity != null){
|
if(tile.entity != null){
|
||||||
try{
|
try{
|
||||||
|
|||||||
Reference in New Issue
Block a user