mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Add liquid_range to nodedef
This commit is contained in:
parent
cba90d4441
commit
413f0d0353
6 changed files with 16 additions and 4 deletions
|
@ -395,6 +395,8 @@ 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);
|
||||
|
||||
// Neighbor liquid levels (key = relative position)
|
||||
// Includes current node
|
||||
std::map<v3s16, f32> neighbor_levels;
|
||||
|
@ -426,9 +428,10 @@ 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)
|
||||
level = (-0.5 + ((float)(n2.param2&LIQUID_LEVEL_MASK)
|
||||
+ 0.5) / (float)LIQUID_LEVEL_SOURCE * node_liquid_level) * BS;
|
||||
else if(n2.getContent() == c_flowing){
|
||||
u8 liquid_level = (n2.param2&LIQUID_LEVEL_MASK) - (LIQUID_LEVEL_MAX+1-range);
|
||||
level = (-0.5 + ((float)liquid_level+ 0.5) / (float)range * node_liquid_level) * BS;
|
||||
}
|
||||
|
||||
// Check node above neighbor.
|
||||
// NOTE: This doesn't get executed if neighbor
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue