Skip to content
Permalink
Browse files
Fix eat sound not playing if eating last of stack
  • Loading branch information
sfan5 committed Dec 15, 2021
1 parent 3781754 commit 1c5ece8334d050379eb99fe2ead52f9f4db44249
Showing with 2 additions and 1 deletion.
  1. +2 −1 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(),

0 comments on commit 1c5ece8

Please sign in to comment.