aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-12-15 15:36:19 +0100
committersfan5 <sfan5@live.de>2021-12-15 15:36:19 +0100
commit1c5ece8334d050379eb99fe2ead52f9f4db44249 (patch)
tree94c7a5ea1ce866a5e4fb4bfb4c38226b6d676c9f
parent378175497a6a5bb3492f268f71b8d55389e33fc4 (diff)
downloadminetest-1c5ece8334d050379eb99fe2ead52f9f4db44249.tar.gz
minetest-1c5ece8334d050379eb99fe2ead52f9f4db44249.tar.bz2
minetest-1c5ece8334d050379eb99fe2ead52f9f4db44249.zip
Fix eat sound not playing if eating last of stack
-rw-r--r--builtin/game/item.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/game/item.lua b/builtin/game/item.lua
index c9ccb8801..5a83eafd2 100644
--- a/builtin/game/item.lua
+++ b/builtin/game/item.lua
@@ -499,11 +499,12 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed
return result
end
end
+ -- read definition before potentially emptying the stack
+ local def = itemstack:get_definition()
if itemstack:take_item():is_empty() then
return itemstack
end
- local def = itemstack:get_definition()
if def and def.sound and def.sound.eat then
core.sound_play(def.sound.eat, {
pos = user:get_pos(),