Asteroid ores (1)
This commit is contained in:
BIN
core/assets-raw/sprites/blocks/props/ferric-boulder1.png
Normal file
BIN
core/assets-raw/sprites/blocks/props/ferric-boulder1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 481 B |
BIN
core/assets-raw/sprites/blocks/props/ferric-boulder2.png
Normal file
BIN
core/assets-raw/sprites/blocks/props/ferric-boulder2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 486 B |
@@ -386,3 +386,4 @@
|
||||
63347=ferric-stone|block-ferric-stone-ui
|
||||
63346=ferric-stone-wall|block-ferric-stone-wall-ui
|
||||
63345=ferric-craters|block-ferric-craters-ui
|
||||
63344=ferric-boulder|block-ferric-boulder-ui
|
||||
|
||||
@@ -42,7 +42,8 @@ public class Blocks implements ContentList{
|
||||
redweed, purbush, coralChunk, yellowCoral,
|
||||
regolithWall, yellowStoneWall, rhyoliteWall, carbonWall, redIceWall, ferricStoneWall,
|
||||
ferricStone, ferricCraters, graphiticStone,
|
||||
iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, shaleBoulder, sandBoulder, daciteBoulder, boulder, snowBoulder, basaltBoulder, grass, salt,
|
||||
iceSnow, sandWater, darksandWater, duneWall, sandWall, moss, sporeMoss, shale, shaleWall, grass, salt,
|
||||
shaleBoulder, sandBoulder, daciteBoulder, boulder, snowBoulder, basaltBoulder, ferricBoulder,
|
||||
metalFloor, metalFloorDamaged, metalFloor2, metalFloor3, metalFloor4, metalFloor5, basalt, magmarock, hotrock, snowWall, saltWall,
|
||||
darkPanel1, darkPanel2, darkPanel3, darkPanel4, darkPanel5, darkPanel6, darkMetal,
|
||||
pebbles, tendrils,
|
||||
@@ -477,6 +478,11 @@ public class Blocks implements ContentList{
|
||||
variants = 2;
|
||||
}};
|
||||
|
||||
ferricBoulder = new Prop("ferric-boulder"){{
|
||||
variants = 2;
|
||||
ferricStone.asFloor().decoration = this;
|
||||
}};
|
||||
|
||||
moss = new Floor("moss"){{
|
||||
variants = 3;
|
||||
attributes.set(Attribute.spores, 0.15f);
|
||||
|
||||
@@ -83,6 +83,41 @@ public abstract class BasicGenerator implements WorldGenerator{
|
||||
});
|
||||
}
|
||||
|
||||
public void ore(Block dest, Block src, float i, float thresh){
|
||||
pass((x, y) -> {
|
||||
if(floor != src) return;
|
||||
|
||||
if(Math.abs(0.5f - noise(x, y + i*999, 2, 0.7, (40 + i * 2))) > 0.26f * thresh &&
|
||||
Math.abs(0.5f - noise(x, y - i*999, 1, 1, (30 + i * 4))) > 0.37f * thresh){
|
||||
ore = dest;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void oreAround(Block ore, Block wall, int radius, float scl, float thresh){
|
||||
for(Tile tile : tiles){
|
||||
int x = tile.x, y = tile.y;
|
||||
|
||||
if(tile.block() == Blocks.air && tile.floor().hasSurface() && noise(x, y + ore.id*999, scl, 1f) > thresh){
|
||||
boolean found = false;
|
||||
|
||||
outer:
|
||||
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.001f) && tiles.in(dx, dy) && tiles.get(dx, dy).block() == wall){
|
||||
found = true;
|
||||
break outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(found){
|
||||
tile.setOverlay(ore);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void terrain(Block dst, float scl, float mag, float cmag){
|
||||
pass((x, y) -> {
|
||||
double rocks = noise(x, y, 5, 0.5, scl) * mag
|
||||
@@ -245,6 +280,21 @@ public abstract class BasicGenerator implements WorldGenerator{
|
||||
}
|
||||
}
|
||||
|
||||
public void decoration(float chance){
|
||||
pass((x, y) -> {
|
||||
for(int i = 0; i < 4; i++){
|
||||
Tile near = world.tile(x + Geometry.d4[i].x, y + Geometry.d4[i].y);
|
||||
if(near != null && near.block() != Blocks.air){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(rand.chance(chance) && floor.asFloor().hasSurface() && block == Blocks.air){
|
||||
block = floor.asFloor().decoration;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void brush(Seq<Tile> path, int rad){
|
||||
path.each(tile -> erase(tile.x, tile.y, rad));
|
||||
}
|
||||
|
||||
@@ -6,26 +6,32 @@ import mindustry.content.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.maps.generators.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.blocks.environment.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
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 iceChance = 0.05f, carbonChance = 0.1f;
|
||||
|
||||
Rand rand;
|
||||
int seed;
|
||||
|
||||
void asteroid(int ax, int ay, int radius){
|
||||
Floor floor = (
|
||||
rand.chance(iceChance) ? Blocks.ice :
|
||||
rand.chance(carbonChance) ? Blocks.graphiticStone :
|
||||
Blocks.ferricStone
|
||||
).asFloor();
|
||||
|
||||
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.ferricStone.asFloor());
|
||||
tiles.getn(x, y).setFloor(floor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,6 +47,7 @@ public class AsteroidGenerator extends BlankPlanetGenerator{
|
||||
floor = Blocks.space;
|
||||
});
|
||||
|
||||
//spawn asteroids
|
||||
asteroid(sx, sy, rand.random(30, 50));
|
||||
|
||||
int amount = rand.random(min, max);
|
||||
@@ -50,7 +57,7 @@ public class AsteroidGenerator extends BlankPlanetGenerator{
|
||||
asteroid((int)ax, (int)ay, (int)radius);
|
||||
}
|
||||
|
||||
//tiny asteroids.
|
||||
//tiny asteroids
|
||||
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);
|
||||
@@ -58,6 +65,7 @@ public class AsteroidGenerator extends BlankPlanetGenerator{
|
||||
asteroid((int)ax, (int)ay, (int)radius);
|
||||
}
|
||||
|
||||
//random noise stone
|
||||
pass((x, y) -> {
|
||||
if(floor != Blocks.space){
|
||||
if(Ridged.noise2d(seed, x, y, foct, fper, 1f / fscl) > fmag){
|
||||
@@ -66,6 +74,7 @@ public class AsteroidGenerator extends BlankPlanetGenerator{
|
||||
}
|
||||
});
|
||||
|
||||
//walls at insides
|
||||
pass((x, y) -> {
|
||||
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;
|
||||
|
||||
@@ -82,11 +91,20 @@ public class AsteroidGenerator extends BlankPlanetGenerator{
|
||||
|
||||
});
|
||||
|
||||
//random craters
|
||||
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;
|
||||
});
|
||||
|
||||
decoration(0.013f);
|
||||
|
||||
//lead generates around stone walls
|
||||
oreAround(Blocks.oreLead, Blocks.stoneWall, 3, 69f, 0.6f);
|
||||
|
||||
//copper only generates on ferric stone
|
||||
ore(Blocks.oreCopper, Blocks.ferricStone, 5f, 0.8f);
|
||||
|
||||
Schematics.placeLaunchLoadout(sx, sy);
|
||||
|
||||
state.rules.environment = Env.space;
|
||||
|
||||
@@ -115,10 +115,6 @@ public class LaunchPad extends Block{
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
float cooldown = Mathf.clamp(launchCounter / (90f));
|
||||
|
||||
Draw.mixcol(lightColor, 1f - cooldown);
|
||||
|
||||
Draw.rect(podRegion, x, y);
|
||||
|
||||
Draw.reset();
|
||||
|
||||
Reference in New Issue
Block a user