Skip to content

@vttforge/types / ActorLike

Interface: ActorLike<System, Item> ​

An Actor, as a sheet holds one and a drop hands one over.

Item is what actor.items holds. It defaults to the shared item surface; name your own item type to read its schema off a collection entry.

Extends ​

Type Parameters ​

System ​

System = Record<string, unknown>

Item ​

Item extends ItemLike<unknown> = ItemLike

Properties ​

documentName ​

readonly documentName: string

'Actor', 'Item', 'ActiveEffect', and so on.

Inherited from ​

DocumentMembers.documentName


effects ​

readonly effects: EmbeddedCollection<ActiveEffectLike<Record<string, unknown>>>


flags ​

readonly flags: DocumentFlags

Inherited from ​

DocumentMembers.flags


id ​

readonly id: string | null

Inherited from ​

DocumentMembers.id


img ​

readonly img: string | null

Inherited from ​

DocumentMembers.img


isOwner ​

readonly isOwner: boolean

Whether the current user owns this document.

Inherited from ​

DocumentMembers.isOwner


items ​

readonly items: EmbeddedCollection<Item>


name ​

readonly name: string

Inherited from ​

DocumentMembers.name


parent ​

readonly parent: DocumentMembers<Record<string, unknown>> | null

The document this one is embedded in, or null at the top level.

Inherited from ​

DocumentMembers.parent


system ​

readonly system: System

The type data model instance. Its fields are the schema's fields.

Inherited from ​

DocumentMembers.system


type ​

readonly type: string

The subtype, as declared under documentTypes in the manifest.

Inherited from ​

DocumentMembers.type


uuid ​

readonly uuid: string

Inherited from ​

DocumentMembers.uuid

Methods ​

allApplicableEffects() ​

allApplicableEffects(): Iterable<ActiveEffectLike<Record<string, unknown>>>

Every effect that may apply, including the transferred ones on owned Items. Nothing is copied onto the Actor in v14; they apply in place.

Returns ​

Iterable<ActiveEffectLike<Record<string, unknown>>>


createEmbeddedDocuments() ​

createEmbeddedDocuments(name, data, operation?): Promise<unknown[]>

Parameters ​

name ​

string

data ​

readonly Record<string, unknown>[]

operation? ​

Record<string, unknown>

Returns ​

Promise<unknown[]>

Inherited from ​

EmbeddedDocumentOwner.createEmbeddedDocuments


delete() ​

delete(operation?): Promise<ActorLike<System, Item> | undefined>

Parameters ​

operation? ​

Record<string, unknown>

Returns ​

Promise<ActorLike<System, Item> | undefined>

Inherited from ​

DocumentMembers.delete


deleteEmbeddedDocuments() ​

deleteEmbeddedDocuments(name, ids, operation?): Promise<unknown[]>

Parameters ​

name ​

string

ids ​

readonly string[]

operation? ​

Record<string, unknown>

Returns ​

Promise<unknown[]>

Inherited from ​

EmbeddedDocumentOwner.deleteEmbeddedDocuments


getEmbeddedDocument() ​

getEmbeddedDocument(name, id): unknown

Parameters ​

name ​

string

id ​

string

Returns ​

unknown

Inherited from ​

EmbeddedDocumentOwner.getEmbeddedDocument


getFlag() ​

getFlag<T>(scope, key): T | undefined

Type Parameters ​

T ​

T = unknown

Parameters ​

scope ​

string

key ​

string

Returns ​

T | undefined

Inherited from ​

DocumentMembers.getFlag


getRollData() ​

getRollData(): Record<string, unknown>

Roll data for @-references in a formula.

Returns ​

Record<string, unknown>


setFlag() ​

setFlag(scope, key, value): Promise<ActorLike<System, Item>>

Parameters ​

scope ​

string

key ​

string

value ​

unknown

Returns ​

Promise<ActorLike<System, Item>>

Inherited from ​

DocumentMembers.setFlag


testUserPermission() ​

testUserPermission(user, permission, options?): boolean

Whether a user has at least this level of access to the document.

isOwner answers the same question for the current user and the highest level. This answers it for any user and any level, which is what a package asks before it shows someone another person's document.

ts
if (item.testUserPermission(game.user, 'LIMITED')) render(link);

Parameters ​

user ​

unknown

permission ​

number | "NONE" | "LIMITED" | "OBSERVER" | "OWNER"

options? ​
exact? ​

boolean

Returns ​

boolean

Inherited from ​

DocumentMembers.testUserPermission


toObject() ​

toObject(source?): Record<string, unknown>

A plain-object copy. source reads the stored data instead of the prepared data.

Parameters ​

source? ​

boolean

Returns ​

Record<string, unknown>

Inherited from ​

DocumentMembers.toObject


unsetFlag() ​

unsetFlag(scope, key): Promise<ActorLike<System, Item>>

Parameters ​

scope ​

string

key ​

string

Returns ​

Promise<ActorLike<System, Item>>

Inherited from ​

DocumentMembers.unsetFlag


update() ​

update(data, operation?): Promise<ActorLike<System, Item> | undefined>

Parameters ​

data ​

Record<string, unknown>

operation? ​

Record<string, unknown>

Returns ​

Promise<ActorLike<System, Item> | undefined>

Inherited from ​

DocumentMembers.update


updateEmbeddedDocuments() ​

updateEmbeddedDocuments(name, updates, operation?): Promise<unknown[]>

Parameters ​

name ​

string

updates ​

readonly Record<string, unknown>[]

operation? ​

Record<string, unknown>

Returns ​

Promise<unknown[]>

Inherited from ​

EmbeddedDocumentOwner.updateEmbeddedDocuments

MIT licensed.