The shape of this token.
Defines the filter to use for detection.
A Graphics instance which renders the border frame for this Token inside the GridLayer.
The effects icons of temporary ActiveEffects that are applied to the Actor of this Token.
The attribute bars of this Token.
The tooltip text of this Token, which contains its elevation.
The target marker, which indicates that this Token is targeted by this User or others.
The nameplate of this Token, which displays its name.
Track the set of User documents which are currently targeting this Token
A reference to the SpriteMesh which displays this Token in the PrimaryCanvasGroup.
Renders the mesh of this Token with ERASE blending in the Token.
Renders the mesh of with the detection filter.
The texture of this Token, which is used by its mesh.
A reference to the VisionSource object which defines this vision source area of effect. This is undefined if the Token does not provide an active source of vision.
A reference to the LightSource object which defines this light source area of effect. This is undefined if the Token does not provide an active source of light.
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.
Private
#priorAn Object which records the Token's prior velocity dx and dy. This can be used to determine which direction a Token was previously moving.
Private
#adjustedThe Token central coordinate, adjusted for its most recent movement vector.
Private
#validThe Token's most recent valid position and rotation.
Private
#unlinkedA flag to capture whether this Token has an unlinked video texture.
Private
#animationThe current animation data of this Token.
Private
#priorThe prior animation data of this Token.
Private
#filterA map of effects id and their filters applied on this token placeable.
Private
#originalThe object that this object is a preview of if this object is a preview.
Private
#lastThe bounds that the placeable was added to the quadtree with.
Private
#drawingAn internal reference to a Promise in-progress to draw the Placeable Object.
Private
#drawnHas this Placeable Object been drawn and is there no drawing in progress?
Static
embeddedIdentify the official Document name for this PlaceableObject class
Static
RENDER_since v12 Stable 4
Static
Private
#DETECTION_Used in Token#_renderDetectionFilter.
Static
Private
#hexagonalThe cache of hexagonal shapes.
The current animations of this Token.
A TokenRing instance which is used if this Token applies a dynamic ring. This property is null if the Token does not use a dynamic ring.
A convenience boolean to test whether the Token is using a dynamic ring.
A boolean flag for whether the current game User has observer permission for the Token
Convenience access to the token's nameplate string
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.
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 Ambient Light actively emit darkness given its properties and the current darkness level of the Scene?
Does this Ambient Light 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.
The maximum radius in pixels of the light field
The range of this token's light perception 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 external radius of the token in pixels.
The object that this object is a preview of if this object is a preview.
A convenient reference for whether the current User has full control over the document.
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?
Does there exist a temporary preview of this placeable object?
Provide a reference to the CanvasLayer which contains this PlaceableObject.
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
Is the HUD display active for this Placeable?
The Token's central position, adjusted in each direction by one or zero pixels to offset it relative to walls.
Update the light and vision source objects associated with this Token.
Optional
options: { Options which configure how perception sources are updated
Indicate that this light and vision source has been deleted
Draw the effect icons for ActiveEffect documents which apply to the Token's Actor.
Apply additional ring effects for this particular Token instance. Effects are returned as an array of integers in foundry.canvas.tokens.TokenRing.effects.
Animate from the old to the new state of this Token.
The animation data to animate to
Optional
options: { The options that configure the animation behavior. Passed to Token#_getAnimationDuration.
The duration of the animation in milliseconds
A desired token movement speed in grid spaces per second
The desired texture transition type
The easing function of the animation
The name of the animation, or null if nameless. The default is Token#animationName.
A on-tick callback
A promise which resolves once the animation has finished or stopped
Check for collision when attempting a move to a new position
The central destination point of the attempted movement
Optional
options: { Additional options forwarded to PointSourcePolygon.testCollision
The origin to be used instead of the current origin
The collision type
The collision mode to test: "any", "all", or "closest"
The collision result depends on the mode of the test: * any: returns a boolean for whether any collision occurred * all: returns a sorted array of PolygonVertex instances * closest: returns a PolygonVertex instance or null
Test whether the Token is inside the Region. This function determines the state of TokenDocument#regions and RegionDocument#tokens.
Implementations of this function are restricted in the following ways:
If this function is overridden, then Token#segmentizeRegionMovement must be overridden too.
The region.
The (x, y) and/or elevation to use instead of the current values.
Is the Token inside the Region?
Split the Token movement through the waypoints into its segments.
Implementations of this function are restricted in the following ways:
The region.
The waypoints of movement.
Optional
options: { Additional options
Is it teleportation?
The movement split into its segments.
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?
Optional
context: { Additional context options
Assign the token as a target for a specific User
Release other active targets for the same player?
Is this target being set as part of a group selection workflow?
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 the external radius of the token. 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 pixels
Additional events which trigger once control of the object is established
Optional parameters which apply for specific implementations
Actions that should be taken for this Placeable Object when a mouseover event occurs. Hover events on PlaceableObject instances allow event propagation by default.
The triggering canvas interaction event
Options which customize event handling
MouseInteractionManager##handlePointerOver
Draw the placeable object into its parent container
Optional
options: object = {}Options which may modify the draw and refresh workflow
The drawn object
Internal
Execute a partial draw.
The draw function
The drawn object
Refresh all incremental render flags for the PlaceableObject. This method is no longer used by the core software but provided for backwards compatibility.
Optional
options: object = {}Options which may modify the refresh workflow
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
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
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
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?
Protected
_isProtected
_getProtected
_getProtected
_getProtected
_isProtected
_renderProtected
_refreshProtected
_refreshProtected
_refreshProtected
_refreshProtected
_refreshProtected
_refreshProtected
_refreshProtected
_refreshProtected
_refreshProtected
_refreshProtected
_refreshProtected
_refreshProtected
_refreshProtected
_getProtected
_refreshProtected
Refresh the target indicators for the Token. Draw both target arrows for the primary User and indicator pips for other Users targeting the same Token.
Optional
reticule: ReticuleOptionsAdditional parameters to configure how the targeting reticule is drawn.
Protected
_drawProtected
Draw the targeting arrows around this token.
Optional
reticule: ReticuleOptions = {}Additional parameters to configure how the targeting reticule is drawn.
Protected
_drawProtected
_getProtected
_getProtected
_drawProtected
Draw the effect icons for ActiveEffect documents which apply to the Token's Actor. Called by Token#drawEffects.
Protected
_drawProtected
_drawProtected
_refreshProtected
_canProtected
_getProtected
Get the animation data for the current state of the document.
The target animation data object
Protected
_getProtected
Get the duration of the animation.
The animation data to animate from
The animation data to animate to
Optional
options: { The options that configure the animation behavior
A desired token movement speed in grid spaces per second
The duration of the animation in milliseconds
Protected
_onProtected
Called each animation frame.
The animation data that changed
The animation context
Protected
_prepareProtected
Prepare the animation data changes: performs special handling required for animating rotation.
The animation data to animate from
The animation data changes
The animation context
Optional
options: { The options that configure the animation behavior
The desired texture transition type
The animation attributes
Protected
_onProtected
Internal
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?
Protected
_getProtected
_createProtected
Create a standard MouseInteractionManager for the PlaceableObject
Protected
_canProtected
Does the User have permission to create the underlying Document?
The User performing the action.
The event object.
The returned status.
Protected
_canProtected
Does the User have permission to left-click drag this Placeable Object?
The User performing the action.
The event object.
The returned status.
Protected
_canProtected
Does the User have permission to update the underlying Document?
The User performing the action.
The event object.
The returned status.
Protected
_canProtected
Does the User have permission to delete the underlying Document?
The User performing the action.
The event object.
The returned status.
Protected
_onProtected
_propagateProtected
_onProtected
_onProtected
_onProtected
_onProtected
_onProtected
_onProtected
_onProtected
_onProtected
_onProtected
_onPrivate
#initializePrivate
#initializePrivate
#createPrivate
#destroyPrivate
#createPrivate
#destroyPrivate
#cleanPrivate
#drawPrivate
#getPrivate
#drawDraw the token's nameplate as a text object
The Text object for the Token nameplate
Private
#drawDraw 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
Private
#animateHandle a single frame of a token animation.
The animation context
Private
#handleMove the token immediately to the destination if it is teleported.
The animation data to animate to
Private
#handleHandle the transition changes, creating the necessary filter and preparing the textures.
The animation data that changed
The animation context
The options that configure the animation behavior
The array to push animation attributes to
Private
#preparePrivate
#getPrivate
#snapPrivate
#snapPrivate
#recordWhen Token position or rotation changes, record the movement vector. Update cached values for both #validPosition and #priorMovement.
Did the x/y position change?
Did rotation change?
Did the width or height change?
Private
#panPrivate
#commitStatic
Private
#handleHandle the rotation changes for the animation, ensuring the shortest rotation path.
The animation data to animate from
The animation data changes
Static
Private
#updateUpdate the padding for both the source and target tokens to ensure they are square.
The source mesh
The target mesh
Static
Private
#createCreate a texture transition filter with the given options.
The options that configure the filter
The created filter
Static
Private
#getGet the hexagonal shape given the type, width, and height.
Column-based instead of row-based hexagonal grid?
The hexagonal shape (one of CONST.TOKEN_HEXAGONAL_SHAPES)
The width of the Token (positive)
The height of the Token (positive)
The hexagonal shape or null if there is no shape for the given combination of arguments
Static
Private
#createCreate the row-based hexagonal ellipse/trapezoid given the type, width, and height.
The shape type (must be ELLIPSE_1, ELLIPSE_1, TRAPEZOID_1, or TRAPEZOID_2)
The width of the Token (positive)
The height of the Token (positive)
The hexagonal shape or null if there is no shape for the given combination of arguments
Static
Private
#createCreate the row-based hexagonal rectangle given the type, width, and height.
The shape type (must be RECTANGLE_1 or RECTANGLE_2)
The width of the Token (positive)
The height of the Token (positive)
The hexagonal shape or null if there is no shape for the given combination of arguments
A Token is an implementation of PlaceableObject which represents an Actor within a viewed Scene on the game canvas.
See
-