diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-09-19 18:55:25 +0200 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-09-19 18:55:25 +0200 |
commit | 950d2c9b3e10cbace9236e820c8119d1abb9e01f (patch) | |
tree | c0d9c1ca33c0251667d0a8cb59f25de65996dc69 /src/script/cpp_api/s_client.cpp | |
parent | fb4815c660d6d9cfc9df76a3ba763095b9701925 (diff) | |
download | dragonfireclient-950d2c9b3e10cbace9236e820c8119d1abb9e01f.tar.xz |
Add ClientObjectRef:remove and return true in on_object_add callback to remove newly added object
Diffstat (limited to 'src/script/cpp_api/s_client.cpp')
-rw-r--r-- | src/script/cpp_api/s_client.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/script/cpp_api/s_client.cpp b/src/script/cpp_api/s_client.cpp index b0e7a073e..1ed273a30 100644 --- a/src/script/cpp_api/s_client.cpp +++ b/src/script/cpp_api/s_client.cpp @@ -323,7 +323,7 @@ void ScriptApiClient::on_object_hp_change(s16 id) runCallbacks(1, RUN_CALLBACKS_MODE_FIRST); } -void ScriptApiClient::on_object_add(s16 id) +bool ScriptApiClient::on_object_add(s16 id) { SCRIPTAPI_PRECHECKHEADER @@ -335,7 +335,8 @@ void ScriptApiClient::on_object_add(s16 id) push_objectRef(L, id); // Call functions - runCallbacks(1, RUN_CALLBACKS_MODE_FIRST); + runCallbacks(1, RUN_CALLBACKS_MODE_OR); + return readParam<bool>(L, -1); } bool ScriptApiClient::on_inventory_open(Inventory *inventory) |