2020-10-05 21:17:15 -05:00
|
|
|
local Piece = require 'tetris.components.piece'
|
2020-12-04 19:36:11 -06:00
|
|
|
local Ruleset = require 'tetris.rulesets.ti_srs'
|
2020-10-05 21:17:15 -05:00
|
|
|
|
|
|
|
local SRS = Ruleset:extend()
|
|
|
|
|
|
|
|
SRS.name = "ACE-SRS"
|
2020-12-02 23:26:36 -06:00
|
|
|
SRS.hash = "StandardACE"
|
|
|
|
SRS.world = true
|
|
|
|
SRS.colourscheme = {
|
|
|
|
I = "C",
|
|
|
|
L = "O",
|
|
|
|
J = "B",
|
|
|
|
S = "G",
|
|
|
|
Z = "R",
|
|
|
|
O = "Y",
|
|
|
|
T = "M",
|
|
|
|
}
|
|
|
|
SRS.softdrop_lock = false
|
|
|
|
SRS.harddrop_lock = true
|
2021-02-08 22:23:50 -06:00
|
|
|
SRS.spawn_above_field = true
|
2020-10-05 21:17:15 -05:00
|
|
|
|
2020-12-27 21:41:26 -06:00
|
|
|
SRS.MANIPULATIONS_MAX = 128
|
|
|
|
|
2021-02-17 13:48:35 -06:00
|
|
|
function SRS:onPieceRotate(piece, grid, upward)
|
2020-10-05 21:17:15 -05:00
|
|
|
piece.lock_delay = 0 -- rotate reset
|
2021-02-17 13:48:35 -06:00
|
|
|
if upward or piece:isDropBlocked(grid) then
|
2020-12-27 21:41:26 -06:00
|
|
|
piece.manipulations = piece.manipulations + 1
|
2021-02-17 17:29:14 -06:00
|
|
|
if piece.manipulations >= self.MANIPULATIONS_MAX and piece:isDropBlocked(grid) then
|
2021-02-17 16:31:16 -06:00
|
|
|
piece.locked = true
|
|
|
|
end
|
2020-10-05 21:17:15 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2021-02-17 13:48:35 -06:00
|
|
|
function SRS:canPieceRotate(piece)
|
|
|
|
return piece.manipulations < self.MANIPULATIONS_MAX
|
|
|
|
end
|
|
|
|
|
2020-10-05 21:17:15 -05:00
|
|
|
return SRS
|