Sound on eat something

User avatar
LNJ
Member
 
Posts: 200
Joined: Tue Sep 23, 2014 16:02
GitHub: LNJ2
IRC: LNJ2GO
In-game: LNJ

Sound on eat something

by LNJ » Mon Jul 06, 2015 14:57

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())?
My Minetest Modding Tutorials (German) | Minetest TNG - My survival subgame! (OUTDATED... :() | #ComeToTheDuckSide - we have privacy! | diaspora* - The free and decentralized alternative to facebook and twitter!
 

User avatar
Calinou
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou

Re: Sound on eat something

by Calinou » Mon Jul 06, 2015 16:38

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.
 

User avatar
LNJ
Member
 
Posts: 200
Joined: Tue Sep 23, 2014 16:02
GitHub: LNJ2
IRC: LNJ2GO
In-game: LNJ

Re: Sound on eat something

by LNJ » Mon Jul 06, 2015 18:01

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?
My Minetest Modding Tutorials (German) | Minetest TNG - My survival subgame! (OUTDATED... :() | #ComeToTheDuckSide - we have privacy! | diaspora* - The free and decentralized alternative to facebook and twitter!
 

User avatar
Calinou
Member
 
Posts: 3124
Joined: Mon Aug 01, 2011 14:26
GitHub: Calinou
IRC: Calinou
In-game: Calinou

Re: Sound on eat something

by Calinou » Mon Jul 06, 2015 20:24

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.
 

User avatar
mahmutelmas06
Member
 
Posts: 355
Joined: Mon Mar 02, 2015 13:10
GitHub: mahmutelmas06
IRC: mahmutelmas06
In-game: masum

Re: Sound on eat something

by mahmutelmas06 » Wed Jul 08, 2015 11:50

Its already added to hunger mods.
Wuzzys hunger or blockmen's hunger mod have this feature.
My Mods:

Beverage
 

amadin
Member
 
Posts: 471
Joined: Tue Jun 16, 2015 16:23
GitHub: Amadin

Re: Sound on eat something

by amadin » Tue Aug 18, 2015 18:51

I want sound on eat too.
 

User avatar
LNJ
Member
 
Posts: 200
Joined: Tue Sep 23, 2014 16:02
GitHub: LNJ2
IRC: LNJ2GO
In-game: LNJ

Re: Sound on eat something

by LNJ » Fri Aug 21, 2015 17:05

Could this be added?
Should I do an Feature Request (issue) on GitHub?
My Minetest Modding Tutorials (German) | Minetest TNG - My survival subgame! (OUTDATED... :() | #ComeToTheDuckSide - we have privacy! | diaspora* - The free and decentralized alternative to facebook and twitter!
 

User avatar
AnxiousInfusion
Member
 
Posts: 146
Joined: Sun Aug 02, 2015 05:43
GitHub: AnxiousInfusion[GitLab]
IRC: AnxiousInfusion
In-game: AnxiousInfusion

Re: Sound on eat something

by AnxiousInfusion » Sat Aug 22, 2015 06:28

Does anyone have it in their heart to donate an audio proposal?
 

User avatar
benrob0329
Member
 
Posts: 1192
Joined: Thu Aug 06, 2015 22:39
GitHub: Benrob0329
In-game: benrob03

Re: Sound on eat something

by benrob0329 » Sat Aug 22, 2015 07:04

Freesound probably has a CC0 eating sound....I would gladly donate the sound of my crunching on something too :-P
 


Return to Minetest Features

Who is online

Users browsing this forum: No registered users and 16 guests

cron