summaryrefslogtreecommitdiff
path: root/utils/mapHelper.lua
blob: 913c02d996114672aa966633e2a2a114f8f50bcf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
local mapHelper = {}

function mapHelper.getAvailablePairedDirections(room1, room2)
    local dd1 = room1:getDoorlessDirections()
    local dd2 = room2:getDoorlessDirections()
    local pairedDirections = {}

    for _, dir1 in ipairs(dd1) do
        local dir2 = OppositeDirection[dir1]
        if utils.contains(dd2, dir2) then
            table.insert(pairedDirections, {dir1, dir2})
        end
    end

    return pairedDirections
end

return mapHelper