From 1307ecc06232e606e57190b4e3dfef497bc7c185 Mon Sep 17 00:00:00 2001 From: Eltrac Date: Tue, 4 Mar 2025 11:38:34 +0800 Subject: refactor: rewrite map generation --- objects/room.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'objects/room.lua') diff --git a/objects/room.lua b/objects/room.lua index 7109ba3..247b999 100644 --- a/objects/room.lua +++ b/objects/room.lua @@ -159,14 +159,16 @@ function Room:addDoor(door) end function Room:connect(anotherRoom, way) + if self:isDoorFull() or anotherRoom:isDoorFull() then + return false + end + if type(way) == "number" then -- if number (Direction enums) way = Ways[way] elseif not way then -- if no way set, randomly choose a doorless direction - local doorless = self:getDoorlessDirections() - if #doorless == 0 then return false end - way = Ways[utils.any(doorless)] + way = Ways[utils.any(self:getDoorlessDirections())] end -- connect room with determined direction -- cgit v1.2.3