The User Entity

Each connected client corresponds to a User() instance. Control of Actors and other permissions are configured at the User level, so having different users allows you to give players access to different content. Each user is assigned a permission level which controls what capabilities they will have within the Virtual Tabletop.


The Users Collection

class Users()

The collection of User entities

Users.Collection.insert(entity)

Add a new Entity to the Collection, asserting that they are of the correct type

Arguments:
  • entity (Entity) – The entity instance to add to the collection
Users.Collection.remove(id)

Remove an Entity from the Collection by its ID.

Arguments:
  • id (String) – The entity ID which should be removed
Users.Collection.get(id)

Get an element from the collection by ID

Arguments:
  • id (String) – The entity ID to retrieve from the collection
Returns:

Entity – The retrieved Entity, if the ID was found, otherwise null;

Users.object

Elements of the Users collection are instances of the User class


The User Instance

class User()

The User entity

User.Entity.create(data, options)

Create a new entity using provided input data The data for entity creation is typically provided from the server through the ‘create<Entity>’ socket Alternatively, the creation event may originate locally and the new entity can be pushed back to the server

Arguments:
  • data (Object) – The data with which to create the entity
  • options (Object) – Additional options which customize the creation workflow
  • options.temporary (Boolean) – Create a temporary entity which is not saved to the world database. Default is false.
  • options.displaySheet (Boolean) – Show the configuration sheet for the created entity once it is created. Default is true.
Returns:

Promise – A Promise which resolves to contain the created Entity

User.Entity.update(data)

Update the current entity using new data This new data is typically provided from the server through the ‘update<Entity>’ socket Alternatively, the update may originate locally, in which case it can be pushed back to the server

Arguments:
  • data (Object) – The data with which to update the entity
Returns:

Promise – A Promise which resolves to the updated Entity

User.Entity.delete()

Delete the entity, removing it from its collection and deleting its data record

Returns:Promise – A Promise which resolves to the ID of the deleted Entity once handled by the server
User.active

type: Boolean

Return a flag for whether this User is currently active

User.character

type: Actor

Return the Actor instance of the user’s impersonated character (or undefined)

User.collection

type: Users

User instances belong to the Users collection

User.isGM

A flag for whether the current User has Assistant GameMaster or full GameMaster permission

User.isSelf

A flag for whether this User is the connected client

User.isTrusted

A flag for whether the current User is a Trusted Player

User.permission

type: Number

A convenience shortcut for the permission level of the current User