From 9509277e10fe589632a6ad8a41c7aa7356cefb03 Mon Sep 17 00:00:00 2001 From: bgkillas Date: Tue, 29 Oct 2024 11:55:44 -0400 Subject: [PATCH] properly set hp when poly player dies --- quant.ew/files/system/local_health/local_health.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/quant.ew/files/system/local_health/local_health.lua b/quant.ew/files/system/local_health/local_health.lua index 94ddb133..8732d664 100644 --- a/quant.ew/files/system/local_health/local_health.lua +++ b/quant.ew/files/system/local_health/local_health.lua @@ -376,6 +376,13 @@ ctx.cap.health = { reduce_hp() else 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() wait(1) player_died()