Fixed an issue with buffer lock inputs

pull/17/head
Ishaan Bhardwaj 2021-04-20 16:11:49 -04:00
parent 894e99e677
commit 1b1abc9792
2 changed files with 19 additions and 18 deletions

View File

@ -529,16 +529,13 @@ function GameMode:initializeNextPiece(inputs, ruleset, piece_data, generate_next
self.lock_drop, self.lock_hard_drop, self.big_mode,
(
self.frames == 0 or (ruleset.are and self:getARE() ~= 0)
) and self.irs or false,
self.buffer_hard_drop, self.buffer_soft_drop,
self.lock_on_hard_drop, self.lock_on_soft_drop
) and self.irs or false
)
if self.piece:isDropBlocked(self.grid) and
self.grid:canPlacePiece(self.piece) then
playSE("bottom")
end
if self.buffer_hard_drop then
self.buffer_hard_drop = false
if config.gamesettings.buffer_lock == 1 then
self.piece:dropToBottom(self.grid)
if self.lock_on_hard_drop then self.piece.locked = true end
end
local above_field = (
(config.gamesettings.spawn_positions == 1 and
ruleset.spawn_above_field) or
@ -552,10 +549,22 @@ function GameMode:initializeNextPiece(inputs, ruleset, piece_data, generate_next
piece_data.shape, piece_data.orientation
) or 0)
)
self.buffer_hard_drop = false
end
if self.buffer_soft_drop then
if (
self.lock_on_soft_drop and
self.piece:isDropBlocked(self.grid) and
config.gamesettings.buffer_lock == 1
) then
self.piece.locked = true
end
self.buffer_soft_drop = false
end
if self.piece:isDropBlocked(self.grid) and
self.grid:canPlacePiece(self.piece) then
playSE("bottom")
end
if self.lock_drop or (
not ruleset.are or self:getARE() == 0
) then

View File

@ -210,9 +210,7 @@ end
function Ruleset:initializePiece(
inputs, data, grid, gravity, prev_inputs,
move, lock_delay, drop_speed,
drop_locked, hard_drop_locked, big, irs,
buffer_hard_drop, buffer_soft_drop,
lock_on_hard_drop, lock_on_soft_drop
drop_locked, hard_drop_locked, big, irs
)
local spawn_positions
if big then
@ -265,13 +263,6 @@ function Ruleset:initializePiece(
end
end
self:dropPiece(inputs, piece, grid, gravity, drop_speed, drop_locked, hard_drop_locked)
if (buffer_hard_drop and config.gamesettings.buffer_lock == 1) then
piece:dropToBottom(grid)
if lock_on_hard_drop then piece.locked = true end
end
if (buffer_soft_drop and lock_on_soft_drop and piece:isDropBlocked(grid) and config.gamesettings.buffer_lock == 1) then
piece.locked = true
end
return piece
end
@ -284,6 +275,7 @@ function Ruleset:processPiece(
drop_locked, hard_drop_locked,
hard_drop_enabled, additive_gravity, classic_lock
)
if piece.locked then return end
local synchroes_allowed = ({not self.world, true, false})[config.gamesettings.synchroes_allowed]