mirror of
https://github.com/minetest/minetest.git
synced 2024-12-15 02:39:21 +01:00
Fix item eat sound not played if last item (#9239)
This commit is contained in:
parent
7a0884e2cd
commit
2ef04cc308
@ -460,10 +460,10 @@ function core.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
local def = itemstack:get_definition()
|
||||||
if itemstack:take_item() ~= nil then
|
if itemstack:take_item() ~= nil then
|
||||||
user:set_hp(user:get_hp() + hp_change)
|
user:set_hp(user:get_hp() + hp_change)
|
||||||
|
|
||||||
local def = itemstack:get_definition()
|
|
||||||
if def and def.sound and def.sound.eat then
|
if def and def.sound and def.sound.eat then
|
||||||
minetest.sound_play(def.sound.eat, { pos = user:get_pos(), max_hear_distance = 16 })
|
minetest.sound_play(def.sound.eat, { pos = user:get_pos(), max_hear_distance = 16 })
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user