diff options
author | Wuzzy <wuzzy2@mail.ru> | 2019-12-24 18:12:46 +0000 |
---|---|---|
committer | rubenwardy <rw@rubenwardy.com> | 2019-12-31 21:31:53 +0000 |
commit | 2ef04cc3089a960df641aada03a09bb5cef4da46 (patch) | |
tree | dedb53fc85e0f9e61e405515c278293c00b5dcb0 | |
parent | 7a0884e2cdcdf39f832b56421a584b770c98f61b (diff) | |
download | minetest-2ef04cc3089a960df641aada03a09bb5cef4da46.tar.gz minetest-2ef04cc3089a960df641aada03a09bb5cef4da46.tar.bz2 minetest-2ef04cc3089a960df641aada03a09bb5cef4da46.zip |
Fix item eat sound not played if last item (#9239)
-rw-r--r-- | builtin/game/item.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/game/item.lua b/builtin/game/item.lua index 8041d557e..4054949f1 100644 --- a/builtin/game/item.lua +++ b/builtin/game/item.lua @@ -460,10 +460,10 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed return result end end + local def = itemstack:get_definition() 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 |