diff options
author | sfan5 <sfan5@live.de> | 2022-09-11 21:16:17 +0200 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2022-09-30 14:02:14 +0200 |
commit | 525fc3833c40dcca478719533a87bc7b5e285e4e (patch) | |
tree | e052ace4266381dbb3f7d8b8591a9d7d66ea6915 /src/script/common/c_content.cpp | |
parent | bbdb1929c61a7cf851b498f34154ac0f9528fbb4 (diff) | |
download | minetest-525fc3833c40dcca478719533a87bc7b5e285e4e.tar.xz |
Implement tool use sounds
Diffstat (limited to 'src/script/common/c_content.cpp')
-rw-r--r-- | src/script/common/c_content.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index da54edb96..93202dcee 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -112,6 +112,19 @@ void read_item_definition(lua_State* L, int index, } lua_pop(L, 1); + // No, this is not a mistake. Item sounds are in "sound", node sounds in "sounds". + lua_getfield(L, index, "sound"); + if (!lua_isnil(L, -1)) { + luaL_checktype(L, -1, LUA_TTABLE); + lua_getfield(L, -1, "punch_use"); + read_soundspec(L, -1, def.sound_use); + lua_pop(L, 1); + lua_getfield(L, -1, "punch_use_air"); + read_soundspec(L, -1, def.sound_use_air); + lua_pop(L, 1); + } + lua_pop(L, 1); + def.range = getfloatfield_default(L, index, "range", def.range); // Client shall immediately place this node when player places the item. |