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.
StaticembeddedIdentify the official Document name for this PlaceableObject class
StaticRENDER_The ticker priority when RenderFlags of this class are handled. Valid values are OBJECTS or PERCEPTION.
StaticRENDER_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
StaticimplementationReturn a reference to the configured subclass of this base PlaceableObject type.
InternalAdd/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
InternalGet the position for movement via the Token Config.
InternalGet the drag waypoint position.
Optionaloptions: { snap?: boolean } = {}InternalGet the position for movement via the Token HUD.
InternalObtain 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
InternalExecute a partial draw.
The draw function
The drawn object
InternalRemove all filter effects on this placeable.
InternalUpdate the quadtree.
InternalUpdate 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
Optionaloptions: 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.
Optionaloptions: {Additional options forwarded to PointSourcePolygon.testCollision
Optionalmode?: "any" | "closest" | "all"The collision mode to test: "any", "all", or "closest"
Optionalorigin?: Point | ElevatedPointThe origin to be used instead of the current origin. The elevation defaults to the current elevation.
Optionaltype?: 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
Optionaloptions: 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
Optionaloptions: { releaseOthers?: boolean } = {}Additional options which modify the control request
OptionalreleaseOthers?: 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
Optionaloptions: { preview?: boolean } = {}Additional options
Optionalpreview?: booleanIs preview?
The movement path with terrain data
Draw the placeable object into its parent container
Optionaloptions: 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
Optionaloptions: 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.
Optionaloptions: { offsetX?: number; offsetY?: number }OptionaloffsetX?: numberThe x-offset.
OptionaloffsetY?: 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.
Optionaloptions: { deleted?: boolean } = {}Optionaldeleted?: booleanIndicate that this light source has been deleted.
Update the light and vision source objects associated with this Token.
Optionaloptions: { deleted?: boolean } = {}Options which configure how perception sources are updated
Optionaldeleted?: booleanIndicate that this light and vision source has been deleted
Update the VisionSource instance associated with this Token.
Optionaloptions: { deleted?: boolean } = {}Options which affect how the vision source is updated
Optionaldeleted?: booleanIndicate that this vision source has been deleted.
Measure the movement path for this Token.
The waypoints of movement
Optionaloptions: 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.
Optionaloptions: 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?
Optionaloptions: { releaseOthers?: boolean } = {}Additional option which modify how targets are acquired
OptionalreleaseOthers?: booleanRelease other active targets?
Terminate the animations of this particular Token, if exists.
Optionaloptions: { reset?: boolean } = {}Additional options.
Optionalreset?: booleanReset the TokenDocument?
Protected_addProtectedAdd ruler waypoints and update ruler paths.
The (unsnapped) center point of the waypoint
Optionaloptions: { snap?: boolean } = {}Additional options
Optionalsnap?: booleanSnap the added waypoint?
Protected_canProtectedDoes the User have permission to create the underlying Document?
The User performing the action. Always equal to game.user.
Optionalevent: FederatedEvent<UIEvent | PixiTouch>The pointer event if this function was called by foundry.canvas.interaction.MouseInteractionManager.
Protected_canProtectedDoes the User have permission to delete the underlying Document?
The User performing the action. Always equal to game.user.
Optionalevent: FederatedEvent<UIEvent | PixiTouch>The pointer event if this function was called by foundry.canvas.interaction.MouseInteractionManager.
Protected_canProtected_canProtectedDoes the User have permission to update the underlying Document?
The User performing the action. Always equal to game.user.
Optionalevent: FederatedEvent<UIEvent | PixiTouch>The pointer event if this function was called by foundry.canvas.interaction.MouseInteractionManager.
Protected_canProtectedHelper 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_changeProtectedChange the elevation of the dragged Tokens.
The number vertical steps
Optionaloptions: { precise?: boolean } = {}Additional options
Optionalprecise?: booleanRound elevations to multiples of the grid distance divided by
CONFIG.Canvas.elevationSnappingPrecision?
If false, rounds to multiples of the grid distance.
Protected_createProtectedCreate a standard MouseInteractionManager for the PlaceableObject
Protected_drawProtectedDraw a single resource bar, given provided data
The Bar number
The Bar container
Resource data for this bar
Protected_drawProtectedDraw a status effect icon
Protected_drawProtectedDraw the effect icons for ActiveEffect documents which apply to the Token's Actor. Called by Token#drawEffects.
Protected_drawProtectedDraw the overlay effect icon
Protected_drawProtectedDraw the targeting arrows around this token.
Optionalreticule: ReticuleOptions = {}Additional parameters to configure how the targeting reticule is drawn.
Protected_drawProtectedDraw the targeting pips around this token.
Protected_finalizeProtectedFinalize the right-drag operation.
The triggering mouse click event
Protected_getProtectedGet the animation data for the current state of the document.
The target animation data object
Protected_getProtectedGet 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_getProtectedGet 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_getProtectedGet 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_getProtectedGet the texture transition type.
Returns "fade" by default.
The options that configure the animation behavior
The transition type
Protected_getProtectedGet the hex color that should be used to render the Token border
The hex color used to depict the border color
Protected_getProtectedGet the constrain options used during the drag operation.
The constrain options
Protected_getProtectedGet the movement action for the waypoints placed during a drag operation.
The movement action
Protected_getProtectedGet the search options used during the drag operation to find the path of movement through the waypoints.
The search options
Protected_getHUDMovementProtectedGet 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_getProtectedGet the movement action in CONFIG.Token.movement.actions to be used for keyboard
movement.
The default implementation returns this.document.movementAction.
Protected_getProtected_getProtectedCreate 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.
Optionaloptions: TokenMeasureMovementPathOptionsAdditional options that affect cost calculations
Protected_getProtectedGet the target opacity that should be used for a Placeable Object depending on its preview state.
Protected_getProtectedGet the text style that should be used for this Token's tooltip.
Protected_getProtectedReturn the text which should be displayed in a token's tooltip field
Protected_getProtectedReturns a record of blinding state.
Protected_getProtected_initializeProtectedInitialize the right-drag operation.
The triggering canvas interaction event
Protected_initializeProtectedCreate the BaseTokenRuler instance for this Token, if any. This function is called when the Token is drawn for the first time.
Protected_isProtectedDoes this Token actively emit light given its properties and the current darkness level of the Scene?
Protected_isProtectedTest whether this Token is a viable vision source for the current User.
Protected_modifyProtectedModify 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_onProtectedCalled each animation frame.
The animation data that changed
The animation context
Protected_onProtectedHandle 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_onProtectedCallback actions which occur on a single right-click event to configure properties of the object
The triggering canvas interaction event
Protected_onProtectedAdditional events that trigger once control of the Token is established
Optional parameters which apply for specific implementations
Optionalpan?: anyPan to the controlled Token
OptionalreleaseOthers?: booleanRelease control of all other Tokens
Protected_onProtectedCalled by foundry.canvas.layers.TokenLayer#_onClickLeft while this Token is in a drag workflow.
The pointerdown event
Protected_onProtectedCalled by foundry.canvas.layers.TokenLayer#_onClickLeft2 while this Token is in a drag workflow.
The pointerdown event
Protected_onProtectedCalled by foundry.canvas.layers.TokenLayer#_onClickRight while this Token is in a drag workflow.
The pointerdown event
Protected_onProtectedCalled by foundry.canvas.layers.TokenLayer#_onClickRight2 while this Token is in a drag workflow.
The pointerdown event
Protected_onProtectedCallback actions which occur when a mouse-drag action is first begun.
The triggering canvas interaction event
If false, the start if prevented
Protected_onProtectedChange the elevation of Token during dragging.
The mousewheel event
Protected_onProtectedCallback actions which occur on a right mouse-drag operation.
The triggering mouse click event
If false, the cancellation is prevented
Protected_onProtectedCallback actions which occur on a right mouse-drag operation.
The triggering canvas interaction event
Protected_onProtectedCallback actions which occur on a right mouse-drag operation.
The triggering canvas interaction event
Protected_onProtectedCallback actions which occur on a right mouse-drag operation.
The triggering mouse click event
If false, the start if prevented
Protected_onProtectedBegin a drag operation from the perspective of the preview clone. Modify the appearance of both the clone (this) and the original (_original) object.
Protected_onProtectedCallback action which occurs on a long press.
The triggering canvas interaction event
The local canvas coordinates of the mousepress.
Protected_onProtectedCallback actions which occur on a single left-unclick event to assume control of the object
The triggering canvas interaction event
Protected_onProtectedCallback actions which occur on a single right-unclick event
The triggering canvas interaction event
Protected_prepareProtectedPrepare 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_propagateProtectedShould the placeable propagate right click downstream?
Protected_refreshProtectedRefresh the border.
Protected_refreshProtectedRefresh the display of status effects, adjusting their position for the token width and height.
Protected_refreshProtectedRefresh the elevation
Protected_refreshProtectedRefresh the token mesh.
Protected_refreshProtectedResize mesh and handle scale adjustment.
Protected_refreshProtectedRefresh the text content, position, and visibility of the Token nameplate.
Protected_refreshProtectedRefresh the position.
Protected_refreshProtectedRefresh the token ring visuals if necessary.
Protected_refreshProtectedRefresh the rotation.
Protected_refreshProtectedRefresh the display of the ruler.
Protected_refreshProtectedRefresh the token mesh shader.
Protected_refreshProtectedRefresh the shape.
Protected_refreshProtectedRefresh the size.
Protected_refreshProtectedRefresh aspects of the user interaction state. For example the border, nameplate, or bars may be shown on Hover or on Control.
Protected_refreshProtectedRefresh 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_refreshProtectedRefresh the tooltip.
Protected_refreshProtectedRefresh presentation of the Token's combat turn marker, if any.
Protected_refreshProtectedRefresh the visibility.
Protected_removeProtectedRemove last ruler waypoints and update ruler paths.
Protected_renderProtectedRender the bound mesh detection filter. Note: this method does not verify that the detection filter exists.
Protected_requiresProtectedDoes this Token require rotation changes to be animated? If false is returned, the rotation speed is set to infinity.
Protected_shouldProtectedPrevent the drop event? Called by Token#_onDragLeftDrop.
The pointerup event
Protected_triggerProtectedCancel the drag workflow. This cancellation cannot be prevented by Token#_onDragLeftCancel.
Protected_triggerProtectedTrigger drop event. This drop cannot be prevented by Token#_shouldPreventDragLeftDrop.
Protected_updateProtectedUpdate the destinations of the drag previews and rulers
The (unsnapped) center point of the waypoint
Optionaloptions: { snap?: boolean } = {}Additional options
Optionalsnap?: booleanSnap the destination?
Protected#onProtectedCallback actions which occur on a right mouse-drag operation.
The triggering mouse click event
If false, the start if prevented
Static_configureInternalConfigure the animation movement speed based on the given animation duration.
The update operation
The origin
The candidante waypoints
The token document
Static_getInternalGet the origin used for pasting the copied objects.
The objects that are copied
The offset
Static_getInternalGet the drop position for the given token.
Optionaloptions: { snap?: boolean } = {}Static_getInternalObtain 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