mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 19:19:02 -06:00
Floorkicks reworked (read comments)
If not classic lock, upward kicks reset to the top of the tile
This commit is contained in:
parent
6a5d5a9c88
commit
714c6b5e99
@ -117,11 +117,15 @@ function Piece:lockIfBottomed(grid)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
function Piece:addGravity(gravity, grid)
|
function Piece:addGravity(gravity, grid, classic_lock)
|
||||||
local new_gravity = self.gravity + gravity
|
local new_gravity = self.gravity + gravity
|
||||||
if self:isDropBlocked(grid) then
|
if self:isDropBlocked(grid) then
|
||||||
self.gravity = math.min(1, new_gravity)
|
if classic_lock then
|
||||||
self.lock_delay = self.lock_delay + 1
|
self.gravity = math.min(1, new_gravity)
|
||||||
|
else
|
||||||
|
self.gravity = 0
|
||||||
|
self.lock_delay = self.lock_delay + 1
|
||||||
|
end
|
||||||
else
|
else
|
||||||
local dropped_squares = math.floor(new_gravity)
|
local dropped_squares = math.floor(new_gravity)
|
||||||
local new_frac_gravity = new_gravity - dropped_squares
|
local new_frac_gravity = new_gravity - dropped_squares
|
||||||
|
@ -115,7 +115,9 @@ function Ruleset:rotatePiece(inputs, piece, grid, prev_inputs, initial)
|
|||||||
|
|
||||||
local was_drop_blocked = piece:isDropBlocked(grid)
|
local was_drop_blocked = piece:isDropBlocked(grid)
|
||||||
|
|
||||||
self:attemptRotate(new_inputs, piece, grid, initial)
|
if self:canPieceRotate(piece, grid) then
|
||||||
|
self:attemptRotate(new_inputs, piece, grid, initial)
|
||||||
|
end
|
||||||
|
|
||||||
if not was_drop_blocked and piece:isDropBlocked(grid) then
|
if not was_drop_blocked and piece:isDropBlocked(grid) then
|
||||||
playSE("bottom")
|
playSE("bottom")
|
||||||
@ -160,6 +162,7 @@ function Ruleset:attemptWallkicks(piece, new_piece, rot_dir, grid)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Ruleset:movePiece(piece, grid, move, instant)
|
function Ruleset:movePiece(piece, grid, move, instant)
|
||||||
|
if not self:canPieceMove(piece, grid) then return end
|
||||||
local x = piece.position.x
|
local x = piece.position.x
|
||||||
local was_drop_blocked = piece:isDropBlocked(grid)
|
local was_drop_blocked = piece:isDropBlocked(grid)
|
||||||
if move == "left" then
|
if move == "left" then
|
||||||
@ -181,7 +184,7 @@ end
|
|||||||
|
|
||||||
function Ruleset:dropPiece(
|
function Ruleset:dropPiece(
|
||||||
inputs, piece, grid, gravity, drop_speed, drop_locked, hard_drop_locked,
|
inputs, piece, grid, gravity, drop_speed, drop_locked, hard_drop_locked,
|
||||||
hard_drop_enabled, additive_gravity
|
hard_drop_enabled, additive_gravity, classic_lock
|
||||||
)
|
)
|
||||||
if piece.big then
|
if piece.big then
|
||||||
gravity = gravity / 2
|
gravity = gravity / 2
|
||||||
@ -191,18 +194,18 @@ function Ruleset:dropPiece(
|
|||||||
local y = piece.position.y
|
local y = piece.position.y
|
||||||
if inputs["down"] == true and drop_locked == false then
|
if inputs["down"] == true and drop_locked == false then
|
||||||
if additive_gravity then
|
if additive_gravity then
|
||||||
piece:addGravity(gravity + drop_speed, grid)
|
piece:addGravity(gravity + drop_speed, grid, classic_lock)
|
||||||
else
|
else
|
||||||
piece:addGravity(math.max(gravity, drop_speed), grid)
|
piece:addGravity(math.max(gravity, drop_speed), grid, classic_lock)
|
||||||
end
|
end
|
||||||
elseif inputs["up"] == true and hard_drop_enabled == true then
|
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)
|
piece:addGravity(gravity, grid, classic_lock)
|
||||||
else
|
else
|
||||||
piece:dropToBottom(grid)
|
piece:dropToBottom(grid)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
piece:addGravity(gravity, grid)
|
piece:addGravity(gravity, grid, classic_lock)
|
||||||
end
|
end
|
||||||
if piece.position.y ~= y then
|
if piece.position.y ~= y then
|
||||||
self:onPieceDrop(piece, grid)
|
self:onPieceDrop(piece, grid)
|
||||||
@ -303,11 +306,13 @@ function Ruleset:processPiece(
|
|||||||
end
|
end
|
||||||
self:dropPiece(
|
self:dropPiece(
|
||||||
inputs, piece, grid, gravity, drop_speed, drop_locked, hard_drop_locked,
|
inputs, piece, grid, gravity, drop_speed, drop_locked, hard_drop_locked,
|
||||||
hard_drop_enabled, additive_gravity
|
hard_drop_enabled, additive_gravity, classic_lock
|
||||||
)
|
)
|
||||||
self:lockPiece(piece, grid, lock_delay, classic_lock)
|
self:lockPiece(piece, grid, lock_delay, classic_lock)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Ruleset:canPieceMove(piece, grid) return true end
|
||||||
|
function Ruleset:canPieceRotate(piece, grid) return true end
|
||||||
function Ruleset:onPieceMove(piece) end
|
function Ruleset:onPieceMove(piece) end
|
||||||
function Ruleset:onPieceRotate(piece) end
|
function Ruleset:onPieceRotate(piece) end
|
||||||
function Ruleset:onPieceDrop(piece) end
|
function Ruleset:onPieceDrop(piece) end
|
||||||
|
Loading…
Reference in New Issue
Block a user