Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

mode_flip_guard

Two tiny cross-module transient signals about the edit↔play mode flip:

  • owned — "the layers module currently owns the mode-flip reset, so the player_spawner / camera_spawner onModeChange watchers should stand down."
  • in flight — "a mode-flip transition is materialising the scene right now, so the live entities are a partial rebuild of it."

Formerly _G.__zero_layers_owns_mode_flip. Moved off _G ahead of the read-only _G seal — the flags are runtime writes (set when layers drives a mode flip), which would break under a sealed _G. require() is cached per VM, so the module-local upvalues are shared state across every requirer within a VM — exactly the cross-module reach the old _G key provided.

  • Setter: layers.module claims ownership before any flip, and raises the in-flight signal for the span of the transition it runs.
  • Readers: player_spawner.module, camera_spawner.module stand down while owned so the player/camera respawn happens exactly once via the layers transition's reload fan-out (not a second time from their own onModeChange watchers); playerSetupValidation.module judges the authored scene once the transition has settled.

Surface

SymbolNotes
M.setOwned(v: boolean)Set whether the layers module owns the current mode-flip reset.
M.isOwned() -> booleanTrue while the layers transition owns the flip; spawners stand down.
M.setInFlight(v: boolean)Set whether a mode-flip transition is materialising the scene.
M.isInFlight() -> booleanTrue for the span of the transition; the live entities are a partial rebuild of the scene.