Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This callback is called if a liquid definitely floods a non-air node on the map. The callback arguments are (pos, oldnode, newnode) and can return a `bool` value indicating whether flooding the node should be cancelled (`return true` will prevent the node from flooding). Documentation is added, the callback function was tested with a modified minetest_game. Note that `return true` will likely cause the node's `on_flood()` callback to be called every second until the node gets removed, so care must be taken to prevent many callbacks from using this return value. The current default liquid update interval is 1.0 seconds, which isn't unmanageable. The larger aim of this patch is to remove the lava cooling ABM, which is a significant cost to idle servers that have lava on their map. This callback will be much more efficient.
- Loading branch information
Showing
6 changed files
with
43 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4002,6 +4002,13 @@ Definition tables | |
^ Node destructor; called after removing node | ||
^ Not called for bulk node placement (i.e. schematics and VoxelManip) | ||
^ default: nil ]] | ||
on_flood = func(pos, oldnode, newnode), --[[ | ||
^ Called when a liquid (newnode) is about to flood oldnode, if | ||
^ it has `floodable = true` in the nodedef. Not called for bulk | ||
^ node placement (i.e. schematics and VoxelManip) or air nodes. If | ||
^ return true the node is not flooded, but on_flood callback will | ||
^ most likely be called over and over again every liquid update | ||
^ interval. Default: nil ]] | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
paramat
Contributor
|
||
|
||
after_place_node = func(pos, placer, itemstack, pointed_thing) --[[ | ||
^ Called after constructing node when node was placed using | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Does on_flood also work if l add it to liquid nodes, e.g. flowing water?