From 78be994cab6eb18940508dc0dd25f89ea433484e Mon Sep 17 00:00:00 2001 From: fluxionary <25628292+fluxionary@users.noreply.github.com> Date: Sat, 18 Mar 2023 00:53:50 -0700 Subject: [PATCH] Check that hp is less than hp_max when trying to heal (#44) --- init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/init.lua b/init.lua index b3e7082..053fbec 100644 --- a/init.lua +++ b/init.lua @@ -377,12 +377,14 @@ local function health_tick() for _,player in ipairs(minetest.get_connected_players()) do local air = player:get_breath() or 0 local hp = player:get_hp() + local hp_max = player:get_properties().hp_max local saturation = stamina.get_saturation(player) -- don't heal if dead, drowning, or poisoned local should_heal = ( saturation >= settings.heal_lvl and saturation >= hp and + hp < hp_max and hp > 0 and air > 0 and not stamina.is_poisoned(player)