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

player_lifecycle

Wires the UserIdentity component's avatar-bind events into the `localPlayerReady` lifecycle hook. Owns the local-avatar-bound latch (fires once after the avatar entity is bound + has settled past the bundle.instantiate deferred-mutation pipeline) and the opt-out path for legacy v…

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

modules.api.engine.player_lifecycle

Wires the UserIdentity component's avatar-bind events into the localPlayerReady lifecycle hook. Owns the local-avatar-bound latch (fires once after the avatar entity is bound + has settled past the bundle.instantiate deferred-mutation pipeline) and the opt-out path for legacy v6 scenes that declare the avatar slot as "".

Exposes the __layers_local_avatar_bound + __layers_local_avatar_opt_out dispatch channels wired in install(); the UserIdentity component's lifecycle and the legacy v6 player_spawner route through them.

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 player_lifecycle Bridges the UserIdentity component's `awake / onDestroy` into the per-scene players registry. Installed by the prelude. The UserIdentity component requires this module and calls `playerJoined(eid)` in awake, `playerLeft(eid)` in onDestroy, and `localAvatarBound(eid, av)` when the local avatar slot fills. Each routes into `layers.active.players._addPlayer / _removePlayer / _onLocalAvatarBound`, which update the per-scene set AND fire `onPlayerJoined / onPlayerLeft` in one atomic step. onLocalReady is fired separately when the joining entity matches `world.connectedUsers.localUser.entity`. `install()` also registers `__layers_*` dispatch channels the player_spawner uses.

activePlayers( ) → void

localUserEntityId( ) → void

register(eid: ?) → void

Fold one player entity into the active scene's registry + fire its onPlayerJoined / onLocalReady subscribers. Returns true once it lands.

argtypedescription
eid?

playerJoined(eid: ?) → void

Public entry the UserIdentity component calls in `awake`: a player entity has joined. Folds it into the per-scene IDENTITY registry — the source of truth for `players.list()` — and fires onPlayerJoined / onLocalReady. A REMOTE player's `awake` can fire while the joiner is still materializing the snapshot, before `layers.active.players` resolves. Missing the registration then would drop that player from `players.list()` forever, so when the registry isn't ready yet we retry for a bounded window instead of silently dropping the join.

argtypedescription
eid?

playerLeft(eid: ?) → void

Public entry the UserIdentity component calls in `onDestroy`: a player entity has left the scene. Removes it from the registry and fires onPlayerLeft.

argtypedescription
eid?

localAvatarBound(eid: ?, avatarEid: ?) → void

Wired from the UserIdentity component's onPropertyChanged when the local identity's `avatar` slot transitions to a live entity id. Drives the per-scene `players:onLocalReady` latch, since that's the canonical signal for "the body exists, you can position / customise it now". The "is this the local player" gate is upstream: onPropertyChanged only fires this callout when its host entity reports `:isLocal() == true`. Re-filtering here against `world.connectedUsers.localUser` would gate this off on anonymous boots (no auth = no connectedUsers record), which is exactly the dev / test path we need to keep working.

argtypedescription
eid?
avatarEid?

_localAvatarOptOut(eid: ?) → void

Wired from the legacy v6 `player_spawner.M.ensure` when the scene's avatar slot for the current mode is the explicit opt-out (`""`). No avatar will ever bind in that case, so the spawner trips this directly so `onLocalReady` can still fire (with no body — the scene's hook is expected to build the avatar itself).

argtypedescription
eid?

install( ) → void

Sub-parts

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

3items
·
other · born here
▤file
▲ 0↑ born
backing path · modules/api/engine/player_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.