diff --git a/tetris/rulesets/standard.lua b/tetris/rulesets/standard.lua index 058a90f..eab688c 100644 --- a/tetris/rulesets/standard.lua +++ b/tetris/rulesets/standard.lua @@ -10,6 +10,25 @@ SRS.harddrop_lock = true SRS.MANIPULATIONS_MAX = 15 +function SRS:onPieceDrop(piece, grid) + self:checkNewLow(piece) + if piece.manipulations >= self.MANIPULATIONS_MAX and piece:isDropBlocked(grid) then + piece.locked = true + else + piece.lock_delay = 0 -- step reset + end +end + +function SRS:onPieceMove(piece, grid) + piece.lock_delay = 0 -- move reset + if piece:isDropBlocked(grid) then + piece.manipulations = piece.manipulations + 1 + if piece.manipulations >= SRS.MANIPULATIONS_MAX then + piece.locked = true + end + end +end + function SRS:onPieceRotate(piece, grid) piece.lock_delay = 0 -- rotate reset self:checkNewLow(piece)