Unspoiled
This commit is contained in:
181
core/src/mindustry/maps/planet/ErekirPlanetGenerator.java
Normal file
181
core/src/mindustry/maps/planet/ErekirPlanetGenerator.java
Normal file
@@ -0,0 +1,181 @@
|
||||
package mindustry.maps.planet;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.util.*;
|
||||
import arc.util.noise.*;
|
||||
import mindustry.*;
|
||||
import mindustry.ai.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.maps.generators.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class ErekirPlanetGenerator extends PlanetGenerator{
|
||||
RidgedPerlin rid = new RidgedPerlin(1, 2);
|
||||
RidgedPerlin crid = new RidgedPerlin(2, 3);
|
||||
|
||||
public float scl = 2f;
|
||||
public float heightScl = 1f, octaves = 8, persistence = 0.7f, heightPow = 3f, heightMult = 1.5f;
|
||||
|
||||
Block[][] arr = {
|
||||
{Blocks.regolith, Blocks.regolith, Blocks.yellowStone, Blocks.rhyolite, Blocks.basalt}
|
||||
};
|
||||
|
||||
{
|
||||
noise.setSeed(2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateSector(Sector sector){
|
||||
//no bases right now
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHeight(Vec3 position){
|
||||
return Mathf.pow(rawHeight(position), heightPow) * heightMult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getColor(Vec3 position){
|
||||
Block block = getBlock(position);
|
||||
return Tmp.c1.set(block.mapColor).a(1f - block.albedo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSizeScl(){
|
||||
return 2000;
|
||||
}
|
||||
|
||||
float rawHeight(Vec3 position){
|
||||
return (float)noise.octaveNoise3D(octaves, persistence, 1f/heightScl, 10f + position.x, 10f + position.y, 10f + position.z);
|
||||
}
|
||||
|
||||
float rawTemp(Vec3 position){
|
||||
return position.dst(0, 0, 1)*2.2f - (float)noise.octaveNoise3D(8, 0.54f, 1.4f, 10f + position.x, 10f + position.y, 10f + position.z) * 2.9f;
|
||||
}
|
||||
|
||||
Block getBlock(Vec3 position){
|
||||
float ice = rawTemp(position);
|
||||
|
||||
float height = rawHeight(position);
|
||||
Tmp.v31.set(position);
|
||||
position = Tmp.v33.set(position).scl(scl);
|
||||
float temp = (float)noise.octaveNoise3D(8, 0.6, 1f/2f, 10f + position.x, 10f + position.y + 99f, 10f + position.z);
|
||||
height *= 1.2f;
|
||||
height = Mathf.clamp(height);
|
||||
|
||||
Block result = arr[Mathf.clamp((int)(temp * arr.length), 0, arr[0].length - 1)][Mathf.clamp((int)(height * arr[0].length), 0, arr[0].length - 1)];
|
||||
|
||||
if(ice < 0.6){
|
||||
if(result == Blocks.rhyolite || result == Blocks.yellowStone || result == Blocks.regolith){
|
||||
return Blocks.ice;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genTile(Vec3 position, TileGen tile){
|
||||
tile.floor = getBlock(position);
|
||||
|
||||
if(tile.floor == Blocks.rhyolite && rand.chance(0.01)){
|
||||
tile.floor = Blocks.rhyoliteCrater;
|
||||
}
|
||||
|
||||
tile.block = tile.floor.asFloor().wall;
|
||||
|
||||
if(rid.getValue(position.x, position.y, position.z, 25) > 0.2){
|
||||
tile.block = Blocks.air;
|
||||
}
|
||||
|
||||
if(crid.getValue(position.x, position.y + 4f, position.z, 7f) > 0.7){
|
||||
tile.floor = Blocks.graphiticStone;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generate(){
|
||||
float temp = rawTemp(sector.tile.v);
|
||||
|
||||
if(temp > 0.7){
|
||||
|
||||
pass((x, y) -> {
|
||||
if(floor != Blocks.ice){
|
||||
float noise = noise(x + 782, y, 7, 0.8f, 310f, 1f);
|
||||
if(noise > 0.67f){
|
||||
if(noise > 0.72f){
|
||||
floor = Blocks.slag;
|
||||
}else{
|
||||
floor = Blocks.yellowStone;
|
||||
}
|
||||
ore = Blocks.air;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
cells(4);
|
||||
|
||||
float length = width/3f;
|
||||
Vec2 trns = Tmp.v1.trns(rand.random(360f), length);
|
||||
int
|
||||
spawnX = (int)(trns.x + width/2f), spawnY = (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);
|
||||
|
||||
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), 7);
|
||||
|
||||
distort(10f, 12f);
|
||||
distort(5f, 7f);
|
||||
|
||||
pass((x, y) -> {
|
||||
float max = 0;
|
||||
for(Point2 p : Geometry.d8){
|
||||
max = Math.max(max, world.getDarkness(x + p.x, y + p.y));
|
||||
}
|
||||
if(max > 0){
|
||||
block = floor.asFloor().wall;
|
||||
if(block == Blocks.air) block = Blocks.yellowStoneWall;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
inverseFloodFill(tiles.getn(spawnX, spawnY));
|
||||
|
||||
tiles.getn(endX, endY).setOverlay(Blocks.spawn);
|
||||
|
||||
tech(Blocks.darkPanel3, Blocks.darkPanel5, Blocks.darkMetal);
|
||||
|
||||
//ores
|
||||
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, 35f, 1f) > 0.67f && block == Blocks.carbonWall){
|
||||
block = Blocks.graphiticWall;
|
||||
}else if(empty && noise(x + 782, y, 4, 0.8f, 40f, 1f) > 0.7f && block != Blocks.carbonWall){
|
||||
ore = Blocks.wallOreBeryl;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Vars.state.rules.environment = Env.scorching | Env.terrestrial;
|
||||
Schematics.placeLaunchLoadout(spawnX, spawnY);
|
||||
}
|
||||
}
|
||||
111
core/src/mindustry/maps/planet/TantrosPlanetGenerator.java
Normal file
111
core/src/mindustry/maps/planet/TantrosPlanetGenerator.java
Normal file
@@ -0,0 +1,111 @@
|
||||
package mindustry.maps.planet;
|
||||
|
||||
import arc.graphics.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.util.*;
|
||||
import mindustry.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.game.*;
|
||||
import mindustry.maps.generators.*;
|
||||
import mindustry.type.*;
|
||||
import mindustry.type.Weather.*;
|
||||
import mindustry.world.*;
|
||||
import mindustry.world.meta.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
public class TantrosPlanetGenerator extends PlanetGenerator{
|
||||
Color c1 = Color.valueOf("5057a6"), c2 = Color.valueOf("272766"), out = new Color();
|
||||
|
||||
Block[][] arr = {
|
||||
{Blocks.redmat, Blocks.redmat, Blocks.darksand, Blocks.bluemat, Blocks.bluemat}
|
||||
};
|
||||
|
||||
{
|
||||
noise.setSeed(1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateSector(Sector sector){
|
||||
//no bases
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getHeight(Vec3 position){
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getColor(Vec3 position){
|
||||
float depth = (float)noise.octaveNoise3D(2, 0.56, 1.7f, position.x, position.y, position.z) / 2f;
|
||||
return c1.write(out).lerp(c2, Mathf.clamp(Mathf.round(depth, 0.15f))).a(0.6f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSizeScl(){
|
||||
return 2000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addWeather(Sector sector, Rules rules){
|
||||
rules.weather.and(new WeatherEntry(Weathers.suspendParticles)).peek().always = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void genTile(Vec3 position, TileGen tile){
|
||||
tile.floor = getBlock(position);
|
||||
|
||||
if(tile.floor == Blocks.redmat && rand.chance(0.1)){
|
||||
tile.block = Blocks.redweed;
|
||||
}
|
||||
|
||||
if(tile.floor == Blocks.bluemat && rand.chance(0.03)){
|
||||
tile.block = Blocks.purbush;
|
||||
}
|
||||
|
||||
if(tile.floor == Blocks.bluemat && rand.chance(0.002)){
|
||||
tile.block = Blocks.yellowCoral;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generate(){
|
||||
pass((x, y) -> {
|
||||
float max = 0;
|
||||
for(Point2 p : Geometry.d8){
|
||||
max = Math.max(max, world.getDarkness(x + p.x, y + p.y));
|
||||
}
|
||||
if(max > 0){
|
||||
block = floor.asFloor().wall;
|
||||
}
|
||||
|
||||
if(noise(x, y, 40f, 1f) > 0.9){
|
||||
//block = Blocks.coralChunk;
|
||||
}
|
||||
});
|
||||
|
||||
Schematics.placeLaunchLoadout(width / 2, height / 2);
|
||||
|
||||
Vars.state.rules.environment = Env.underwater;
|
||||
|
||||
state.rules.canGameOver = false;
|
||||
}
|
||||
|
||||
float rawHeight(Vec3 position){
|
||||
return (float)noise.octaveNoise3D(8, 0.7f, 1f, position.x, position.y, position.z);
|
||||
}
|
||||
|
||||
Block getBlock(Vec3 position){
|
||||
float height = rawHeight(position);
|
||||
Tmp.v31.set(position);
|
||||
position = Tmp.v33.set(position).scl(2f);
|
||||
float temp = (float)noise.octaveNoise3D(8, 0.6, 1f/2f, position.x, position.y + 99f, position.z);
|
||||
height *= 1.2f;
|
||||
height = Mathf.clamp(height);
|
||||
|
||||
//float tar = (float)noise.octaveNoise3D(4, 0.55f, 1f/2f, position.x, position.y + 999f, position.z) * 0.3f + Tmp.v31.dst(0, 0, 1f) * 0.2f;
|
||||
|
||||
return arr[Mathf.clamp((int)(temp * arr.length), 0, arr[0].length - 1)][Mathf.clamp((int)(height * arr[0].length), 0, arr[0].length - 1)];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user