From 9f256f201e2e8047fc5a78e6d6362dd15b0360d6 Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Mon, 27 Jul 2015 20:40:04 +0200 Subject: [PATCH] Added regeneration depending on class/armor - Added a quotient used when dividing hbhunger's defined time to heal players, quotient depending on player's class/armor --- mods/hbhunger/init.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mods/hbhunger/init.lua b/mods/hbhunger/init.lua index 1a3a7540..aa2154d9 100755 --- a/mods/hbhunger/init.lua +++ b/mods/hbhunger/init.lua @@ -108,7 +108,16 @@ minetest.register_globalstep(function(dtime) local h = tonumber(hbhunger.hunger[name]) local hp = player:get_hp() - if timer > 10 then + local timerquot = 1 + + if pclasses.api.get_player_class(name) == "warrior" then + timerquot = 2 + elseif pclasses.api.util.does_wear_full_armor(name, "mithril", false) then + timerquot = 1.5 + end + + + if timer > 10/timerquot then -- heal player by 1 hp if not dead and satiation is > 15 (of 30) if h > 15 and hp > 0 and player:get_breath() > 0 then player:set_hp(hp+1)