mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 15:13:16 +00:00
properly set hp when poly player dies
This commit is contained in:
parent
28369b17a9
commit
9509277e10
1 changed files with 7 additions and 0 deletions
|
@ -376,6 +376,13 @@ ctx.cap.health = {
|
||||||
reduce_hp()
|
reduce_hp()
|
||||||
else
|
else
|
||||||
polymorph.switch_entity(end_poly_effect(ctx.my_player.entity))
|
polymorph.switch_entity(end_poly_effect(ctx.my_player.entity))
|
||||||
|
local _, max_hp_new, has_hp = util.get_ent_health(ctx.my_player.entity)
|
||||||
|
if not ctx.my_player.currently_polymorphed and has_hp then
|
||||||
|
-- Restore the player back to small amount of hp.
|
||||||
|
local new_hp = 3 * max_hp_new / 20
|
||||||
|
local final_hp = math.max(new_hp, math.min(2/5, max_hp_new))
|
||||||
|
util.set_ent_health(ctx.my_player.entity, {final_hp, max_hp_new})
|
||||||
|
end
|
||||||
async(function()
|
async(function()
|
||||||
wait(1)
|
wait(1)
|
||||||
player_died()
|
player_died()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue