Fixed up an edge case in immobile spin

pull/17/head
Ishaan Bhardwaj 2021-05-22 14:41:51 -04:00
parent 9f8e9a9778
commit 86e975f929
1 changed files with 6 additions and 5 deletions

View File

@ -206,14 +206,14 @@ function GameMode:update(inputs, ruleset)
self.piece.last_rotated = false self.piece.last_rotated = false
self:onPieceMove(self.piece, self.grid, piece_dx) self:onPieceMove(self.piece, self.grid, piece_dx)
end end
if (piece_drot ~= 0) then
self.piece.last_rotated = true
self:onPieceRotate(self.piece, self.grid, piece_drot)
end
if (piece_dy ~= 0) then if (piece_dy ~= 0) then
self.piece.last_rotated = false self.piece.last_rotated = false
self:onPieceDrop(self.piece, self.grid, piece_dy) self:onPieceDrop(self.piece, self.grid, piece_dy)
end end
if (piece_drot ~= 0) then
self.piece.last_rotated = true
self:onPieceRotate(self.piece, self.grid, piece_drot)
end
if inputs["up"] == true and if inputs["up"] == true and
self.piece:isDropBlocked(self.grid) and self.piece:isDropBlocked(self.grid) and
@ -242,7 +242,8 @@ function GameMode:update(inputs, ruleset)
if self.piece.locked == true then if self.piece.locked == true then
-- spin detection, immobile only for now -- spin detection, immobile only for now
if self.immobile_spin_bonus and ( if self.immobile_spin_bonus and
self.piece.last_rotated and (
self.piece:isDropBlocked(self.grid) and self.piece:isDropBlocked(self.grid) and
self.piece:isMoveBlocked(self.grid, { x=-1, y=0 }) and self.piece:isMoveBlocked(self.grid, { x=-1, y=0 }) and
self.piece:isMoveBlocked(self.grid, { x=1, y=0 }) and self.piece:isMoveBlocked(self.grid, { x=1, y=0 }) and