Add stomach growl sound, tweak hunger msgs

This commit is contained in:
Wuzzy 2019-09-21 18:57:58 +02:00
parent 3fdfe4e37f
commit 247ed18ce2
5 changed files with 25 additions and 9 deletions

View File

@ -1,7 +1,11 @@
Hunger mod
==========
For Voxelgarden(By Casimir?)
For Voxelgarden (by Casimir?)
Tweaked by Kaadmy, for Pixture
Asset license: CC BY-SA 4.0
Source license: LGPLv2.1
Media license: CC BY-SA 4.0
Source code license: LGPLv2.1
Sound credits:
* hunger_hungry.ogg: borygmi
Source: <https://freesound.org/people/borygmi/sounds/414975/>

View File

@ -200,7 +200,7 @@ local function on_item_eat(hpdata, replace_with_item, itemstack,
local headpos = player:get_pos()
headpos.y = headpos.y + 1
minetest.sound_play("hunger_eat", {pos = headpos, max_hear_distance = 8})
minetest.sound_play("hunger_eat", {pos = headpos, max_hear_distance = 8, object=player})
particlespawners[name] = minetest.add_particlespawner(
{
@ -298,14 +298,21 @@ local function on_globalstep(dtime)
hunger.userdata[name].saturation = 0
if player_step[name] >= 24 then -- how much the player has been active
player_step[name] = 0
local oldhng = hunger.userdata[name].hunger
hunger.userdata[name].hunger = hunger.userdata[name].hunger - 1
if (oldhng == 5 or oldhng == 3) and hp >= 0 then
minetest.chat_send_player(name, minetest.colorize("#f00", S("You are hungry.")))
local pos_sound = player:get_pos()
minetest.sound_play({name="hunger_hungry"}, {pos=pos_sound, max_hear_distance=3, object=player})
end
if hunger.userdata[name].hunger <= 0 and hp >= 0 then
player:set_hp(hp - 1)
hunger.userdata[name].hunger = 0
local pos_sound = player:get_pos()
minetest.chat_send_player(
name, minetest.colorize("#f00", S("You are hungry.")))
if hp > 1 then
minetest.chat_send_player(name, minetest.colorize("#f00", S("You are starving.")))
else
minetest.chat_send_player(name, minetest.colorize("#f00", S("You starved to death.")))
end
end
end
end
@ -334,7 +341,8 @@ local function fake_on_item_eat(hpdata, replace_with_item, itemstack,
"hunger_eat",
{
pos = headpos,
max_hear_distance = 8
max_hear_distance = 8,
object = player,
})
if not minetest.settings:get_bool("creative_mode") then

View File

@ -1,4 +1,6 @@
# textdomain: hunger
You are hungry.=Sie haben Hunger.
You are starving.=Sie verhungern.
You starved to death.=Sie sind verhungert.
Eating=Essen
You're eating food, which slows you down=Sie essen etwas und sind langsamer

View File

@ -1,4 +1,6 @@
# textdomain: hunger
You are hungry.=
You are starving.=
You starved to death.=
Eating=
You're eating food, which slows you down=

Binary file not shown.