mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2024-12-24 17:50:37 +01:00
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
This commit is contained in:
parent
73cfac15d5
commit
9f256f201e
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user