From a0eee0cad893dfdff4c703f7af904f98af5ac601 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Fri, 1 Dec 2023 13:08:53 +0900 Subject: [PATCH] spawn clay wip --- src/net/torvald/terrarum/blockproperties/Block.kt | 1 + .../modulebasegame/worldgenerator/Biomegen.kt | 13 +++++++++++++ .../modulebasegame/worldgenerator/Worldgen.kt | 1 - 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/net/torvald/terrarum/blockproperties/Block.kt b/src/net/torvald/terrarum/blockproperties/Block.kt index bbe346c96..e6992298d 100644 --- a/src/net/torvald/terrarum/blockproperties/Block.kt +++ b/src/net/torvald/terrarum/blockproperties/Block.kt @@ -18,6 +18,7 @@ object Block { const val DIRT = "basegame:32" const val GRASS = "basegame:33" const val GRASSWALL = "basegame:34" + const val CLAY = "basegame:35" const val PLANK_NORMAL = "basegame:48" const val PLANK_EBONY = "basegame:49" diff --git a/src/net/torvald/terrarum/modulebasegame/worldgenerator/Biomegen.kt b/src/net/torvald/terrarum/modulebasegame/worldgenerator/Biomegen.kt index f958854d1..f4119e94c 100644 --- a/src/net/torvald/terrarum/modulebasegame/worldgenerator/Biomegen.kt +++ b/src/net/torvald/terrarum/modulebasegame/worldgenerator/Biomegen.kt @@ -115,6 +115,7 @@ class Biomegen(world: GameWorld, seed: Long, params: Any, val biomeMapOut: HashM private fun draw(x: Int, y: Int, noiseValue: List, world: GameWorld) { val control1 = noiseValue[0].coerceIn(0.0, 0.99999).times(slices).toInt().coerceAtMost(slices - 1) val control2 = noiseValue[1].coerceIn(0.0, 0.99999).times(9).toInt().coerceAtMost(9 - 1) + val control3 = noiseValue[2].coerceIn(0.0, 0.99999).times(12).toInt().coerceAtMost(12 - 1) val ba = LandUtil.getBlockAddr(world, x, y) if (y > 0) { @@ -189,11 +190,22 @@ class Biomegen(world: GameWorld, seed: Long, params: Any, val biomeMapOut: HashM } else -> null to null } + val lutum = when (control3) { + 0 -> { + if (tileThis == Block.DIRT) { + Block.CLAY to Block.CLAY + } + else null to null + } + else -> null to null + } val outTile = if (grassRock.first == Block.STONE) grassRock else if (sablum.first != null) sablum + else if (lutum.first != null) + lutum else grassRock @@ -208,6 +220,7 @@ class Biomegen(world: GameWorld, seed: Long, params: Any, val biomeMapOut: HashM return listOf( makeRandomSpotties("TERRA", params.featureSize1), makeRandomSpotties("SABLUM", params.featureSize2), + makeRandomSpotties("LUTUM", params.featureSize2), ) } diff --git a/src/net/torvald/terrarum/modulebasegame/worldgenerator/Worldgen.kt b/src/net/torvald/terrarum/modulebasegame/worldgenerator/Worldgen.kt index e7299f820..2ceb80088 100644 --- a/src/net/torvald/terrarum/modulebasegame/worldgenerator/Worldgen.kt +++ b/src/net/torvald/terrarum/modulebasegame/worldgenerator/Worldgen.kt @@ -63,7 +63,6 @@ object Worldgen { Work(Lang["MENU_IO_WORLDGEN_RETICULATING_SPLINES"], Terragen(world, highlandLowlandSelectCache, params.seed, params.terragenParams), listOf("TERRAIN")), Work(Lang["MENU_IO_WORLDGEN_GROWING_MINERALS"], Oregen(world, caveAttenuateBiasScaledCache, params.seed, oreRegistry), listOf("ORES")), Work(Lang["MENU_IO_WORLDGEN_POSITIONING_ROCKS"], OregenAutotiling(world, params.seed, oreTilingModes), listOf("ORES")), - Work(Lang["MENU_IO_WORLDGEN_POSITIONING_ROCKS"], OregenAutotiling(world, params.seed, oreTilingModes), listOf("ORES")), // TODO generate rock veins // TODO generate gemstones Work(Lang["MENU_IO_WORLDGEN_CARVING_EARTH"], Cavegen(world, highlandLowlandSelectCache, params.seed, params.terragenParams), listOf("TERRAIN", "CAVE")),