From 653debbbc23f3cd8d42acec448cf61f3d59bc45f Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 26 Sep 2021 11:37:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=9E=E5=90=88=E5=88=B6=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=8E=A9=E5=AE=B6sid=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=9B=9E=E5=90=88=E9=A1=BA=E5=BA=8F=20=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E7=8E=A9=E5=AE=B6=E4=B9=9F=E6=9C=89sid=E4=BA=86=EF=BC=88?= =?UTF-8?q?=E8=B7=9Fid=E7=9B=B8=E5=90=8C=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/eventsets/checkTurn_1.lua | 17 +++++++++++------ parts/eventsets/checkTurn_7.lua | 17 +++++++++++------ parts/player/init.lua | 2 +- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/parts/eventsets/checkTurn_1.lua b/parts/eventsets/checkTurn_1.lua index bdd209db..b571f5fb 100644 --- a/parts/eventsets/checkTurn_1.lua +++ b/parts/eventsets/checkTurn_1.lua @@ -2,12 +2,17 @@ return{ dropPiece=function(P) if #PLY_ALIVE>1 then P.control=false - local ID=P.id - repeat - ID=ID+1 - if not PLAYERS[ID]then ID=1 end - until PLAYERS[ID].alive or ID==P.id - PLAYERS[ID].control=true + local id1=P.sid + local minMaxID,minID=1e99,1e99 + for i=1,#PLY_ALIVE do + local id2=PLY_ALIVE[i].sid + if id2>id1 then + minMaxID=math.min(minMaxID,id2) + else + minID=math.min(minID,id2) + end + end + PLY_ALIVE[minMaxID==1e99 and minID or minMaxID].control=true end end } diff --git a/parts/eventsets/checkTurn_7.lua b/parts/eventsets/checkTurn_7.lua index 08156272..0ce5d424 100644 --- a/parts/eventsets/checkTurn_7.lua +++ b/parts/eventsets/checkTurn_7.lua @@ -2,12 +2,17 @@ return{ dropPiece=function(P) if P.stat.piece%7==0 and #PLY_ALIVE>1 then P.control=false - local ID=P.id - repeat - ID=ID+1 - if not PLAYERS[ID]then ID=1 end - until PLAYERS[ID].alive or ID==P.id - PLAYERS[ID].control=true + local id1=P.sid + local minMaxID,minID=1e99,1e99 + for i=1,#PLY_ALIVE do + local id2=PLY_ALIVE[i].sid + if id2>id1 then + minMaxID=math.min(minMaxID,id2) + else + minID=math.min(minID,id2) + end + end + PLY_ALIVE[minMaxID==1e99 and minID or minMaxID].control=true end end } diff --git a/parts/player/init.lua b/parts/player/init.lua index 41a7952b..992cbc1f 100644 --- a/parts/player/init.lua +++ b/parts/player/init.lua @@ -175,7 +175,7 @@ local function _newEmptyPlayer(id,mini) --User-related P.username="" P.uid=false - P.sid=false + P.sid=id --Block states --[[