LARGE update to the modpack for upcoming beta5.1

This commit is contained in:
Ishaan Bhardwaj
2021-05-19 12:40:50 -04:00
parent b67bb3f344
commit 2bce1ae282
10 changed files with 1289 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
local SRS = require 'tetris.rulesets.standard'
local Infinity = SRS:extend()
Infinity.name = "Infinity-SRS"
Infinity.hash = "Infinity-SRS"
function Infinity:onPieceDrop(piece) piece.lock_delay = 0 end
function Infinity:onPieceMove(piece) piece.lock_delay = 0 end
function Infinity:onPieceRotate(piece) piece.lock_delay = 0 end
return Infinity

190
tetris/rulesets/kon.lua Normal file
View File

@@ -0,0 +1,190 @@
local SRS = require 'tetris.rulesets.standard'
local kon = SRS:extend()
kon.name = "kon"
kon.hash = "kon"
kon.colourscheme = {
I = "M",
L = "R",
J = "C",
S = "Y",
Z = "B",
O = "O",
T = "G",
}
kon.kicks_cw = { -- also 180
{x=0, y=0}, {x=1, y=0}, {x=-1, y=0},
{x=0, y=1}, {x=1, y=1}, {x=-1, y=1},
{x=0, y=-1}, {x=1, y=-1}, {x=-1, y=-1},
{x=0, y=2}, {x=0, y=-2},
}
kon.kicks_ccw = {
{x=0, y=0}, {x=-1, y=0}, {x=1, y=0},
{x=0, y=1}, {x=-1, y=1}, {x=1, y=1},
{x=0, y=-1}, {x=-1, y=-1}, {x=1, y=-1},
{x=0, y=2}, {x=0, y=-2},
}
kon.kicks_I_cw = {}
kon.kicks_I_ccw = {}
for _, y in pairs({0, 2, 1, -1, -2}) do
for _, x in pairs({0, 1, -1, 2, -2}) do
table.insert(kon.kicks_I_cw, {x=x, y=y})
table.insert(kon.kicks_I_ccw, {x=-x, y=y})
end
end
kon.corners_I = {
[0] = {
{x=0, y=-1}, {x=-1, y=-1}, {x=-2, y=-1}, {x=1, y=-1}, {x=2, y=0},
{x=0, y=1}, {x=-1, y=1}, {x=-2, y=1}, {x=1, y=1}, {x=-3, y=0},
},
[1] = {
{x=1, y=0}, {x=1, y=-1}, {x=1, y=1}, {x=1, y=2}, {x=0, y=-2},
{x=-1, y=0}, {x=-1, y=-1}, {x=-1, y=1}, {x=-1, y=2}, {x=0, y=3},
},
[2] = {
{x=0, y=0}, {x=-1, y=0}, {x=-2, y=0}, {x=1, y=0}, {x=2, y=1},
{x=0, y=2}, {x=-1, y=2}, {x=-2, y=2}, {x=1, y=2}, {x=-3, y=1},
},
[3] = {
{x=0, y=0}, {x=0, y=-1}, {x=0, y=1}, {x=0, y=2}, {x=-1, y=-2},
{x=-2, y=0}, {x=-2, y=-1}, {x=-2, y=1}, {x=-2, y=2}, {x=-1, y=3},
}
}
kon.corners_O = {
{x=0, y=1}, {x=-1, y=1},
{x=-2, y=0}, {x=-2, y=-1},
{x=-1, y=-2}, {x=0, y=-2},
{x=1, y=-1}, {x=1, y=0},
}
kon.corners_3x3 = {
L = {
[0] = {
{x=-2, y=0}, {x=-1, y=1}, {x=-1, y=-1}, {x=0, y=1}, {x=0, y=-1},
{x=1, y=1}, {x=1, y=-2}, {x=2, y=0}, {x=2, y=-1},
}
},
Z = {
[0] = {
{x=-2, y=-1}, {x=-1, y=-2}, {x=-1, y=0}, {x=0, y=-2},
{x=0, y=1}, {x=1, y=-1}, {x=1, y=1}, {x=2, y=0},
}
},
T = {
[0] = {
{x=-2, y=0}, {x=-1, y=-1}, {x=-1, y=1}, {x=0, y=-2},
{x=0, y=1}, {x=1, y=-1}, {x=1, y=1}, {x=2, y=0},
}
},
S = {
[0] = {
{x=-2, y=0}, {x=-1, y=-1}, {x=-1, y=1}, {x=0, y=-2},
{x=0, y=1}, {x=1, y=-2}, {x=1, y=0}, {x=2, y=-1},
}
},
J = {
[0] = {
{x=-2, y=-1}, {x=-2, y=0}, {x=-1, y=-2}, {x=-1, y=1}, {x=0, y=-1},
{x=0, y=1}, {x=1, y=-1}, {x=1, y=1}, {x=2, y=0},
}
}
}
for piece, _ in pairs(kon.corners_3x3) do
for i = 1, 3 do
kon.corners_3x3[piece][i] = {}
for _, corner in pairs(kon.corners_3x3[piece][i - 1]) do
table.insert(
kon.corners_3x3[piece][i],
{x=-corner.y, y=corner.x}
)
end
end
end
function kon:attemptRotate(new_inputs, piece, grid, initial)
local rot_dir = 0
if (new_inputs["rotate_left"] or new_inputs["rotate_left2"]) then
rot_dir = 3
elseif (new_inputs["rotate_right"] or new_inputs["rotate_right2"]) then
rot_dir = 1
elseif (new_inputs["rotate_180"]) then
rot_dir = self:get180RotationValue()
end
if rot_dir == 0 then return end
if config.gamesettings.world_reverse == 3 or (self.world and config.gamesettings.world_reverse == 2) then
rot_dir = 4 - rot_dir
end
local new_piece = piece:withRelativeRotation(rot_dir)
if (grid:canPlacePiece(new_piece)) then
if piece:isDropBlocked(grid) then
self:attemptWallkicks(piece, new_piece, rot_dir, grid)
else
piece:setRelativeRotation(rot_dir)
self:onPieceRotate(piece, grid)
end
else
if not(initial and self.enable_IRS_wallkicks == false) then
self:attemptWallkicks(piece, new_piece, rot_dir, grid)
end
end
end
function kon:attemptWallkicks(piece, new_piece, rot_dir, grid)
local kicks
if rot_dir == 3 then
kicks = piece.shape == "I" and kon.kicks_I_ccw or kon.kicks_ccw
else
kicks = piece.shape == "I" and kon.kicks_I_cw or kon.kicks_cw
end
local corners
if piece.shape == "I" then
corners = kon.corners_I[new_piece.rotation]
elseif piece.shape == "O" then
corners = kon.corners_O
else
corners = kon.corners_3x3[piece.shape][new_piece.rotation]
end
local chosen_kick
local greatest_corners = -1
for _, offset in pairs(kicks) do
kicked_piece = new_piece:withOffset(offset)
if grid:canPlacePiece(kicked_piece) then
local occupied_corners = 0
for _, corner in pairs(corners) do
if grid:isOccupied(
kicked_piece.position.x + corner.x,
kicked_piece.position.y + corner.y
) then
occupied_corners = occupied_corners + 1
end
end
if occupied_corners > greatest_corners then
greatest_corners = occupied_corners
chosen_kick = offset
end
end
end
if chosen_kick then
piece:setRelativeRotation(rot_dir)
piece:setOffset(chosen_kick)
self:onPieceRotate(piece, grid)
end
end
return kon

View File

@@ -0,0 +1,66 @@
local NRS_R = require 'tetris.rulesets.nintendo_r'
local NRS_X = NRS_R:extend()
NRS_X.name = "Nintendo-X"
NRS_X.hash = "NintendoX"
NRS_X.wallkicks_line_cw = {{x=1, y=0}, {x=2, y=0}, {x=-1, y=0}, {x=0, y=-1}}
NRS_X.wallkicks_line_ccw = {{x=-1, y=0}, {x=1, y=0}, {x=2, y=0}, {x=0, y=-1}}
NRS_X.wallkicks_other_cw = {{x=1, y=0}, {x=-1, y=0}, {x=0, y=-1}}
NRS_X.wallkicks_other_ccw = {{x=-1, y=0}, {x=1, y=0}, {x=0, y=-1}}
function NRS_X: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 NRS_X:onPieceCreate(piece, grid)
piece.lowest_y = -math.huge
end
function NRS_X:onPieceDrop(piece)
self:checkNewLow(piece)
end
function NRS_X:onPieceRotate(piece)
self:checkNewLow(piece)
end
function NRS_X:attemptWallkicks(piece, new_piece, rot_dir, grid)
local kicks
if piece.shape == "O" then
return
elseif piece.shape == "I" then
kicks = (
rot_dir == 3 and
NRS_X.wallkicks_line_ccw or
NRS_X.wallkicks_line_cw
)
else
kicks = (
rot_dir == 3 and
NRS_X.wallkicks_other_ccw or
NRS_X.wallkicks_other_cw
)
end
assert(piece.rotation ~= new_piece.rotation)
for idx, offset in pairs(kicks) do
kicked_piece = new_piece:withOffset(offset)
if grid:canPlacePiece(kicked_piece) then
piece:setRelativeRotation(rot_dir)
piece:setOffset(offset)
self:onPieceRotate(piece, grid, offset.y < 0)
return
end
end
end
return NRS_X

43
tetris/rulesets/tod.lua Normal file
View File

@@ -0,0 +1,43 @@
local SRS = require 'tetris.rulesets.arika_srs'
local TOD = SRS:extend()
TOD.name = "TOD M4"
TOD.hash = "TOD"
TOD.colourscheme = {
I = "C",
J = "B",
L = "M",
O = "F",
S = "G",
Z = "R",
T = "Y"
}
TOD.harddrop_lock = false
function TOD:attemptWallkicks(piece, new_piece, rot_dir, grid)
local kicks = {{x=1, y=0}, {x=-1, y=0}, {x=0, y=-1}}
for idx, offset in pairs(kicks) do
kicked_piece = new_piece:withOffset(offset)
if grid:canPlacePiece(kicked_piece) then
piece:setRelativeRotation(rot_dir)
piece:setOffset(offset)
self:onPieceRotate(piece, grid)
return
end
end
end
function TOD:onPieceDrop(piece)
piece.lock_delay = math.max(
0, piece.lock_delay - math.ceil(1 / self.game:getGravity())
)
end
function TOD:onPieceMove() end
function TOD:onPieceRotate() end
function TOD:canPieceRotate() return true end
return TOD

238
tetris/rulesets/vrs.lua Normal file
View File

@@ -0,0 +1,238 @@
local Ruleset = require "tetris.rulesets.ruleset"
local VRS = Ruleset:extend()
VRS.name = "V.R.S."
VRS.hash = "VRS"
VRS.world = true
VRS.colourscheme = {
I = "M",
L = "R",
J = "C",
S = "Y",
Z = "B",
O = "O",
T = "G",
}
VRS.enable_IRS_wallkicks = true
VRS.spawn_above_field = true
VRS.spawn_positions = {
I = { x=4, y=4 },
J = { x=4, y=5 },
L = { x=4, y=5 },
O = { x=4, y=5 },
S = { x=4, y=5 },
T = { x=4, y=5 },
Z = { x=4, y=5 },
}
VRS.big_spawn_positions = {
I = { x=2, y=2 },
J = { x=2, y=3 },
L = { x=2, y=3 },
O = { x=2, y=3 },
S = { x=2, y=3 },
T = { x=2, y=3 },
Z = { x=2, y=3 },
}
VRS.block_offsets = {
I = {
{{x=1, y=0}, {x=0, y=0}, {x=-1, y=0}, {x=2, y=0}},
{{x=1, y=-2}, {x=1, y=-1}, {x=1, y=0}, {x=1, y=1}},
{{x=1, y=0}, {x=0, y=0}, {x=-1, y=0}, {x=2, y=0}},
{{x=1, y=-2}, {x=1, y=-1}, {x=1, y=0}, {x=1, y=1}}
},
S = {
{{x=-1, y=0}, {x=0, y=0}, {x=0, y=-1}, {x=1, y=-1}},
{{x=0, y=-1}, {x=0, y=0}, {x=1, y=0}, {x=1, y=1}},
{{x=-1, y=0}, {x=0, y=0}, {x=0, y=-1}, {x=1, y=-1}},
{{x=0, y=-1}, {x=0, y=0}, {x=1, y=0}, {x=1, y=1}}
},
Z = {
{{x=-1, y=-1}, {x=0, y=-1}, {x=0, y=0}, {x=1, y=0}},
{{x=1, y=-1}, {x=1, y=0}, {x=0, y=0}, {x=0, y=1}},
{{x=-1, y=-1}, {x=0, y=-1}, {x=0, y=0}, {x=1, y=0}},
{{x=1, y=-1}, {x=1, y=0}, {x=0, y=0}, {x=0, y=1}}
},
T = {
{{x=1, y=0}, {x=0, y=0}, {x=-1, y=0}, {x=0, y=-1}},
{{x=0, y=-1}, {x=0, y=0}, {x=0, y=1}, {x=1, y=0}},
{{x=1, y=0}, {x=0, y=0}, {x=-1, y=0}, {x=0, y=1}},
{{x=0, y=-1}, {x=0, y=0}, {x=0, y=1}, {x=-1, y=0}}
},
J = {
{{x=1, y=0}, {x=0, y=0}, {x=-1, y=0}, {x=-1, y=-1}},
{{x=0, y=-1}, {x=0, y=0}, {x=0, y=1}, {x=1, y=-1}},
{{x=1, y=0}, {x=0, y=0}, {x=-1, y=0}, {x=1, y=1}},
{{x=0, y=-1}, {x=0, y=0}, {x=0, y=1}, {x=-1, y=1}}
},
L = {
{{x=1, y=0}, {x=0, y=0}, {x=-1, y=0}, {x=1, y=-1}},
{{x=0, y=-1}, {x=0, y=0}, {x=0, y=1}, {x=1, y=1}},
{{x=1, y=0}, {x=0, y=0}, {x=-1, y=0}, {x=-1, y=1}},
{{x=0, y=-1}, {x=0, y=0}, {x=0, y=1}, {x=-1, y=-1}}
},
O = {
{{x=0, y=0}, {x=1, y=0}, {x=1, y=-1}, {x=0, y=-1}},
{{x=0, y=0}, {x=1, y=0}, {x=1, y=-1}, {x=0, y=-1}},
{{x=0, y=0}, {x=1, y=0}, {x=1, y=-1}, {x=0, y=-1}},
{{x=0, y=0}, {x=1, y=0}, {x=1, y=-1}, {x=0, y=-1}}
},
}
VRS.kicks_ccw = {
I = {
[0] = {{x=-1, y=0}, {x=-1, y=1}, {x=-2, y=0}, {x=-2, y=1}, {x=-1, y=-1}, {x=-2, y=-1}, {x=-1, y=2}, {x=-2, y=2}, {x=0, y=0}, {x=0, y=1}, {x=1, y=0}, {x=1, y=1}, {x=0, y=-1}, {x=1, y=-1}, {x=0, y=2}, {x=1, y=2}},
{{x=0, y=0}, {x=0, y=1}, {x=-1, y=0}, {x=-1, y=1}, {x=0, y=-1}, {x=-1, y=-1}, {x=0, y=-2}, {x=-1, y=-2}, {x=1, y=0}, {x=1, y=1}, {x=2, y=0}, {x=2, y=1}, {x=1, y=-1}, {x=2, y=-1}, {x=1, y=-2}, {x=2, y=-2}},
{{x=-1, y=0}, {x=-1, y=1}, {x=-2, y=0}, {x=-2, y=1}, {x=-1, y=-1}, {x=-2, y=-1}, {x=-1, y=2}, {x=-2, y=2}, {x=0, y=0}, {x=0, y=1}, {x=1, y=0}, {x=1, y=1}, {x=0, y=-1}, {x=1, y=-1}, {x=0, y=2}, {x=1, y=2}},
{{x=0, y=0}, {x=0, y=1}, {x=-1, y=0}, {x=-1, y=1}, {x=0, y=-1}, {x=-1, y=-1}, {x=0, y=-2}, {x=-1, y=-2}, {x=1, y=0}, {x=1, y=1}, {x=2, y=0}, {x=2, y=1}, {x=1, y=-1}, {x=2, y=-1}, {x=1, y=-2}, {x=2, y=-2}},
},
TLJ = {
[0] = {{x=0, y=0}, {x=0, y=1}, {x=1, y=0}, {x=1, y=1}, {x=-1, y=0}, {x=-1, y=1}, {x=0, y=-1}, {x=1, y=-1}, {x=-1, y=-1}, {x=0, y=2}, {x=0, y=-2}},
{{x=0, y=0}, {x=0, y=1}, {x=1, y=0}, {x=1, y=1}, {x=-1, y=0}, {x=-1, y=1}, {x=0, y=-1}, {x=1, y=-1}, {x=-1, y=-1}, {x=0, y=2}, {x=0, y=-2}},
{{x=0, y=0}, {x=0, y=1}, {x=-1, y=0}, {x=-1, y=1}, {x=1, y=0}, {x=1, y=1}, {x=0, y=-1}, {x=-1, y=-1}, {x=1, y=-1}, {x=0, y=2}, {x=0, y=-2}},
{{x=0, y=0}, {x=0, y=1}, {x=-1, y=0}, {x=-1, y=1}, {x=1, y=0}, {x=1, y=1}, {x=0, y=-1}, {x=-1, y=-1}, {x=1, y=-1}, {x=0, y=2}, {x=0, y=-2}},
},
SZ = {
[0] = {{x=-1, y=0}, {x=-1, y=1}, {x=-2, y=0}, {x=-2, y=1}, {x=-1, y=-1}, {x=-2, y=-1}, {x=0, y=0}, {x=0, y=1}, {x=0, y=-1}, {x=-1, y=2}, {x=-1, y=-2}},
{{x=0, y=0}, {x=0, y=1}, {x=-1, y=0}, {x=-1, y=1}, {x=0, y=-1}, {x=-1, y=-1}, {x=1, y=0}, {x=1, y=1}, {x=1, y=-1}, {x=0, y=2}, {x=0, y=-2}},
{{x=-1, y=0}, {x=-1, y=1}, {x=-2, y=0}, {x=-2, y=1}, {x=-1, y=-1}, {x=-2, y=-1}, {x=0, y=0}, {x=0, y=1}, {x=0, y=-1}, {x=-1, y=2}, {x=-1, y=-2}},
{{x=0, y=0}, {x=0, y=1}, {x=-1, y=0}, {x=-1, y=1}, {x=0, y=-1}, {x=-1, y=-1}, {x=1, y=0}, {x=1, y=1}, {x=1, y=-1}, {x=0, y=2}, {x=0, y=-2}},
},
O = {
-- lol
[0] = {{x=0, y=0}},
{{x=0, y=0}},
{{x=0, y=0}},
{{x=0, y=0}},
},
}
VRS.kicks_cw = {
I = {
[0] = {{x=0, y=0}, {x=0, y=1}, {x=1, y=0}, {x=1, y=1}, {x=0, y=-1}, {x=1, y=-1}, {x=0, y=2}, {x=1, y=2}, {x=-1, y=0}, {x=-1, y=1}, {x=-2, y=0}, {x=-2, y=1}, {x=-1, y=-1}, {x=-2, y=-1}, {x=-1, y=2}, {x=-2, y=2}},
{{x=1, y=0}, {x=1, y=1}, {x=2, y=0}, {x=2, y=1}, {x=1, y=-1}, {x=2, y=-1}, {x=1, y=-2}, {x=2, y=-2}, {x=0, y=0}, {x=0, y=1}, {x=-1, y=0}, {x=-1, y=1}, {x=0, y=-1}, {x=-1, y=-1}, {x=0, y=-2}, {x=-1, y=-2}},
{{x=0, y=0}, {x=0, y=1}, {x=1, y=0}, {x=1, y=1}, {x=0, y=-1}, {x=1, y=-1}, {x=0, y=2}, {x=1, y=2}, {x=-1, y=0}, {x=-1, y=1}, {x=-2, y=0}, {x=-2, y=1}, {x=-1, y=-1}, {x=-2, y=-1}, {x=-1, y=2}, {x=-2, y=2}},
{{x=1, y=0}, {x=1, y=1}, {x=2, y=0}, {x=2, y=1}, {x=1, y=-1}, {x=2, y=-1}, {x=1, y=-2}, {x=2, y=-2}, {x=0, y=0}, {x=0, y=1}, {x=-1, y=0}, {x=-1, y=1}, {x=0, y=-1}, {x=-1, y=-1}, {x=0, y=-2}, {x=-1, y=-2}},
},
TLJ = {
[0] = {{x=0, y=0}, {x=0, y=1}, {x=-1, y=0}, {x=-1, y=1}, {x=1, y=0}, {x=1, y=1}, {x=0, y=-1}, {x=-1, y=-1}, {x=1, y=-1}, {x=0, y=2}, {x=0, y=-2}},
{{x=0, y=0}, {x=0, y=1}, {x=1, y=0}, {x=1, y=1}, {x=-1, y=0}, {x=-1, y=1}, {x=0, y=-1}, {x=1, y=-1}, {x=-1, y=-1}, {x=0, y=2}, {x=0, y=-2}},
{{x=0, y=0}, {x=0, y=1}, {x=1, y=0}, {x=1, y=1}, {x=-1, y=0}, {x=-1, y=1}, {x=0, y=-1}, {x=1, y=-1}, {x=-1, y=-1}, {x=0, y=2}, {x=0, y=-2}},
{{x=0, y=0}, {x=0, y=1}, {x=-1, y=0}, {x=-1, y=1}, {x=1, y=0}, {x=1, y=1}, {x=0, y=-1}, {x=-1, y=-1}, {x=1, y=-1}, {x=0, y=2}, {x=0, y=-2}},
},
SZ = {
[0] = {{x=0, y=0}, {x=0, y=1}, {x=1, y=0}, {x=1, y=1}, {x=0, y=-1}, {x=1, y=-1}, {x=-1, y=0}, {x=-1, y=1}, {x=-1, y=-1}, {x=0, y=2}, {x=0, y=-2}},
{{x=1, y=0}, {x=1, y=1}, {x=2, y=0}, {x=2, y=1}, {x=1, y=-1}, {x=2, y=-1}, {x=0, y=0}, {x=0, y=1}, {x=0, y=-1}, {x=1, y=2}, {x=1, y=-2}},
{{x=0, y=0}, {x=0, y=1}, {x=1, y=0}, {x=1, y=1}, {x=0, y=-1}, {x=1, y=-1}, {x=-1, y=0}, {x=-1, y=1}, {x=-1, y=-1}, {x=0, y=2}, {x=0, y=-2}},
{{x=1, y=0}, {x=1, y=1}, {x=2, y=0}, {x=2, y=1}, {x=1, y=-1}, {x=2, y=-1}, {x=0, y=0}, {x=0, y=1}, {x=0, y=-1}, {x=1, y=2}, {x=1, y=-2}},
},
O = {
-- lol
[0] = {{x=0, y=0}},
{{x=0, y=0}},
{{x=0, y=0}},
{{x=0, y=0}},
},
}
function VRS:attemptRotate(new_inputs, piece, grid, initial)
local rot_dir = 0
if (new_inputs["rotate_left"] or new_inputs["rotate_left2"]) then
rot_dir = 3
elseif (new_inputs["rotate_right"] or new_inputs["rotate_right2"]) then
rot_dir = 1
elseif (new_inputs["rotate_180"]) then
rot_dir = self:get180RotationValue()
end
if rot_dir == 0 then return end
if config.gamesettings.world_reverse == 3 or (self.world and config.gamesettings.world_reverse == 2) then
rot_dir = 4 - rot_dir
end
local new_piece = piece:withRelativeRotation(rot_dir)
self:attemptWallkicks(piece, new_piece, rot_dir, grid)
end
function VRS:attemptWallkicks(piece, new_piece, rot_dir, grid)
local kicks
if rot_dir == 1 then
if piece.shape == "I" then
kicks = VRS.kicks_cw.I[piece.rotation]
elseif (
piece.shape == "T" or
piece.shape == "L" or
piece.shape == "J"
) then
kicks = VRS.kicks_cw.TLJ[piece.rotation]
elseif (
piece.shape == "S" or
piece.shape == "Z"
) then
kicks = VRS.kicks_cw.SZ[piece.rotation]
else
kicks = VRS.kicks_cw.O[piece.rotation]
end
else
if piece.shape == "I" then
kicks = VRS.kicks_ccw.I[piece.rotation]
elseif (
piece.shape == "T" or
piece.shape == "L" or
piece.shape == "J"
) then
kicks = VRS.kicks_ccw.TLJ[piece.rotation]
elseif (
piece.shape == "S" or
piece.shape == "Z"
) then
kicks = VRS.kicks_ccw.SZ[piece.rotation]
else
kicks = VRS.kicks_ccw.O[piece.rotation]
end
end
for idx, offset in pairs(kicks) do
kicked_piece = new_piece:withOffset(offset)
if grid:canPlacePiece(kicked_piece) then
piece:setRelativeRotation(rot_dir)
piece:setOffset(offset)
self:onPieceRotate(piece, grid)
return
end
end
end
function VRS:onPieceCreate(piece)
piece.rotate_counter = 0
end
function VRS:onPieceDrop(piece)
piece.lock_delay = 0 -- step reset
end
function VRS:onPieceRotate(piece)
piece.rotate_counter = piece.rotate_counter + 1
piece.lock_delay = 0
end
function VRS:canPieceRotate(piece)
return piece.rotate_counter < 15
end
function VRS:get180RotationValue() return 3 end
return VRS