diff options
author | Paramat <paramat@users.noreply.github.com> | 2019-11-08 03:09:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-08 03:09:43 +0000 |
commit | 2a74727857a9bfd950ce1e6a58e0ade879033574 (patch) | |
tree | fcb59f922de4336a9a7abf37842567089d1638e9 /src/mapgen/mapgen.cpp | |
parent | 5506e97ed897dde2d4820fe1b021a4622bae03b3 (diff) | |
download | minetest-2a74727857a9bfd950ce1e6a58e0ade879033574.tar.gz minetest-2a74727857a9bfd950ce1e6a58e0ade879033574.tar.bz2 minetest-2a74727857a9bfd950ce1e6a58e0ade879033574.zip |
Randomwalk caves: Add parameters for number, proportion flooded. Allow small caves (#8928)
Add mapgen parameters to set the range of the random number of
randomwalk caves per mapchunk, and to set the proportion that are
flooded with liquids.
Default values are, for now, unchanged from the previous hardcoded
values.
Add parameters to allow small randomwalk caves
Disabled by default for now as they have never been present in the
non-mgv6 mapgens.
Diffstat (limited to 'src/mapgen/mapgen.cpp')
-rw-r--r-- | src/mapgen/mapgen.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp index 6d5e721ce..a1ac7a5ca 100644 --- a/src/mapgen/mapgen.cpp +++ b/src/mapgen/mapgen.cpp @@ -843,18 +843,29 @@ void MapgenBasic::generateCavesNoiseIntersection(s16 max_stone_y) void MapgenBasic::generateCavesRandomWalk(s16 max_stone_y, s16 large_cave_depth) { - if (node_min.Y > max_stone_y || node_max.Y > large_cave_depth) + if (node_min.Y > max_stone_y) return; PseudoRandom ps(blockseed + 21343); - u32 bruises_count = ps.range(0, 2); + // Small randomwalk caves + u32 num_small_caves = ps.range(small_cave_num_min, small_cave_num_max); - for (u32 i = 0; i < bruises_count; i++) { + for (u32 i = 0; i < num_small_caves; i++) { CavesRandomWalk cave(ndef, &gennotify, seed, water_level, - c_water_source, c_lava_source, lava_depth, biomegen); + c_water_source, c_lava_source, large_cave_flooded, lava_depth, biomegen); + cave.makeCave(vm, node_min, node_max, &ps, false, max_stone_y, heightmap); + } + + if (node_max.Y > large_cave_depth) + return; + + // Large randomwalk caves below 'large_cave_depth' + u32 num_large_caves = ps.range(large_cave_num_min, large_cave_num_max); - cave.makeCave(vm, node_min, node_max, &ps, true, max_stone_y, - heightmap); + for (u32 i = 0; i < num_large_caves; i++) { + CavesRandomWalk cave(ndef, &gennotify, seed, water_level, + c_water_source, c_lava_source, large_cave_flooded, lava_depth, biomegen); + cave.makeCave(vm, node_min, node_max, &ps, true, max_stone_y, heightmap); } } |