This commit is contained in:
Ishaan Bhardwaj
2020-12-18 21:57:36 -05:00
parent a0887a46c0
commit bc8ef59f98
14 changed files with 429 additions and 28 deletions

View File

@@ -109,4 +109,4 @@ end
function DTET:getDefaultOrientation() return 3 end
return DTET
return DTET

View File

@@ -23,6 +23,7 @@ function SRS:onPieceMove(piece, grid)
if piece:isDropBlocked(grid) then
piece.manipulations = piece.manipulations + 1
if piece.manipulations >= 24 then
piece:dropToBottom(grid)
piece.locked = true
end
end
@@ -33,6 +34,7 @@ function SRS:onPieceRotate(piece, grid)
if piece:isDropBlocked(grid) then
piece.rotations = piece.rotations + 1
if piece.rotations >= 12 then
piece:dropToBottom(grid)
piece.locked = true
end
end

48
tetris/rulesets/trans.lua Normal file
View File

@@ -0,0 +1,48 @@
local ARS = require 'tetris.rulesets.arika'
local Trans = ARS:extend()
Trans.name = "TransRS"
Trans.hash = "TransRS"
function Trans: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 = 2
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)
local pieces = {"I", "J", "L", "O", "S", "T", "Z"}
repeat
new_piece.shape = pieces[math.random(7)]
until piece.shape ~= new_piece.shape
if (grid:canPlacePiece(new_piece)) then
self:onPieceRotate(piece, grid)
piece:setRelativeRotation(rot_dir)
piece.shape = new_piece.shape
else
if not(initial and self.enable_IRS_wallkicks == false) then
if (grid:canPlacePiece(new_piece:withOffset({x=1, y=0}))) then
self:onPieceRotate(piece, grid)
piece:setRelativeRotation(rot_dir):setOffset({x=1, y=0})
piece.shape = new_piece.shape
elseif (grid:canPlacePiece(new_piece:withOffset({x=-1, y=0}))) then
self:onPieceRotate(piece, grid)
piece:setRelativeRotation(rot_dir):setOffset({x=-1, y=0})
piece.shape = new_piece.shape
end
end
end
end
return Trans