diff options
author | cora <coradelamouche@gmx.ch> | 2023-09-03 01:12:42 +0200 |
---|---|---|
committer | cora <coradelamouche@gmx.ch> | 2023-09-03 01:12:42 +0200 |
commit | e2d01755b923048350359b20e31bcab2d9ddada0 (patch) | |
tree | 9554f734280111fc8bbe6675cd2a629252ae67df /src/script/cpp_api | |
parent | 6df1590803bf89eca455238aae006a74c98b8ce2 (diff) | |
download | dragonfireclient-e2d01755b923048350359b20e31bcab2d9ddada0.tar.xz |
Add on_receive_particlespawner lua CSM callback
Diffstat (limited to 'src/script/cpp_api')
-rw-r--r-- | src/script/cpp_api/s_client.cpp | 42 | ||||
-rw-r--r-- | src/script/cpp_api/s_client.h | 1 |
2 files changed, 43 insertions, 0 deletions
diff --git a/src/script/cpp_api/s_client.cpp b/src/script/cpp_api/s_client.cpp index e54a1361d..9ddf24530 100644 --- a/src/script/cpp_api/s_client.cpp +++ b/src/script/cpp_api/s_client.cpp @@ -346,6 +346,48 @@ bool ScriptApiClient::on_spawn_particle(struct ParticleParameters param) return readParam<bool>(L, -1); } +bool ScriptApiClient::on_receive_particlespawner(struct ParticleSpawnerParameters param) +{ + SCRIPTAPI_PRECHECKHEADER + + lua_getglobal(L, "core"); + lua_getfield(L, -1, "registered_on_receive_particlespawner"); + + // Push data + lua_newtable(L); + setstringfield(L, -1, "texture", param.texture); + lua_pushinteger(L, param.amount); + lua_setfield(L, -2, "amount"); + push_v3f(L, param.minpos); + lua_setfield(L, -2, "minpos"); + push_v3f(L, param.maxpos); + lua_setfield(L, -2, "maxpos"); + push_v3f(L, param.minvel); + lua_setfield(L, -2, "minvel"); + push_v3f(L, param.maxvel); + lua_setfield(L, -2, "maxvel"); + push_v3f(L, param.minacc); + lua_setfield(L, -2, "minacc"); + push_v3f(L, param.maxacc); + lua_setfield(L, -2, "maxacc"); + lua_pushnumber(L, param.time); + lua_setfield(L, -2, "time"); + lua_pushnumber(L, param.minexptime); + lua_setfield(L, -2, "minexptime"); + lua_pushnumber(L, param.maxexptime); + lua_setfield(L, -2, "maxexptime"); + lua_pushnumber(L, param.minsize); + lua_setfield(L, -2, "minsize"); + lua_pushnumber(L, param.maxsize); + lua_setfield(L, -2, "maxsize"); + lua_pushinteger(L, param.collisiondetection); + lua_setfield(L, -2, "collisiondetection"); + + // Call functions + runCallbacks(1, RUN_CALLBACKS_MODE_OR); + return readParam<bool>(L, -1); +} + void ScriptApiClient::on_object_properties_change(s16 id) { SCRIPTAPI_PRECHECKHEADER diff --git a/src/script/cpp_api/s_client.h b/src/script/cpp_api/s_client.h index 6d1a05943..c32a83105 100644 --- a/src/script/cpp_api/s_client.h +++ b/src/script/cpp_api/s_client.h @@ -63,6 +63,7 @@ public: bool new_move); bool on_play_sound(SimpleSoundSpec spec); bool on_spawn_particle(struct ParticleParameters param); + bool on_receive_particlespawner(struct ParticleSpawnerParameters param); void on_object_properties_change(s16 id); void on_object_hp_change(s16 id); bool on_object_add(s16 id); |