From 706e8ef130e9c3fc2af95de304203c0c01cdd2f2 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sat, 20 Mar 2021 16:27:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9E=81=E7=AE=80=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/player/player.lua | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/parts/player/player.lua b/parts/player/player.lua index 14e07a73..7c21e646 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -1053,33 +1053,27 @@ do--Player.drop(P)--Place piece --Finesse: roof check local finesse - if CY<=18 then - local y0=CY + if CY>ENV.fieldH-2 then + finesse=true + else for x=1,#CB[1]do - local y - for i=#CB,1,-1 do - if CB[i][x]then - y=i - goto L1 - end - end - goto L2 - ::L1:: - if y then - x=CX+x-1 - for y1=y0+y,#P.field do - --Roof=finesse - if P:solid(x,y1)then - finesse=true - goto L2 - end + local y=#CB + + --Find the highest y of blocks' x-th column + while not CB[y][x]do y=y-1 end + + local testX=CX+x-1--Optimize + + --Test the whole column of field to find roof + for testY=CY+y,#P.field do + if P:solid(testX,testY)then + finesse=true + goto BERAK end end end - else - finesse=true + ::BERAK:: end - ::L2:: --Remove rows need to be cleared if cc>0 then