setSavedEntity
setSavedEntity(
authority,player,entity,setSavedEntityOptions?):void
Registers entity as the one player’s save keeps as savedAs, main
where none is named: the player’s record for that name restores onto it
over what its spawn set up, unless restore is false. From here it is read
at each of the player’s saves and captured as it goes. Registering another
saved as the same name replaces the one there, which is captured first, as
setViewTarget replaces a view target. A character, a dragon a game spawns
in place of one, each character of a party a player switches between, or a
pet. Takes the room’s step, requireAuthority, or a join hook’s step for
the player and what the player’s join spawned. One a join hook registers
restores as the player’s save attaches, after the player’s restore and
before any onPlayerReady, so every join hook’s default is laid first. A
restore that throws throws a SavedEntityRestoreError, which refuses a
join it runs in. After the player’s join it refuses the player’s save’s
load on a page, and in a room keeps that name’s record as stored. Any other
refusal throws in development and is logged in a deployed room,
which changes nothing.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
authority |
EntityAuthority |
player |
Entity |
entity |
Entity |
setSavedEntityOptions |
SetSavedEntityOptions |
Returns
Section titled “Returns”void