mirror of
https://github.com/SashLilac/cambridge-modpack.git
synced 2024-11-25 04:49:02 -06:00
KRS Hotfix #2
This commit is contained in:
parent
4a83f71fe2
commit
588c5515a5
@ -61,6 +61,7 @@ KRS.wallkicks_line = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function KRS:onPieceCreate(piece)
|
function KRS:onPieceCreate(piece)
|
||||||
|
piece.das_kicked = false
|
||||||
piece.recovery_frames = self.game:getLockDelay() * 15
|
piece.recovery_frames = self.game:getLockDelay() * 15
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -80,11 +81,12 @@ function KRS:onPieceRotate(piece)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function KRS:canPieceMove(piece) return true end
|
function KRS:canPieceMove(piece) return not piece.das_kicked end
|
||||||
function KRS:canPieceRotate(piece) return true end
|
function KRS:canPieceRotate(piece) return true end
|
||||||
|
|
||||||
function KRS:attemptRotate(new_inputs, piece, grid, initial)
|
function KRS:attemptRotate(new_inputs, piece, grid, initial)
|
||||||
local rot_dir = 0
|
piece.das_kicked = false
|
||||||
|
local rot_dir = 0
|
||||||
|
|
||||||
if (new_inputs["rotate_left"] or new_inputs["rotate_left2"]) then
|
if (new_inputs["rotate_left"] or new_inputs["rotate_left2"]) then
|
||||||
rot_dir = 3
|
rot_dir = 3
|
||||||
@ -107,11 +109,11 @@ function KRS:attemptRotate(new_inputs, piece, grid, initial)
|
|||||||
self:onPieceRotate(piece)
|
self:onPieceRotate(piece)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
self:attemptWallkicks(piece, new_piece, rot_dir, grid)
|
self:attemptWallkicks(piece, new_piece, rot_dir, grid, new_inputs)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function KRS:attemptWallkicks(piece, new_piece, rot_dir, grid)
|
function KRS:attemptWallkicks(piece, new_piece, rot_dir, grid, new_inputs)
|
||||||
local kicks = (
|
local kicks = (
|
||||||
piece.shape == "I" and
|
piece.shape == "I" and
|
||||||
KRS.wallkicks_line[piece.rotation][new_piece.rotation] or
|
KRS.wallkicks_line[piece.rotation][new_piece.rotation] or
|
||||||
@ -122,13 +124,15 @@ function KRS:attemptWallkicks(piece, new_piece, rot_dir, grid)
|
|||||||
self.game.das.frames >= self.game:getDasLimit() - self.game:getARR()
|
self.game.das.frames >= self.game:getDasLimit() - self.game:getARR()
|
||||||
)
|
)
|
||||||
if (
|
if (
|
||||||
self.game.das.direction == "left" and
|
new_inputs.left or
|
||||||
(das_charged or piece:isMoveBlocked(grid, {x=-1, y=0}))
|
(self.game.das.direction == "left" and
|
||||||
|
(das_charged or piece:isMoveBlocked(grid, {x=-1, y=0})))
|
||||||
) then
|
) then
|
||||||
priority = -1
|
priority = -1
|
||||||
elseif (
|
elseif (
|
||||||
self.game.das.direction == "right" and
|
new_inputs.right or
|
||||||
(das_charged or piece:isMoveBlocked(grid, {x=1, y=0}))
|
(self.game.das.direction == "right" and
|
||||||
|
(das_charged or piece:isMoveBlocked(grid, {x=1, y=0})))
|
||||||
) then
|
) then
|
||||||
priority = 1
|
priority = 1
|
||||||
end
|
end
|
||||||
@ -138,6 +142,7 @@ function KRS:attemptWallkicks(piece, new_piece, rot_dir, grid)
|
|||||||
piece:setRelativeRotation(rot_dir)
|
piece:setRelativeRotation(rot_dir)
|
||||||
piece:setOffset({x=priority, y=0})
|
piece:setOffset({x=priority, y=0})
|
||||||
self:onPieceRotate(piece)
|
self:onPieceRotate(piece)
|
||||||
|
piece.das_kicked = priority ~= 0
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -148,6 +153,7 @@ function KRS:attemptWallkicks(piece, new_piece, rot_dir, grid)
|
|||||||
piece:setRelativeRotation(rot_dir)
|
piece:setRelativeRotation(rot_dir)
|
||||||
piece:setOffset({x=offset[1]+priority, y=offset[2]})
|
piece:setOffset({x=offset[1]+priority, y=offset[2]})
|
||||||
self:onPieceRotate(piece)
|
self:onPieceRotate(piece)
|
||||||
|
piece.das_kicked = priority ~= 0
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user