forked from Mirrorlandia_minetest/minetest
Cave liquids: Use a more precise point for calculating biome
Use the centre point of the route being carved for a more precise match between cave liquids and biome.
This commit is contained in:
parent
cb92cdf3a4
commit
5abd0efb90
@ -497,28 +497,29 @@ void CavesRandomWalk::carveRoute(v3f vec, float f, bool randomize_xz)
|
|||||||
v3s16 startp(orp.X, orp.Y, orp.Z);
|
v3s16 startp(orp.X, orp.Y, orp.Z);
|
||||||
startp += of;
|
startp += of;
|
||||||
|
|
||||||
// Get biome at 'startp', use 'node_cave_liquid' if stated, otherwise
|
v3f fp = orp + vec * f;
|
||||||
// fallback to classic behaviour.
|
fp.X += 0.1f * ps->range(-10, 10);
|
||||||
|
fp.Z += 0.1f * ps->range(-10, 10);
|
||||||
|
v3s16 cp(fp.X, fp.Y, fp.Z);
|
||||||
|
|
||||||
|
// Get biome at 'cp + of', the absolute centre point of this route
|
||||||
|
v3s16 cpabs = cp + of;
|
||||||
MapNode liquidnode = CONTENT_IGNORE;
|
MapNode liquidnode = CONTENT_IGNORE;
|
||||||
|
|
||||||
if (bmgn) {
|
if (bmgn) {
|
||||||
Biome *biome = (Biome *)bmgn->calcBiomeAtPoint(startp);
|
Biome *biome = (Biome *)bmgn->calcBiomeAtPoint(cpabs);
|
||||||
if (biome->c_cave_liquid != CONTENT_IGNORE)
|
if (biome->c_cave_liquid != CONTENT_IGNORE)
|
||||||
liquidnode = biome->c_cave_liquid;
|
liquidnode = biome->c_cave_liquid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (liquidnode == CONTENT_IGNORE) {
|
if (liquidnode == CONTENT_IGNORE) {
|
||||||
|
// Fallback to classic behaviour using point 'startp'
|
||||||
float nval = NoisePerlin3D(np_caveliquids, startp.X,
|
float nval = NoisePerlin3D(np_caveliquids, startp.X,
|
||||||
startp.Y, startp.Z, seed);
|
startp.Y, startp.Z, seed);
|
||||||
liquidnode = (nval < 0.40f && node_max.Y < lava_depth) ?
|
liquidnode = (nval < 0.40f && node_max.Y < lava_depth) ?
|
||||||
lavanode : waternode;
|
lavanode : waternode;
|
||||||
}
|
}
|
||||||
|
|
||||||
v3f fp = orp + vec * f;
|
|
||||||
fp.X += 0.1f * ps->range(-10, 10);
|
|
||||||
fp.Z += 0.1f * ps->range(-10, 10);
|
|
||||||
v3s16 cp(fp.X, fp.Y, fp.Z);
|
|
||||||
|
|
||||||
s16 d0 = -rs / 2;
|
s16 d0 = -rs / 2;
|
||||||
s16 d1 = d0 + rs;
|
s16 d1 = d0 + rs;
|
||||||
if (randomize_xz) {
|
if (randomize_xz) {
|
||||||
|
Loading…
Reference in New Issue
Block a user