The TokenDocument that this Token represents
Internal_Prevent keyboard movement of this Token?
Internal_The preview type, if any.
Internal_Vision version incremented each time vision (and light) are updated.
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_The 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 preview type, if any.
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.
Apply render flags before a render occurs.
The render flags which must be applied
Does the User have permission to control the Placeable Object?
The User performing the action. Always equal to game.user.
The pointer event if this function was called by foundry.canvas.interaction.MouseInteractionManager.
InternalAdd/Modify a filter effect on this token.
The status effect ID being applied, from CONFIG.specialStatusEffects
Is the special status effect now active?
InternalCreate an unattached VisionSource instance used for shared fog exploration.
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 or DOM interaction event
Options which customize event handling
Actions that should be taken for this Placeable Object when a mouseout event occurs
The triggering canvas or DOM interaction event
Options which customize event handling
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
Optional_result?: (string | object)[]Used internally by the server-side backend
Optional_updateData?: Record<string, object>Used internally by the server-side backend
Optionalaction?: "update"The action of this database operation
Optionalanimate?: booleanAnimate movement. Default: true.
Optionalanimation?: {The animation options.
Optionalduration?: numberThe duration of the animation in milliseconds (nonnegative).
Optionaleasing?: CanvasAnimationEasingFunctionThe easing function of the animation of non-movement
properties. Default: undefined (linear).
OptionallinkToMovement?: booleanSet the duration of non-movement properties to the animation.
OptionalmovementSpeed?: numberThe base movement speed in grid size per second (positive).
OptionalautoRotate?: booleanAutomatically rotate the token in the direction of movement? Default:
game.settings.get("core", "tokenAutoRotate") if method is "dragging" or "keyboard" otherwise false.
Optionalbroadcast?: booleanWhether the database operation is broadcast to other connected clients
OptionalconstrainOptions?: Omit<The options to constrain movement.
Optionaldiff?: booleanDifference each update object against current Document data and only use differential data for the update operation
OptionaldocumentName?: stringThe Document name
OptionaldryRun?: booleanIs the operation a dry run? If so, an empty result array is returned before the Documents are updated.
OptionalextractedImages?: Record<string, string>Base64 images extracted during server-side processing
OptionalmeasureOptions?: Omit<TokenMeasureMovementPathOptions, "preview">The options to measure movement.
OptionalmodifiedTime?: numberThe timestamp when the operation was performed
OptionalnoHook?: booleanBlock the dispatch of hooks related to this operation
Optionalpack?: string | nullA compendium collection ID which contains the Documents
Optionalpan?: boolean | { duration?: number; force?: boolean; transitionType?: string }Pan the canvas (with transition animation) to the destination if the token is controlled? Default: true.
Optionalparent?: Document<object, DocumentConstructionContext> | nullA parent Document within which Documents are embedded
OptionalparentUuid?: string | nullA parent Document UUID provided when the parent instance is unavailable
Optionalplanned?: booleanDon't start the movement yet? Default: false.
Optionalrecursive?: booleanMerge objects recursively. If false, inner objects will be replaced explicitly. Use with caution!
Optionalrender?: booleanRe-render Applications whose display depends on the created Documents
OptionalshowRuler?: booleanShow the ruler during the movement animation of the token? Default: true if
method is "dragging" otherwise false.
duration of movement. Default: false.
OptionalterrainOptions?: Omit<TokenCreateTerrainMovementPathOptions, "preview">The terrain movement options.
Refresh the displayed state of the placeable. Used to update aspects of the placeable which change based on the user interaction state.
Refresh the visibility of the placeable.
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: {Additional options which modify the control request
Optionalforce?: booleanControl the object even if it is not interactable?
OptionalisNew?: booleanWas this object just created?
OptionalreleaseOthers?: booleanRelease any other controlled objects first
OptionalrenderSidebar?: booleanRe-render the sidebar.
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: TokenCreateTerrainMovementPathOptions = {}Additional options
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: TokenFindMovementPathOptions = {}Additional 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
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
OptionalrenderSidebar?: booleanRe-render the sidebar.
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_ProtectedAdd ruler waypoints and update ruler paths.
The (unsnapped) center point of the waypoint
Optionaloptions: { snap?: boolean } = {}Additional options
Optionalsnap?: booleanSnap the added waypoint?
Protected_ProtectedDoes 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_ProtectedDoes 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_Protected_ProtectedDoes 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_ProtectedHelper 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_ProtectedChange 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_ProtectedCreate a standard MouseInteractionManager for the PlaceableObject
Protected_ProtectedDraw a single resource bar, given provided data
The Bar index
The Bar container
Resource data for this bar
Protected_ProtectedDraw a status effect icon
Protected_ProtectedDraw the effect icons for ActiveEffect documents which apply to the Token's Actor. Called by Token#drawEffects.
Protected_ProtectedDraw the overlay effect icon
Protected_ProtectedDraw the targeting arrows around this token.
Optionalreticule: ReticuleOptions = {}Additional parameters to configure how the targeting reticule is drawn.
Protected_ProtectedDraw the targeting pips around this token.
Protected_ProtectedFinalize the right-drag operation.
The triggering mouse click event
Protected_ProtectedGet the animation data for the current state of the document.
The target animation data object
Protected_ProtectedGet 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_ProtectedGet 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_ProtectedGet 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_ProtectedGet the texture transition type.
Returns "fade" by default.
The options that configure the animation behavior
The transition type
Protected_ProtectedGet the hex color that should be used to render the Token border
The hex color used to depict the border color
Protected_ProtectedGet the constrain options used during the drag operation.
The constrain options
Protected_ProtectedGet the update operation options that should be used for a drag-left-drop operation.
Protected_ProtectedGet the measure options used during the drag operation.
The measure options
Protected_ProtectedGet the movement action for the waypoints placed during a drag operation.
The movement action
Protected_ProtectedGet the search options used during the drag operation to find the path of movement through the waypoints.
The search options
Protected_ProtectedGet the terrain options used during the drag operation.
The terrain options
Protected_ProtectedGet 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_ProtectedGet the movement action in CONFIG.Token.movement.actions to be used for keyboard
movement.
The default implementation returns this.document.movementAction.
Protected_Protected_ProtectedCreate 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_ProtectedGet the target opacity that should be used for a Placeable Object depending on its preview state.
Protected_ProtectedGet the text style that should be used for this Token's tooltip.
Protected_ProtectedReturn the text which should be displayed in a token's tooltip field
Protected_ProtectedReturns a record of blinding state.
Protected_Protected_ProtectedInitialize the right-drag operation.
The triggering canvas interaction event
Protected_ProtectedCreate the BaseTokenRuler instance for this Token, if any. This function is called when the Token is drawn for the first time.
Protected_ProtectedTest whether this Token should contribute to shared Fog of War exploration.
Protected_ProtectedDoes this Token actively emit light given its properties and the current darkness level of the Scene?
Protected_ProtectedTest whether this Token is a viable vision source for the current User.
Protected_ProtectedModify 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_ProtectedCalled each animation frame.
The animation data that changed
The animation context
Protected_ProtectedHandle 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_ProtectedCallback actions which occur on a single right-click event to configure properties of the object
The triggering canvas interaction event
Protected_ProtectedAdditional events that trigger once control of the object is established
Optional parameters which apply for specific implementations
Optionalpan?: boolean | { duration?: number; transitionType?: string }Pan to the controlled Token
OptionalreleaseOthers?: booleanRelease control of all other Tokens
Protected_ProtectedCalled by foundry.canvas.layers.TokenLayer#_onClickLeft while this Token is in a drag workflow.
The pointerdown event
Protected_ProtectedCalled by foundry.canvas.layers.TokenLayer#_onClickLeft2 while this Token is in a drag workflow.
The pointerdown event
Protected_ProtectedCalled by foundry.canvas.layers.TokenLayer#_onClickRight while this Token is in a drag workflow.
The pointerdown event
Protected_ProtectedCalled by foundry.canvas.layers.TokenLayer#_onClickRight2 while this Token is in a drag workflow.
The pointerdown event
Protected_ProtectedCallback actions which occur when a mouse-drag action is first begun.
The triggering canvas interaction event
If false, the start if prevented
Protected_ProtectedChange the elevation of Token during dragging.
The mousewheel event
Protected_ProtectedCallback actions which occur on a right mouse-drag operation.
The triggering mouse click event
If false, the cancellation is prevented
Protected_ProtectedCallback actions which occur on a right mouse-drag operation.
The triggering canvas interaction event
Protected_ProtectedCallback actions which occur on a right mouse-drag operation.
The triggering canvas interaction event
Protected_ProtectedCallback actions which occur on a right mouse-drag operation.
The triggering mouse click event
If false, the start if prevented
Protected_ProtectedBegin a drag operation from the perspective of the preview clone. Modify the appearance of both the clone (this) and the original (_original) object.
Protected_ProtectedCallback action which occurs on a long press.
The triggering canvas interaction event
The local canvas coordinates of the mousepress.
Protected_ProtectedCallback actions which occur on a single left-unclick event to assume control of the object
The triggering canvas interaction event
Protected_ProtectedCallback actions which occur on a single right-unclick event
The triggering canvas interaction event
Protected_ProtectedPrepare 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_ProtectedShould the placeable propagate right click downstream?
Protected_ProtectedRefresh the border.
Protected_ProtectedRefresh the display of status effects, adjusting their position for the token width and height.
Protected_ProtectedRefresh the elevation
Protected_ProtectedRefresh the token mesh.
Protected_ProtectedResize mesh and handle scale adjustment.
Protected_ProtectedRefresh the text content, position, and visibility of the Token nameplate.
Protected_ProtectedRefresh the position.
Protected_ProtectedRefresh the token ring visuals if necessary.
Protected_ProtectedRefresh the rotation.
Protected_ProtectedRefresh the display of the ruler.
Protected_ProtectedRefresh the token mesh shader.
Protected_ProtectedRefresh the shape.
Protected_ProtectedRefresh the size.
Protected_ProtectedRefresh 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_ProtectedRefresh the tooltip.
Protected_ProtectedRefresh presentation of the Token's combat turn marker, if any.
Protected_ProtectedRemove last ruler waypoints and update ruler paths.
Protected_ProtectedRender the bound mesh detection filter. Note: this method does not verify that the detection filter exists.
Protected_ProtectedDoes this Token require rotation changes to be animated? If false is returned, the rotation speed is set to infinity.
Protected_ProtectedPrevent the drop event? Called by Token#_onDragLeftDrop.
The pointerup event
Protected_ProtectedCancel the drag workflow. This cancellation cannot be prevented by Token#_onDragLeftCancel.
Protected_ProtectedTrigger drop event. This drop cannot be prevented by Token#_shouldPreventDragLeftDrop.
Protected_ProtectedUpdate 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_InternalConfigure the animation movement speed based on the given animation duration.
The update operation
The origin
The candidante waypoints
The token document
Static_InternalGet the origin used for pasting the copied objects.
The objects that are copied
The offset
Static_InternalGet the drop position for the given token.
Optionaloptions: { snap?: boolean } = {}Static_InternalObtain 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