mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 12:39:01 -06:00
Fixed a clipping issue with negative gravity
Gamemodes are able to define their own piece class behavior to override negative gravity handling
This commit is contained in:
parent
3cf5daeb2e
commit
eae58f11e9
@ -126,7 +126,9 @@ function Piece:addGravity(gravity, grid, classic_lock)
|
||||
self.gravity = 0
|
||||
self.lock_delay = self.lock_delay + 1
|
||||
end
|
||||
else
|
||||
elseif not (
|
||||
self:isMoveBlocked(grid, { x=0, y=-1 }) and gravity < 0
|
||||
) then
|
||||
local dropped_squares = math.floor(math.abs(new_gravity))
|
||||
local new_frac_gravity = new_gravity - dropped_squares
|
||||
self.gravity = new_frac_gravity
|
||||
@ -142,6 +144,8 @@ function Piece:addGravity(gravity, grid, classic_lock)
|
||||
self.gravity = new_frac_gravity
|
||||
self:moveInGrid({ x = 0, y = -1 }, dropped_squares, grid)
|
||||
end
|
||||
else
|
||||
self.gravity = 0
|
||||
end
|
||||
return self
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user