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

prototype_lifecycle

The play-mode invariant for authored player prototypes and EditorOnly entities. In play a PlayerPrototype subtree is the clone source, not a live scene entity: the scene loader spawns it only in edit, and the spawn-on-join flow instantiates a clone per joining user in play. This…

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

prototype_lifecycle

The play-mode invariant for authored player prototypes and EditorOnly entities. In play a PlayerPrototype subtree is the clone source, not a live scene entity: the scene loader spawns it only in edit, and the spawn-on-join flow instantiates a clone per joining user in play. This module deactivates and hides any prototype still live when play begins (the fallback when the loader spawned one) and every EditorOnly entity, so neither is simulated nor rendered in play; in edit both are fully live. Runtime clones are tracked here and despawned on the return to edit.

Location: src/lua/lib/modules/api/engine/prototype_lifecycle.module

Interface

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

conforms to

zero/source-extract/v2

module prototype_lifecycle The play-mode invariant for authored player prototypes and EditorOnly entities. In play a PlayerPrototype subtree is the clone source, not a live scene entity: the scene loader spawns it only in edit and the spawn-on-join flow instantiates a clone per joining user in play. This module deactivates and hides any prototype still live when play begins (the fallback when the loader spawned one) and every EditorOnly entity, so neither is simulated nor rendered in play. In edit both are fully live. Runtime clones are tracked here and despawned on the return to edit. Deactivating and hiding a root cascades to its subtree through the hierarchy, so operating on the root covers its children. require modules/api/engine/prototype_lifecycle

prototypeRoots( ) →

Ids of every active-layer entity carrying the PlayerPrototype component.

editorOnlyEntities( ) → void

Ids of every active-layer entity whose participation is EditorOnly.

setLive(live: boolean) → void

Apply an active/internal state to every prototype root and EditorOnly entity.

argtypedescription
liveboolean

setEditorSurfaceLive(live: boolean) → void

Apply an active/hidden state to the tracked EditorOnly entities alone, leaving prototype roots untouched. Pausing play returns the editor authoring surface (the free camera + editor-only visualizers) over the frozen world, but must NOT revive the player-prototype clone sources — those stay deactivated so no duplicate body appears alongside the live avatar. Operates on the tracked-id list (not a fresh query) because the entities are marked internal in play and a query would no longer return them.

argtypedescription
liveboolean

showEditorSurface( ) → void

Reactivate and unhide the EditorOnly authoring surface (free camera + editor-only visualizers) without touching player-prototype roots. Used when play mode is paused so the editor camera returns over the frozen world.

hideEditorSurface( ) → void

Deactivate and hide the EditorOnly authoring surface without touching player-prototype roots. Used when play mode resumes so the surface disappears and gameplay cameras take the viewport back.

deactivatePrototypes( ) → void

Deactivate and hide every prototype root and EditorOnly entity so play mode neither simulates nor renders them.

activatePrototypes( ) → void

Reactivate and unhide every prototype root and EditorOnly entity.

registerClone(id: string) → void

Track a runtime clone root so it can be despawned on the return to edit.

argtypedescription
idstringThe clone's root entity id.

despawnClones( ) → void

Despawn every still-existing tracked clone and clear the tracking list.

enterPlay( ) → void

Enter play mode: deactivate and hide prototypes and EditorOnly entities.

enterEdit( ) → void

Enter edit mode: despawn runtime clones, then reactivate prototypes and EditorOnly entities.

install( ) → void

Keep the play-mode invariant applied for every flip, in every world. `enterPlay` / `enterEdit` are what make `PrototypeOnly` and `EditorOnly` mean something at runtime, and until something calls them on the flip a template stays live: its camera competes for the viewport with the camera of the player cloned from it, carries no follow target, and holds the shot at the spawn point; its body answers the same input as a second character. Registered from the prelude beside the other engine installs rather than from a scene-load path — a load that does not run leaves the invariant unapplied with nothing reporting it, and a flip that reloads no scene never reaches a loader hook at all. Idempotent: a second call registers nothing, and the current mode is applied once on install so a world opened straight into play does not start with its templates live.

examples

PrototypeLifecycle.install()

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/prototype_lifecycle.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.