The TokenDocument that this Token represents
Internal
_preventPrevent keyboard movement of this Token?
The attribute bars of this Token.
A Graphics instance which renders the border frame for this Token inside the GridLayer.
A control icon for interacting with the object
Defines the filter to use for detection.
Renders the mesh of with the detection filter.
A reference to the Scene embedded Document instance which this object represents
The effects icons of temporary ActiveEffects that are applied to the Actor of this Token.
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.
A reference to the SpriteMesh which displays this Token in the PrimaryCanvasGroup.
A mouse interaction manager instance which handles mouse workflows related to this object.
The nameplate of this Token, which displays its name.
Status flags which are applied at render-time to update the PlaceableObject. If an object defines RenderFlags, it should at least include flags for "redraw" and "refresh".
The ruler of this Token.
Retain a reference to the Scene within which this Placeable Object resides
The shape of this token.
The target arrows marker, which indicates that this Token is targeted by this User.
Track the set of User documents which are currently targeting this Token
The target pips marker, which indicates that this Token is targeted by other User(s).
The texture of this Token, which is used by its mesh.
The tooltip text of this Token, which contains its elevation.
The Turn Marker of this Token. Only a subset of Token objects have a turn marker at any given time.
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.
Renders the mesh of this Token with ERASE blending in the Token.
Protected
_plannedThe ruler data.
Static
embeddedIdentify the official Document name for this PlaceableObject class
Static
RENDER_The ticker priority when RenderFlags of this class are handled. Valid values are OBJECTS or PERCEPTION.
Static
RENDER_The object that this object is a preview of if this object is a preview.
The current animations of this Token.
The general animation name used for this Token.
Translate the token's bright light distance in units into a radius in pixels.
An indicator for whether the object is currently controlled
Return a reference to the detection modes array.
Translate the token's dim light distance in units into a radius in pixels.
Does this token actively emit darkness given its properties and the current darkness level of the Scene?
Does this token actively emit light given its properties and the current darkness level of the Scene?
The external radius of the token in pixels.
Translate the token's grid height into a pixel height based on the canvas size
Is the HUD display active for this Placeable?
A convenience boolean to test whether the Token is using a dynamic ring.
Test whether the Token uses a limited angle of vision or light emission.
Does there exist a temporary preview of this placeable object?
Test whether the Token has sight (or blindness) at any radius
An indicator for whether the object is currently a hover target
The id of the corresponding Document which this PlaceableObject represents.
An indicator for whether or not this token is currently involved in the active combat encounter.
The mouse interaction state of this placeable.
Is this Token currently being dragged?
A convenient reference for whether the current User has full control over the document.
Is this placeable object a temporary preview?
An indicator for whether the Token is currently targeted by the active game User
Does this Tile depict an animated video texture?
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.
Provide a reference to the CanvasLayer which contains this PlaceableObject.
The range of this token's light perception in pixels.
The animation name used to animate this Token's movement.
The promise of the current movement animation chain of this Token or null if there isn't a movement animation in progress.
Convenience access to the token's nameplate string
A unique identifier which is used to uniquely identify elements on the canvas related to this object.
A boolean flag for whether the current game User has observer permission for the Token
Translate the token's maximum vision range that takes into account lights.
The maximum radius in pixels of the light field
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 document sheet used to configure the properties of this Placeable Object or the Document it represents.
Should the ruler of this Token be visible?
Translate the token's vision range in units into a radius in pixels.
The HTML source element for the primary Tile texture
Translate the token's grid width into a pixel width based on the canvas size
Static
implementationReturn a reference to the configured subclass of this base PlaceableObject type.
Internal
Add/Modify a filter effect on this token.
The status effect ID being applied, from CONFIG.specialStatusEffects
Is the special status effect now active?
The inner _destroy method which may optionally be defined by each PlaceableObject subclass.
Options passed to the initial destroy call
Finalize the left-drag operation.
The triggering mouse click event
Internal
Get the position for movement via the Token Config.
Internal
Get the drag waypoint position.
Optional
options: { snap?: boolean } = {}Internal
Get the position for movement via the Token HUD.
Internal
Obtain a shifted waypoint for the Token. The returned waypoint must move the Token to a snapped position.
The number of grid units to shift along the X-axis
The number of grid units to shift along the Y-axis
The number of grid units to shift along the Z-axis
The shifted target waypoint (snapped if square/hexagonal grid)
Initialize the left-drag operation.
The triggering canvas interaction event
Callback actions which occur on a single left-click event to assume control of the object
The triggering canvas interaction event
Register pending canvas operations which should occur after a new PlaceableObject of this type is created
Define additional steps taken when an existing placeable object of this type is deleted
Callback actions which occur on a mouse-move operation.
The triggering mouse click event
If false, the cancellation is prevented
Callback actions which occur on a mouse-move operation.
The triggering canvas interaction event
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
Actions that should be taken for this Placeable Object when a mouseout event occurs
The triggering canvas interaction event
Additional events which trigger once control of the object is released
Options which modify the releasing workflow
Define additional steps taken when an existing placeable object of this type is updated with new data
Internal
Execute a partial draw.
The draw function
The drawn object
Internal
Remove all filter effects on this placeable.
Internal
Update the quadtree.
Internal
Update the filter effects depending on special status effects TODO: replace this method by something more convenient.
Activate interactivity for the Placeable Object
Animate from the old to the new state of this Token.
The animation data to animate to
Optional
options: TokenAnimationOptions = {}The options that configure the animation behavior
A promise which resolves once the animation has finished or stopped
Check for collision when attempting a move to a new position.
The result of this function must not be affected by the animation of this Token.
The central destination point of the attempted movement. The elevation defaults to the elevation of the origin.
Optional
options: {Additional options forwarded to PointSourcePolygon.testCollision
Optional
mode?: "any" | "closest" | "all"The collision mode to test: "any", "all", or "closest"
Optional
origin?: Point | ElevatedPointThe origin to be used instead of the current origin. The elevation defaults to the current elevation.
Optional
type?: PointSourcePolygonTypeThe collision type
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
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
Constrain the given movement path.
The result of this function must not be affected by the animation of this Token.
The waypoints of movement
Optional
options: TokenConstrainMovementPathOptions = {}Additional options
The (constrained) path of movement and a boolean that is true if and only if the path was constrained. If it wasn't constrained, then a copy of the path of all given waypoints with all default values filled in is returned.
Assume control over a PlaceableObject, flagging it as controlled and enabling downstream behaviors
Optional
options: { releaseOthers?: boolean } = {}Additional options which modify the control request
Optional
releaseOthers?: booleanRelease any other controlled objects first
A flag denoting whether control was successful
This function adds intermediate waypoints pre/post enter and exit for a Region if the Region has at least one Behavior that could affect the movement, which is determined by foundry.data.regionBehaviors.RegionBehaviorType#_getTerrainEffects. For each segment of the movement path the terrain data is created from all behaviors that could affect the movement of this Token with CONFIG.Token.movement.TerrainData.resolveTerrainEffects. This terrain data is included in the returned regionalized movement path. This terrain data may then be used in Token#_getMovementCostFunction and Token#constrainMovementPath.
The waypoints of movement
Optional
options: { preview?: boolean } = {}Additional options
Optional
preview?: booleanIs preview?
The movement path with terrain data
Draw the placeable object into its parent container
Optional
options: object = {}Options which may modify the draw and refresh workflow
The drawn object
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 effect icons for ActiveEffect documents which apply to the Token's Actor.
Find a movement path through the waypoints. The path may not necessarily be one with the least cost. The path returned may be partial, i.e. it doesn't go through all waypoints, but must always start with the first waypoints unless the waypoints are empty, in which case an empty path is returned.
The result of this function must not be affected by the animation of this Token.
The waypoints of movement
Optional
options: TokenFindMovementPathOptionsAdditional options
The job of the movement pathfinder
Get the Color used to represent the disposition of this Token.
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
The Token's central position, adjusted in each direction by one or zero pixels to offset it relative to walls.
The center point with elevation.
Optional
options: { offsetX?: number; offsetY?: number }Optional
offsetX?: numberThe x-offset.
Optional
offsetY?: numberThe y-offset.
The adjusted center point.
Override ring colors for this particular Token instance.
Apply additional ring effects for this particular Token instance. Effects are returned as an array of integers in foundry.canvas.placeables.tokens.TokenRing.effects.
Get the shape of this Token.
Update an emitted light source associated with this Token.
Optional
options: { deleted?: boolean } = {}Optional
deleted?: booleanIndicate that this light source has been deleted.
Update the light and vision source objects associated with this Token.
Optional
options: { deleted?: boolean } = {}Options which configure how perception sources are updated
Optional
deleted?: booleanIndicate that this light and vision source has been deleted
Update the VisionSource instance associated with this Token.
Optional
options: { deleted?: boolean } = {}Options which affect how the vision source is updated
Optional
deleted?: booleanIndicate that this vision source has been deleted.
Measure the movement path for this Token.
The waypoints of movement
Optional
options: TokenMeasureMovementPathOptionsAdditional options that affect cost calculations (passed to Token#_getMovementCostFunction)
Recalculate the planned movement path of this Token for the current User.
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
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
Set this Token as an active target for the current game User.
Is the Token now targeted?
Optional
options: { releaseOthers?: boolean } = {}Additional option which modify how targets are acquired
Optional
releaseOthers?: booleanRelease other active targets?
Terminate the animations of this particular Token, if exists.
Optional
options: { reset?: boolean } = {}Additional options.
Optional
reset?: booleanReset the TokenDocument?
Protected
_addProtected
Add ruler waypoints and update ruler paths.
The (unsnapped) center point of the waypoint
Optional
options: { snap?: boolean } = {}Additional options
Optional
snap?: booleanSnap the added waypoint?
Protected
_canProtected
Does the User have permission to create the underlying Document?
The User performing the action. Always equal to game.user
.
Optional
event: FederatedEvent<UIEvent | PixiTouch>The pointer event if this function was called by foundry.canvas.interaction.MouseInteractionManager.
Protected
_canProtected
Does the User have permission to delete the underlying Document?
The User performing the action. Always equal to game.user
.
Optional
event: FederatedEvent<UIEvent | PixiTouch>The pointer event if this function was called by foundry.canvas.interaction.MouseInteractionManager.
Protected
_canProtected
_canProtected
Does the User have permission to update the underlying Document?
The User performing the action. Always equal to game.user
.
Optional
event: FederatedEvent<UIEvent | PixiTouch>The pointer event if this function was called by foundry.canvas.interaction.MouseInteractionManager.
Protected
_canProtected
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?
Protected
_changeProtected
Change the elevation of the dragged Tokens.
The number vertical steps
Optional
options: { precise?: boolean } = {}Additional options
Optional
precise?: booleanRound elevations to multiples of the grid distance divided by
CONFIG.Canvas.elevationSnappingPrecision
?
If false, rounds to multiples of the grid distance.
Protected
_createProtected
Create a standard MouseInteractionManager for the PlaceableObject
Protected
_drawProtected
Draw a single resource bar, given provided data
The Bar number
The Bar container
Resource data for this bar
Protected
_drawProtected
Draw a status effect icon
Protected
_drawProtected
Draw the effect icons for ActiveEffect documents which apply to the Token's Actor. Called by Token#drawEffects.
Protected
_drawProtected
Draw the overlay effect icon
Protected
_drawProtected
Draw the targeting arrows around this token.
Optional
reticule: ReticuleOptions = {}Additional parameters to configure how the targeting reticule is drawn.
Protected
_drawProtected
Draw the targeting pips around this token.
Protected
_finalizeProtected
Finalize the right-drag operation.
The triggering mouse click event
Protected
_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
The options that configure the animation behavior
The duration of the animation in milliseconds
Protected
_getProtected
Get the base movement speed for the animation in grid size per second.
The default implementation returns CONFIG.Token.movement.defaultSpeed
.
The options that configure the animation behavior
The base movement speed in grid size per second
Protected
_getProtected
Get the rotation speed for the animation in 60 degrees per second. Returns the movement speed by default.
The options that configure the animation behavior
The rotation speed in 60 degrees per second
Protected
_getProtected
Get the texture transition type.
Returns "fade"
by default.
The options that configure the animation behavior
The transition type
Protected
_getProtected
Get the hex color that should be used to render the Token border
The hex color used to depict the border color
Protected
_getProtected
Get the constrain options used during the drag operation.
The constrain options
Protected
_getProtected
Get the movement action for the waypoints placed during a drag operation.
The movement action
Protected
_getProtected
Get the search options used during the drag operation to find the path of movement through the waypoints.
The search options
Protected
_getHUDMovementProtected
Get the movement action in CONFIG.Token.movement.actions to be used for movement
via the Token HUD.
The default implementation returns this.document.movementAction
.
Protected
_getProtected
Get the movement action in CONFIG.Token.movement.actions to be used for keyboard
movement.
The default implementation returns this.document.movementAction
.
Protected
_getProtected
_getProtected
Create the movement cost function for this Token.
In square and hexagonal grids it calculates the cost for single grid space move between two grid space offsets.
For tokens that occupy more than one grid space the cost of movement is calculated as the median of all individual
grid space moves unless the cost of any of these is infinite, in which case total cost is always infinite.
In gridless grids the from
and to
parameters of the cost function are top-left offsets.
If the movement cost function is undefined, the cost equals the distance moved.
Optional
options: TokenMeasureMovementPathOptionsAdditional options that affect cost calculations
Protected
_getProtected
Get the target opacity that should be used for a Placeable Object depending on its preview state.
Protected
_getProtected
Get the text style that should be used for this Token's tooltip.
Protected
_getProtected
Return the text which should be displayed in a token's tooltip field
Protected
_getProtected
Returns a record of blinding state.
Protected
_getProtected
_initializeProtected
Initialize the right-drag operation.
The triggering canvas interaction event
Protected
_initializeProtected
Create the BaseTokenRuler instance for this Token, if any. This function is called when the Token is drawn for the first time.
Protected
_isProtected
Does this Token actively emit light given its properties and the current darkness level of the Scene?
Protected
_isProtected
Test whether this Token is a viable vision source for the current User.
Protected
_modifyProtected
Modify the base movement speed of the animation. Divides by the terrain difficulty, if present, by default.
The base movement speed in grid size per second
The options that configure the animation behavior
The modified movement speed in grid size per second
Protected
_onProtected
Called each animation frame.
The animation data that changed
The animation context
Protected
_onProtected
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
_onProtected
Callback actions which occur on a single right-click event to configure properties of the object
The triggering canvas interaction event
Protected
_onProtected
Additional events that trigger once control of the Token is established
Optional parameters which apply for specific implementations
Optional
pan?: anyPan to the controlled Token
Optional
releaseOthers?: booleanRelease control of all other Tokens
Protected
_onProtected
Called by foundry.canvas.layers.TokenLayer#_onClickLeft while this Token is in a drag workflow.
The pointerdown event
Protected
_onProtected
Called by foundry.canvas.layers.TokenLayer#_onClickLeft2 while this Token is in a drag workflow.
The pointerdown event
Protected
_onProtected
Called by foundry.canvas.layers.TokenLayer#_onClickRight while this Token is in a drag workflow.
The pointerdown event
Protected
_onProtected
Called by foundry.canvas.layers.TokenLayer#_onClickRight2 while this Token is in a drag workflow.
The pointerdown event
Protected
_onProtected
Callback actions which occur when a mouse-drag action is first begun.
The triggering canvas interaction event
If false, the start if prevented
Protected
_onProtected
Change the elevation of Token during dragging.
The mousewheel event
Protected
_onProtected
Callback actions which occur on a right mouse-drag operation.
The triggering mouse click event
If false, the cancellation is prevented
Protected
_onProtected
Callback actions which occur on a right mouse-drag operation.
The triggering canvas interaction event
Protected
_onProtected
Callback actions which occur on a right mouse-drag operation.
The triggering canvas interaction event
Protected
_onProtected
Callback actions which occur on a right mouse-drag operation.
The triggering mouse click event
If false, the start if prevented
Protected
_onProtected
Begin a drag operation from the perspective of the preview clone. Modify the appearance of both the clone (this) and the original (_original) object.
Protected
_onProtected
Callback action which occurs on a long press.
The triggering canvas interaction event
The local canvas coordinates of the mousepress.
Protected
_onProtected
Callback actions which occur on a single left-unclick event to assume control of the object
The triggering canvas interaction event
Protected
_onProtected
Callback actions which occur on a single right-unclick event
The triggering canvas interaction event
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
The options that configure the animation behavior
The animation attributes
Protected
_propagateProtected
Should the placeable propagate right click downstream?
Protected
_refreshProtected
Refresh the border.
Protected
_refreshProtected
Refresh the display of status effects, adjusting their position for the token width and height.
Protected
_refreshProtected
Refresh the elevation
Protected
_refreshProtected
Refresh the token mesh.
Protected
_refreshProtected
Resize mesh and handle scale adjustment.
Protected
_refreshProtected
Refresh the text content, position, and visibility of the Token nameplate.
Protected
_refreshProtected
Refresh the position.
Protected
_refreshProtected
Refresh the token ring visuals if necessary.
Protected
_refreshProtected
Refresh the rotation.
Protected
_refreshProtected
Refresh the display of the ruler.
Protected
_refreshProtected
Refresh the token mesh shader.
Protected
_refreshProtected
Refresh the shape.
Protected
_refreshProtected
Refresh the size.
Protected
_refreshProtected
Refresh aspects of the user interaction state. For example the border, nameplate, or bars may be shown on Hover or on Control.
Protected
_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.
Protected
_refreshProtected
Refresh the tooltip.
Protected
_refreshProtected
Refresh presentation of the Token's combat turn marker, if any.
Protected
_refreshProtected
Refresh the visibility.
Protected
_removeProtected
Remove last ruler waypoints and update ruler paths.
Protected
_renderProtected
Render the bound mesh detection filter. Note: this method does not verify that the detection filter exists.
Protected
_requiresProtected
Does this Token require rotation changes to be animated? If false is returned, the rotation speed is set to infinity.
Protected
_shouldProtected
Prevent the drop event? Called by Token#_onDragLeftDrop.
The pointerup event
Protected
_triggerProtected
Cancel the drag workflow. This cancellation cannot be prevented by Token#_onDragLeftCancel.
Protected
_triggerProtected
Trigger drop event. This drop cannot be prevented by Token#_shouldPreventDragLeftDrop.
Protected
_updateProtected
Update the destinations of the drag previews and rulers
The (unsnapped) center point of the waypoint
Optional
options: { snap?: boolean } = {}Additional options
Optional
snap?: booleanSnap the destination?
Protected
#onProtected
Callback actions which occur on a right mouse-drag operation.
The triggering mouse click event
If false, the start if prevented
Static
_configureInternal
Configure the animation movement speed based on the given animation duration.
The update operation
The origin
The candidante waypoints
Static
_getInternal
Get the origin used for pasting the copied objects.
The objects that are copied
The offset
Static
_getInternal
Get the drop position for the given token.
Optional
options: { snap?: boolean } = {}Static
_getInternal
Obtain the shifted position.
The number of grid units to shift along the X-axis
The number of grid units to shift along the Y-axis
The number of grid units to shift along the Z-axis
The unsnapped position
The snapped position
The grid
The shifted target coordinates
A Token is an implementation of PlaceableObject which represents an foundry.documents.Actor within a viewed Scene on the game canvas.
See