Skip to content

Commit 1c5ece8

Browse files
committedDec 15, 2021
Fix eat sound not playing if eating last of stack
1 parent 3781754 commit 1c5ece8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed
 

Diff for: ‎builtin/game/item.lua

+2-1
Original file line numberDiff line numberDiff line change
@@ -499,11 +499,12 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed
499499
return result
500500
end
501501
end
502+
-- read definition before potentially emptying the stack
503+
local def = itemstack:get_definition()
502504
if itemstack:take_item():is_empty() then
503505
return itemstack
504506
end
505507

506-
local def = itemstack:get_definition()
507508
if def and def.sound and def.sound.eat then
508509
core.sound_play(def.sound.eat, {
509510
pos = user:get_pos(),

0 commit comments

Comments
 (0)
Please sign in to comment.