mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 19:43:45 +01:00
final fixes to liquid flow, works now as intended
This commit is contained in:
parent
a1e2a8bec6
commit
7d92ce061d
20
src/map.cpp
20
src/map.cpp
@ -1612,7 +1612,7 @@ void Map::transformLiquids(core::map<v3s16, MapBlock*> & modified_blocks)
|
|||||||
int num_flows = 0;
|
int num_flows = 0;
|
||||||
NodeNeighbor airs[6]; // surrounding air
|
NodeNeighbor airs[6]; // surrounding air
|
||||||
int num_airs = 0;
|
int num_airs = 0;
|
||||||
NodeNeighbor neutrals[6]; // nodes that are solid, another kind of liquid
|
NodeNeighbor neutrals[6]; // nodes that are solid or another kind of liquid
|
||||||
int num_neutrals = 0;
|
int num_neutrals = 0;
|
||||||
bool flowing_down = false;
|
bool flowing_down = false;
|
||||||
for (u16 i = 0; i < 6; i++) {
|
for (u16 i = 0; i < 6; i++) {
|
||||||
@ -1631,7 +1631,7 @@ void Map::transformLiquids(core::map<v3s16, MapBlock*> & modified_blocks)
|
|||||||
case LIQUID_NONE:
|
case LIQUID_NONE:
|
||||||
if (nb.n.d == CONTENT_AIR) {
|
if (nb.n.d == CONTENT_AIR) {
|
||||||
airs[num_airs++] = nb;
|
airs[num_airs++] = nb;
|
||||||
// if the current nodes happens to be a flowing node, it will start to flow down here.
|
// if the current node happens to be a flowing node, it will start to flow down here.
|
||||||
if (nb.t == NEIGHBOR_LOWER)
|
if (nb.t == NEIGHBOR_LOWER)
|
||||||
flowing_down = true;
|
flowing_down = true;
|
||||||
} else {
|
} else {
|
||||||
@ -1650,22 +1650,12 @@ void Map::transformLiquids(core::map<v3s16, MapBlock*> & modified_blocks)
|
|||||||
break;
|
break;
|
||||||
case LIQUID_FLOWING:
|
case LIQUID_FLOWING:
|
||||||
// if this node is not (yet) of a liquid type, choose the first liquid type we encounter
|
// if this node is not (yet) of a liquid type, choose the first liquid type we encounter
|
||||||
// (while ignoring flowing liquids at the lowest level, which cannot flow into this node)
|
|
||||||
if (liquid_kind == CONTENT_AIR)
|
if (liquid_kind == CONTENT_AIR)
|
||||||
liquid_kind = content_features(nb.n.d).liquid_alternative_flowing;
|
liquid_kind = content_features(nb.n.d).liquid_alternative_flowing;
|
||||||
if (content_features(nb.n.d).liquid_alternative_flowing != liquid_kind) {
|
if (content_features(nb.n.d).liquid_alternative_flowing != liquid_kind) {
|
||||||
neutrals[num_neutrals++] = nb;
|
neutrals[num_neutrals++] = nb;
|
||||||
} else {
|
} else {
|
||||||
// order flowing neighbors by liquid level descending
|
flows[num_flows++] = nb;
|
||||||
u16 insert_at = 0;
|
|
||||||
while (insert_at < num_flows && ((flows[insert_at].n.param2 & LIQUID_LEVEL_MASK) >
|
|
||||||
(nb.n.param2 & LIQUID_LEVEL_MASK))) {
|
|
||||||
insert_at++;
|
|
||||||
}
|
|
||||||
for (u16 j = insert_at; j < num_flows; j++)
|
|
||||||
flows[j + 1] = flows[j];
|
|
||||||
flows[insert_at] = nb;
|
|
||||||
num_flows++;
|
|
||||||
if (nb.t == NEIGHBOR_LOWER)
|
if (nb.t == NEIGHBOR_LOWER)
|
||||||
flowing_down = true;
|
flowing_down = true;
|
||||||
}
|
}
|
||||||
@ -1776,10 +1766,10 @@ void Map::transformLiquids(core::map<v3s16, MapBlock*> & modified_blocks)
|
|||||||
break;
|
break;
|
||||||
case LIQUID_FLOWING:
|
case LIQUID_FLOWING:
|
||||||
for (u16 i = 0; i < num_flows; i++) {
|
for (u16 i = 0; i < num_flows; i++) {
|
||||||
/*u8 flow_level = (flows[i].n.param2 & LIQUID_LEVEL_MASK);
|
u8 flow_level = (flows[i].n.param2 & LIQUID_LEVEL_MASK);
|
||||||
// liquid_level is still the ORIGINAL level of this node.
|
// liquid_level is still the ORIGINAL level of this node.
|
||||||
if (flows[i].t != NEIGHBOR_UPPER && ((flow_level < liquid_level || flow_level < new_node_level) ||
|
if (flows[i].t != NEIGHBOR_UPPER && ((flow_level < liquid_level || flow_level < new_node_level) ||
|
||||||
flow_down_enabled))*/
|
flow_down_enabled))
|
||||||
m_transforming_liquid.push_back(flows[i].p);
|
m_transforming_liquid.push_back(flows[i].p);
|
||||||
}
|
}
|
||||||
for (u16 i = 0; i < num_airs; i++) {
|
for (u16 i = 0; i < num_airs; i++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user