Module engine.Actor

Functions

_M:act () Called when it is time to act
_M:canMove (x, y, terrain_only) Can the actor go there
_M:canSee (actor, def, def_pct) Can the actor see the target actor This does not check LOS or such, only the actual ability to see it.
By default this returns true, but a module can override it to check for telepathy, invisibility, stealth, ...
_M:defineDisplayCallback () Attach or remove a display callback Defines particles to display
_M:disappear (src) Remove the actor from the level, marking it as dead but not using the death functions
_M:enoughEnergy (val) Do we have enough energy
_M:getEntityKind () Return the kind of the entity
_M:getPathString () Get the "path string" for this actor See Map:addPathString() for more info
_M:getTarget () Gets the actor target Does nothing, AI redefines it so should a "Player" class
_M:hasLOS (x, y, what, range, source_x, source_y) Does the actor have LOS to the target
_M:isNear (x, y, radius) Are we within a certain distance of the target
_M:knockback (srcx, srcy, dist, recursive, on_terrain) Knock back the actor
_M:lineFOV (tx, ty, extra_block, block, sx, sy) Create a line to target based on field of vision
_M:move (x, y, force, map) Moves an actor on the map *WARNING*: changing x and y properties manually is *WRONG* and will blow up in your face.
_M:moveDir (dir) Moves into the given direction (calls actor:move() internally)
_M:pull (srcx, srcy, dist, recursive) Pull the actor
_M:reactionToward (target) What is our reaction toward the target See Faction:factionReaction()
_M:setEmote (e) Set the current emote
_M:setTarget (target) Sets the actor target Does nothing, AI redefines it so should a "Player" class
_M:setupMinimapInfo (mo, map) Setup minimap color for this entity You may overload this method to customize your minimap
_M:teleportRandom (x, y, dist, min_dist) Teleports randomly to a passable grid
_M:useEnergy (val) Use some energy


Functions

_M:act ()
Called when it is time to act
_M:canMove (x, y, terrain_only)
Can the actor go there

Parameters

  • x:
  • y:
  • terrain_only: if true checks only the terrain, otherwise checks all entities
_M:canSee (actor, def, def_pct)
Can the actor see the target actor This does not check LOS or such, only the actual ability to see it.
By default this returns true, but a module can override it to check for telepathy, invisibility, stealth, ...

Parameters

  • actor: the target actor to check
  • def: the default
  • def_pct: the default percent chance

Return value:

true or false and a number from 0 to 100 representing the "chance" to be seen
_M:defineDisplayCallback ()
Attach or remove a display callback Defines particles to display
_M:disappear (src)
Remove the actor from the level, marking it as dead but not using the death functions

Parameters

  • src:
_M:enoughEnergy (val)
Do we have enough energy

Parameters

  • val:
_M:getEntityKind ()
Return the kind of the entity
_M:getPathString ()
Get the "path string" for this actor See Map:addPathString() for more info
_M:getTarget ()
Gets the actor target Does nothing, AI redefines it so should a "Player" class
_M:hasLOS (x, y, what, range, source_x, source_y)
Does the actor have LOS to the target

Parameters

  • x: the spot we test for LOS
  • y: the spot we test for LOS
  • what: the property to check for, defaults to block_sight
  • range: the maximum range to see, defaults to self.sight
  • source_x: the spot to test from (defaults to self.x)
  • source_y: the spot to test from (defaults to self.y)

Return value:

has_los, last_x, last_y
_M:isNear (x, y, radius)
Are we within a certain distance of the target

Parameters

  • x: the spot we test for nearness
  • y: the spot we test for nearness
  • radius: how close we should be (defaults to 1)
_M:knockback (srcx, srcy, dist, recursive, on_terrain)
Knock back the actor

Parameters

  • srcx:
  • srcy:
  • dist:
  • recursive:
  • on_terrain:
_M:lineFOV (tx, ty, extra_block, block, sx, sy)
Create a line to target based on field of vision

Parameters

  • tx:
  • ty:
  • extra_block:
  • block:
  • sx:
  • sy:
_M:move (x, y, force, map)
Moves an actor on the map *WARNING*: changing x and y properties manually is *WRONG* and will blow up in your face. Use this method. Always.

Parameters

  • x: coord of the destination
  • y: coord of the destination
  • force: if true do not check for the presence of an other entity. *Use wisely*
  • map: the map to move onto

Return value:

true if a move was *ATTEMPTED*. This means the actor will probably want to use energy
_M:moveDir (dir)
Moves into the given direction (calls actor:move() internally)

Parameters

  • dir:
_M:pull (srcx, srcy, dist, recursive)
Pull the actor

Parameters

  • srcx:
  • srcy:
  • dist:
  • recursive:
_M:reactionToward (target)
What is our reaction toward the target See Faction:factionReaction()

Parameters

  • target:
_M:setEmote (e)
Set the current emote

Parameters

  • e:
_M:setTarget (target)
Sets the actor target Does nothing, AI redefines it so should a "Player" class

Parameters

  • target:
_M:setupMinimapInfo (mo, map)
Setup minimap color for this entity You may overload this method to customize your minimap

Parameters

  • mo:
  • map:
_M:teleportRandom (x, y, dist, min_dist)
Teleports randomly to a passable grid

Parameters

  • x: the coord of the teleportation
  • y: the coord of the teleportation
  • dist: the radius of the random effect, if set to 0 it is a precise teleport
  • min_dist: the minimum radius of of the effect, will never teleport closer. Defaults to 0 if not set

Return value:

true if the teleport worked
_M:useEnergy (val)
Use some energy

Parameters

  • val:

Valid XHTML 1.0!