diff --git a/mods/hbhunger/hunger.lua b/mods/hbhunger/hunger.lua index 2e0f49e..ed6f229 100644 --- a/mods/hbhunger/hunger.lua +++ b/mods/hbhunger/hunger.lua @@ -105,10 +105,17 @@ function hbhunger.item_eat(hunger_change, replace_with_item, poisen, heal, sound hbhunger.hunger[name] = h hbhunger.set_hunger_raw(user) end + -- we must respect the real maximun hp of the player already set + max_hp = user:get_properties().hp_max -- Healing - if hp < 20 and heal then - hp = hp + heal - if hp > 20 then hp = 20 end + if hp < max_hp then + -- heal is not defines due way of hbhunger.register_food + if not heal then heal = 1 end + -- eating something not give you inmediate life, give you statiation to get recovery + if hp < 3 and heal > 0 then hp = hp + heal end + -- so do not hardcoded hp to 20 when eating + if hp > max_hp then hp = max_hp end + -- this will work only when valid then user:set_hp(hp) end -- Poison