Actor

Methods
64
Fields
None

Getting one

client:createMenuEntry(…):getActor()

Methods

MethodReturnsDescription
getCombatLevel()numberThe actor's combat level: an NPC's transformed composition's, a player's appearance's.
getName()string?The actor's name, non-breaking spaces made spaces; nil for a despawned NPC or a player with none.
isInteracting()booleanWhether the actor's target is an NPC or a player (not a tile). It can be true while getInteracting() is nil (the target is out of range…
getInteracting()Actor?The actor this one interacts with, found across the client's world views, or nil.
getHealthRatio()numberThe health of the first health bar's current update, in getHealthScale() units; -1 with no bar showing. The current update is the newest…
getHealthScale()numberThe first health bar's width, the most getHealthRatio() can be; -1 with no bar.
getWorldLocation()WorldPointThe server-side tile: the head of the actor's path in its world view, plus that view's base, on its plane. Ahead of where it renders while…
getLocalLocation()LocalPointThe client-side position in local units (128 a tile), where the actor renders: interpolated between tiles while it moves.
getCameraFocus()LocalPointWhere the camera orbits while it follows the actor (client:getCameraFocusEntity() is the actor then): its getLocalLocation().
getWorldView()WorldViewThe world view the actor is in: the top level, or a world entity's (a boat's).
getOrientation()numberThe orientation the actor is turning to (0..2047).
getCurrentOrientation()numberThe orientation the actor renders at now.
getAnimation()numberThe animation playing (AnimationID), -1 for none.
setAnimation(number)()Set the animation playing, through the game's own sequence setter. No AnimationChanged follows. Does nothing on a despawned actor.
getAnimationFrame()numberThe frame of the animation playing, -1 for none.
setAnimationFrame(number)()Set the frame of the animation playing.
getAnimationFrameCycle()numberThe client cycles the animation has spent on its current frame (getAnimationFrame()'s): 1 up to the frame's length (`Animation:getFrameLe…
getAnimationLoopCount()numberHow many times the animation has looped since it started: 0 until it first passes its end, then 1 more each time it does. Starting another…
getPoseAnimation()numberThe pose (idle or movement) animation playing, -1 for none.
setPoseAnimation(number)()Set the pose animation playing.
getPoseAnimationFrame()numberThe frame of the pose animation, -1 for none.
setPoseAnimationFrame(number)()Set the frame of the pose animation.
getPoseAnimationFrameCycle()numberThe client cycles the pose animation has spent on its current frame (getPoseAnimationFrame()'s); 0 with none, or once the actor has despa…
getIdlePoseAnimation()numberThe idle pose animation.
setIdlePoseAnimation(number)()Set the idle pose animation.
getIdleRotateLeft()numberThe idle turn-left animation.
setIdleRotateLeft(number)()Set the idle turn-left animation.
getIdleRotateRight()numberThe idle turn-right animation.
setIdleRotateRight(number)()Set the idle turn-right animation.
getWalkAnimation()numberThe walk animation.
setWalkAnimation(number)()Set the walk animation.
getWalkRotate180()numberThe walk-backwards animation.
setWalkRotate180(number)()Set the walk-backwards animation.
getWalkRotateLeft()numberThe walk-left animation.
setWalkRotateLeft(number)()Set the walk-left animation.
getWalkRotateRight()numberThe walk-right animation.
setWalkRotateRight(number)()Set the walk-right animation.
getRunAnimation()numberThe run animation.
setRunAnimation(number)()Set the run animation.
getSpotAnims(){ActorSpotAnim}The spot animations the actor carries, one per slot in use, in slot order.
hasSpotAnim(number)booleanWhether any slot carries spot animation spotAnimId.
getGraphic()numberThe actor's single graphic: the first spot animation's id, or -1.
setGraphic(number)()Set the actor's single graphic: every spot animation removed, then (for an id above -1) graphic put in slot 0. No GraphicChanged follow…
setSpotAnimFrame(number)()Set the frame of the first spot animation (in slot order), if the actor carries one.
getCanvasTilePoly()Polygon?The canvas polygon of the tile under the actor's local location (one tile; an NPC answers its whole size), or nil when a corner does no…
getCanvasTextLocation(Graphics2D, string, number)Point?The canvas point to draw text at, centred over the actor zOffset up: the anchor's x less half the text's width in the graphics' current…
getCanvasTextLocationForWidth(number, number)Point?The point getCanvasTextLocation(graphics, text, zOffset) gives, for text textWidth pixels wide, without a graphics (outside a render, o…
getCanvasImageLocation(BufferedImage, number)Point?The canvas point that centres image over the actor, zOffset up: its top-left corner, or nil when the point does not project.
getCanvasSpriteLocation(SpritePixels, number)Point?The canvas point that centres sprite over the actor, zOffset up: its top-left corner, or nil when the point does not project.
getMinimapLocation()Point?Where the actor is on the minimap, or nil when it is outside the minimap's radius or the minimap is hidden.
getLogicalHeight()numberThe model's logical height, roughly where the health bar is drawn (200 until a model has set it).
getWorldArea()WorldAreaThe world area the actor covers: its world location and size (an NPC's composition size, 1 for a player).
getOverheadText()string?The text over the actor's head, nil for none.
setOverheadText(string)()Replace the text over the actor's head, through the game's own string assign (a chat filter does this in onOverheadTextChanged).
getOverheadCycle()numberThe client cycles the overhead text still shows for.
setOverheadCycle(number)()Set the client cycles the overhead text shows for.
isDead()booleanWhether the actor has died: set when a death health bar reaches 0 (when ActorDeath is posted), cleared when one rises above 0.
setDead(boolean)()Set the dead flag isDead() answers.
getFootprintSize()numberThe side of the actor's footprint in local units, which ground heights under it are sampled over.
getAnimationHeightOffset()numberThe vertical offset the actor's animation renders it at.
getConvexHull()Shape?The outline of the actor's model on the canvas this frame: the convex hull of the model the client builds for it, at its local location and…
getModel()Model?The model the client builds for the actor this frame, a copy; nil in HD, off the game thread or once the actor is gone.
getRenderMode()numberHow the client draws the actor (Renderable.RENDERMODE_*), its own answer: a player 2 (RENDERMODE_SORTED_NO_DEPTH); an NPC 2 when its mo…
isPresent()booleanWhether the actor is still in the game.

Returned by

MethodReturnsDescription
ActorDeath.getActorActorThe actor; never nil. From a legacy (differ) delivery read after the actor left the map, the handle it had, with its last-known values.
AnimationChanged.getActorActorThe actor; read getAnimation() on it for the new animation. Never nil: from a legacy (differ) delivery about an actor that has left the…
GraphicChanged.getActorActor?The actor. nil from a legacy delivery (a client where the actor sites do not install), which does not say whether it is an NPC or a playe…
HitsplatApplied.getActorActorThe actor hit; never nil. From a legacy (differ) delivery read after the actor left the map, the handle it had, with its last-known value…
InteractingChanged.getSourceActor?The actor whose target changed. nil from a legacy delivery (a client where the actor sites do not install), which does not say whether it…
InteractingChanged.getTargetActor?The actor it targets now, nil for none.
MenuEntry.getActorActor?getNpc(), else getPlayer().
OverheadTextChanged.getActorActor?The actor. nil from a legacy delivery (a client where the actor sites do not install), which does not say whether it is an NPC or a playe…
Projectile.getInteractingActor?The same as getTargetActor().
Projectile.getSourceActorActor?The actor it was fired from, looked up in the top-level world view, or nil (fired from a tile, or the actor is gone).
Projectile.getTargetActorActor?The actor it is aimed at, looked up in the top-level world view, or nil when it is aimed at a tile (or the actor is gone).

Method details

getCombatLevel

getCombatLevel: (Actor) -> number

The actor's combat level: an NPC's transformed composition's, a player's appearance's.

getName

getName: (Actor) -> string?

The actor's name, non-breaking spaces made spaces; nil for a despawned NPC or a player with none.

isInteracting

isInteracting: (Actor) -> boolean

Whether the actor's target is an NPC or a player (not a tile). It can be true while getInteracting() is nil (the target is out of range).

getInteracting

getInteracting: (Actor) -> Actor?

The actor this one interacts with, found across the client's world views, or nil.

getHealthRatio

getHealthRatio: (Actor) -> number

The health of the first health bar's current update, in getHealthScale() units; -1 with no bar showing. The current update is the newest arrived, until it expires.

getHealthScale

getHealthScale: (Actor) -> number

The first health bar's width, the most getHealthRatio() can be; -1 with no bar.

getWorldLocation

getWorldLocation: (Actor) -> WorldPoint

The server-side tile: the head of the actor's path in its world view, plus that view's base, on its plane. Ahead of where it renders while it walks. On an NPC-owned boat (a charter ship's crew, a trial's master), the sea tile under where it renders instead, the tile its scene:npcs() row measures by.

getLocalLocation

getLocalLocation: (Actor) -> LocalPoint

The client-side position in local units (128 a tile), where the actor renders: interpolated between tiles while it moves.

getCameraFocus

getCameraFocus: (Actor) -> LocalPoint

Where the camera orbits while it follows the actor (client:getCameraFocusEntity() is the actor then): its getLocalLocation().

getOrientation

getOrientation: (Actor) -> number

The orientation the actor is turning to (0..2047).

getAnimation

getAnimation: (Actor) -> number

The animation playing (AnimationID), -1 for none.

setAnimation

setAnimation: (Actor, number) -> ()

Set the animation playing, through the game's own sequence setter. No AnimationChanged follows. Does nothing on a despawned actor.

getAnimationFrameCycle

getAnimationFrameCycle: (Actor) -> number

The client cycles the animation has spent on its current frame (getAnimationFrame()'s): 1 up to the frame's length (Animation:getFrameLengths()) once a cycle has run on it; 0 with no animation, or once the actor has despawned.

getAnimationLoopCount

getAnimationLoopCount: (Actor) -> number

How many times the animation has looped since it started: 0 until it first passes its end, then 1 more each time it does. Starting another animation, or the same one again, starts the count over. 0 with no animation, or once the actor has despawned.

getPoseAnimation

getPoseAnimation: (Actor) -> number

The pose (idle or movement) animation playing, -1 for none.

getPoseAnimationFrameCycle

getPoseAnimationFrameCycle: (Actor) -> number

The client cycles the pose animation has spent on its current frame (getPoseAnimationFrame()'s); 0 with none, or once the actor has despawned.

hasSpotAnim

hasSpotAnim: (Actor, number) -> boolean

Whether any slot carries spot animation spotAnimId.

getGraphic

getGraphic: (Actor) -> number

The actor's single graphic: the first spot animation's id, or -1.

setGraphic

setGraphic: (Actor, number) -> ()

Set the actor's single graphic: every spot animation removed, then (for an id above -1) graphic put in slot 0. No GraphicChanged follows. Does nothing on a despawned actor.

setSpotAnimFrame

setSpotAnimFrame: (Actor, number) -> ()

Set the frame of the first spot animation (in slot order), if the actor carries one.

getCanvasTilePoly

getCanvasTilePoly: (Actor) -> Polygon?

The canvas polygon of the tile under the actor's local location (one tile; an NPC answers its whole size), or nil when a corner does not project.

getCanvasTextLocation

getCanvasTextLocation: (Actor, Graphics2D, string, number) -> Point?

The canvas point to draw text at, centred over the actor zOffset up: the anchor's x less half the text's width in the graphics' current font (getStringBounds), or nil when the point does not project. The text is measured only when it does.

getCanvasTextLocationForWidth

getCanvasTextLocationForWidth: (Actor, number, number) -> Point?

The point getCanvasTextLocation(graphics, text, zOffset) gives, for text textWidth pixels wide, without a graphics (outside a render, or with a width measured once). getCanvasTextLocation measures the text itself; the x is the anchor's minus textWidth / 2, truncated to an int.

getMinimapLocation

getMinimapLocation: (Actor) -> Point?

Where the actor is on the minimap, or nil when it is outside the minimap's radius or the minimap is hidden.

getLogicalHeight

getLogicalHeight: (Actor) -> number

The model's logical height, roughly where the health bar is drawn (200 until a model has set it).

getWorldArea

getWorldArea: (Actor) -> WorldArea

The world area the actor covers: its world location and size (an NPC's composition size, 1 for a player).

setOverheadText

setOverheadText: (Actor, string) -> ()

Replace the text over the actor's head, through the game's own string assign (a chat filter does this in onOverheadTextChanged).

setOverheadCycle

setOverheadCycle: (Actor, number) -> ()

Set the client cycles the overhead text shows for.

isDead

isDead: (Actor) -> boolean

Whether the actor has died: set when a death health bar reaches 0 (when ActorDeath is posted), cleared when one rises above 0.

setDead

setDead: (Actor, boolean) -> ()

Set the dead flag isDead() answers.

getFootprintSize

getFootprintSize: (Actor) -> number

The side of the actor's footprint in local units, which ground heights under it are sampled over.

getConvexHull

getConvexHull: (Actor) -> Shape?

The outline of the actor's model on the canvas this frame: the convex hull of the model the client builds for it, at its local location and current orientation, at its footprint's ground height less its animation height offset. nil when it does not project, with no scene, in HD (no model is readable there) or once the actor is gone.

getModel

getModel: (Actor) -> Model?

The model the client builds for the actor this frame, a copy; nil in HD, off the game thread or once the actor is gone.

getRenderMode

getRenderMode: (Actor) -> number

How the client draws the actor (Renderable.RENDERMODE_*), its own answer: a player 2 (RENDERMODE_SORTED_NO_DEPTH); an NPC 2 when its model override dresses it as a player or its type is drawn so, else 0 (RENDERMODE_DEFAULT; also once it is gone).

isPresent

isPresent: (Actor) -> boolean

Whether the actor is still in the game.