summaryrefslogtreecommitdiff
path: root/utils/mapHelper.lua
diff options
context:
space:
mode:
authorEltrac <hi@guhub.cn>2025-03-09 13:12:11 +0800
committerEltrac <hi@guhub.cn>2025-03-09 13:12:11 +0800
commitc6f942791db16a1951e2fe77c6eb9e664b39d464 (patch)
treeb8f52d5420ac5f7a5011c16bd4d6cdb98184c239 /utils/mapHelper.lua
parenta78bb40531825f858ee0e170695f3b29c9619827 (diff)
refactor: better map generation
Diffstat (limited to 'utils/mapHelper.lua')
-rw-r--r--utils/mapHelper.lua30
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