Ruleset and randomizer refactoring (Read comments)

You can now specify an arbitrary number of pieces for a ruleset.
The randomizers will adjust accordingly.
Expect a pento ruleset in the modpack soon!
Also, gamemode skin selection has been refactored.
This commit is contained in:
Ishaan Bhardwaj
2021-01-06 22:53:44 -05:00
parent ced40297cc
commit 1fdd091456
5 changed files with 54 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
local Object = require 'libs.classic'
local Piece = require 'tetris.components.piece'
local Bag7Randomizer = require "tetris.randomizers.bag7"
local Ruleset = Object:extend()
@@ -22,10 +23,24 @@ Ruleset.harddrop_lock = false
Ruleset.enable_IRS_wallkicks = false
Ruleset.are_cancel = false
Ruleset.fallback_randomizer = Bag7Randomizer()
Ruleset.next_sounds = {
I = "I",
L = "L",
J = "J",
S = "S",
Z = "Z",
O = "O",
T = "T"
}
Ruleset.pieces = 7
-- Component functions.
function Ruleset:new()
if config.gamesettings.piece_colour == 1 then
blocks["bone"] = (not self.world) and
{