mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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.
This commit is contained in:
parent
5506e97ed8
commit
2a74727857
17 changed files with 416 additions and 188 deletions
|
@ -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);
|
||||
}
|
||||
|
||||
cave.makeCave(vm, node_min, node_max, &ps, true, 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);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue