New ferric blocks, improved asteroid generation

This commit is contained in:
Anuken
2021-06-19 21:19:46 -04:00
parent ca60309fde
commit 3c65a26d72
16 changed files with 43 additions and 46 deletions

View File

@@ -11,9 +11,9 @@ import mindustry.world.meta.*;
import static mindustry.Vars.*;
public class AsteroidGenerator extends BlankPlanetGenerator{
public static int min = 15, max = 25, octaves = 2, foct = 3;
public static int min = 20, max = 28, octaves = 2, foct = 3;
public static float radMin = 5f, radMax = 50f, persistence = 0.4f, scale = 30f, mag = 0.46f, thresh = 1f;
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;
@@ -25,7 +25,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){
tiles.getn(x, y).setFloor(Blocks.stone.asFloor());
tiles.getn(x, y).setFloor(Blocks.ferricStone.asFloor());
}
}
}
@@ -51,7 +51,7 @@ public class AsteroidGenerator extends BlankPlanetGenerator{
}
//tiny asteroids.
int smalls = rand.random(min, max * 2);
int smalls = rand.random(min, max) * 3;
for(int i = 0; i < smalls; i++){
float radius = rand.random(1, 8), ax = rand.random(radius, width - radius), ay = rand.random(radius, height - radius);
@@ -61,15 +61,15 @@ public class AsteroidGenerator extends BlankPlanetGenerator{
pass((x, y) -> {
if(floor != Blocks.space){
if(Ridged.noise2d(seed, x, y, foct, fper, 1f / fscl) > fmag){
floor = Blocks.graphiticStone;
floor = Blocks.stone;
}
}
});
pass((x, y) -> {
if(floor == Blocks.space || Ridged.noise2d(seed + 1, x, y, 3, 0.5f, 1f / 70f) > 0.5f) return;
if(floor == Blocks.space || Ridged.noise2d(seed + 1, x, y, 3, 0.5f, 1f / 60f) > 0.38f || Mathf.within(x, y, sx, sy, 20 + Ridged.noise2d(seed, x, y, 3, 0.5f, 1f / 30f) * 6f)) return;
int radius = 5;
int radius = 6;
for(int dx = x - radius; dx <= x + radius; dx++){
for(int dy = y - radius; dy <= y + radius; dy++){
if(Mathf.within(dx, dy, x, y, radius + 0.0001f) && tiles.in(dx, dy) && tiles.getn(dx, dy).floor() == Blocks.space){
@@ -82,6 +82,11 @@ public class AsteroidGenerator extends BlankPlanetGenerator{
});
pass((x, y) -> {
if(floor == Blocks.ferricStone && rand.chance(0.02)) floor = Blocks.ferricCraters;
if(floor == Blocks.stone && rand.chance(0.02)) floor = Blocks.craters;
});
Schematics.placeLaunchLoadout(sx, sy);
state.rules.environment = Env.space;
@@ -89,6 +94,6 @@ public class AsteroidGenerator extends BlankPlanetGenerator{
@Override
public int getSectorSize(Sector sector){
return 450;
return 500;
}
}