Class WorldPlayerRegistry
Owns committed Player registrations and safe avatar access for one loaded World.
public sealed class WorldPlayerRegistry
- Inheritance
-
WorldPlayerRegistry
- Inherited Members
Properties
Count
Gets the number of Players with usable committed membership in this World.
public int Count { get; }
Property Value
Remarks
Counts current registrations on demand, so use it for reporting rather than work performed each tick.
Methods
ForEachAvatarAsync(PlayerAvatarAction)
Runs one synchronous avatar callback for each currently usable Player in this World.
public ValueTask ForEachAvatarAsync(PlayerAvatarAction action)
Parameters
actionPlayerAvatarAction
Returns
Remarks
The committed membership snapshot is queued as one World operation. Each registration is checked again on the World thread, so a revoked membership is skipped and a retired Store cannot be used. The callback must not retain its Store or avatar Entity.
Snapshot()
Gets a materialized snapshot of the Players committed to this World.
public IReadOnlyList<Player> Snapshot()
Returns
Remarks
The snapshot is detached from later roster changes. A returned Player may disconnect after the snapshot is created, so use ForEachAvatarAsync(PlayerAvatarAction) for avatar work.
TryGet(Guid, out Player?)
Resolves the Player committed to this World at the instant of lookup.
public bool TryGet(Guid playerId, out Player? player)
Parameters
Returns
Remarks
The returned Player may disconnect after lookup. Use Player.InCurrentWorldAsync for avatar work.