Better (default) SOCD handling

This commit is contained in:
Ishaan Bhardwaj 2021-09-04 22:33:53 -04:00
parent 0e1f40ad30
commit 438acde2e2

View File

@ -155,18 +155,18 @@ function Ruleset:dropPiece(
hard_drop_enabled, additive_gravity, classic_lock hard_drop_enabled, additive_gravity, classic_lock
) )
local y = piece.position.y local y = piece.position.y
if inputs["down"] == true and drop_locked == false then if inputs["up"] == true and hard_drop_enabled == true then
if additive_gravity then
piece:addGravity(gravity + drop_speed, grid, classic_lock)
else
piece:addGravity(math.max(gravity, drop_speed), grid, classic_lock)
end
elseif inputs["up"] == true and hard_drop_enabled == true then
if hard_drop_locked == true or piece:isDropBlocked(grid) then if hard_drop_locked == true or piece:isDropBlocked(grid) then
piece:addGravity(gravity, grid, classic_lock) piece:addGravity(gravity, grid, classic_lock)
else else
piece:dropToBottom(grid) piece:dropToBottom(grid)
end end
elseif inputs["down"] == true and drop_locked == false then
if additive_gravity then
piece:addGravity(gravity + drop_speed, grid, classic_lock)
else
piece:addGravity(math.max(gravity, drop_speed), grid, classic_lock)
end
else else
piece:addGravity(gravity, grid, classic_lock) piece:addGravity(gravity, grid, classic_lock)
end end