科研-极简模式优化

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,
}

View File

@@ -253,9 +253,7 @@ local hooks = {
'hook_right',
'hook_right_manual',
'hook_right_auto',
'hook_rotLeft',
'hook_rotRight',
'hook_rot180',
'hook_rotate',
'hook_drop',
'hook_spawn',
'hook_hold',

View File

@@ -271,7 +271,7 @@ function Player:act_rotRight()
if self.cur then
self.ctrlCount=self.ctrlCount+1
self:spin(1)
self:_triggerEvent('hook_rotRight')
self:_triggerEvent('hook_rotate',1)
self.keyPressing[3]=false
end
end
@@ -280,7 +280,7 @@ function Player:act_rotLeft()
if self.cur then
self.ctrlCount=self.ctrlCount+1
self:spin(3)
self:_triggerEvent('hook_rotLeft')
self:_triggerEvent('hook_rotate',3)
self.keyPressing[4]=false
end
end
@@ -289,7 +289,7 @@ function Player:act_rot180()
if self.cur then
self.ctrlCount=self.ctrlCount+2
self:spin(2)
self:_triggerEvent('hook_rot180')
self:_triggerEvent('hook_rotate',2)
self.keyPressing[5]=false
end
end