Allowed gamemode and ruleset objects to control each other

Also added GameMode:onExit(), which triggers on game exit or retry
This commit is contained in:
Ishaan Bhardwaj
2021-02-19 11:01:18 -05:00
parent cb2b693bcb
commit 8a459b68ba
3 changed files with 11 additions and 7 deletions

View File

@@ -95,9 +95,8 @@ function GameMode:getSkin()
return "2tie"
end
function GameMode:initialize(ruleset, secret_inputs)
function GameMode:initialize(ruleset)
-- generate next queue
self:new(secret_inputs)
self.used_randomizer = (
ruleset.pieces == self.randomizer.possible_pieces and
self.randomizer or
@@ -107,6 +106,7 @@ function GameMode:initialize(ruleset, secret_inputs)
BagRandomizer(ruleset.pieces)
)
)
self.ruleset = ruleset
for i = 1, math.max(self.next_queue_length, 1) do
table.insert(self.next_queue, self:getNextPiece(ruleset))
end
@@ -333,6 +333,8 @@ function GameMode:onGameComplete()
self:onGameOver()
end
function GameMode:onExit() end
-- DAS functions
function GameMode:startRightDAS()