diff --git a/tetris/rulesets/pairs.lua b/tetris/rulesets/pairs.lua index f392c13..131adc5 100644 --- a/tetris/rulesets/pairs.lua +++ b/tetris/rulesets/pairs.lua @@ -225,8 +225,22 @@ function PAIRS:attemptWallkicks(piece, new_piece, rot_dir, grid) end end +function PAIRS:checkNewLow(piece) + for _, block in pairs(piece:getBlockOffsets()) do + local y = piece.position.y + block.y + if y > piece.lowest_y then + piece.lock_delay = 0 + piece.lowest_y = y + end + end +end + +function PAIRS:onPieceCreate(piece, grid) + piece.lowest_y = -math.huge +end + function PAIRS:onPieceDrop(piece, grid) - piece.lock_delay = 0 + self:checkNewLow(piece) end function PAIRS:get180RotationValue() diff --git a/tetris/rulesets/standard_exp.lua b/tetris/rulesets/standard_exp.lua index e80224e..d285662 100755 --- a/tetris/rulesets/standard_exp.lua +++ b/tetris/rulesets/standard_exp.lua @@ -10,7 +10,7 @@ SRS.enable_IRS_wallkicks = true SRS.MANIPULATIONS_MAX = 15 -function SRS:check_new_low(piece) +function SRS:checkNewLow(piece) for _, block in pairs(piece:getBlockOffsets()) do local y = piece.position.y + block.y if y > piece.lowest_y then @@ -76,7 +76,7 @@ function SRS:onPieceCreate(piece, grid) end function SRS:onPieceDrop(piece, grid) - self:check_new_low(piece) + self:checkNewLow(piece) if piece.manipulations >= self.MANIPULATIONS_MAX and piece:isDropBlocked(grid) then piece.locked = true else @@ -96,7 +96,7 @@ end function SRS:onPieceRotate(piece, grid) piece.lock_delay = 0 -- rotate reset - self:check_new_low(piece) + self:checkNewLow(piece) piece.manipulations = piece.manipulations + 1 if piece.manipulations >= self.MANIPULATIONS_MAX then piece:moveInGrid({ x = 0, y = 1 }, 1, grid)