E-Heart ARS updated to not kick the other dir

This commit is contained in:
Ishaan Bhardwaj 2021-02-21 17:40:54 -05:00
parent fa224d1026
commit 303e844608

View File

@ -16,23 +16,17 @@ function EHeart:attemptWallkicks(piece, new_piece, rot_dir, grid)
table.sort(offsets, function(A, B) return A.y < B.y or A.y == B.y and A.x < B.y end) table.sort(offsets, function(A, B) return A.y < B.y or A.y == B.y and A.x < B.y end)
for index, offset in pairs(offsets) do for index, offset in pairs(offsets) do
if grid:isOccupied(piece.position.x + offset.x, piece.position.y + offset.y) then if grid:isOccupied(piece.position.x + offset.x, piece.position.y + offset.y) then
-- individual checks for all 9 cells, in the given order if offset.x < 0 then
if offset.y < 0 then self:lateralKick(1, piece, new_piece, rot_dir, grid)
if offset.x < 0 then self:lateralKick(1, piece, new_piece, rot_dir, grid) break
elseif offset.x == 0 then return elseif offset.x == 0 then
elseif offset.x > 0 then self:lateralKick(-1, piece, new_piece, rot_dir, grid) end return
elseif offset.y == 0 then elseif offset.x > 0 then
if offset.x < 0 then self:lateralKick(1, piece, new_piece, rot_dir, grid) self:lateralKick(-1, piece, new_piece, rot_dir, grid)
elseif offset.x == 0 then return break
elseif offset.x > 0 then self:lateralKick(-1, piece, new_piece, rot_dir, grid) end
elseif offset.y > 0 then
if offset.x < 0 then self:lateralKick(1, piece, new_piece, rot_dir, grid)
elseif offset.x == 0 then return
elseif offset.x > 0 then self:lateralKick(-1, piece, new_piece, rot_dir, grid) end
end end
end end
end end
end end
function EHeart:lateralKick(dx, piece, new_piece, rot_dir, grid) function EHeart:lateralKick(dx, piece, new_piece, rot_dir, grid)