Add stomach growl sound, tweak hunger msgs
This commit is contained in:
parent
3fdfe4e37f
commit
247ed18ce2
|
@ -1,7 +1,11 @@
|
||||||
Hunger mod
|
Hunger mod
|
||||||
==========
|
==========
|
||||||
For Voxelgarden(By Casimir?)
|
For Voxelgarden (by Casimir?)
|
||||||
Tweaked by Kaadmy, for Pixture
|
Tweaked by Kaadmy, for Pixture
|
||||||
|
|
||||||
Asset license: CC BY-SA 4.0
|
Media license: CC BY-SA 4.0
|
||||||
Source license: LGPLv2.1
|
Source code license: LGPLv2.1
|
||||||
|
|
||||||
|
Sound credits:
|
||||||
|
* hunger_hungry.ogg: borygmi
|
||||||
|
Source: <https://freesound.org/people/borygmi/sounds/414975/>
|
||||||
|
|
|
@ -200,7 +200,7 @@ local function on_item_eat(hpdata, replace_with_item, itemstack,
|
||||||
local headpos = player:get_pos()
|
local headpos = player:get_pos()
|
||||||
|
|
||||||
headpos.y = headpos.y + 1
|
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(
|
particlespawners[name] = minetest.add_particlespawner(
|
||||||
{
|
{
|
||||||
|
@ -298,14 +298,21 @@ local function on_globalstep(dtime)
|
||||||
hunger.userdata[name].saturation = 0
|
hunger.userdata[name].saturation = 0
|
||||||
if player_step[name] >= 24 then -- how much the player has been active
|
if player_step[name] >= 24 then -- how much the player has been active
|
||||||
player_step[name] = 0
|
player_step[name] = 0
|
||||||
|
local oldhng = hunger.userdata[name].hunger
|
||||||
hunger.userdata[name].hunger = hunger.userdata[name].hunger - 1
|
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
|
if hunger.userdata[name].hunger <= 0 and hp >= 0 then
|
||||||
player:set_hp(hp - 1)
|
player:set_hp(hp - 1)
|
||||||
hunger.userdata[name].hunger = 0
|
hunger.userdata[name].hunger = 0
|
||||||
|
if hp > 1 then
|
||||||
local pos_sound = player:get_pos()
|
minetest.chat_send_player(name, minetest.colorize("#f00", S("You are starving.")))
|
||||||
minetest.chat_send_player(
|
else
|
||||||
name, minetest.colorize("#f00", S("You are hungry.")))
|
minetest.chat_send_player(name, minetest.colorize("#f00", S("You starved to death.")))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -334,7 +341,8 @@ local function fake_on_item_eat(hpdata, replace_with_item, itemstack,
|
||||||
"hunger_eat",
|
"hunger_eat",
|
||||||
{
|
{
|
||||||
pos = headpos,
|
pos = headpos,
|
||||||
max_hear_distance = 8
|
max_hear_distance = 8,
|
||||||
|
object = player,
|
||||||
})
|
})
|
||||||
|
|
||||||
if not minetest.settings:get_bool("creative_mode") then
|
if not minetest.settings:get_bool("creative_mode") then
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
# textdomain: hunger
|
# textdomain: hunger
|
||||||
You are hungry.=Sie haben Hunger.
|
You are hungry.=Sie haben Hunger.
|
||||||
|
You are starving.=Sie verhungern.
|
||||||
|
You starved to death.=Sie sind verhungert.
|
||||||
Eating=Essen
|
Eating=Essen
|
||||||
You're eating food, which slows you down=Sie essen etwas und sind langsamer
|
You're eating food, which slows you down=Sie essen etwas und sind langsamer
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
# textdomain: hunger
|
# textdomain: hunger
|
||||||
You are hungry.=
|
You are hungry.=
|
||||||
|
You are starving.=
|
||||||
|
You starved to death.=
|
||||||
Eating=
|
Eating=
|
||||||
You're eating food, which slows you down=
|
You're eating food, which slows you down=
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue