Skip to main content

RoomEntityFactory

RoomEntityFactory creates a room entity. In normal gameplay, this is called by MapSystem — you rarely need to call it directly.

Usage

RoomEntityFactory(
bounds: bounds,
doorways: doorways,
spawnPoints: spawnPoints
).make(in: world)

// With an explicit room ID (for reconnecting rooms across sessions)
RoomEntityFactory(
roomID: existingUUID,
bounds: bounds
).make(in: world)

Parameters

ParameterTypeDefaultDescription
roomIDUUID?nilExplicit room ID — a new UUID is generated if omitted
boundsRoomBoundsOrigin and size of the room in world space
doorways[Doorway][]Connection points to adjacent rooms
spawnPoints[SpawnPoint][]Enemy and item spawn locations
useGridBoolfalseWhether the room uses grid-based layout (reserved for future use)

Components Added

ComponentInitial Value
RoomMetadataComponentroomID, bounds, doorways, spawnPoints
TransformComponentbounds.center
RoomMemberComponentroomID