This commit is contained in:
Anuken
2021-06-21 19:35:00 -04:00
parent 4a88f64fa9
commit ff3940865e
3 changed files with 77 additions and 4 deletions

View File

@@ -1998,6 +1998,7 @@ public class Blocks implements ContentList{
length = 200f;
hitEffect = Fx.hitMeltdown;
hitColor = Pal.meltdownHit;
status = StatusEffects.melting;
drawSize = 420f;
incendChance = 0.4f;

View File

@@ -118,6 +118,56 @@ public abstract class BasicGenerator implements WorldGenerator{
}
}
public void wallOre(Block src, Block dest, float scl, float thresh){
boolean overlay = dest.isOverlay();
pass((x, y) -> {
if(block != Blocks.air){
boolean empty = false;
for(Point2 p : Geometry.d8){
Tile other = tiles.get(x + p.x, y + p.y);
if(other != null && other.block() == Blocks.air){
empty = true;
break;
}
}
if(empty && noise(x + 78, y, 4, 0.7f, scl, 1f) > thresh && block == src){
if(overlay){
ore = dest;
}else{
block = dest;
}
}
}
});
}
public void cliffs(){
for(Tile tile : tiles){
if(!tile.block().isStatic() || tile.block() == Blocks.cliff) continue;
int rotation = 0;
for(int i = 0; i < 8; i++){
Tile other = world.tiles.get(tile.x + Geometry.d8[i].x, tile.y + Geometry.d8[i].y);
if(other != null && !other.block().isStatic()){
rotation |= (1 << i);
}
}
if(rotation != 0){
tile.setBlock(Blocks.cliff);
}
tile.data = (byte)rotation;
}
for(Tile tile : tiles){
if(tile.block() != Blocks.cliff && tile.block().isStatic()){
tile.setBlock(Blocks.air);
}
}
}
public void terrain(Block dst, float scl, float mag, float cmag){
pass((x, y) -> {
double rocks = noise(x, y, 5, 0.5, scl) * mag

View File

@@ -15,7 +15,7 @@ public class AsteroidGenerator extends BlankPlanetGenerator{
//TODO nonstatic
public static int min = 20, max = 28, octaves = 2, foct = 3;
public static float radMin = 12f, radMax = 60f, persistence = 0.4f, scale = 30f, mag = 0.46f, thresh = 1f;
public static float fmag = 0.6f, fscl = 50f, fper = 0.6f;
public static float fmag = 0.59f, fscl = 50f, fper = 0.6f;
public static float iceChance = 0.05f, carbonChance = 0.1f;
Rand rand;
@@ -30,7 +30,7 @@ public class AsteroidGenerator extends BlankPlanetGenerator{
for(int x = ax - radius; x <= ax + radius; x++){
for(int y = ay - radius; y <= ay + radius; y++){
if(tiles.in(x, y) && Mathf.dst(x, y, ax, ay) / (radius) + Simplex.noise2d(seed, octaves, persistence, 1f / scale, x, y) * mag < thresh){
if(tiles.in(x, y) && Mathf.dst(x, y, ax, ay) / radius + Simplex.noise2d(seed, octaves, persistence, 1f / scale, x, y) * mag < thresh){
tiles.getn(x, y).setFloor(floor);
}
}
@@ -68,7 +68,7 @@ public class AsteroidGenerator extends BlankPlanetGenerator{
//random noise stone
pass((x, y) -> {
if(floor != Blocks.space){
if(Ridged.noise2d(seed, x, y, foct, fper, 1f / fscl) > fmag){
if(Ridged.noise2d(seed, x, y, foct, fper, 1f / fscl) - Ridged.noise2d(seed, x, y, 1, 1f, 5f)/2.7f > fmag){
floor = Blocks.stone;
}
}
@@ -100,11 +100,33 @@ public class AsteroidGenerator extends BlankPlanetGenerator{
decoration(0.013f);
//lead generates around stone walls
oreAround(Blocks.oreLead, Blocks.stoneWall, 3, 69f, 0.6f);
oreAround(Blocks.oreLead, Blocks.stoneWall, 3, 70f, 0.6f);
//copper only generates on ferric stone
ore(Blocks.oreCopper, Blocks.ferricStone, 5f, 0.8f);
wallOre(Blocks.carbonWall, Blocks.graphiticWall, 35f, 0.57f);
//TODO
//wallOre(Blocks.iceWall, Blocks.wallOreBeryl, 35f, 0.57f);
//TODO:
//- thorium - cores?
//- copper maybe should not exist
//- consider replacing certain ores with something else
//- sand source - olivine/pyroxene
//- beryllium in walls
//titanium
pass((x, y) -> {
if(floor != Blocks.stone) return;
int i = 4;
if(Math.abs(0.5f - noise(x, y + i*999 - x*1.5f, 2, 0.65, (60 + i * 2))) > 0.26f * 1f){
ore = Blocks.oreTitanium;
}
});
Schematics.placeLaunchLoadout(sx, sy);
state.rules.environment = Env.space;