From 2ea75cdfafa299b6e0f090d55572e3f0007d5a34 Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Sat, 6 Mar 2021 22:13:38 -0500 Subject: [PATCH] Fixed a corner case in the last commit --- tetris/modes/gamemode.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tetris/modes/gamemode.lua b/tetris/modes/gamemode.lua index c5abf88..c4510a5 100644 --- a/tetris/modes/gamemode.lua +++ b/tetris/modes/gamemode.lua @@ -534,11 +534,18 @@ function GameMode:initializeNextPiece(inputs, ruleset, piece_data, generate_next end if self.buffer_hard_drop then self.buffer_hard_drop = false + local above_field = ( + (config.gamesettings.spawn_positions == 1 and + ruleset.spawn_above_field) or + config.gamesettings.spawn_positions == 3 + ) self:onHardDrop(self.piece.position.y - ( self.piece.big and ruleset.big_spawn_positions[self.piece.shape].y or ruleset.spawn_positions[self.piece.shape].y) + - ruleset:getAboveFieldOffset(piece_data.shape, piece_data.orientation) + (above_field and ruleset:getAboveFieldOffset( + piece_data.shape, piece_data.orientation + ) or 0) ) end if self.buffer_soft_drop then