mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Break liquid reflow scan early for all-air blocks (#15975)
Avoid scanning the a newly loaded block if it is all air and no liquid is flowing from above.
This commit is contained in:
parent
52b974184d
commit
6a71095655
1 changed files with 39 additions and 32 deletions
|
@ -121,6 +121,12 @@ void ReflowScan::scanColumn(int x, int z)
|
||||||
bool was_checked = false;
|
bool was_checked = false;
|
||||||
bool was_pushed = false;
|
bool was_pushed = false;
|
||||||
|
|
||||||
|
// if there is no liquid above and the current block is air
|
||||||
|
// we can skip scanning the block
|
||||||
|
if (!was_liquid && block->isAir()) {
|
||||||
|
// continue after the block with air
|
||||||
|
was_ignore = false;
|
||||||
|
} else {
|
||||||
// Scan through the whole block
|
// Scan through the whole block
|
||||||
for (s16 y = MAP_BLOCKSIZE - 1; y >= 0; y--) {
|
for (s16 y = MAP_BLOCKSIZE - 1; y >= 0; y--) {
|
||||||
MapNode node = block->getNodeNoCheck(dx, y, dz);
|
MapNode node = block->getNodeNoCheck(dx, y, dz);
|
||||||
|
@ -157,6 +163,7 @@ void ReflowScan::scanColumn(int x, int z)
|
||||||
was_liquid = is_liquid;
|
was_liquid = is_liquid;
|
||||||
was_ignore = is_ignore;
|
was_ignore = is_ignore;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Check the node below the current block
|
// Check the node below the current block
|
||||||
MapBlock *below = lookupBlock(x, -1, z);
|
MapBlock *below = lookupBlock(x, -1, z);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue