1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Fix liquid_range

* Prevent graphical glitches on old servers
* Fix flowing of liquids with viscosity != 1 and range != 8
* Fix range = 0, no flowing nodes will appear
This commit is contained in:
PilzAdam 2013-09-09 15:32:55 +02:00
parent 2bf9abade2
commit 0d35350b69
2 changed files with 10 additions and 4 deletions

View file

@ -395,7 +395,7 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
l = getInteriorLight(n, 0, data);
video::SColor c = MapBlock_LightColor(f.alpha, l, decode_light(f.light_source));
u8 range = rangelim(nodedef->get(c_flowing).liquid_range, 0, 8);
u8 range = rangelim(nodedef->get(c_flowing).liquid_range, 1, 8);
// Neighbor liquid levels (key = relative position)
// Includes current node
@ -429,7 +429,11 @@ void mapblock_mesh_generate_special(MeshMakeData *data,
if(n2.getContent() == c_source)
level = (-0.5+node_liquid_level) * BS;
else if(n2.getContent() == c_flowing){
u8 liquid_level = (n2.param2&LIQUID_LEVEL_MASK) - (LIQUID_LEVEL_MAX+1-range);
u8 liquid_level = (n2.param2&LIQUID_LEVEL_MASK);
if (liquid_level <= LIQUID_LEVEL_MAX+1-range)
liquid_level = 0;
else
liquid_level -= (LIQUID_LEVEL_MAX+1-range);
level = (-0.5 + ((float)liquid_level+ 0.5) / (float)range * node_liquid_level) * BS;
}