Extends
Members
_controlled :boolean
- Overrides:
An indicator for whether the object is currently controlled
Type:
- boolean
_hover :boolean
- Overrides:
An indicator for whether the object is currently a hover target
Type:
- boolean
actor
A convenient reference to the Actor object associated with the Token embedded document.
bounds
- Overrides:
The bounding box for this PlaceableObject. This is required if the layer uses a Quadtree, otherwise it is optional
brightRadius
Translate the token's bright light distance in units into a radius in pixels.
center :Object
- Overrides:
Properties:
Name | Type | Description |
---|---|---|
x |
The central x-coordinate |
|
y |
The central y-coordinate |
The Token's current central position
Type:
- Object
combatant :Combatant|null
Return a reference to a Combatant that represents this Token, if one is present in the current encounter.
Type:
- Combatant | null
controlIcon :ControlIcon
- Overrides:
A control icon for interacting with the object
Type:
data :abstract.DocumentData
- Overrides:
The underlying data object which provides the basis for this placeable object
Type:
dimRadius
Translate the token's sight distance in units into a radius in pixels.
document :abstract.Document
- Overrides:
A reference to the Scene embedded Document instance which this object represents
Type:
embeddedName :string
- Overrides:
Identify the official EmbeddedEntity name for this PlaceableObject class
Type:
- string
emitsLight :boolean
Test whether the Token emits light (or darkness) at any radius
Type:
- boolean
fov :PIXI.Polygon
- Overrides:
The field-of-vision polygon for the object, if it has been computed
Type:
- PIXI.Polygon
h :number
Translate the token's grid height into a pixel height based on the canvas size
Type:
- number
hasActiveHUD
Is the HUD display active for this token?
hasLimitedVisionAngle :boolean
Test whether the Token has a limited angle of vision or light emission which would require sight to update on Token rotation
Type:
- boolean
hasSight :boolean
Test whether the Token has sight (or blindness) at any radius
Type:
- boolean
id :string
- Overrides:
The id of the corresponding Document which this PlaceableObject represents.
Type:
- string
inCombat :boolean
An indicator for whether or not this token is currently involved in the active combat encounter.
Type:
- boolean
isTargeted :boolean
An indicator for whether the Token is currently targeted by the active game User
Type:
- boolean
isVisible :boolean
- See:
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.
Type:
- boolean
layer :PIXI.Container
- Overrides:
Provide a reference to the CanvasLayer which contains this PlaceableObject.
Type:
- PIXI.Container
light :PointSource
A reference to the PointSource object which defines this light source area of effect
Type:
los :PIXI.Polygon|null
- Overrides:
The line-of-sight polygon for the object, if it has been computed
Type:
- PIXI.Polygon | null
mouseInteractionManager :MouseInteractionManager
- Overrides:
A mouse interaction manager instance which handles mouse workflows related to this object.
Type:
name :string
Convenience access to the token's nameplate string
Type:
- string
observer :boolean
A boolean flag for whether the current game User has observer permission for the Token
Type:
- boolean
owner :boolean
A convenient reference for whether the current User has full control over the Token document.
Type:
- boolean
scene :Scene
- Overrides:
Retain a reference to the Scene within which this Placeable Object resides
Type:
sheet :FormApplication
- Overrides:
A Form Application which is used to configure the properties of this Placeable Object or the EmbeddedEntity it represents.
Type:
sourceId
The named identified for the source object associated with this Token
targeted :Set.<User>
Track the set of User entities which are currently targeting this Token
Type:
- Set.<User>
vision :PointSource
- Overrides:
A reference to the PointSource object which defines this vision source area of effect
Type:
w :number
Translate the token's grid width into a pixel width based on the canvas size
Type:
- number
Methods
(protected) _canConfigure()
- Overrides:
Does the User have permission to configure the Placeable Object?
(protected) _canControl()
- Overrides:
Does the User have permission to control the Placeable Object?
(protected) _canCreate()
- Overrides:
Does the User have permission to create the underlying Embedded Entity?
(protected) _canDelete()
- Overrides:
Does the User have permission to delete the underlying Embedded Entity?
(protected) _canDrag()
- Overrides:
Does the User have permission to drag this Placeable Object?
(protected) _canHover()
- Overrides:
Does the User have permission to hover on this Placeable Object?
(protected) _canHUD()
- Overrides:
Can the User access the HUD for this Placeable Object?
(protected) _canUpdate()
- Overrides:
Does the User have permission to update the underlying Embedded Entity?
(protected) _canView()
- Overrides:
Does the User have permission to view details of the Placeable Object?
(protected) _createInteractionManager()
- Overrides:
Create a standard MouseInteractionManager for the PlaceableObject
(protected) _drawBar(number, bar, data)
Draw a single resource bar, given provided data
Parameters:
Name | Type | Description |
---|---|---|
number |
number | The Bar number |
bar |
PIXI.Graphics | The Bar container |
data |
Object | Resource data for this bar |
_drawNameplate() → {PIXI.Text}
Draw the token's nameplate as a text object
Returns:
The Text object for the Token nameplate
- Type
- PIXI.Text
_getShiftedPosition(dx, dy) → {Object}
- Overrides:
Obtain a shifted position for the Placeable Object
Parameters:
Name | Type | Description |
---|---|---|
dx |
number | The number of grid units to shift along the X-axis |
dy |
number | The number of grid units to shift along the Y-axis |
Returns:
The shifted target coordinates
- Type
- Object
_onClickLeft(event)
- Overrides:
- See:
-
- MouseInteractionManager#_handleClickLeft
Callback actions which occur on a single left-click event to assume control of the object
Parameters:
Name | Type | Description |
---|---|---|
event |
PIXI.InteractionEvent | The triggering canvas interaction event |
_onClickLeft2(event)
- Overrides:
- See:
-
- MouseInteractionManager#_handleClickLeft2
Callback actions which occur on a double left-click event to activate
Parameters:
Name | Type | Description |
---|---|---|
event |
PIXI.InteractionEvent | The triggering canvas interaction event |
_onClickRight(event)
- Overrides:
- See:
-
- MouseInteractionManager#_handleClickRight
Callback actions which occur on a single right-click event to configure properties of the object
Parameters:
Name | Type | Description |
---|---|---|
event |
PIXI.InteractionEvent | The triggering canvas interaction event |
_onClickRight2(event)
- Overrides:
- See:
-
- MouseInteractionManager#_handleClickRight2
Callback actions which occur on a double right-click event to configure properties of the object
Parameters:
Name | Type | Description |
---|---|---|
event |
PIXI.InteractionEvent | The triggering canvas interaction event |
(protected) _onControl(options)
- Overrides:
Additional events which trigger once control of the object is established
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | Optional parameters which apply for specific implementations |
(protected) _onCreate()
- Overrides:
Register pending canvas operations which should occur after a new PlaceableObject of this type is created
(protected) _onDelete()
- Overrides:
Define additional steps taken when an existing placeable object of this type is deleted
_onDragLeftCancel(event)
- Overrides:
- See:
-
- MouseInteractionManager#_handleDragCancel
Callback actions which occur on a mouse-move operation.
Parameters:
Name | Type | Description |
---|---|---|
event |
MouseEvent | The triggering mouse click event |
(async) _onDragLeftDrop(event) → {Promise.<*>}
- Overrides:
- See:
-
- MouseInteractionManager#_handleDragDrop
Callback actions which occur on a mouse-move operation.
Parameters:
Name | Type | Description |
---|---|---|
event |
PIXI.InteractionEvent | The triggering canvas interaction event |
Returns:
- Type
- Promise.<*>
_onDragLeftMove(event)
- Overrides:
- See:
-
- MouseInteractionManager#_handleDragMove
Callback actions which occur on a mouse-move operation.
Parameters:
Name | Type | Description |
---|---|---|
event |
PIXI.InteractionEvent | The triggering canvas interaction event |
_onDragLeftStart(event)
- Overrides:
- See:
-
- MouseInteractionManager#_handleDragStart
Callback actions which occur when a mouse-drag action is first begun.
Parameters:
Name | Type | Description |
---|---|---|
event |
PIXI.InteractionEvent | The triggering canvas interaction event |
_onHoverIn(event, options)
- Overrides:
- See:
-
- MouseInteractionManager#_handleMouseOver
Actions that should be taken for this Placeable Object when a mouseover event occurs
Parameters:
Name | Type | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
event |
PIXI.InteractionEvent | The triggering canvas interaction event |
||||||||||
options |
object | Options which customize event handling Properties
|
_onHoverOut(event)
- Overrides:
- See:
-
- MouseInteractionManager#_handleMouseOut
Actions that should be taken for this Placeable Object when a mouseout event occurs
Parameters:
Name | Type | Description |
---|---|---|
event |
PIXI.InteractionEvent | The triggering canvas interaction event |
(protected) _onRelease(options)
- Overrides:
Additional events which trigger once control of the object is released
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | Options which modify the releasing workflow |
(protected) _onUpdate()
- Overrides:
Define additional steps taken when an existing placeable object of this type is updated with new data
_updateRotation(options) → {number}
- Overrides:
Determine a new angle of rotation for a PlaceableObject either from an explicit angle or from a delta offset.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object | An object which defines the rotation update parameters Properties
|
Returns:
The new rotation angle for the object
- Type
- number
activateListeners()
- Overrides:
Activate interactivity for the Placeable Object
(async) animateMovement(ray)
Animate Token movement along a certain path which is defined by a Ray object
Parameters:
Name | Type | Description |
---|---|---|
ray |
Ray | The path along which to animate Token movement |
can(user, action) → {boolean}
- Overrides:
Test whether a user can perform a certain interaction with regards to a Placeable Object
Parameters:
Name | Type | Description |
---|---|---|
user |
User | The User performing the action |
action |
string | The named action being attempted |
Returns:
Does the User have rights to perform the action?
- Type
- boolean
checkCollision(destination) → {boolean}
Check for collision when attempting a move to a new position
Parameters:
Name | Type | Description |
---|---|---|
destination |
Point | The destination point of the attempted movement |
Returns:
A true/false indicator for whether the attempted movement caused a collision
- Type
- boolean
clear() → {PlaceableObject}
- Overrides:
Clear the display of the existing object
Returns:
The cleared object
- Type
- PlaceableObject
clone() → {PlaceableObject}
- Overrides:
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
Returns:
A new object with identical data
- Type
- PlaceableObject
control(options) → {boolean}
- Overrides:
Assume control over a PlaceableObject, flagging it as controlled and enabling downstream behaviors
Parameters:
Name | Type | Description | ||||||
---|---|---|---|---|---|---|---|---|
options |
Object | Additional options which modify the control request Properties
|
Returns:
A flag denoting whether or not control was successful
- Type
- boolean
destroy()
- Inherited From:
(async) draw() → {Promise.<PlaceableObject>}
- Overrides:
Draw the placeable object into its parent container
Returns:
The drawn object
- Type
- Promise.<PlaceableObject>
(async) drawEffects()
Draw the active effects and overlay effect icons which are present upon the Token
drawTooltip()
Draw a text tooltip for the token which can be used to display Elevation or a resource value
getCenter(x, y) → {Object}
Get the center-point coordinate for a given grid position
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The grid x-coordinate that represents the top-left of the Token |
y |
number | The grid y-coordinate that represents the top-left of the Token |
Returns:
The coordinate pair which represents the Token's center at position (x, y)
- Type
- Object
getLightRadius(units) → {number}
A generic transformation to turn a certain number of grid units into a radius in canvas pixels. This function adds additional padding to the light radius equal to half the token width. This causes light to be measured from the outer token edge, rather than from the center-point.
Parameters:
Name | Type | Description |
---|---|---|
units |
number | The radius in grid units |
Returns:
The radius in canvas units
- Type
- number
getSightOrigin() → {Point}
Return the token's sight origin, tailored for the direction of their movement velocity to break ties with walls
Returns:
- Type
- Point
refresh()
- Overrides:
Update display of the Token, pulling latest data and re-rendering the display of Token components
release(options) → {boolean}
- Overrides:
Release control over a PlaceableObject, removing it from the controlled set
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | Options which modify the releasing workflow |
Returns:
A Boolean flag confirming the object was released.
- Type
- boolean
(async) rotate(angle, snap) → {Promise.<PlaceableObject>}
- Overrides:
Rotate the PlaceableObject to a certain angle of facing
Parameters:
Name | Type | Description |
---|---|---|
angle |
number | The desired angle of rotation |
snap |
number | Snap the angle of rotation to a certain target degree increment |
Returns:
The rotated object
- Type
- Promise.<PlaceableObject>
(async) setPosition(x, y, optionsopt) → {Promise.<Token>}
Set the token's position by comparing its center position vs the nearest grid vertex Return a Promise that resolves to the Token once the animation for the movement has been completed
Parameters:
Name | Type | Attributes | Default | Description | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
x |
number | The x-coordinate of the token center |
||||||||||||
y |
number | The y-coordinate of the token center |
||||||||||||
options |
object |
<optional> |
{}
|
Additional options which configure the token movement Properties
|
Returns:
The Token after animation has completed
- Type
- Promise.<Token>
setTarget(targeted, user, releaseOthers, groupSelection)
Set this Token as an active target for the current game User
Parameters:
Name | Type | Default | Description |
---|---|---|---|
targeted |
boolean |
true
|
Is the Token now targeted? |
user |
User | null | Assign the token as a target for a specific User |
|
releaseOthers |
boolean | Release other active targets for the same player? |
|
groupSelection |
boolean | Is this target being set as part of a group selection workflow? |
stopAnimation()
Terminate animation of this particular Token
(async) toggleCombat(combatopt) → {Promise.<Token>}
Add or remove the currently controlled Tokens from the active combat encounter
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
combat |
Combat |
<optional> |
A specific combat encounter to which this Token should be added |
Returns:
The Token which initiated the toggle
- Type
- Promise.<Token>
(async) toggleEffect(effect, optionsopt) → {Promise.<boolean>}
Toggle an active effect by it's texture path. Copy the existing Array in order to ensure the update method detects the data as changed.
Parameters:
Name | Type | Attributes | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
effect |
string | object | The texture file-path of the effect icon to toggle on the Token. |
|||||||||||||
options |
object |
<optional> |
Additional optional arguments which configure how the effect is handled. Properties
|
Returns:
Was the texture applied (true) or removed (false)
- Type
- Promise.<boolean>
(async) toggleVisibility() → {Promise.<Array.<TokenDocument>>}
Toggle the visibility state of any Tokens in the currently selected set
Returns:
A Promise which resolves to the updated Token documents
- Type
- Promise.<Array.<TokenDocument>>
updateSource(deferopt, deletedopt, noUpdateFogopt)
Update the light and vision source objects associated with this Token
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
defer |
boolean |
<optional> |
Defer refreshing the SightLayer to manually call that refresh later. |
deleted |
boolean |
<optional> |
Indicate that this light source has been deleted. |
noUpdateFog |
boolean |
<optional> |
Never update the Fog exploration progress for this update. |