githubEdit

Players

The Players module allows scenesarrow-up-right to look for players in their environment and get information about their identity and profilesarrow-up-right.

const Players = require("~system/Players");

It contains the following methods and types:

Methods

There's two methods in this module to discover players in the scene, and one to obtain their profiles.

getPlayersInScene

Returns a Player array, each with a userId that can be used in getPlayerData.

interface Request {}

interface Response {
  players: Player[];
}

function getPlayersInScene(Request): Promise<Response>;

getConnectedPlayers

getPlayerData

Returns the UserData for a user, if known for the given userId.

Types

There's only two types in this module: Player and UserData.

Player

Holds a reference to a userId.

UserData

Holds (possibly partial) information about a user, their identity and avatar.

World Explorers obtain this information through the content systemarrow-up-right.

The profile entity definitionarrow-up-right details all of these fields and more. While the structure and keys of UserData are slightly different, the meaning of each field is the same.

Last updated