From fff492d89d376c69c67b78944c81d3201cbc6c2c Mon Sep 17 00:00:00 2001 From: Anuken Date: Thu, 2 Dec 2021 13:25:43 -0500 Subject: [PATCH] Erekir generation improvements --- .../blocks/props/yellow-stone-boulder1.png | Bin 0 -> 636 bytes .../blocks/props/yellow-stone-boulder2.png | Bin 0 -> 720 bytes core/assets/icons/icons.properties | 1 + core/src/mindustry/content/Blocks.java | 40 +++++++++++-- core/src/mindustry/ctype/ContentType.java | 3 +- .../maps/generators/BasicGenerator.java | 45 ++++++++++++++ .../maps/planet/ErekirPlanetGenerator.java | 55 ++++++++---------- core/src/mindustry/type/TeamEntry.java | 20 +++++++ .../world/blocks/environment/Floor.java | 5 ++ 9 files changed, 132 insertions(+), 37 deletions(-) create mode 100644 core/assets-raw/sprites/blocks/props/yellow-stone-boulder1.png create mode 100644 core/assets-raw/sprites/blocks/props/yellow-stone-boulder2.png create mode 100644 core/src/mindustry/type/TeamEntry.java diff --git a/core/assets-raw/sprites/blocks/props/yellow-stone-boulder1.png b/core/assets-raw/sprites/blocks/props/yellow-stone-boulder1.png new file mode 100644 index 0000000000000000000000000000000000000000..3f7bc8955e38eef5c3c358a59c27c66030d4522d GIT binary patch literal 636 zcmV-?0)zdDP)Px%Hc3Q5RA_LQ1z2Kv`Osy`R=Bh5x zAOrXYFC>D)#={^;0QWbo?6k2%xr9wR5G#Og=eI-DzJ?h9K$Rf2Y%csBJY^@f1OA8@ zw1J&)dvUf@qoctzOf-m8enA1ME+c?y^@T=*X=$0rOKW0P@H!t9Wong)l^HOteATpi z9?-46sg2rtLHLH#J8T)if|8HBfT-H&f+<{9UzTiWn;@x8U^r_=;`zbqPE3(Yd5CLl zLH@S#5kRhls?d2{;8(8;{Wr0DK&Np!S^AA*hl^%_V-i*Hrr#+ly@X^4s*zCu-&NvR zWs|HtFis~6r4*{3U1VKC<8(6r=#Hxt0xZ9+X7vCU1jPq)fRDZNAb~O2r2?!@EE0lRzE&o#iYHVe1r|CJE(_(ovK&x88D=RBTZj;)$Tpx3qRRfMgnj^T WYXBt3RU+U300000x$iEP)Px%ib+I4RA__(!(LZNli_=5l2^-|Rey zzfas?9C-{$Azp@hyQv}Fe2xBsxaUNTPL?<&wz~+67G$Ro= z9_-?SR;vvc#TB{he9S+gSU8~G9*e_cdnwumvoM8Pt+qE2jA}hk@~m$$M{3~Y{l%&0 z$E6S^Wg{rjiC9HkDVIp(ZReyA3ZQu3MjXJ++ft&)5s>OQ9M~pwBmoriX-(>Muxda@ z8sy`mAR>SR&M0gWAtHc6Mrr}1iy#T`o%?KZ^(K}=CX(afV&h9s@_Jx0oh5c7SF#f8 zf-nMaM`wxaX;HkIZ=pV);0`u%&d5lIogDVA9q#qbdk5petbO5UlXMuD1ks^D#f zk2iu9ycYGg!q!QvW9pnr7x7hV8lCICD`660^Ekdn5fevTA##zr7M6xh2o}KFnM(t4 zbuul~5^GXqV@nFSPB3}fmz%8;pm2RR$N>yU_pXH~t2$6{Y2^S88(Y}$CPj(}0Em(_ z8I=~{N?gI~JF%pQOauVPh~Sb35c;cuiwGaGe-c09W)FgLwU3$r0000 { for(int i = 0; i < 4; i++){ @@ -358,6 +379,30 @@ public abstract class BasicGenerator implements WorldGenerator{ }); } + public void blend(Block floor, Block around, float radius){ + float r2 = radius*radius; + int cap = Mathf.ceil(radius); + int max = tiles.width * tiles.height; + Floor dest = around.asFloor(); + + for(int i = 0; i < max; i++){ + Tile tile = tiles.geti(i); + if(tile.floor() == floor){ + for(int cx = -cap; cx <= cap; cx++){ + for(int cy = -cap; cy <= cap; cy++){ + if(cx*cx + cy*cy <= r2){ + Tile other = tiles.get(tile.x + cx, tile.y + cy); + + if(other != null && other.floor() != floor){ + other.setFloor(dest); + } + } + } + } + } + } + } + public void brush(Seq path, int rad){ path.each(tile -> erase(tile.x, tile.y, rad)); } diff --git a/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java b/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java index 3c586b2134..edd1daf54e 100644 --- a/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java +++ b/core/src/mindustry/maps/planet/ErekirPlanetGenerator.java @@ -92,11 +92,11 @@ public class ErekirPlanetGenerator extends PlanetGenerator{ tile.block = tile.floor.asFloor().wall; - if(Ridged.noise3d(1, position.x, position.y, position.z, 2, 25) > 0.2){ + if(Ridged.noise3d(1, position.x, position.y, position.z, 2, 25) > 0.19){ tile.block = Blocks.air; } - if(Ridged.noise3d(2, position.x, position.y + 4f, position.z, 3, 7f) > 0.7){ + if(Ridged.noise3d(2, position.x, position.y + 4f, position.z, 3, 6f) > 0.65){ tile.floor = Blocks.carbonStone; } } @@ -136,25 +136,29 @@ public class ErekirPlanetGenerator extends PlanetGenerator{ //arkycite pass((x, y) -> { + if(nearWall(x, y)) return; - float noise = noise(x + 300, y - x*1.6f + 100, 4, 0.81f, 96f, 1f); + float noise = noise(x + 300, y - x*1.6f + 100, 4, 0.8f, 120f, 1f); if(noise > 0.71f){ floor = Blocks.arkyciteFloor; - }else if(noise > 0.65){ - floor = Blocks.arkyicStone; } }); + median(2, 0.6, Blocks.arkyciteFloor); + + //TODO arkycite walls + blend(Blocks.arkyciteFloor, Blocks.arkyicStone, 4); + distort(10f, 12f); distort(5f, 7f); + //does arkycite need smoothing? + median(2, 0.6, Blocks.arkyciteFloor); + //smooth out slag to prevent random 1-tile patches median(3, 0.6, Blocks.slag); - //does arkycite need smoothing? - //median(3, 0.6, Blocks.arkyciteFloor); - pass((x, y) -> { float max = 0; for(Point2 p : Geometry.d8){ @@ -171,42 +175,29 @@ public class ErekirPlanetGenerator extends PlanetGenerator{ tiles.getn(endX, endY).setOverlay(Blocks.spawn); + //TODO tech is lazy and boring 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; + //TODO use d4 instead of d8 for no out-of-reach ores? + if(nearAir(x, y)){ + if(noise(x + 78, y, 4, 0.7f, 35f, 1f) > 0.67f && block == Blocks.carbonWall){ + block = Blocks.graphiticWall; + }else if(noise(x + 782, y, 4, 0.8f, 40f, 1f) > 0.7f && block != Blocks.carbonWall){ + ore = Blocks.wallOreBeryl; } } + }else if(!nearWall(x, y)){ - 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; - } - }else{ - boolean empty = true; - for(Point2 p : Geometry.d8){ - Tile other = tiles.get(x + p.x, y + p.y); - if(other != null && other.block() != Blocks.air){ - empty = false; - break; - } - } - - if(empty && noise(x + 150, y + x*2 + 100, 4, 0.8f, 40f, 1f) > 0.71f/* && floor == Blocks.yellowStone*/){ + if(noise(x + 150, y + x*2 + 100, 4, 0.8f, 40f, 1f) > 0.71f/* && floor == Blocks.yellowStone*/){ ore = Blocks.oreTungsten; } //TODO design ore generation so it doesn't overlap - if(empty && noise(x + 999, y + 600, 4, 0.63f, 37f, 1f) < 0.25f/* && floor == Blocks.yellowStone*/){ + if(noise(x + 999, y + 600, 4, 0.63f, 37f, 1f) < 0.25f/* && floor == Blocks.yellowStone*/){ ore = Blocks.oreThorium; } } @@ -239,6 +230,8 @@ public class ErekirPlanetGenerator extends PlanetGenerator{ } } + decoration(0.015f); + //not allowed state.rules.hiddenBuildItems.addAll(Items.copper, Items.titanium, Items.coal, Items.lead, Items.blastCompound, Items.pyratite, Items.sporePod, Items.metaglass, Items.plastanium); diff --git a/core/src/mindustry/type/TeamEntry.java b/core/src/mindustry/type/TeamEntry.java new file mode 100644 index 0000000000..b288637447 --- /dev/null +++ b/core/src/mindustry/type/TeamEntry.java @@ -0,0 +1,20 @@ +package mindustry.type; + +import mindustry.ctype.*; +import mindustry.game.*; + +/** This class is only for displaying team lore in the content database. */ +//TODO +public class TeamEntry extends UnlockableContent{ + public final Team team; + + public TeamEntry(Team team){ + super(team.name); + this.team = team; + } + + @Override + public ContentType getContentType(){ + return ContentType.team; + } +} diff --git a/core/src/mindustry/world/blocks/environment/Floor.java b/core/src/mindustry/world/blocks/environment/Floor.java index 22f72762e4..ec07d11326 100644 --- a/core/src/mindustry/world/blocks/environment/Floor.java +++ b/core/src/mindustry/world/blocks/environment/Floor.java @@ -115,6 +115,11 @@ public class Floor extends Block{ //keep default value if not found... if(wall == null) wall = Blocks.air; + //try to load the default boulder + if(decoration == null){ + decoration = content.block(name + "-boulder"); + } + if(isLiquid && walkEffect == Fx.none){ walkEffect = Fx.ripple; }