Interface: PlayerDataChangedEvent<T>

Information delivered for one accepted player-data change.

Type Parameters

T

T = SyncedObject

Properties

affects

readonly affects: (...path) => boolean

Returns whether this change affects a path or anything above or below it. Call with no segments to match any change to the root object.

Parameters

path

...SyncedObjectPath

Returns

boolean

Example

if (event.affects('inventory', 'selectedItemId')) {
  renderSelectedItem(event.current.inventory.selectedItemId)
}

changedPaths

readonly changedPaths: SyncedObjectChangedPaths

The complete invalidation set prepared by Plot. Every actual difference is covered and every reported path identifies a subtree that differs. To keep work bounded, Plot may collapse many descendants to their differing ancestor; an empty path identifies the root object. Prefer affects when deciding whether to update a specific feature.


current

readonly current: ImmutableSynced<T>

The current complete immutable object.


playerId

readonly playerId: number

The player that owns the changed object.


previous

readonly previous: ImmutableSynced<T>

The complete object before this change.


reason

readonly reason: SyncedObjectChangeReason

Whether this SDK initiated the accepted change.


revision

readonly revision: number

The accepted per-player revision of the current object.