Page 1 of 1
Sound on eat something

Posted:
Mon Jul 06, 2015 14:57
by LNJ
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())?
Re: Sound on eat something

Posted:
Mon Jul 06, 2015 16:38
by Calinou
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.
Re: Sound on eat something

Posted:
Mon Jul 06, 2015 18:01
by LNJ
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.
How is it possible?
Re: Sound on eat something

Posted:
Mon Jul 06, 2015 20:24
by Calinou
Add this in
mods/default/init.lua:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
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)
And drop an appropriate
health_gain sound in the sounds folder.
Re: Sound on eat something

Posted:
Wed Jul 08, 2015 11:50
by mahmutelmas06
Its already added to hunger mods.
Wuzzys hunger or blockmen's hunger mod have this feature.
Re: Sound on eat something

Posted:
Tue Aug 18, 2015 18:51
by amadin
I want sound on eat too.
Re: Sound on eat something

Posted:
Fri Aug 21, 2015 17:05
by LNJ
Could this be added?
Should I do an Feature Request (issue) on GitHub?
Re: Sound on eat something

Posted:
Sat Aug 22, 2015 06:28
by AnxiousInfusion
Does anyone have it in their heart to donate an audio proposal?
Re: Sound on eat something

Posted:
Sat Aug 22, 2015 07:04
by benrob0329
Freesound probably has a CC0 eating sound....I would gladly donate the sound of my crunching on something too :-P