From d0505251b3224fb61104c12fdff2af6f00f343b1 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Mon, 8 Feb 2021 23:23:50 -0500 Subject: [PATCH] Spawn positions now ruleset dependent Is configurable in options --- scene/game_config.lua | 2 +- tetris/rulesets/arika_ace.lua | 1 + tetris/rulesets/arika_ace2.lua | 1 + tetris/rulesets/arika_srs.lua | 1 + tetris/rulesets/ruleset.lua | 16 ++++++++++++---- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/scene/game_config.lua b/scene/game_config.lua index f14cd4f..4a04b23 100644 --- a/scene/game_config.lua +++ b/scene/game_config.lua @@ -11,7 +11,7 @@ ConfigScene.options = { {"manlock", "Manual Locking", false, {"Per ruleset", "Per gamemode", "Harddrop", "Softdrop"}}, {"piece_colour", "Piece Colours", false, {"Per ruleset", "Arika", "TTC"}}, {"world_reverse", "A Button Rotation", false, {"Left", "Auto", "Right"}}, - {"spawn_positions", "Spawn Positions", false, {"In field", "Out of field"}}, + {"spawn_positions", "Spawn Positions", false, {"Per ruleset", "In field", "Out of field"}}, {"display_gamemode", "Display Gamemode", false, {"On", "Off"}}, {"das_last_key", "DAS Switch", false, {"Default", "Instant"}}, {"smooth_movement", "Smooth Piece Drop", false, {"On", "Off"}}, diff --git a/tetris/rulesets/arika_ace.lua b/tetris/rulesets/arika_ace.lua index 6b201be..35d6f38 100755 --- a/tetris/rulesets/arika_ace.lua +++ b/tetris/rulesets/arika_ace.lua @@ -18,6 +18,7 @@ ARS.colourscheme = { ARS.softdrop_lock = false ARS.harddrop_lock = true +ARS.spawn_above_field = true function ARS:onPieceCreate(piece, grid) piece.floorkick = 0 diff --git a/tetris/rulesets/arika_ace2.lua b/tetris/rulesets/arika_ace2.lua index 525ee1b..5072c12 100644 --- a/tetris/rulesets/arika_ace2.lua +++ b/tetris/rulesets/arika_ace2.lua @@ -5,6 +5,7 @@ local ARS = Ruleset:extend() ARS.name = "ACE-ARS2" ARS.hash = "ArikaACE2" +ARS.spawn_above_field = true function ARS:onPieceCreate(piece, grid) piece.floorkick = 0 diff --git a/tetris/rulesets/arika_srs.lua b/tetris/rulesets/arika_srs.lua index 88b9b6e..36af808 100755 --- a/tetris/rulesets/arika_srs.lua +++ b/tetris/rulesets/arika_srs.lua @@ -17,6 +17,7 @@ SRS.colourscheme = { } SRS.softdrop_lock = false SRS.harddrop_lock = true +SRS.spawn_above_field = true SRS.MANIPULATIONS_MAX = 128 diff --git a/tetris/rulesets/ruleset.lua b/tetris/rulesets/ruleset.lua index 06b6e1f..42a024c 100644 --- a/tetris/rulesets/ruleset.lua +++ b/tetris/rulesets/ruleset.lua @@ -23,6 +23,7 @@ Ruleset.harddrop_lock = false Ruleset.enable_IRS_wallkicks = false Ruleset.are_cancel = false Ruleset.are = true +Ruleset.spawn_above_field = false Ruleset.next_sounds = { I = "I", @@ -243,10 +244,17 @@ function Ruleset:initializePiece( end end - local spawn_dy = ( - config.gamesettings.spawn_positions == 2 and - 2 or 0 - ) + local spawn_dy + if (config.gamesettings.spawn_positions == 1) then + spawn_dy = ( + self.spawn_above_field and 2 or 0 + ) + else + spawn_dy = ( + config.gamesettings.spawn_positions == 3 and + 2 or 0 + ) + end local piece = Piece(data.shape, data.orientation - 1, { x = spawn_x and spawn_x or spawn_positions[data.shape].x,