Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commit3bb1da2647

README.md

player_prototype_spawn

The deterministic spawn core for authored player prototypes. A PlayerSpawn entity names a PlayerPrototype subtree to instantiate; spawnFor clones that subtree from its captured authored template, prunes clone-subtree nodes whose networkScope excludes the caller's owner/authority role, marks the clone RuntimeOnly, and turns the clone root into the joining user's hidden UserIdentity, named user like every user identity (the prototype keeps its own name, so a lookup by that name reaches the prototype), plugging it into the players registry, join/leave, ownership, and sync. The body named by PlayerPrototype.body is adopted as the user's avatar and placed at the PlayerSpawn's world transform; the prototype's CameraRig follows it. installJoinHook wires spawnFor to a scene's user-join event so a joining user is placed automatically.

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