Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

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:

  1. sceneProxy.camera_default — per-scene override (future field)
  2. world.camera_default — world-level default
  3. 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

SymbolNotes
M.install()Idempotent. Registers the layers.onLoad / onUnload hooks. Called once from the engine prelude.
M.ensure(sceneProxy) -> entity_id | nilManually 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.