科研-极简模式优化

This commit is contained in:
MrZ_26
2023-10-10 15:04:40 +08:00
parent 6ccebcfe17
commit 769125a894
4 changed files with 43 additions and 33 deletions

View File

@@ -16,7 +16,10 @@ local function lockMovement(P)
lockKey(P,{1,2})
end
local function lockRotation(P)
lockKey(P,{3,4,5})
lockKey(P,{3,4})
end
local function lockRotation180(P)
lockKey(P,{5})
end
local function unlock(P)
if P.cur and P.cur.name==6 and not P.gameEnv.skipOCheck then -- don't unlock rotation if O piece & no O-spin
@@ -40,26 +43,27 @@ local function onMove(P)
P.holdTime=0
lockKey(P,{8})
-- return if overhang
if P:_roofCheck() then return end
P.modeData.moveCount=P.modeData.moveCount+1
if P.modeData.moveCount>=2 then lockMovement(P) end
if not P:_roofCheck() then
P.modeData.moveCount=P.modeData.moveCount+1
if P.modeData.moveCount>=2 then lockMovement(P) end
end
end
local function onAutoMove(P)
if P:_roofCheck() then unlock(P) end
end
local function onRotate(P)
local function onRotate(P,dir)
if not P.cur then return end
P.holdTime=0
lockKey(P,{8})
-- return if overhang
if P:_roofCheck() then return end
P.modeData.rotations=P.modeData.rotations+1
if P.modeData.rotations>=2 then lockRotation(P) end
if not P:_roofCheck() then
P.modeData.rotations=P.modeData.rotations+(dir==2 and 2 or 1)
lockRotation180(P)
if P.modeData.rotations>=2 then
lockRotation(P)
end
end
end
return {
@@ -91,6 +95,7 @@ return {
if P.gameEnv.skipOCheck then return end
if P.cur.name==6 then
lockRotation(P)
lockRotation180(P)
else
resetLock(P)
end
@@ -99,11 +104,12 @@ return {
if P.gameEnv.skipOCheck then return end
if P.cur.name==6 then
lockRotation(P)
lockRotation180(P)
else
resetLock(P)
end
end,
hook_left_manual=onMove, hook_right_manual=onMove,
hook_left_auto=onAutoMove, hook_right_auto=onAutoMove,
hook_rotLeft=onRotate, hook_rotRight=onRotate, hook_rot180=onRotate,
hook_rotate=onRotate
}

View File

@@ -15,7 +15,10 @@ local function lockMovement(P)
lockKey(P,{1,2})
end
local function lockRotation(P)
lockKey(P,{3,4,5})
lockKey(P,{3,4})
end
local function lockRotation180(P)
lockKey(P,{5})
end
local function unlock(P)
if P.cur and P.cur.name==6 and not P.gameEnv.skipOCheck then -- don't unlock rotation if O piece & no O-spin
@@ -39,26 +42,27 @@ local function onMove(P)
P.holdTime=0
lockKey(P,{8})
-- return if overhang
if P:_roofCheck() then return end
P.modeData.moveCount=P.modeData.moveCount+1
if P.modeData.moveCount>=2 then lockMovement(P) end
if not P:_roofCheck() then
P.modeData.moveCount=P.modeData.moveCount+1
if P.modeData.moveCount>=2 then lockMovement(P) end
end
end
local function onAutoMove(P)
if P:_roofCheck() then unlock(P) end
end
local function onRotate(P)
local function onRotate(P,dir)
if not P.cur then return end
P.holdTime=0
lockKey(P,{8})
-- return if overhang
if P:_roofCheck() then return end
P.modeData.rotations=P.modeData.rotations+1
if P.modeData.rotations>=2 then lockRotation(P) end
if not P:_roofCheck() then
P.modeData.rotations=P.modeData.rotations+(dir==2 and 2 or 1)
lockRotation180(P)
if P.modeData.rotations>=2 then
lockRotation(P)
end
end
end
return {
@@ -98,6 +102,7 @@ return {
if P.gameEnv.skipOCheck then return end
if P.cur.name==6 then
lockRotation(P)
lockRotation180(P)
else
resetLock(P)
end
@@ -106,11 +111,12 @@ return {
if P.gameEnv.skipOCheck then return end
if P.cur.name==6 then
lockRotation(P)
lockRotation180(P)
else
resetLock(P)
end
end,
hook_left_manual=onMove, hook_right_manual=onMove,
hook_left_auto=onAutoMove, hook_right_auto=onAutoMove,
hook_rotLeft=onRotate, hook_rotRight=onRotate, hook_rot180=onRotate
}
hook_rotate=onRotate,
}