Editor experimental sector generator
This commit is contained in:
@@ -408,7 +408,7 @@ public abstract class BasicGenerator implements WorldGenerator{
|
||||
if(cx*cx + cy*cy <= r2){
|
||||
Tile other = tiles.get(tile.x + cx, tile.y + cy);
|
||||
|
||||
if(other != null){
|
||||
if(other != null && other.floor() != floor){
|
||||
other.setFloor(dest);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,10 +30,10 @@ public class BlankPlanetGenerator extends PlanetGenerator{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generate(Tiles tiles, Sector sec){
|
||||
public void generate(Tiles tiles, Sector sec, int seed){
|
||||
this.tiles = tiles;
|
||||
this.sector = sec;
|
||||
this.rand.setSeed(sec.id);
|
||||
this.rand.setSeed(sec.id + seed + baseSeed);
|
||||
|
||||
tiles.fill();
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@ import mindustry.world.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public abstract class PlanetGenerator extends BasicGenerator implements HexMesher{
|
||||
public int baseSeed = 0;
|
||||
public int seed = 0;
|
||||
|
||||
protected IntSeq ints = new IntSeq();
|
||||
protected Sector sector;
|
||||
|
||||
@@ -128,10 +131,11 @@ public abstract class PlanetGenerator extends BasicGenerator implements HexMeshe
|
||||
return res % 2 == 0 ? res : res + 1;
|
||||
}
|
||||
|
||||
public void generate(Tiles tiles, Sector sec){
|
||||
public void generate(Tiles tiles, Sector sec, int seed){
|
||||
this.tiles = tiles;
|
||||
this.seed = seed + baseSeed;
|
||||
this.sector = sec;
|
||||
this.rand.setSeed(sec.id);
|
||||
this.rand.setSeed(sec.id + seed + baseSeed);
|
||||
|
||||
TileGen gen = new TileGen();
|
||||
tiles.each((x, y) -> {
|
||||
|
||||
@@ -18,8 +18,6 @@ import mindustry.world.meta.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class ErekirPlanetGenerator extends PlanetGenerator{
|
||||
static final int seed = 2;
|
||||
|
||||
public float scl = 2f;
|
||||
public float heightScl = 0.9f, octaves = 8, persistence = 0.7f, heightPow = 3f, heightMult = 1.6f;
|
||||
|
||||
@@ -30,6 +28,10 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
||||
//{Blocks.regolith, Blocks.regolith, Blocks.yellowStone, Blocks.crystallineStone, Blocks.carbonStone}
|
||||
};
|
||||
|
||||
{
|
||||
baseSeed = 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateSector(Sector sector){
|
||||
//no bases right now
|
||||
@@ -96,11 +98,11 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
||||
|
||||
tile.block = tile.floor.asFloor().wall;
|
||||
|
||||
if(Ridged.noise3d(1, position.x, position.y, position.z, 2, 14) > 0.14){
|
||||
if(Ridged.noise3d(seed + 1, position.x, position.y, position.z, 2, 14) > 0.14){
|
||||
tile.block = Blocks.air;
|
||||
}
|
||||
|
||||
if(Ridged.noise3d(2, position.x, position.y + 4f, position.z, 3, 6f) > 0.6){
|
||||
if(Ridged.noise3d(seed + 2, position.x, position.y + 4f, position.z, 3, 6f) > 0.6){
|
||||
tile.floor = Blocks.carbonStone;
|
||||
}
|
||||
}
|
||||
@@ -257,6 +259,8 @@ public class ErekirPlanetGenerator extends PlanetGenerator{
|
||||
//}
|
||||
});
|
||||
|
||||
trimDark();
|
||||
|
||||
//vents
|
||||
outer:
|
||||
for(Tile tile : tiles){
|
||||
|
||||
@@ -21,7 +21,6 @@ import static mindustry.Vars.*;
|
||||
public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
//alternate, less direct generation (wip)
|
||||
public static boolean alt = false;
|
||||
static final int seed = 0;
|
||||
|
||||
BaseGenerator basegen = new BaseGenerator();
|
||||
float scl = 5f;
|
||||
@@ -120,7 +119,7 @@ public class SerpuloPlanetGenerator extends PlanetGenerator{
|
||||
tile.floor = getBlock(position);
|
||||
tile.block = tile.floor.asFloor().wall;
|
||||
|
||||
if(Ridged.noise3d(1, position.x, position.y, position.z, 2, 22) > 0.31){
|
||||
if(Ridged.noise3d(seed + 1, position.x, position.y, position.z, 2, 22) > 0.31){
|
||||
tile.block = Blocks.air;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,14 +16,16 @@ import mindustry.world.meta.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class TantrosPlanetGenerator extends PlanetGenerator{
|
||||
static final int seed = 1;
|
||||
|
||||
Color c1 = Color.valueOf("5057a6"), c2 = Color.valueOf("272766"), out = new Color();
|
||||
|
||||
Block[][] arr = {
|
||||
{Blocks.redmat, Blocks.redmat, Blocks.darksand, Blocks.bluemat, Blocks.bluemat}
|
||||
};
|
||||
|
||||
{
|
||||
baseSeed = 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateSector(Sector sector){
|
||||
//no bases
|
||||
|
||||
Reference in New Issue
Block a user