- mgv7_spflags = [nocaverns|caverns], [notunnels|tunnels]
Flags specifying which v7 cave generator to use; requires that "caves" be enabled in mg_flags - caves_bedrock_level = [value]
Integer specifying the lower boundary for generated tunnels (does not apply to caverns) - caves_surface_level = [value]
Integer specifying the upper boundary for generated tunnels (does not apply to caverns)
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
// Limit route along y-axis to height of area
route_y_min = 0;
route_y_max = ar.Y - 1;
// Randomize starting position relative to area
orp = v3f(
(float)(ps->next() % ar.X) + 0.5,
(float)(ps->range(route_y_min, route_y_max)) + 0.5,
(float)(ps->next() % ar.Z) + 0.5
);
I also fixed the start-point and end-point boundary checks in "CaveV7::makeTunnel( )". The radius (rs) was being added to the absolute position (p), even though the height-map comparison is only applicable along the Y-axis.
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
p = of + orpi + veci;
if (p.Z >= node_min.Z && p.Z <= node_max.Z &&
p.X >= node_min.X && p.X <= node_max.X) {
u32 index = (p.Z - node_min.Z) * mg->ystride + (p.X - node_min.X);
s16 h = mg->ridge_heightmap[index];
if (p.Y + rs / 2 > h)
return; // Ignore section not in our heightmap
}
if (p.Y + rs / 2 > surface_level || p.Y - rs / 2 < bedrock_level) {
return; // Ignore section above surface level or below bedrock level
}
I tested these changes extensively with a variety of mapgen parameters, and all works as expected. I was also careful to use an unassigned slot in mgv7_spflags, accounting for addition of "floatlands" in 0.4.14.
All of the patched files are in the attachment, with comments delineating the specific changes. I hope it is useful!