cambridge-modpack/tetris/rulesets/srs_x.lua

46 lines
906 B
Lua
Raw Normal View History

2020-11-14 09:43:01 -06:00
local Piece = require 'tetris.components.piece'
2020-12-04 19:53:09 -06:00
local Ruleset = require 'tetris.rulesets.ti_srs'
2020-11-14 09:43:01 -06:00
local SRS = Ruleset:extend()
SRS.name = "SRS-X"
SRS.hash = "Reversed SRS drop functions"
2020-12-04 19:53:09 -06:00
SRS.softdrop_lock = true
SRS.harddrop_lock = false
SRS.colourscheme = {
I = "R",
L = "O",
J = "B",
S = "M",
Z = "G",
O = "Y",
T = "C",
2020-11-14 09:43:01 -06:00
}
function SRS:onPieceMove(piece, grid)
piece.lock_delay = 0 -- move reset
if piece:isDropBlocked(grid) then
piece.manipulations = piece.manipulations + 1
if piece.manipulations >= 24 then
2020-12-18 20:57:36 -06:00
piece:dropToBottom(grid)
2020-11-14 09:43:01 -06:00
piece.locked = true
end
end
end
function SRS:onPieceRotate(piece, grid)
piece.lock_delay = 0 -- rotate reset
if piece:isDropBlocked(grid) then
piece.rotations = piece.rotations + 1
if piece.rotations >= 12 then
2020-12-18 20:57:36 -06:00
piece:dropToBottom(grid)
2020-11-14 09:43:01 -06:00
piece.locked = true
end
end
end
2020-12-04 20:45:52 -06:00
function SRS:get180RotationValue() return 2 end
2020-11-14 09:43:01 -06:00
return SRS