Users

Each connected client corresponds to a User() instance.



The Users Collection

class Users()

The collection of User entities

Users.object

Elements of the Users collection are instances of the User class


The User Instance

class User()

The User entity

User.Entity.hasPerm(user, permission)

Test whether a provided User has ownership permission over the Entity instance

Arguments:
  • user (User) – The user to test for permission
  • permission (Number) – The permission level to test
Returns:

Boolean – Whether or not the user has the permission for this 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