component
Room
Composite: four walls and a floor with a doorway, arranged from one Level. Unpack to customize.
Room is a composite: a data arrangement of parts, not code. add
copies the arrangement JSON plus the source of every part it references.
Add it
npx @runek/cli add room
Pulls level.
Use it
Place it in a world by type — the renderer expands the arrangement in place:
{ "type": "Room", "props": { "position": [0, 0, 0], "seed": 1 } }
Register the arrangement in your registry map next to the parts it uses:
import room from './runek/composites/room.json'
const registry = { /* …parts… */, Room: room as unknown as CompositeDef }
An instance seed deterministically re-rolls every child that doesn’t pin its
own. In the editor, Unpack replaces an instance with its editable
arrangement (a Group of ordinary nodes) for per-instance customization.
Arrangement
{
"kind": "composite",
"name": "Room",
"description": "Four walls and a floor with a front doorway — one Level with an opening. Unpack it to add a ceiling, windows, or more openings.",
"bounds": [8, 3, 8],
"nodes": [
{
"type": "Level",
"props": {
"size": [8, 8],
"height": 3,
"walls": {
"front": { "openings": [{ "width": 1.4, "height": 2 }] }
}
}
}
]
}
Migrate
v0.11.0 → v0.12.0. Room is no longer a coded component — the registry name now resolves to a composite: one Level with a front doorway. For JSX composition, reach for Level directly; it is the same walls-plus-floor ring with per-side openings.
import { Room } from './runek/Room'
<Room size={[8, 8]} doorWidth={1.4} roof />
import { Level } from './runek/Level'
<Level
size={[8, 8]}
walls={{ front: { openings: [{ width: 1.4, height: 2 }] } }}
/>
- World files need nothing:
{ "type": "Room" }keeps rendering via the composite. - The old
roofceiling is aFlooron top:<Floor position={[0, 3.2, 0]} size={[8, 8]} />(its origin is its top surface), or unpack the composite and extend it. scripts/migrate-buildings.mjsbakes oldRoomnodes with non-default props into the equivalent parts.- The
RoomPropstype no longer exists.
Registry manifest
registry manifest /r/components/room.json Self-contained JSON: the inlined arrangement plus resolved dependencies, exactly whatrunek add room fetches.
Browse the whole catalog in the gallery →.