summaryrefslogtreecommitdiff
path: root/src/server.cpp
diff options
context:
space:
mode:
authorAuke Kok <sofar@foo-projects.org>2017-04-19 23:10:39 -0700
committerparamat <mat.gregory@virginmedia.com>2017-04-22 01:23:51 +0100
commitcca58fe0fd1aac4246a23e1fc4f8469bdd280c6d (patch)
tree0dad1131f8cb0d9ec8c7bc7e35f4e3fc378c4ca0 /src/server.cpp
parent8464da75857c1556f64984c0b014300638e38d4f (diff)
downloadminetest-cca58fe0fd1aac4246a23e1fc4f8469bdd280c6d.tar.gz
minetest-cca58fe0fd1aac4246a23e1fc4f8469bdd280c6d.tar.bz2
minetest-cca58fe0fd1aac4246a23e1fc4f8469bdd280c6d.zip
Add on_flood() callback.
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.
Diffstat (limited to 'src/server.cpp')
-rw-r--r--src/server.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/server.cpp b/src/server.cpp
index a921423d2..ac6265d09 100644
--- a/src/server.cpp
+++ b/src/server.cpp
@@ -599,7 +599,7 @@ void Server::AsyncRunStep(bool initial_step)
ScopeProfiler sp(g_profiler, "Server: liquid transform");
std::map<v3s16, MapBlock*> modified_blocks;
- m_env->getMap().transformLiquids(modified_blocks);
+ m_env->getMap().transformLiquids(modified_blocks, m_env);
#if 0
/*
Update lighting