diff options
author | Wuzzy <wuzzy2@mail.ru> | 2018-12-10 09:25:47 +0100 |
---|---|---|
committer | Loïc Blot <nerzhul@users.noreply.github.com> | 2018-12-10 09:25:47 +0100 |
commit | 5560ec8178053b27adac6f277f539975d46267b8 (patch) | |
tree | 5a8ee794f004a5c0d49084c0f9050cd8808b9d5f /builtin/game | |
parent | 98a72b9d458f3108d4a4bef4f0ad78f46baee2c4 (diff) | |
download | minetest-5560ec8178053b27adac6f277f539975d46267b8.tar.gz minetest-5560ec8178053b27adac6f277f539975d46267b8.tar.bz2 minetest-5560ec8178053b27adac6f277f539975d46267b8.zip |
Add eat sound (#7956)
Diffstat (limited to 'builtin/game')
-rw-r--r-- | builtin/game/item.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/builtin/game/item.lua b/builtin/game/item.lua index 9b7569c77..ced28771e 100644 --- a/builtin/game/item.lua +++ b/builtin/game/item.lua @@ -469,6 +469,11 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed if itemstack:take_item() ~= nil then user:set_hp(user:get_hp() + hp_change) + local def = itemstack:get_definition() + if def and def.sound and def.sound.eat then + minetest.sound_play(def.sound.eat, { pos = user:get_pos(), max_hear_distance = 16 }) + end + if replace_with_item then if itemstack:is_empty() then itemstack:add_item(replace_with_item) |