mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 18:39:02 -06:00
Tweaked rotation/manipulation behaviour on SRS rules.
Also changed order of operations to call onPieceRotate in Rulesets after actually rotating the piece.
This commit is contained in:
parent
e3b038b5a7
commit
eaee5fc7f0
@ -6,6 +6,8 @@ local SRS = Ruleset:extend()
|
|||||||
SRS.name = "ACE-SRS"
|
SRS.name = "ACE-SRS"
|
||||||
SRS.hash = "ACE Standard"
|
SRS.hash = "ACE Standard"
|
||||||
|
|
||||||
|
SRS.MANIPULATIONS_MAX = 128
|
||||||
|
|
||||||
SRS.spawn_positions = {
|
SRS.spawn_positions = {
|
||||||
I = { x=5, y=2 },
|
I = { x=5, y=2 },
|
||||||
J = { x=4, y=3 },
|
J = { x=4, y=3 },
|
||||||
@ -26,23 +28,11 @@ SRS.big_spawn_positions = {
|
|||||||
Z = { x=2, y=1 },
|
Z = { x=2, y=1 },
|
||||||
}
|
}
|
||||||
|
|
||||||
function SRS:onPieceMove(piece, grid)
|
|
||||||
piece.lock_delay = 0 -- move reset
|
|
||||||
if piece:isDropBlocked(grid) then
|
|
||||||
piece.manipulations = piece.manipulations + 1
|
|
||||||
if piece.manipulations >= 128 then
|
|
||||||
piece:dropToBottom(grid)
|
|
||||||
piece.locked = true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function SRS:onPieceRotate(piece, grid)
|
function SRS:onPieceRotate(piece, grid)
|
||||||
piece.lock_delay = 0 -- rotate reset
|
piece.lock_delay = 0 -- rotate reset
|
||||||
if piece:isDropBlocked(grid) then
|
if piece:isDropBlocked(grid) then
|
||||||
piece.manipulations = piece.manipulations + 1
|
piece.manipulations = piece.manipulations + 1
|
||||||
if piece.manipulations >= 128 then
|
if piece.manipulations >= self.MANIPULATIONS_MAX then
|
||||||
piece:dropToBottom(grid)
|
|
||||||
piece.locked = true
|
piece.locked = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -115,8 +115,8 @@ function Ruleset:attemptRotate(new_inputs, piece, grid, initial)
|
|||||||
local new_piece = piece:withRelativeRotation(rot_dir)
|
local new_piece = piece:withRelativeRotation(rot_dir)
|
||||||
|
|
||||||
if (grid:canPlacePiece(new_piece)) then
|
if (grid:canPlacePiece(new_piece)) then
|
||||||
self:onPieceRotate(piece, grid)
|
|
||||||
piece:setRelativeRotation(rot_dir)
|
piece:setRelativeRotation(rot_dir)
|
||||||
|
self:onPieceRotate(piece, grid)
|
||||||
else
|
else
|
||||||
if not(initial and self.enable_IRS_wallkicks == false) then
|
if not(initial and self.enable_IRS_wallkicks == false) then
|
||||||
self:attemptWallkicks(piece, new_piece, rot_dir, grid)
|
self:attemptWallkicks(piece, new_piece, rot_dir, grid)
|
||||||
|
@ -8,6 +8,8 @@ SRS.hash = "Standard"
|
|||||||
|
|
||||||
SRS.enable_IRS_wallkicks = true
|
SRS.enable_IRS_wallkicks = true
|
||||||
|
|
||||||
|
SRS.MANIPULATIONS_MAX = 15
|
||||||
|
|
||||||
function SRS:check_new_low(piece)
|
function SRS:check_new_low(piece)
|
||||||
for _, block in pairs(piece:getBlockOffsets()) do
|
for _, block in pairs(piece:getBlockOffsets()) do
|
||||||
local y = piece.position.y + block.y
|
local y = piece.position.y + block.y
|
||||||
@ -75,7 +77,7 @@ end
|
|||||||
|
|
||||||
function SRS:onPieceDrop(piece, grid)
|
function SRS:onPieceDrop(piece, grid)
|
||||||
self:check_new_low(piece)
|
self:check_new_low(piece)
|
||||||
if piece.manipulations >= 15 and piece:isDropBlocked(grid) then
|
if piece.manipulations >= self.MANIPULATIONS_MAX and piece:isDropBlocked(grid) then
|
||||||
piece.locked = true
|
piece.locked = true
|
||||||
else
|
else
|
||||||
piece.lock_delay = 0 -- step reset
|
piece.lock_delay = 0 -- step reset
|
||||||
@ -86,8 +88,7 @@ function SRS:onPieceMove(piece, grid)
|
|||||||
piece.lock_delay = 0 -- move reset
|
piece.lock_delay = 0 -- move reset
|
||||||
if piece:isDropBlocked(grid) then
|
if piece:isDropBlocked(grid) then
|
||||||
piece.manipulations = piece.manipulations + 1
|
piece.manipulations = piece.manipulations + 1
|
||||||
if piece.manipulations >= 15 then
|
if piece.manipulations >= self.MANIPULATIONS_MAX then
|
||||||
piece:dropToBottom(grid)
|
|
||||||
piece.locked = true
|
piece.locked = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -97,12 +98,12 @@ function SRS:onPieceRotate(piece, grid)
|
|||||||
piece.lock_delay = 0 -- rotate reset
|
piece.lock_delay = 0 -- rotate reset
|
||||||
self:check_new_low(piece)
|
self:check_new_low(piece)
|
||||||
piece.manipulations = piece.manipulations + 1
|
piece.manipulations = piece.manipulations + 1
|
||||||
if piece:isDropBlocked(grid) then
|
if piece.manipulations >= self.MANIPULATIONS_MAX then
|
||||||
if piece.manipulations >= 15 then
|
piece:moveInGrid({ x = 0, y = 1 }, 1, grid)
|
||||||
piece:dropToBottom(grid)
|
if piece:isDropBlocked(grid) then
|
||||||
piece.locked = true
|
piece.locked = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function SRS:get180RotationValue() return 2 end
|
function SRS:get180RotationValue() return 2 end
|
||||||
|
@ -18,6 +18,9 @@ SRS.colourscheme = {
|
|||||||
SRS.softdrop_lock = false
|
SRS.softdrop_lock = false
|
||||||
SRS.harddrop_lock = true
|
SRS.harddrop_lock = true
|
||||||
|
|
||||||
|
SRS.MANIPULATIONS_MAX = 10
|
||||||
|
SRS.ROTATIONS_MAX = 8
|
||||||
|
|
||||||
SRS.spawn_positions = {
|
SRS.spawn_positions = {
|
||||||
I = { x=5, y=4 },
|
I = { x=5, y=4 },
|
||||||
J = { x=4, y=5 },
|
J = { x=4, y=5 },
|
||||||
@ -162,15 +165,18 @@ function SRS:onPieceCreate(piece, grid)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function SRS:onPieceDrop(piece, grid)
|
function SRS:onPieceDrop(piece, grid)
|
||||||
piece.lock_delay = 0 -- step reset
|
if (piece.manipulations >= self.MANIPULATIONS_MAX or piece.rotations >= self.ROTATIONS_MAX) and piece:isDropBlocked(grid) then
|
||||||
|
piece.locked = true
|
||||||
|
else
|
||||||
|
piece.lock_delay = 0 -- step reset
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function SRS:onPieceMove(piece, grid)
|
function SRS:onPieceMove(piece, grid)
|
||||||
piece.lock_delay = 0 -- move reset
|
piece.lock_delay = 0 -- move reset
|
||||||
if piece:isDropBlocked(grid) then
|
if piece:isDropBlocked(grid) then
|
||||||
piece.manipulations = piece.manipulations + 1
|
piece.manipulations = piece.manipulations + 1
|
||||||
if piece.manipulations >= 10 then
|
if piece.manipulations >= self.MANIPULATIONS_MAX then
|
||||||
piece:dropToBottom(grid)
|
|
||||||
piece.locked = true
|
piece.locked = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -179,9 +185,8 @@ end
|
|||||||
function SRS:onPieceRotate(piece, grid)
|
function SRS:onPieceRotate(piece, grid)
|
||||||
piece.lock_delay = 0 -- rotate reset
|
piece.lock_delay = 0 -- rotate reset
|
||||||
if piece:isDropBlocked(grid) then
|
if piece:isDropBlocked(grid) then
|
||||||
piece.rotations = piece.rotations + 1
|
piece.rotations = piece.rotations + 1
|
||||||
if piece.rotations >= 8 then
|
if piece.rotations >= self.ROTATIONS_MAX then
|
||||||
piece:dropToBottom(grid)
|
|
||||||
piece.locked = true
|
piece.locked = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user