aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_client.cpp
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2021-05-10 20:45:05 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2021-05-10 20:45:05 +0200
commitc86dcd0f682f76339989afec255bf3d7078db096 (patch)
treecd74cff6f879026a47c197545796aa2deb20ea15 /src/script/cpp_api/s_client.cpp
parentb84ed7d0beb524a62070a503a40b78b77506b258 (diff)
downloaddragonfireclient-c86dcd0f682f76339989afec255bf3d7078db096.tar.xz
Add on_object_hp_change callback and nametag images
Diffstat (limited to 'src/script/cpp_api/s_client.cpp')
-rw-r--r--src/script/cpp_api/s_client.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/script/cpp_api/s_client.cpp b/src/script/cpp_api/s_client.cpp
index b8decf2cd..2231cf573 100644
--- a/src/script/cpp_api/s_client.cpp
+++ b/src/script/cpp_api/s_client.cpp
@@ -308,6 +308,21 @@ void ScriptApiClient::on_object_properties_change(s16 id)
runCallbacks(1, RUN_CALLBACKS_MODE_FIRST);
}
+void ScriptApiClient::on_object_hp_change(s16 id)
+{
+ SCRIPTAPI_PRECHECKHEADER
+
+ // Get core.on_object_hp_change
+ lua_getglobal(L, "core");
+ lua_getfield(L, -1, "registered_on_object_hp_change");
+
+ // Push data
+ ClientObjectRef::create(L, id);
+
+ // Call functions
+ runCallbacks(1, RUN_CALLBACKS_MODE_FIRST);
+}
+
bool ScriptApiClient::on_inventory_open(Inventory *inventory)
{
SCRIPTAPI_PRECHECKHEADER