mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-24 00:49:34 +01:00
Lingering heal/harm potions change at least 1 HP
This commit is contained in:
parent
3deac5a1c6
commit
fd724f4c1c
1 changed files with 8 additions and 1 deletions
|
@ -532,6 +532,10 @@ function mcl_potions.healing_func(player, hp)
|
||||||
if obj and obj.harmed_by_heal then hp = -hp end
|
if obj and obj.harmed_by_heal then hp = -hp end
|
||||||
|
|
||||||
if hp > 0 then
|
if hp > 0 then
|
||||||
|
-- at least 1 HP
|
||||||
|
if hp < 1 then
|
||||||
|
hp = 1
|
||||||
|
end
|
||||||
|
|
||||||
if obj and obj._cmi_is_mob then
|
if obj and obj._cmi_is_mob then
|
||||||
obj.health = math.max(obj.health + hp, obj.hp_max)
|
obj.health = math.max(obj.health + hp, obj.hp_max)
|
||||||
|
@ -539,7 +543,10 @@ function mcl_potions.healing_func(player, hp)
|
||||||
player:set_hp(math.min(player:get_hp() + hp, player:get_properties().hp_max), { type = "set_hp", other = "healing" })
|
player:set_hp(math.min(player:get_hp() + hp, player:get_properties().hp_max), { type = "set_hp", other = "healing" })
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
elseif hp < 0 then
|
||||||
|
if hp > -1 then
|
||||||
|
hp = -1
|
||||||
|
end
|
||||||
|
|
||||||
if obj and obj._cmi_is_mob then
|
if obj and obj._cmi_is_mob then
|
||||||
obj.health = obj.health + hp
|
obj.health = obj.health + hp
|
||||||
|
|
Loading…
Reference in a new issue