From 2b258aeaed0af7523318a292be16ca6f7798f1ea Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Thu, 9 Feb 2023 03:33:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=A2=E9=98=9F=E6=88=98?= =?UTF-8?q?=E7=BB=93=E6=9D=9F=E5=88=A4=E5=AE=9A=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/player/player.lua | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/parts/player/player.lua b/parts/player/player.lua index 2b0e27b6..0c91a79a 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -2676,13 +2676,6 @@ local function update_dead(P,dt) _updateMisc(P,dt) end function Player:_die() - do - local p=TABLE.find(PLY_ALIVE,self) - if p then - PLY_ALIVE[p]=PLY_ALIVE[#PLY_ALIVE] - rem(PLY_ALIVE) - end - end self.alive=false self.timing=false self.control=false @@ -2845,6 +2838,13 @@ function Player:lose(force) end end end + do + local p=TABLE.find(PLY_ALIVE,self) + if p then + PLY_ALIVE[p]=PLY_ALIVE[#PLY_ALIVE] + rem(PLY_ALIVE) + end + end self:_die() self.result='lose' if self.gameEnv.layout=='royale' then @@ -2907,21 +2907,12 @@ function Player:lose(force) self:dropPosition() freshPlayerPosition('update') - local cur=PLY_ALIVE[1].group - for i=2,#PLY_ALIVE do - local g=PLY_ALIVE[i].group - if cur==0 then - if g==0 then-- Two team 0, not finished - goto BREAK_notFinished - else-- Remember this may-be-last team - if i==#PLY_ALIVE then goto BREAK_notFinished end - cur=g - end - elseif g==0 or cur~=g then-- Find another team, not finished + for i=1,#PLY_ALIVE-1 do + if PLY_ALIVE[i].group==0 or PLY_ALIVE[i].group~=PLY_ALIVE[i+1].group then goto BREAK_notFinished end end - -- Only 1 team survived, all winner + -- Only 1 people or only 1 team survived, they win for i=1,#PLY_ALIVE do PLY_ALIVE[i]:win() end