From 5b0d83b51c33a6a72054670e6c290b9ffd32a191 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Fri, 29 Jan 2021 21:15:15 -0500 Subject: [PATCH] BONKERS handles rotate reset correctly now --- tetris/modes/pro_tl.lua | 10 +++++++--- tetris/rulesets/bonkers.lua | 1 - 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/tetris/modes/pro_tl.lua b/tetris/modes/pro_tl.lua index 3fe70a3..e297f64 100644 --- a/tetris/modes/pro_tl.lua +++ b/tetris/modes/pro_tl.lua @@ -80,9 +80,13 @@ function ProGame:onHold() end function ProGame:whilePieceActive() - self.piece.lock_delay = self.piece.lowest_y < self.piece.position.y - and 0 or self.piece.lock_delay - self.piece.lowest_y = math.max(self.piece.lowest_y, self.piece.position.y) + for _, block in pairs(self.piece:getBlockOffsets()) do + local y = self.piece.position.y + block.y + if y > self.piece.lowest_y then + self.piece.lock_delay = 0 + self.piece.lowest_y = y + end + end end function ProGame:onLineClear(cleared_row_count) diff --git a/tetris/rulesets/bonkers.lua b/tetris/rulesets/bonkers.lua index fa047aa..e44cf62 100644 --- a/tetris/rulesets/bonkers.lua +++ b/tetris/rulesets/bonkers.lua @@ -133,7 +133,6 @@ function BONKERS:attemptWallkicks(piece, new_piece, rot_dir, grid) if grid:canPlacePiece(kicked_piece) then piece:setRelativeRotation(rot_dir) piece:setOffset(offset) - piece.lock_delay = 0 -- rotate reset return end end