TokenLayer

TokenLayer

The Tokens Container

Constructor

new TokenLayer()

Members

(static) layerOptions

_lastWildcard :string

Remember the last drawn wildcard token image to avoid repetitions

Type:
  • string

documentName

gridPrecision

hud

Token objects on this layer utilize the TokenHUD

ownedTokens :Array.<Token>

An Array of tokens which belong to actors which are owned

Type:

Methods

_onClickLeft()

activate()

concludeAnimation()

Immediately conclude the animation of any/all tokens

cycleTokens(forwards, reset) → {Token|null}

Cycle the controlled token by rotating through the list of Owned Tokens that are available within the Scene Tokens are currently sorted in order of their TokenID

Parameters:
Name Type Description
forwards boolean

Which direction to cycle. A truthy value cycles forward, while a false value cycles backwards.

reset boolean

Restart the cycle order back at the beginning?

Returns:

The Token object which was cycled to, or null

Type
Token | null

deactivate()

selectObjects()

targetObjects(x, y, width, height, releaseOthers) → {number}

Target all Token instances which fall within a coordinate rectangle.

Parameters:
Name Type Description
x number

The top-left x-coordinate of the selection rectangle

y number

The top-left y-coordinate of the selection rectangle

width number

The width of the selection rectangle

height number

The height of the selection rectangle

releaseOthers boolean

Whether or not to release other targeted tokens

Returns:

The number of Token instances which were targeted.

Type
number

(async) tearDown()

(async) toggleCombat(state, combat, tokenopt) → {Promise.<Array.<Combatant>>}

Add or remove the set of currently controlled Tokens from the active combat encounter

Parameters:
Name Type Attributes Default Description
state boolean true

The desired combat state which determines if each Token is added (true) or removed (false)

combat Combat | null null

A Combat encounter from which to add or remove the Token

token Token | null <optional>

A specific Token which is the origin of the group toggle request

Returns:

The Combatants added or removed

Type
Promise.<Array.<Combatant>>