From 01af13003ae215341d66e37a0129c82e495ad230 Mon Sep 17 00:00:00 2001 From: Rin Date: Sat, 21 Aug 2021 20:33:13 +0100 Subject: [PATCH] Improve PRS to make it more accurate to puzzle trial's --- tetris/rulesets/prs.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tetris/rulesets/prs.lua b/tetris/rulesets/prs.lua index 6100ce3..3af2596 100644 --- a/tetris/rulesets/prs.lua +++ b/tetris/rulesets/prs.lua @@ -6,6 +6,27 @@ PRS.name = "Permissive Rotation System" PRS.hash = "PRS" PRS.world = true +function PRS:attemptRotate(new_inputs, piece, grid, initial) + local rot_dir = 0 + + if (new_inputs["rotate_left"] or new_inputs["rotate_left2"]) then + rot_dir = 3 + elseif (new_inputs["rotate_right"] or new_inputs["rotate_right2"]) then + rot_dir = 1 + elseif (new_inputs["rotate_180"]) then + rot_dir = self:get180RotationValue() + end + + if rot_dir == 0 then return end + + if config.gamesettings.world_reverse == 3 or (self.world and config.gamesettings.world_reverse == 2) then + rot_dir = 4 - rot_dir + end + + local new_piece = piece:withRelativeRotation(rot_dir) + self:attemptWallkicks(piece, new_piece, rot_dir, grid) +end + function PRS:attemptWallkicks(piece, newpiece, rot_dir, grid) for y=0,5 do for x=0,5 do