From f434e9ee9b4a1e982996c2d6ecb155823efc26c7 Mon Sep 17 00:00:00 2001 From: Ho-spair Date: Tue, 20 Dec 2022 21:32:38 +0800 Subject: [PATCH] prevent enter dying loop --- lua/server/room.lua | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lua/server/room.lua b/lua/server/room.lua index 06e83706..7efec8ad 100644 --- a/lua/server/room.lua +++ b/lua/server/room.lua @@ -1388,12 +1388,14 @@ function Room:changeHp(player, num, reason, skillName, damageStruct) self.logic:trigger(fk.HpChanged, player, data) if player.hp < 1 then - ---@type DyingStruct - local dyingStruct = { - who = player.id, - damage = damageStruct, - } - self:enterDying(dyingStruct) + if num < 0 then + ---@type DyingStruct + local dyingStruct = { + who = player.id, + damage = damageStruct, + } + self:enterDying(dyingStruct) + end elseif player.dying then player.dying = false end