summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <wuzzy2@mail.ru>2019-12-24 18:12:46 +0000
committerSmallJoker <SmallJoker@users.noreply.github.com>2019-12-24 19:12:46 +0100
commit876a15bd7570f4cccf815a1d5e5588525e445cb1 (patch)
treef4a0d031de6c7366e3c756a6c5e0fcaaef81bcf2
parent7199dc75598e2900141c618ca01d23113c711be5 (diff)
downloadminetest-876a15bd7570f4cccf815a1d5e5588525e445cb1.tar.gz
minetest-876a15bd7570f4cccf815a1d5e5588525e445cb1.tar.bz2
minetest-876a15bd7570f4cccf815a1d5e5588525e445cb1.zip
Fix item eat sound not played if last item (#9239)
-rw-r--r--builtin/game/item.lua2
1 files changed, 1 insertions, 1 deletions
diff --git a/builtin/game/item.lua b/builtin/game/item.lua
index ef47cd66d..d6c6469b3 100644
--- a/builtin/game/item.lua
+++ b/builtin/game/item.lua
@@ -462,10 +462,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