# --- Calc potential rooms ---
scoreboard players set p_rooms dungeon 0
execute as @e[tag=door] run scoreboard players add p_rooms dungeon 1


# ---------- Door -----------
# Does the door lead to a next room?
execute at @e[tag=spawn] as @e[tag=door,limit=1,sort=nearest] run function rooms:1_layout/1.1_door_or_wall
# Next room
execute as @e[tag=is_door,tag=!next_done,limit=1] at @s positioned ^ ^ ^23 run function rooms:1_layout/1.2_next_room

# --- Calc potential rooms ---
scoreboard players set p_rooms dungeon 0
execute as @e[tag=door] run scoreboard players add p_rooms dungeon 1

# --------- Next state -------
execute if score p_rooms dungeon matches 0 run scoreboard players add layout generation 1
execute if score p_rooms dungeon matches 0 run scoreboard players set @e[tag=center] rooms_from_spawn 0
