It would be nice, if there is played a sound when you eat something (minetest.item_eat())!
I mean could this be added to the function?
Or is this possible already (without doing this for everything extern with minetest.sound_play())?
Calinou wrote:It is definitely possible, I have done it in Carbone. It also is possible to prevent overheal (eating when your health bar is already full).
I guess pull requests are welcome; let's hope that they are quickly merged if someone makes something like that.
minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack, user, pointed_thing)
if user:get_hp() >= 20 then return itemstack end
local pos = user:getpos()
minetest.sound_play("health_gain", {pos = pos, gain = 0.4})
end)
Users browsing this forum: No registered users and 16 guests