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:
Oshisaure 2020-12-28 03:41:26 +00:00
parent e3b038b5a7
commit eaee5fc7f0
4 changed files with 26 additions and 30 deletions

View File

@ -6,6 +6,8 @@ local SRS = Ruleset:extend()
SRS.name = "ACE-SRS"
SRS.hash = "ACE Standard"
SRS.MANIPULATIONS_MAX = 128
SRS.spawn_positions = {
I = { x=5, y=2 },
J = { x=4, y=3 },
@ -26,23 +28,11 @@ SRS.big_spawn_positions = {
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)
piece.lock_delay = 0 -- rotate reset
if piece:isDropBlocked(grid) then
piece.manipulations = piece.manipulations + 1
if piece.manipulations >= 128 then
piece:dropToBottom(grid)
if piece.manipulations >= self.MANIPULATIONS_MAX then
piece.locked = true
end
end

View File

@ -115,8 +115,8 @@ function Ruleset:attemptRotate(new_inputs, piece, grid, initial)
local new_piece = piece:withRelativeRotation(rot_dir)
if (grid:canPlacePiece(new_piece)) then
self:onPieceRotate(piece, grid)
piece:setRelativeRotation(rot_dir)
self:onPieceRotate(piece, grid)
else
if not(initial and self.enable_IRS_wallkicks == false) then
self:attemptWallkicks(piece, new_piece, rot_dir, grid)

View File

@ -8,6 +8,8 @@ SRS.hash = "Standard"
SRS.enable_IRS_wallkicks = true
SRS.MANIPULATIONS_MAX = 15
function SRS:check_new_low(piece)
for _, block in pairs(piece:getBlockOffsets()) do
local y = piece.position.y + block.y
@ -75,7 +77,7 @@ end
function SRS:onPieceDrop(piece, grid)
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
else
piece.lock_delay = 0 -- step reset
@ -86,8 +88,7 @@ function SRS:onPieceMove(piece, grid)
piece.lock_delay = 0 -- move reset
if piece:isDropBlocked(grid) then
piece.manipulations = piece.manipulations + 1
if piece.manipulations >= 15 then
piece:dropToBottom(grid)
if piece.manipulations >= self.MANIPULATIONS_MAX then
piece.locked = true
end
end
@ -97,9 +98,9 @@ function SRS:onPieceRotate(piece, grid)
piece.lock_delay = 0 -- rotate reset
self:check_new_low(piece)
piece.manipulations = piece.manipulations + 1
if piece.manipulations >= self.MANIPULATIONS_MAX then
piece:moveInGrid({ x = 0, y = 1 }, 1, grid)
if piece:isDropBlocked(grid) then
if piece.manipulations >= 15 then
piece:dropToBottom(grid)
piece.locked = true
end
end

View File

@ -18,6 +18,9 @@ SRS.colourscheme = {
SRS.softdrop_lock = false
SRS.harddrop_lock = true
SRS.MANIPULATIONS_MAX = 10
SRS.ROTATIONS_MAX = 8
SRS.spawn_positions = {
I = { x=5, y=4 },
J = { x=4, y=5 },
@ -162,15 +165,18 @@ function SRS:onPieceCreate(piece, grid)
end
function SRS:onPieceDrop(piece, grid)
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
function SRS:onPieceMove(piece, grid)
piece.lock_delay = 0 -- move reset
if piece:isDropBlocked(grid) then
piece.manipulations = piece.manipulations + 1
if piece.manipulations >= 10 then
piece:dropToBottom(grid)
if piece.manipulations >= self.MANIPULATIONS_MAX then
piece.locked = true
end
end
@ -180,8 +186,7 @@ function SRS:onPieceRotate(piece, grid)
piece.lock_delay = 0 -- rotate reset
if piece:isDropBlocked(grid) then
piece.rotations = piece.rotations + 1
if piece.rotations >= 8 then
piece:dropToBottom(grid)
if piece.rotations >= self.ROTATIONS_MAX then
piece.locked = true
end
end