mirror of
https://github.com/SashLilac/cambridge.git
synced 2024-11-22 13:49:02 -06:00
Added immobile spin bonus toggle (read comments)
Use piece.spin in your onPieceLock method to check for a spin
This commit is contained in:
parent
fc58e6e908
commit
fc8fb8b66f
@ -48,6 +48,7 @@ function GameMode:new(secret_inputs)
|
|||||||
self.irs = true
|
self.irs = true
|
||||||
self.ihs = true
|
self.ihs = true
|
||||||
self.square_mode = false
|
self.square_mode = false
|
||||||
|
self.immobile_spin_bonus = false
|
||||||
self.rpc_details = "In game"
|
self.rpc_details = "In game"
|
||||||
self.SGnames = {
|
self.SGnames = {
|
||||||
"9", "8", "7", "6", "5", "4", "3", "2", "1",
|
"9", "8", "7", "6", "5", "4", "3", "2", "1",
|
||||||
@ -132,13 +133,31 @@ function GameMode:update(inputs, ruleset)
|
|||||||
self:chargeDAS(inputs, self:getDasLimit(), self.getARR())
|
self:chargeDAS(inputs, self:getDasLimit(), self.getARR())
|
||||||
|
|
||||||
-- set attempt flags
|
-- set attempt flags
|
||||||
if inputs["left"] or inputs["right"] then self:onAttemptPieceMove(self.piece) end
|
if inputs["left"] or inputs["right"] then
|
||||||
|
self:onAttemptPieceMove(self.piece)
|
||||||
|
if self.immobile_spin_bonus and self.piece ~= nil then
|
||||||
|
if not self.piece:isMoveBlocked(self.grid, { x=-1, y=0 }) and
|
||||||
|
not self.piece:isMoveBlocked(self.grid, { x=1, y=0 }) then
|
||||||
|
self.piece.spin = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
if
|
if
|
||||||
inputs["rotate_left"] or inputs["rotate_right"] or
|
inputs["rotate_left"] or inputs["rotate_right"] or
|
||||||
inputs["rotate_left2"] or inputs["rotate_right2"] or
|
inputs["rotate_left2"] or inputs["rotate_right2"] or
|
||||||
inputs["rotate_180"]
|
inputs["rotate_180"]
|
||||||
then
|
then
|
||||||
self:onAttemptPieceRotate(self.piece)
|
self:onAttemptPieceRotate(self.piece)
|
||||||
|
if self.immobile_spin_bonus and self.piece ~= nil then
|
||||||
|
if 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=0, y=-1 }) then
|
||||||
|
self.piece.spin = true
|
||||||
|
else
|
||||||
|
self.piece.spin = false
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if self.piece == nil then
|
if self.piece == nil then
|
||||||
|
Loading…
Reference in New Issue
Block a user