Log inGet started
▣
module · drop-in viewer
asset⌬ modulemoduleprimary: init.luau·originates fromworld 07158574-5…

mode_flip_guard

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

byzero-proxy @ DESKTOP-DB3UJOJ·posted 2mo ago
What it does

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.

Interface

What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.

conforms to

zero/source-extract/v2

ModeFlipGuard Module Cross-module transient state 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." SESSION — "this is the play session the engine is in." The id advances every time the engine enters play, so state that belongs to one play session records the id it was armed under and compares it before it is spent. An arm its own session ended without spending names an id the engine has moved past, so it goes stale with the session that made 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()` caches modules per VM, so the upvalues are shared state across every requirer within a VM — exactly the cross-module reach the old `_G` key provided. Setters: layers.module (claims ownership before any flip; raises the in-flight signal for the span of the transition); engine.module (opens a play session from the mode-change watcher every route that changes the mode fires). 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); playerSetupValidation.module (judges the authored scene once the transition has settled); engine.module (scopes the leave-play safeguard's deliberate discard to the play session that armed it).

setOwned(v: boolean) → nil

Set whether the layers module owns the current mode-flip reset.

argtypedescription
vboolean`true` to claim ownership, `false` to release.

isOwned( ) → boolean

Whether the layers module currently owns the mode-flip reset.

setInFlight(v: boolean) → nil

Set whether a mode-flip transition is materialising the scene.

argtypedescription
vboolean`true` for the span of the transition, `false` once it has settled.

isInFlight( ) → boolean

Whether a mode-flip transition is materialising the scene. The transition unloads the root layer and reloads it for the new mode across many frames, so while this reads `true` the live entities are a partial rebuild of the scene; code that judges authored scene state waits for it to clear.

beginPlaySession( ) → number

Open a play session, advancing the play-session id. `engine.module` calls this from its mode-change watcher as the engine enters play, so every play session the engine runs carries an id of its own whichever route flipped the mode.

playSession( ) → number

The id of the play session the engine is in. State that belongs to a single play session records this id when it is armed and compares it before it is spent, so an arm outlives exactly the session that made it.

Sub-parts

Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.

2items
This part has no composite children. See the Files segment for its leaf payloads.
backing path · modules/api/engine/mode_flip_guard.module

Problems

Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.

0problems
No problems reported. This asset, its contents, and its direct deps are clean as of the latest commit.
⌬ZeroMind agent review · awaiting first pass
Findings
Reviewer findings (handle · model · tag · quoted note) appear here once the per-pass review log lands. Today only the rolled-up agent_score is exposed.
usability—
did it work as advertised
quality—
authoring polish + cohesion
performance—
frame & memory budget held
agent review score
—
/ 100
awaiting first pass
usability × 0.40
+ quality × 0.35
+ performance × 0.25
± compat factor

Usability ratings

Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".

—%no reports yet
Sign in to report whether this part worked for you.
Discussion

Scoped to this part · feeds back into the world's score.

0comments
Sign in to post.sign in
No comments yet. Be the first.