mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 14:29:02 -06:00
PAIRS anti-stall added
This commit is contained in:
parent
5076adf022
commit
0c2e3efd1a
@ -225,8 +225,22 @@ function PAIRS:attemptWallkicks(piece, new_piece, rot_dir, grid)
|
||||
end
|
||||
end
|
||||
|
||||
function PAIRS:onPieceDrop(piece, grid)
|
||||
function PAIRS: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 PAIRS:onPieceCreate(piece, grid)
|
||||
piece.lowest_y = -math.huge
|
||||
end
|
||||
|
||||
function PAIRS:onPieceDrop(piece, grid)
|
||||
self:checkNewLow(piece)
|
||||
end
|
||||
|
||||
function PAIRS:get180RotationValue()
|
||||
|
@ -10,7 +10,7 @@ SRS.enable_IRS_wallkicks = true
|
||||
|
||||
SRS.MANIPULATIONS_MAX = 15
|
||||
|
||||
function SRS:check_new_low(piece)
|
||||
function SRS:checkNewLow(piece)
|
||||
for _, block in pairs(piece:getBlockOffsets()) do
|
||||
local y = piece.position.y + block.y
|
||||
if y > piece.lowest_y then
|
||||
@ -76,7 +76,7 @@ function SRS:onPieceCreate(piece, grid)
|
||||
end
|
||||
|
||||
function SRS:onPieceDrop(piece, grid)
|
||||
self:check_new_low(piece)
|
||||
self:checkNewLow(piece)
|
||||
if piece.manipulations >= self.MANIPULATIONS_MAX and piece:isDropBlocked(grid) then
|
||||
piece.locked = true
|
||||
else
|
||||
@ -96,7 +96,7 @@ end
|
||||
|
||||
function SRS:onPieceRotate(piece, grid)
|
||||
piece.lock_delay = 0 -- rotate reset
|
||||
self:check_new_low(piece)
|
||||
self:checkNewLow(piece)
|
||||
piece.manipulations = piece.manipulations + 1
|
||||
if piece.manipulations >= self.MANIPULATIONS_MAX then
|
||||
piece:moveInGrid({ x = 0, y = 1 }, 1, grid)
|
||||
|
Loading…
Reference in New Issue
Block a user