Corridors carve center-to-center and pierce room walls, so the old wall-threshold rule placed almost no doors. Detect the pierced-wall threshold (corridor floor outside a room, room on one side, corridor on the opposite) and mark it Door with probability door_chance (default 0.5), else leave it an open archway. Connectivity is via corridor floor, independent of doors. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
39 lines
1.9 KiB
Rust
39 lines
1.9 KiB
Rust
//! The vocabulary of generation [`crate::pass::Pass`] implementations.
|
||
//!
|
||
//! Each concrete pass is its own submodule, added by Tasks 7–11. Passes never
|
||
//! call each other; they communicate **only** through the
|
||
//! [`crate::pass::GenContext`] fields (`tiles`, `regions`, `graph`,
|
||
//! `blackboard`). This module's job is to host them and to document the
|
||
//! integration contract below.
|
||
//!
|
||
//! # Inter-Pass Data Contract (v1 dungeon)
|
||
//!
|
||
//! This is the integration contract for the v1 dungeon recipe. Each pass reads
|
||
//! certain `GenContext` state and writes others; the table is the single source
|
||
//! of truth so the five passes can be implemented and unit-tested in parallel,
|
||
//! each by constructing a `GenContext` in its required input state.
|
||
//!
|
||
//! | Pass | Reads | Writes |
|
||
//! |------|-------|--------|
|
||
//! | `BspPartition` | (empty grid) | `ctx.regions`: one placeholder `Region { kind: Room, bounds: <leaf rect>, cells: [] }` per BSP leaf |
|
||
//! | `RoomCarver` | `ctx.regions` (placeholder Rooms) | carves `Floor` into `ctx.tiles`; shrinks each Room's `bounds` to its actual room rect and fills `cells` |
|
||
//! | `MstConnect` | `ctx.regions` (kind=Room, non-empty `cells`) centers | `ctx.graph`: edges `{ a, b, at: None }` forming an MST over rooms + a few extra loop edges |
|
||
//! | `CorridorCarver` | `ctx.graph` edges + Room region bounds/centers | carves L-shaped `Floor` corridors into `ctx.tiles`; appends `Region { kind: Corridor, .. }` per corridor |
|
||
//! | `DoorPlacer` | `ctx.tiles` + `ctx.regions` + `ctx.graph` | converts boundary `Wall` cells (room↔corridor) to `Door`; sets the corresponding `edge.at = Some(point)` |
|
||
//!
|
||
//! Submodule declarations are appended here by Tasks 7–11.
|
||
|
||
pub mod bsp;
|
||
pub use bsp::{BspConfig, BspPartition};
|
||
|
||
pub mod room;
|
||
pub use room::{RoomCarver, RoomConfig};
|
||
|
||
pub mod connect;
|
||
pub use connect::{ConnectConfig, MstConnect};
|
||
|
||
pub mod corridor;
|
||
pub use corridor::CorridorCarver;
|
||
|
||
pub mod door;
|
||
pub use door::{DoorConfig, DoorPlacer};
|