From ff3940865e9fc975c11de60151f7a302eabb741b Mon Sep 17 00:00:00 2001 From: Anuken Date: Mon, 21 Jun 2021 19:35:00 -0400 Subject: [PATCH] A. --- core/src/mindustry/content/Blocks.java | 1 + .../maps/generators/BasicGenerator.java | 50 +++++++++++++++++++ .../maps/planet/AsteroidGenerator.java | 30 +++++++++-- 3 files changed, 77 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/content/Blocks.java b/core/src/mindustry/content/Blocks.java index 16831b009d..00d0b301c6 100644 --- a/core/src/mindustry/content/Blocks.java +++ b/core/src/mindustry/content/Blocks.java @@ -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; diff --git a/core/src/mindustry/maps/generators/BasicGenerator.java b/core/src/mindustry/maps/generators/BasicGenerator.java index 6c6ea86e5c..dad8275c0e 100644 --- a/core/src/mindustry/maps/generators/BasicGenerator.java +++ b/core/src/mindustry/maps/generators/BasicGenerator.java @@ -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 diff --git a/core/src/mindustry/maps/planet/AsteroidGenerator.java b/core/src/mindustry/maps/planet/AsteroidGenerator.java index eff010294c..e2377f784f 100644 --- a/core/src/mindustry/maps/planet/AsteroidGenerator.java +++ b/core/src/mindustry/maps/planet/AsteroidGenerator.java @@ -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;