aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/cpp_api/s_client.cpp')
-rw-r--r--src/script/cpp_api/s_client.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/script/cpp_api/s_client.cpp b/src/script/cpp_api/s_client.cpp
index a8a7d5e26..4bc368d1d 100644
--- a/src/script/cpp_api/s_client.cpp
+++ b/src/script/cpp_api/s_client.cpp
@@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "client.h"
#include "common/c_converter.h"
#include "common/c_content.h"
+#include "s_item.h"
void ScriptApiClient::on_shutdown()
{
@@ -189,6 +190,23 @@ bool ScriptApiClient::on_punchnode(v3s16 p, MapNode node)
return blocked;
}
+bool ScriptApiClient::on_placenode(const PointedThing &pointed, const ItemDefinition &item)
+{
+ SCRIPTAPI_PRECHECKHEADER
+
+ // Get core.registered_on_placenode
+ lua_getglobal(L, "core");
+ lua_getfield(L, -1, "registered_on_placenode");
+
+ // Push data
+ push_pointed_thing(L, pointed);
+ push_item_definition(L, item);
+
+ // Call functions
+ runCallbacks(2, RUN_CALLBACKS_MODE_OR);
+ return lua_toboolean(L, -1);
+}
+
void ScriptApiClient::setEnv(ClientEnvironment *env)
{
ScriptApiBase::setEnv(env);