mods - hbhunger - donot hardcoded max hp value when eating and healting
* Related to https://codeberg.org/Wuzzy/minetest_hbhunger/issues/1 * the code has a hardcoded hp > 20 then hp = 20 at hunger.lua line 39 that do not respect the hp_max real value * also do not give inmediate life, eating something gives you healt-satiation so then your character wil have enought conditions to recovery healt
This commit is contained in:
parent
41f73142c9
commit
1ac019d9a1
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user