TeleportDataBuilder
Realm-agnostic assembly of the teleport-data envelope: the provider registry plus TeleportDataBuilder.PromiseBuildTeleportData. Both TeleportDataService (server) and TeleportDataServiceClient (client) own one of these and delegate their build surface to it, so a teleport authored on either realm goes through the same providers and produces the same envelope shape. That symmetry is the point: a client-initiated teleport can no longer forget shared data or hand-roll a divergent table.
Pure -- it performs no teleport and touches no Player state beyond the injected UserId resolver -- so it is unit tested without any real player.
Types
TeleportDataProvider
Contributes teleport data shared by every player in a teleport. Returns nil to contribute nothing.
PerPlayerTeleportDataProvider
Contributes teleport data for a single player in a teleport (called once per player, with the full player list for context). Returns nil to contribute nothing. This is how per-player data survives a group teleport, where every player would otherwise share one flat table.
Functions
new
Creates a builder. getUserId resolves the UserId used to key a player's envelope slice; it is
injected (rather than reading player.UserId directly) so a headless test can stand in a fake player.
RegisterTeleportDataProvider
Registers a provider that contributes teleport data on every TeleportDataBuilder.PromiseBuildTeleportData call. Returns a function that unregisters the provider (also give it to a [Maid]).
RegisterPerPlayerTeleportDataProvider
TeleportDataBuilder.RegisterPerPlayerTeleportDataProvider(provider: PerPlayerTeleportDataProvider) → () → ()Registers a per-player provider that contributes each player's own slice on every TeleportDataBuilder.PromiseBuildTeleportData call. Returns a function that unregisters it (also give it to a [Maid]).
PromiseBuildTeleportData
Builds the teleport-data envelope, awaiting any provider that returns a Promise. Providers may return a table, nil, or a Promise of either. Resolves to the assembled per-player envelope (see TeleportDataBuilder._assembleEnvelope for precedence and the size guard).
A provider whose Promise rejects rejects the whole build, so an asynchronous provider should handle its own errors (e.g. resolve nil) when it would rather degrade than block the teleport.