diff options
| author | Eltrac <hi@guhub.cn> | 2025-03-04 11:38:34 +0800 |
|---|---|---|
| committer | Eltrac <hi@guhub.cn> | 2025-03-04 11:38:34 +0800 |
| commit | 1307ecc06232e606e57190b4e3dfef497bc7c185 (patch) | |
| tree | 39f7103a6e8057cd5451404d00fbe07a44c23b7f /objects/room.lua | |
| parent | 435847f1ef23c13145a28d57dc018a5a0b777a9c (diff) | |
refactor: rewrite map generation
Diffstat (limited to 'objects/room.lua')
| -rw-r--r-- | objects/room.lua | 8 |
1 files changed, 5 insertions, 3 deletions
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 |
