1
0
Fork 0

Compare commits

...

1 Commits

Author SHA1 Message Date
Teemu Lehti b1e4ce8d15 Disable health regen and allow starving to death 2024-11-05 21:10:35 +02:00
1 changed files with 15 additions and 15 deletions

View File

@ -252,30 +252,30 @@ minetest.register_globalstep(function(dtime)
mcl_hunger.update_exhaustion_hud(player)
end
if food_level >= 18 then -- slow regeneration
if player_health > 0 and player_health < player:get_properties().hp_max then
player:set_hp(player_health+1)
mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN)
mcl_hunger.update_exhaustion_hud(player)
end
-- if food_level >= 18 then -- slow regeneration
-- if player_health > 0 and player_health < player:get_properties().hp_max then
-- player:set_hp(player_health+1)
-- mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN)
-- mcl_hunger.update_exhaustion_hud(player)
-- end
elseif food_level == 0 then -- starvation
if food_level == 0 then -- starvation
-- the amount of health at which a player will stop to get
-- harmed by starvation (10 for Easy, 1 for Normal, 0 for Hard)
local maximum_starvation = 1
local maximum_starvation = 0
-- TODO: implement Minecraft-like difficulty modes and the update maximumStarvation here
if player_health > maximum_starvation then
mcl_util.deal_damage(player, 1, {type = "starve"})
end
end
elseif food_tick_timer > max_tick_timer and food_level == 20 and food_saturation_level > 0 then -- fast regeneration
if player_health > 0 and player_health < player:get_properties().hp_max then
food_tick_timer = 0
player:set_hp(player_health+1)
mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN)
mcl_hunger.update_exhaustion_hud(player)
end
-- elseif food_tick_timer > max_tick_timer and food_level == 20 and food_saturation_level > 0 then -- fast regeneration
-- if player_health > 0 and player_health < player:get_properties().hp_max then
-- food_tick_timer = 0
-- player:set_hp(player_health+1)
-- mcl_hunger.exhaust(player_name, mcl_hunger.EXHAUST_REGEN)
-- mcl_hunger.update_exhaustion_hud(player)
-- end
end
food_tick_timers[player] = food_tick_timer -- update food_tick_timer table