diff options
| author | Eltrac <hi@guhub.cn> | 2025-03-09 13:12:11 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-03-09 13:12:11 +0800 |
| commit | c6f942791db16a1951e2fe77c6eb9e664b39d464 (patch) | |
| tree | b8f52d5420ac5f7a5011c16bd4d6cdb98184c239 /utils/mapHelper.lua | |
| parent | a78bb40531825f858ee0e170695f3b29c9619827 (diff) | |
refactor: better map generation
Diffstat (limited to 'utils/mapHelper.lua')
| -rw-r--r-- | utils/mapHelper.lua | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/utils/mapHelper.lua b/utils/mapHelper.lua new file mode 100644 index 0000000..a17ad56 --- /dev/null +++ b/utils/mapHelper.lua @@ -0,0 +1,30 @@ +local mapHelper = {} + +function mapHelper.getAvailablePairedDirections(room1, room2) + local dd1 = room1:getDoorlessDirections() + local dd2 = room2:getDoorlessDirections() + local pairedDirections = {} + + print("room 1 doors") + for _, door in ipairs(room1.doors) do + print(door.location) + end + + print("room 2 doors") + for _, door in ipairs(room2.doors) do + print(door.location) + end + + for _, dir1 in ipairs(dd1) do + local dir2 = OppositeDirection[dir1] + if utils.contains(dd2, dir2) then + print(dir1, dir2) + table.insert(pairedDirections, {dir1, dir2}) + end + end + print("---") + + return pairedDirections +end + +return mapHelper |
