diff --git a/README.md b/README.md index a910fd6..01e3224 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Mindustry Java Mod - Random Planet v0.4.4 +# Mindustry Java Mod - Random Planet v0.4.5 A Java Mindustry mod. Randomly generate a planet and its sectors, including the starting sector. @@ -119,6 +119,9 @@ I combined both technologies from Serpulo and Erekir as best as I could, includi - Increase the size of the pathways, so it doesn't look like "tunnels/canals". - Increase the range of ore selection. +*v0.4.5* +- Rework liquid placement to sync with [Mineable Alloys](https://github.com/PiggyChu620/MindustryMineableAlloys) 1.3 update + --- **1.** [Schematic Instruction](SchematicInstruction.md) diff --git a/mod.hjson b/mod.hjson index df00c52..8390feb 100644 --- a/mod.hjson +++ b/mod.hjson @@ -1,5 +1,5 @@ #the mod name as displayed in-game -displayName: "Random Planet v0.4.4" +displayName: "Random Planet v0.4.5" repo: "PiggyChu620/MindustryRandomPlanet" @@ -16,7 +16,7 @@ main: "ec620.EC620JavaMod" description: "Randomly generate a planet and its sectors.\nIt's a mixtech mod, I myself don't like the idea of \"Oh, you can only use these things here, and you can only use those things there, bruh, bruh, bruh!\", so I make one myself, if you don't like mixtech and think it's \"unbalanced\" and \"boring\", then please go away, much appreciated!" #the mod version -version: 0.4.4 +version: 0.4.5 #the minimum game build required to run this mod minGameVersion: 140 diff --git a/src/ec620/EC620JavaMod.java b/src/ec620/EC620JavaMod.java index 429fc95..50d3fef 100644 --- a/src/ec620/EC620JavaMod.java +++ b/src/ec620/EC620JavaMod.java @@ -47,7 +47,7 @@ public EC620JavaMod() dd.titleFont= Fonts.def; dd.titleFontColor=new Color(1,0,0); BaseDialog dialog = new BaseDialog("Random Planet", dd); - dialog.cont.add("Welcome to Random Planet v0.4.4",Color.green,1.2f).center().row(); + dialog.cont.add("Welcome to Random Planet v0.4.5",Color.green,1.2f).center().row(); dialog.cont.add("Please see Settings for customization",Color.cyan).center().row(); //dialog.cont.add("in order to see the setting info,",Color.cyan).row(); //dialog.cont.add("I can not figure out how to make it wrap,",Color.cyan).row(); diff --git a/src/ec620/content/EC620PlanetGenerator.java b/src/ec620/content/EC620PlanetGenerator.java index 5c9372a..cc274a8 100644 --- a/src/ec620/content/EC620PlanetGenerator.java +++ b/src/ec620/content/EC620PlanetGenerator.java @@ -37,6 +37,7 @@ import java.util.Objects; import java.util.stream.Collectors; import java.util.stream.Stream; +import java.util.Map; import static ec620.EC620JavaMod.*; import static mindustry.Vars.*; @@ -386,7 +387,7 @@ else if(moss > 0.21f){ //return toShallowMoss.get(res, res); return Blocks.moss; } - if(!hasSand && res.itemDrop== Items.sand) hasSand=true; + if(!hasSand && res.itemDrop == Items.sand) hasSand=true; return res; } @@ -596,7 +597,9 @@ void setOre(Block block) for(int i=0;i=b.itemDrop.cost) ores.add(b); + String name="ma620."+b.name; + if(Core.settings.has(name)) if(pgRand.chance(Core.settings.getFloat(name)/100f)) ores.add(b); + else if(pgRand.nextDouble()*2>=b.itemDrop.cost) ores.add(b); // if(Simplex.noise3d(seed, 2, 0.5, scl, sector.tile.v.x+i, sector.tile.v.y, sector.tile.v.z)*nmag + poles > (i+1)*addscl/(l+1)) // { // ores.add(availableOres.get(i)); @@ -605,8 +608,10 @@ void setOre(Block block) while(ores.size<5) { Block b=availableOres.getFrac(pgRand.nextFloat()); + String n="ma620."+b.name; - if(pgRand.chance(0.01d) || pgRand.nextDouble()*2>=b.itemDrop.cost) ores.add(b); + if(Core.settings.has(n)) if(pgRand.chance(Core.settings.getFloat(n)/100f)) ores.add(b); + else if(pgRand.nextDouble()*2>=b.itemDrop.cost) ores.add(b); } } @@ -817,14 +822,14 @@ void setOre(Block block) // r.setFloor(arkyciteFloor.asFloor()); // } - boolean isWater=pgRand.chance(.5f) || sector.id==0; + //boolean isWater=pgRand.chance(.5f) || sector.id==0; Seq lakeSeq=new Seq<>(); Seq lakeVec=new Seq<>(); Seq newRooms=new Seq<>(); //rivers pass((x, y) -> { - //if(block.solid) return; + if(block.solid) return; Vec3 v = sector.rect.project(x, y); @@ -841,19 +846,19 @@ void setOre(Block block) //do not place rivers on ice, they're frozen //ignore pre-existing liquids - if(!(floor == Blocks.ice || floor == Blocks.iceSnow || floor == Blocks.snow || floor.asFloor().isLiquid)) + if(!floor.asFloor().isLiquid) { - if(isWater) - { - floor = spore ? - (deep ? Blocks.taintedWater : Blocks.darksandTaintedWater) : - (deep ? Blocks.water : - (floor == Blocks.sand || floor == Blocks.salt ? Blocks.sandWater : Blocks.darksandWater)); - } - else - { +// if(isWater) +// { +// floor = spore ? +// (deep ? Blocks.taintedWater : Blocks.darksandTaintedWater) : +// (deep ? Blocks.water : +// (floor == Blocks.sand || floor == Blocks.salt ? Blocks.sandWater : Blocks.darksandWater)); +// } +// else +// { lakeVec.add(new Vec2(x,y)); - } + //} // { // if(lakeSeq.size==0) // { @@ -884,9 +889,40 @@ void setOre(Block block) } } }); - Seq availableLiquids=Seq.with(Blocks.water, cryofluid, slag, tar, arkyciteFloor); - int n=pgRand.nextInt(5)+1; + Seq availableLiquids=content.blocks().select(x->x instanceof Floor && x.asFloor().liquidDrop!=null); +// ObjectMap> availableLiquids=new ObjectMap<>(); +// Seq keys=new Seq<>(); +// for(Liquid li: content.liquids().select(x->!x.hidden)) +// { +// Seq bs=content.blocks().select(x->x instanceof Floor && x.asFloor().liquidDrop==li); +// if(bs.size>0) +// { +// keys.add(li); +// availableLiquids.put(li, bs); +// } +// } + int n=pgRand.nextInt(availableLiquids.size)+1; + Seq liquids=new Seq<>(); + while(liquids.sizex.asFloor().liquidDrop==Liquids.water) && (sector.id==0 || pgRand.chance(.5f))) liquids.add(Blocks.water); while(lakeVec.size>0) { Vec2 vec=lakeVec.get(0); @@ -899,18 +935,13 @@ void setOre(Block block) lakeVec.removeAll(s); seq.addAll(s); } - Block b; - if(liquids.size