mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-11-23 02:51:06 +01:00
Take away 3 food points for regenerating
This commit is contained in:
parent
9c22df853d
commit
10446881b4
1 changed files with 10 additions and 2 deletions
|
@ -140,12 +140,20 @@ minetest.register_globalstep(function(dtime)
|
||||||
local hp = player:get_hp()
|
local hp = player:get_hp()
|
||||||
if timer > 0.5 then
|
if timer > 0.5 then
|
||||||
-- Quick heal (every 0.5s)
|
-- Quick heal (every 0.5s)
|
||||||
if h >= 20 and hp > 0 then
|
if h >= 20 and hp > 0 and hp < 20 then
|
||||||
|
-- +1 HP, -3 food points
|
||||||
player:set_hp(hp+1)
|
player:set_hp(hp+1)
|
||||||
|
h = h-3
|
||||||
|
mcl_hunger.hunger[name] = h
|
||||||
|
mcl_hunger.set_hunger_raw(player)
|
||||||
-- Slow heal, and hunger damage (every 4s)
|
-- Slow heal, and hunger damage (every 4s)
|
||||||
elseif timerMult == 0 then
|
elseif timerMult == 0 then
|
||||||
if h >= 18 and hp > 0 then
|
if h >= 18 and hp > 0 and hp < 20 then
|
||||||
|
-- +1 HP, -3 food points
|
||||||
player:set_hp(hp+1)
|
player:set_hp(hp+1)
|
||||||
|
h = h-3
|
||||||
|
mcl_hunger.hunger[name] = h
|
||||||
|
mcl_hunger.set_hunger_raw(player)
|
||||||
elseif h == 0 then
|
elseif h == 0 then
|
||||||
-- Damage hungry player down to 1 HP
|
-- Damage hungry player down to 1 HP
|
||||||
if hp-1 >= 0 then
|
if hp-1 >= 0 then
|
||||||
|
|
Loading…
Reference in a new issue