Builtin Library
README.md
camera_spawner
Generic primary-camera spawner. § 17 step 10 of
docs/plans/2026-05-01-player-camera-unification.md.
Hooks layers.onLoad: on every non-additive scene load it spawns a
Camera-bearing entity with behavior resolved through:
sceneProxy.camera_default— per-scene override (future field)world.camera_default— world-level default- Neither set:
log.error+ skip the spawn (no hardcoded fallback).
The spawned entity is temporary so layers.active:save() doesn't bake it.
follow is set to the first Player entity in the scene at spawn
time; later scripts can re-target by writing
entity(camId).component.get("Camera").follow = someId.
Additive overlays do NOT spawn their own camera — they ride on the parent non-additive scene's camera.
Surface
| Symbol | Notes |
|---|---|
M.install() | Idempotent. Registers the layers.onLoad / onUnload hooks. Called once from the engine prelude. |
M.ensure(sceneProxy) -> entity_id | nil | Manually spawn the primary camera for sceneProxy. Use from scene entrypoints that want to control spawn ordering. Returns nil when the camera was already in place. |