aboutsummaryrefslogtreecommitdiff
path: root/src/script/cpp_api/s_client.cpp
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-11-24 15:01:52 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-11-24 15:01:52 +0100
commitfb4d54ee30ee9b8394bac18418b88adb0f9cd953 (patch)
treebb409836bdfdbbc75b9c40216aee28bad39165c5 /src/script/cpp_api/s_client.cpp
parent50629cc6a1830783580811cedec1fd8ab559f40b (diff)
downloaddragonfireclient-fb4d54ee30ee9b8394bac18418b88adb0f9cd953.tar.xz
Added minetest.register_on_play_sound
Diffstat (limited to 'src/script/cpp_api/s_client.cpp')
-rw-r--r--src/script/cpp_api/s_client.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/script/cpp_api/s_client.cpp b/src/script/cpp_api/s_client.cpp
index 981b08537..cf7df5b5d 100644
--- a/src/script/cpp_api/s_client.cpp
+++ b/src/script/cpp_api/s_client.cpp
@@ -237,6 +237,22 @@ bool ScriptApiClient::on_recieve_physics_override(float speed, float jump, float
return readParam<bool>(L, -1);
}
+bool ScriptApiClient::on_play_sound(SimpleSoundSpec spec)
+{
+ SCRIPTAPI_PRECHECKHEADER
+
+ // Get core.registered_on_play_sound
+ lua_getglobal(L, "core");
+ lua_getfield(L, -1, "registered_on_play_sound");
+
+ // Push data
+ push_soundspec(L, spec);
+
+ // Call functions
+ runCallbacks(1, RUN_CALLBACKS_MODE_OR);
+ return readParam<bool>(L, -1);
+}
+
bool ScriptApiClient::on_inventory_open(Inventory *inventory)
{
SCRIPTAPI_PRECHECKHEADER