Floorkicks reworked (read comments)

If not classic lock, upward kicks reset to the top of the tile
This commit is contained in:
Ishaan Bhardwaj
2021-02-16 23:28:54 -05:00
parent 6a5d5a9c88
commit 714c6b5e99
2 changed files with 19 additions and 10 deletions

View File

@@ -117,11 +117,15 @@ function Piece:lockIfBottomed(grid)
return self
end
function Piece:addGravity(gravity, grid)
function Piece:addGravity(gravity, grid, classic_lock)
local new_gravity = self.gravity + gravity
if self:isDropBlocked(grid) then
self.gravity = math.min(1, new_gravity)
self.lock_delay = self.lock_delay + 1
if classic_lock then
self.gravity = math.min(1, new_gravity)
else
self.gravity = 0
self.lock_delay = self.lock_delay + 1
end
else
local dropped_squares = math.floor(new_gravity)
local new_frac_gravity = new_gravity - dropped_squares