Question ,this is good way to fix mcl2-player-hunger ?
I add one new variable at init.lua > mcl_hunger.EXHAUST_FLOW = 10 and made some changes:
Code: Select all
..
minetest.register_globalstep(function(dtime)
main_timer = main_timer + dtime
timer = timer + dtime
if main_timer > mcl_hunger.HUD_TICK or timer > 0.5 then
if main_timer > mcl_hunger.HUD_TICK then main_timer = 0 end
for _,player in ipairs(minetest.get_connected_players()) do
local name = player:get_player_name()
-- litle exaust flow ,all time counting :)
mcl_hunger.exhaust(name, mcl_hunger.EXHAUST_FLOW)
-- end of fix
local h = tonumber(mcl_hunger.get_hunger(player))
local hp = player:get_hp()
if timer > 0.5 then
-- Slow health regeneration, and hunger damage (every 4s).
-- Regeneration rate based on tutorial video
..
Code: Select all
..
-- next fix - i cant die at starving, value hp stop at 1 value
-- original: if hp-1 > 0 then
if hp-1 >= 0 then
if mod_death_messages then
..
end
player:set_hp(hp-1)
end
..