A Graphics instance which renders the border frame for this Token inside the GridLayer.
Track the set of User documents which are currently targeting this Token
A reference to the SpriteMesh which displays this Token in the PrimaryCanvasGroup.
A reference to the VisionSource object which defines this vision source area of effect
A reference to the LightSource object which defines this light source area of effect
A reference to an animation that is currently in progress for this Token, if any
Retain a reference to the Scene within which this Placeable Object resides
A reference to the Scene embedded Document instance which this object represents
A control icon for interacting with the object
A mouse interaction manager instance which handles mouse workflows related to this object.
Know if a placeable is in the hover-in state.
Passthrough certain drag operations on locked objects.
An Object which records the Token's prior velocity dx and dy. This can be used to determine which direction a Token was previously moving.
The Token central coordinate, adjusted for its most recent movement vector.
The Token's most recent valid position and rotation.
A flag to capture whether this Token has an unlinked video texture
A point-in-time snapshot of the display attributes for the Token which provides a baseline for animation.
Identify the official Document name for this PlaceableObject class
A convenient reference to the Actor object associated with the Token embedded document.
A convenient reference for whether the current User has full control over the Token document.
A boolean flag for whether the current game User has observer permission for the Token
Is the HUD display active for this token?
Convenience access to the token's nameplate string
Defines the filter to use for detection.
Translate the token's grid width into a pixel width based on the canvas size
Translate the token's grid height into a pixel height based on the canvas size
The Token's current central position
The HTML source element for the primary Tile texture
Does this Tile depict an animated video texture?
An indicator for whether or not this token is currently involved in the active combat encounter.
Return a reference to a Combatant that represents this Token, if one is present in the current encounter.
An indicator for whether the Token is currently targeted by the active game User
Return a reference to the detection modes array.
Determine whether the Token is visible to the calling user's perspective. Hidden Tokens are only displayed to GM Users. Non-hidden Tokens are always visible if Token Vision is not required. Controlled tokens are always visible. All Tokens are visible to a GM user if no Token is controlled.
The animation name used for Token movement
Test whether the Token has sight (or blindness) at any radius
Does this Token actively emit light given its properties and the current darkness level of the Scene?
Test whether the Token uses a limited angle of vision or light emission.
Translate the token's dim light distance in units into a radius in pixels.
Translate the token's bright light distance in units into a radius in pixels.
Translate the token's vision range in units into a radius in pixels.
Translate the token's maximum vision range that takes into account lights.
The mouse interaction state of this placeable.
The id of the corresponding Document which this PlaceableObject represents.
A unique identifier which is used to uniquely identify elements on the canvas related to this object.
Is this placeable object a temporary preview?
The field-of-vision polygon for the object, if it has been computed
Provide a reference to the CanvasLayer which contains this PlaceableObject.
The line-of-sight polygon for the object, if it has been computed
A Form Application which is used to configure the properties of this Placeable Object or the Document it represents.
An indicator for whether the object is currently controlled
An indicator for whether the object is currently a hover target
An indicator for whether the object is currently a hover target
The Token's central position, adjusted in each direction by one or zero pixels to offset it relative to walls.
Clone the placeable object, returning a new object with identical attributes. The returned object is non-interactive, and has no assigned ID. If you plan to use it permanently you should call the create method.
A new object with identical data
Update the light and vision source objects associated with this Token.
Options which configure how perception sources are updated
Update an emitted light source associated with this Token.
Update the VisionSource instance associated with this Token.
Options which affect how the vision source is updated
The inner _destroy method which may optionally be defined by each PlaceableObject subclass.
Refresh display of elements of the Token HUD.
Which components of the HUD to refresh?
Refresh the display of Token attribute bars, rendering its latest resource data If the bar attribute is valid (has a value and max), draw the bar. Otherwise hide it.
Draw the token's nameplate as a text object
The Text object for the Token nameplate
Draw the active effects and overlay effect icons which are present upon the Token
Get the display attributes of the TokenDocument which are used to inform refresh.
Animate changes to the appearance of the Token. Animations are performed over differences between the TokenDocument and the current Token and TokenMesh appearance.
A record of the differential data which changed, for reference only
Options which configure the animation behavior
A promise which resolves once the animation is complete
Terminate animation of this particular Token.
Check for collision when attempting a move to a new position
The central destination point of the attempted movement
Additional options forwarded to WallsLayer#checkCollision
The result of the WallsLayer#checkCollision test
Get the center-point coordinate for a given grid position
The grid x-coordinate that represents the top-left of the Token
The grid y-coordinate that represents the top-left of the Token
The coordinate pair which represents the Token's center at position (x, y)
Update the tracked position and movement velocity of the Token
Options provided as part of a Token update
Set this Token as an active target for the current game User. Note: If the context is set with groupSelection:true, you need to manually broadcast the activity for other users.
Is the Token now targeted?
Additional context options
Toggle an active effect by its texture path. Copy the existing Array in order to ensure the update method detects the data as changed.
The texture file-path of the effect icon to toggle on the Token.
Additional optional arguments which configure how the effect is handled.
Was the texture applied (true) or removed (false)
Toggle the visibility state of any Tokens in the currently selected set
A Promise which resolves to the updated Token documents
A generic transformation to turn a certain number of grid units into a radius in canvas pixels. This function adds additional padding to the light radius equal to half the token width. This causes light to be measured from the outer token edge, rather than from the center-point.
The radius in grid units
The radius in canvas units
Handle changes to Token behavior when a significant status effect is applied
The status effect ID being applied, from CONFIG.specialStatusEffects
Is the special status effect now active?
Additional events which trigger once control of the object is established
Optional parameters which apply for specific implementations
Additional events which trigger once control of the object is released
Options which modify the releasing workflow
Callback actions which occur on a mouse-move operation.
The triggering mouse click event
Begin a drag operation from the perspective of the preview clone. Modify the appearance of both the clone (this) and the original (_original) object.
Conclude a drag operation from the perspective of the preview clone. Modify the appearance of both the clone (this) and the original (_original) object.
Test whether a user can perform a certain interaction regarding a Placeable Object
The User performing the action
The named action being attempted
Does the User have rights to perform the action?
Draw the placeable object into its parent container
The drawn object
Refresh the current display state of the Placeable Object
The refreshed object
Assume control over a PlaceableObject, flagging it as controlled and enabling downstream behaviors
Additional options which modify the control request
Release any other controlled objects first
A flag denoting whether control was successful
Release control over a PlaceableObject, removing it from the controlled set
Options which modify the releasing workflow
A Boolean flag confirming the object was released.
Rotate the PlaceableObject to a certain angle of facing
The desired angle of rotation
Snap the angle of rotation to a certain target degree increment
The rotated object
Determine a new angle of rotation for a PlaceableObject either from an explicit angle or from a delta offset.
An object which defines the rotation update parameters
The new rotation angle for the object
Activate interactivity for the Placeable Object
Callback actions which occur on a single right-click event to configure properties of the object
The triggering canvas interaction event
Callback actions which occur when a mouse-drag action is first begun.
The triggering canvas interaction event
Draw the Token border, taking into consideration the grid type and border color
Refresh the target indicators for the Token. Draw both target arrows for the primary User as well as indicator pips for other Users targeting the same Token.
Draw the targeting arrows around this token.
Additional parameters to configure how the targeting reticule is drawn.
Draw a single resource bar, given provided data
The Bar number
The Bar container
Resource data for this bar
Refresh the display of status effects, adjusting their position for the token width and height.
Draw a status effect icon
Draw the overlay effect icon
Does the User have permission to create the underlying Document?
The User performing the action.
The event object.
The returned status.
Does the User have permission to update the underlying Document?
The User performing the action.
The event object.
The returned status.
Does the User have permission to delete the underlying Document?
The User performing the action.
The event object.
The returned status.
Create a standard MouseInteractionManager for the PlaceableObject
Callback action which occurs on a long press.
The triggering canvas interaction event
The local canvas coordinates of the mousepress.
Establish an initial velocity of the token based on its direction of facing. Assume the Token made some prior movement towards the direction that it is currently facing.
Test whether this Token is a viable vision source for the current User
Apply initial sanitizations to the provided input data to ensure that a Token has valid required attributes. Constrain the Token position to remain within the Canvas rectangle.
Draw resource bars for the Token
Get the hex color that should be used to render the Token border
The hex color used to depict the border color
Draw a text tooltip for the token which can be used to display Elevation or a resource value
The text object used to render the tooltip
Return the text which should be displayed in a token's tooltip field
Helper method to determine whether a token attribute is viewable under a certain mode
The mode from CONST.TOKEN_DISPLAY_MODES
Is the attribute viewable?
Handle a single frame of a token animation.
The current animation frame
The animation configuration
Prepare a MovementSource for the document
Record that a Token movement has occurred, updating various internal attributes.
The prior token top-left coordinate
The new token top-left coordinate
A helper function to toggle the overlay status icon on the Token
Control updates to the appearance of the Token and its linked TokenMesh when a data update occurs.
A Token is an implementation of PlaceableObject which represents an Actor within a viewed Scene on the game canvas.
{TokenDocument}
{TokenLayer}