Cleanup
This commit is contained in:
@@ -140,50 +140,8 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private @Nullable String lastSec;
|
|
||||||
|
|
||||||
private void sec(String name){
|
|
||||||
if(lastSec != null){
|
|
||||||
float elapsed = Time.elapsed();
|
|
||||||
Log.info("@: @ (@ sec)", lastSec.toUpperCase(), elapsed, Strings.fixed(elapsed / 1000f, 2));
|
|
||||||
}
|
|
||||||
if(name != null){
|
|
||||||
Time.mark();
|
|
||||||
}
|
|
||||||
lastSec = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO remove
|
|
||||||
@Override
|
|
||||||
public void generate(Tiles tiles, Sector sec, int seed){
|
|
||||||
this.tiles = tiles;
|
|
||||||
this.seed = seed + baseSeed;
|
|
||||||
this.sector = sec;
|
|
||||||
this.width = tiles.width;
|
|
||||||
this.height = tiles.height;
|
|
||||||
this.rand.setSeed(sec.id + seed + baseSeed);
|
|
||||||
|
|
||||||
long begin = Time.millis();
|
|
||||||
sec("genTile");
|
|
||||||
|
|
||||||
TileGen gen = new TileGen();
|
|
||||||
for(int y = 0; y < height; y++){
|
|
||||||
for(int x = 0; x < width; x++){
|
|
||||||
gen.reset();
|
|
||||||
Vec3 position = sector.rect.project(x / (float)tiles.width, y / (float)tiles.height);
|
|
||||||
|
|
||||||
genTile(position, gen);
|
|
||||||
tiles.set(x, y, new Tile(x, y, gen.floor, gen.overlay, gen.block));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
generate(tiles);
|
|
||||||
Log.info("TOTAL TILE: @ (@ sec)", Time.timeSinceMillis(begin), Strings.fixed(Time.timeSinceMillis(begin) / 1000f, 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void generate(){
|
protected void generate(){
|
||||||
sec("tempPass");
|
|
||||||
float temp = rawTemp(sector.tile.v);
|
float temp = rawTemp(sector.tile.v);
|
||||||
|
|
||||||
if(temp > 0.7){
|
if(temp > 0.7){
|
||||||
@@ -208,8 +166,6 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
sec("cells1");
|
|
||||||
|
|
||||||
cells(4);
|
cells(4);
|
||||||
|
|
||||||
//regolith walls for more dense terrain
|
//regolith walls for more dense terrain
|
||||||
@@ -229,14 +185,10 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
endX = (int)(-trns.x + width/2f), endY = (int)(-trns.y + height/2f);
|
endX = (int)(-trns.x + width/2f), endY = (int)(-trns.y + height/2f);
|
||||||
float maxd = Mathf.dst(width/2f, height/2f);
|
float maxd = Mathf.dst(width/2f, height/2f);
|
||||||
|
|
||||||
sec("pathfinding");
|
|
||||||
|
|
||||||
erase(spawnX, spawnY, 15);
|
erase(spawnX, spawnY, 15);
|
||||||
brush(pathfind(spawnX, spawnY, endX, endY, tile -> (tile.solid() ? 300f : 0f) + maxd - tile.dst(width/2f, height/2f)/10f, Astar.manhattan), 9);
|
brush(pathfind(spawnX, spawnY, endX, endY, tile -> (tile.solid() ? 300f : 0f) + maxd - tile.dst(width/2f, height/2f)/10f, Astar.manhattan), 9);
|
||||||
erase(endX, endY, 15);
|
erase(endX, endY, 15);
|
||||||
|
|
||||||
sec("arkycite");
|
|
||||||
|
|
||||||
//arkycite
|
//arkycite
|
||||||
pass((x, y) -> {
|
pass((x, y) -> {
|
||||||
if(floor != Blocks.beryllicStone) return;
|
if(floor != Blocks.beryllicStone) return;
|
||||||
@@ -259,26 +211,18 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
|
|
||||||
blend(Blocks.arkyciteFloor, Blocks.arkyicStone, 4);
|
blend(Blocks.arkyciteFloor, Blocks.arkyicStone, 4);
|
||||||
|
|
||||||
sec("slag");
|
|
||||||
|
|
||||||
//TODO may overwrite floor blocks under walls and look bad
|
//TODO may overwrite floor blocks under walls and look bad
|
||||||
blend(Blocks.slag, Blocks.yellowStonePlates, 4);
|
blend(Blocks.slag, Blocks.yellowStonePlates, 4);
|
||||||
|
|
||||||
sec("distort");
|
|
||||||
|
|
||||||
distort(10f, 12f);
|
distort(10f, 12f);
|
||||||
distort(5f, 7f);
|
distort(5f, 7f);
|
||||||
|
|
||||||
sec("arkycite-slag-median");
|
|
||||||
|
|
||||||
//does arkycite need smoothing?
|
//does arkycite need smoothing?
|
||||||
median(2, 0.6, Blocks.arkyciteFloor);
|
median(2, 0.6, Blocks.arkyciteFloor);
|
||||||
|
|
||||||
//smooth out slag to prevent random 1-tile patches
|
//smooth out slag to prevent random 1-tile patches
|
||||||
median(3, 0.6, Blocks.slag);
|
median(3, 0.6, Blocks.slag);
|
||||||
|
|
||||||
sec("details 1");
|
|
||||||
|
|
||||||
pass((x, y) -> {
|
pass((x, y) -> {
|
||||||
//rough rhyolite
|
//rough rhyolite
|
||||||
if(noise(x, y + 600 + x, 5, 0.86f, 60f, 1f) < 0.41f && floor == Blocks.rhyolite){
|
if(noise(x, y + 600 + x, 5, 0.86f, 60f, 1f) < 0.41f && floor == Blocks.rhyolite){
|
||||||
@@ -312,17 +256,11 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
sec("inverse flood fill");
|
|
||||||
|
|
||||||
inverseFloodFill(tiles.getn(spawnX, spawnY));
|
inverseFloodFill(tiles.getn(spawnX, spawnY));
|
||||||
|
|
||||||
sec("redStone");
|
|
||||||
|
|
||||||
//TODO veins, blend after inverse flood fill?
|
//TODO veins, blend after inverse flood fill?
|
||||||
blend(Blocks.redStoneWall, Blocks.denseRedStone, 4);
|
blend(Blocks.redStoneWall, Blocks.denseRedStone, 4);
|
||||||
|
|
||||||
sec("ores");
|
|
||||||
|
|
||||||
//make sure enemies have room
|
//make sure enemies have room
|
||||||
erase(endX, endY, 6);
|
erase(endX, endY, 6);
|
||||||
|
|
||||||
@@ -376,15 +314,8 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
block = Blocks.crystalBlocks;
|
block = Blocks.crystalBlocks;
|
||||||
ore = Blocks.air;
|
ore = Blocks.air;
|
||||||
}
|
}
|
||||||
|
|
||||||
//this is annoying as blocks under it can't be seen
|
|
||||||
//if(block == Blocks.air && floor == Blocks.regolith && rand.chance(0.004) && !near(x, y, 3, Blocks.crystalBlocks)){
|
|
||||||
// block = Blocks.crystalBlocks;
|
|
||||||
//}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
sec("trim dark");
|
|
||||||
|
|
||||||
//remove props near ores, they're too annoying
|
//remove props near ores, they're too annoying
|
||||||
pass((x, y) -> {
|
pass((x, y) -> {
|
||||||
if(ore.asFloor().wallOre || block.itemDrop != null || (block == Blocks.air && ore != Blocks.air)){
|
if(ore.asFloor().wallOre || block.itemDrop != null || (block == Blocks.air && ore != Blocks.air)){
|
||||||
@@ -394,8 +325,6 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
|
|
||||||
trimDark();
|
trimDark();
|
||||||
|
|
||||||
sec("vents");
|
|
||||||
|
|
||||||
int minVents = rand.random(6, 9);
|
int minVents = rand.random(6, 9);
|
||||||
int ventCount = 0;
|
int ventCount = 0;
|
||||||
|
|
||||||
@@ -503,8 +432,6 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sec("decoration");
|
|
||||||
|
|
||||||
for(Tile tile : tiles){
|
for(Tile tile : tiles){
|
||||||
if(tile.overlay().needsSurface && !tile.floor().hasSurface()){
|
if(tile.overlay().needsSurface && !tile.floor().hasSurface()){
|
||||||
tile.setOverlay(Blocks.air);
|
tile.setOverlay(Blocks.air);
|
||||||
@@ -524,7 +451,5 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
|||||||
//all sectors are wave sectors
|
//all sectors are wave sectors
|
||||||
state.rules.waves = true;
|
state.rules.waves = true;
|
||||||
state.rules.showSpawns = true;
|
state.rules.showSpawns = true;
|
||||||
|
|
||||||
sec("");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user