From 10446881b454486c771547e1989a970e4c6493f0 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sat, 20 May 2017 15:01:59 +0200 Subject: [PATCH] Take away 3 food points for regenerating --- mods/PLAYER/mcl_hunger/init.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/mods/PLAYER/mcl_hunger/init.lua b/mods/PLAYER/mcl_hunger/init.lua index 398254b7..ae90298f 100644 --- a/mods/PLAYER/mcl_hunger/init.lua +++ b/mods/PLAYER/mcl_hunger/init.lua @@ -140,12 +140,20 @@ minetest.register_globalstep(function(dtime) local hp = player:get_hp() if timer > 0.5 then -- 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) + h = h-3 + mcl_hunger.hunger[name] = h + mcl_hunger.set_hunger_raw(player) -- Slow heal, and hunger damage (every 4s) 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) + h = h-3 + mcl_hunger.hunger[name] = h + mcl_hunger.set_hunger_raw(player) elseif h == 0 then -- Damage hungry player down to 1 HP if hp-1 >= 0 then