mirror of
https://github.com/SashLilac/cambridge-modpack.git
synced 2024-12-25 00:09:02 -06:00
Add permissive rotation system
This commit is contained in:
parent
d22a5d821c
commit
c6804d4367
34
tetris/rulesets/prs.lua
Normal file
34
tetris/rulesets/prs.lua
Normal file
@ -0,0 +1,34 @@
|
||||
local SRS = require 'tetris.rulesets.standard'
|
||||
|
||||
local PRS = SRS:extend()
|
||||
|
||||
PRS.name = "Permissive Rotation System"
|
||||
PRS.hash = "PRS"
|
||||
PRS.world = true
|
||||
|
||||
function PRS:attemptWallkicks(piece, newpiece, rot_dir, grid)
|
||||
for y=0,5 do
|
||||
for x=0,5 do
|
||||
local offset = {x=x, y=y}
|
||||
kicked_piece = newpiece:withOffset(offset)
|
||||
if grid:canPlacePiece(kicked_piece) then
|
||||
piece:setRelativeRotation(rot_dir)
|
||||
piece:setOffset(offset)
|
||||
self:onPieceRotate(piece, grid)
|
||||
return
|
||||
end
|
||||
end
|
||||
for x=0,5 do
|
||||
local offset = {x=-x, y=y}
|
||||
kicked_piece = newpiece:withOffset(offset)
|
||||
if grid:canPlacePiece(kicked_piece) then
|
||||
piece:setRelativeRotation(rot_dir)
|
||||
piece:setOffset(offset)
|
||||
self:onPieceRotate(piece, grid)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return PRS
|
Loading…
Reference in New Issue
Block a user