aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/cpp_api')
-rw-r--r--src/script/cpp_api/s_client.cpp19
-rw-r--r--src/script/cpp_api/s_client.h1
2 files changed, 18 insertions, 2 deletions
diff --git a/src/script/cpp_api/s_client.cpp b/src/script/cpp_api/s_client.cpp
index 7971e4081..5990c4df2 100644
--- a/src/script/cpp_api/s_client.cpp
+++ b/src/script/cpp_api/s_client.cpp
@@ -297,7 +297,7 @@ void ScriptApiClient::on_object_properties_change(s16 id)
{
SCRIPTAPI_PRECHECKHEADER
- // Get core.on_object_properties_change
+ // Get core.registered_on_object_properties_change
lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_on_object_properties_change");
@@ -312,7 +312,7 @@ void ScriptApiClient::on_object_hp_change(s16 id)
{
SCRIPTAPI_PRECHECKHEADER
- // Get core.on_object_hp_change
+ // Get core.registered_on_object_hp_change
lua_getglobal(L, "core");
lua_getfield(L, -1, "registered_on_object_hp_change");
@@ -323,6 +323,21 @@ void ScriptApiClient::on_object_hp_change(s16 id)
runCallbacks(1, RUN_CALLBACKS_MODE_FIRST);
}
+void ScriptApiClient::on_object_add(s16 id)
+{
+ SCRIPTAPI_PRECHECKHEADER
+
+ // Get core.registered_on_object_add
+ lua_getglobal(L, "core");
+ lua_getfield(L, -1, "registered_on_object_add");
+
+ // Push data
+ push_objectRef(L, id);
+
+ // Call functions
+ runCallbacks(1, RUN_CALLBACKS_MODE_FIRST);
+}
+
bool ScriptApiClient::on_inventory_open(Inventory *inventory)
{
SCRIPTAPI_PRECHECKHEADER
diff --git a/src/script/cpp_api/s_client.h b/src/script/cpp_api/s_client.h
index a2babfac8..12d96d81e 100644
--- a/src/script/cpp_api/s_client.h
+++ b/src/script/cpp_api/s_client.h
@@ -65,6 +65,7 @@ public:
bool on_spawn_particle(struct ParticleParameters param);
void on_object_properties_change(s16 id);
void on_object_hp_change(s16 id);
+ void on_object_add(s16 id);
bool on_inventory_open(Inventory *inventory);
void open_enderchest();