Skip to content
Work in progress. These docs describe Spawnite at launch, and some parts are still being built.

records

const records: Readonly<{ player: Readonly<{ for: (playerId) => PlayerRecordHandle; }>; playerWorld: Readonly<{ for: (worldId, playerId) => PlayerRecordHandle; }>; world: Readonly<{ for: (worldId) => WorldRecordHandle; }>; }>

The game’s records, to name one as deliver’s source or receiver. records.player.for(playerId) is the player’s game-wide record, records.playerWorld.for(worldId, playerId) the player’s record in a world, and records.world.for(worldId) the world’s. Each id is branded, a PlayerId from readPlayerId or requirePlayerId, a WorldId from readHeldWorld or requireWorldId, so the two of playerWorld.for never swap. A handle is an address: it opens nothing, fetches nothing, and does not say the record exists. A keyed record’s handle is its declaration’s for.