diff --git a/parts/eventsets/tech_finesse_lock.lua b/parts/eventsets/tech_finesse_lock.lua index 5eec4b14..b4d0e4c1 100644 --- a/parts/eventsets/tech_finesse_lock.lua +++ b/parts/eventsets/tech_finesse_lock.lua @@ -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 } diff --git a/parts/eventsets/tech_finesse_lock_f.lua b/parts/eventsets/tech_finesse_lock_f.lua index d61c5d28..8291199c 100644 --- a/parts/eventsets/tech_finesse_lock_f.lua +++ b/parts/eventsets/tech_finesse_lock_f.lua @@ -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 -} \ No newline at end of file + hook_rotate=onRotate, +} diff --git a/parts/player/init.lua b/parts/player/init.lua index 94d16de9..6a117672 100644 --- a/parts/player/init.lua +++ b/parts/player/init.lua @@ -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', diff --git a/parts/player/player.lua b/parts/player/player.lua index 11a7fce6..eea5199b 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -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