aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api
diff options
context:
space:
mode:
authorJude Melton-Houghton <jwmhjwmh@gmail.com>2022-10-18 18:03:05 -0400
committerGitHub <noreply@github.com>2022-10-18 18:03:05 -0400
commitdafdb3edb4b65db144d72cd2274a657af671bdd1 (patch)
tree8234b9b09c311b05bf2a42c48ca9c1082164aae3 /src/script/cpp_api
parentb38ffdec279bcded98e34f5116c8d676aa9f73a7 (diff)
downloadminetest-dafdb3edb4b65db144d72cd2274a657af671bdd1.tar.xz
Check for falling `float` nodes in liquid transform (#12862)
Diffstat (limited to 'src/script/cpp_api')
-rw-r--r--src/script/cpp_api/s_env.cpp12
-rw-r--r--src/script/cpp_api/s_env.h2
2 files changed, 14 insertions, 0 deletions
diff --git a/src/script/cpp_api/s_env.cpp b/src/script/cpp_api/s_env.cpp
index 55c0a84f5..e49113405 100644
--- a/src/script/cpp_api/s_env.cpp
+++ b/src/script/cpp_api/s_env.cpp
@@ -257,6 +257,18 @@ void ScriptApiEnv::on_emerge_area_completion(
}
}
+void ScriptApiEnv::check_for_falling(v3s16 p)
+{
+ SCRIPTAPI_PRECHECKHEADER
+
+ int error_handler = PUSH_ERROR_HANDLER(L);
+ lua_getglobal(L, "core");
+ lua_getfield(L, -1, "check_for_falling");
+ luaL_checktype(L, -1, LUA_TFUNCTION);
+ push_v3s16(L, p);
+ PCALL_RES(lua_pcall(L, 1, 0, error_handler));
+}
+
void ScriptApiEnv::on_liquid_transformed(
const std::vector<std::pair<v3s16, MapNode>> &list)
{
diff --git a/src/script/cpp_api/s_env.h b/src/script/cpp_api/s_env.h
index 090858f17..9a50a01cc 100644
--- a/src/script/cpp_api/s_env.h
+++ b/src/script/cpp_api/s_env.h
@@ -43,6 +43,8 @@ public:
void on_emerge_area_completion(v3s16 blockpos, int action,
ScriptCallbackState *state);
+ void check_for_falling(v3s16 p);
+
// Called after liquid transform changes
void on_liquid_transformed(const std::vector<std::pair<v3s16, MapNode>> &list);