Class engine.Actor

Base Actor class used by NPCs, Players, Enemies, etc

Fields

engine.Actor.display_on_seen

Display actor when seen

engine.Actor.display_on_remember

Remember actor after seeing it

engine.Actor.display_on_unknown

Display actor when it hasn't yet been seen

Methods

engine.Actor:init (t, no_default)

Instantiates an actor

engine.Actor:act ()

Called when it is time to act

engine.Actor:getTarget ()

Gets the actor target Does nothing, AI redefines it, so should a "Player" class

engine.Actor:setTarget (target)

Sets the actor target Does nothing, AI redefines it, so should a "Player" class

engine.Actor:setupMinimapInfo (mo, map)

Setup minimap color for this entity You may overload this method to customize your minimap

engine.Actor:setEmote (e)

Set the current emote

engine.Actor:defineDisplayCallback ()

Attach or remove a display callback Defines particles to display

engine.Actor:move (x, y, force)

Moves an actor on the map WARNING: changing x and y properties manually is WRONG and will blow up in your face.

engine.Actor:moveDir (dir, force)

Moves into the given direction (calls Actor:move() internally)

engine.Actor:canMove (x, y, terrain_only)

Can the actor go there

engine.Actor:disappear (src)

Remove the actor from the level, marking it as dead but not using the death functions

engine.Actor:getPathString ()

Get the "path string" for this actor See Map:addPathString() for more info

engine.Actor:teleportRandom (x, y, dist, min_dist)

Teleports randomly to a passable grid

engine.Actor:knockback (srcx, srcy, dist, recursive, on_terrain)

Knock back the actor

engine.Actor:pull (srcx, srcy, dist, recursive)

Pull the actor

engine.Actor:deleteFromMap (map)

Remove this actor from specified map

engine.Actor:enoughEnergy (val)

Do we have enough energy?

engine.Actor:useEnergy (val)

Use some energy

engine.Actor:reactionToward (target)

What is our reaction toward the target

engine.Actor: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, ...

engine.Actor:lineFOV (tx, ty, extra_block, block[, sx=self.x][, sy=self.y])

Create a line to target based on field of vision

engine.Actor:hasLOS (x, y[, what=block_sight][, range=self.sight][, source_x=self.x][, source_y=self.y])

Does the actor have LOS to the target

engine.Actor:isNear (x, y, radius)

Are we within a certain distance of the target

engine.Actor:getEntityKind ()

Return the kind of the entity

engine.Actor:he_she ()

he/she formatting

engine.Actor:his_her ()

his/her formatting

engine.Actor:him_her ()

him/her formatting

engine.Actor:his_her_self ()

he/she/self formatting



Fields

engine.Actor.display_on_seen
Display actor when seen
engine.Actor.display_on_remember
Remember actor after seeing it
engine.Actor.display_on_unknown
Display actor when it hasn't yet been seen

Methods

engine.Actor:init (t, no_default)
Instantiates an actor

Parameters:

  • t table default values for actor
  • no_default table override the default values for entities
engine.Actor:act ()
Called when it is time to act

Returns:

    true if alive
engine.Actor:getTarget ()
Gets the actor target Does nothing, AI redefines it, so should a "Player" class
engine.Actor:setTarget (target)
Sets the actor target Does nothing, AI redefines it, so should a "Player" class

Parameters:

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

Parameters:

engine.Actor:setEmote (e)
Set the current emote

Parameters:

engine.Actor:defineDisplayCallback ()
Attach or remove a display callback Defines particles to display
engine.Actor:move (x, y, force)
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 int coord of the destination
  • y int coord of the destination
  • force boolean if true do not check for the presence of an other entity. Use wisely

Returns:

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

Parameters:

  • dir number direction to move
  • force number amount to move

Returns:

    true if we attempted to move
engine.Actor:canMove (x, y, terrain_only)
Can the actor go there

Parameters:

  • x int x coordinate
  • y int y coordinate
  • terrain_only optional boolean if true checks only the terrain, otherwise checks all entities

Returns:

    true if it can
engine.Actor:disappear (src)
Remove the actor from the level, marking it as dead but not using the death functions

Parameters:

  • src not used by default, but should be the event source
engine.Actor:getPathString ()
Get the "path string" for this actor See Map:addPathString() for more info
engine.Actor:teleportRandom (x, y, dist, min_dist)
Teleports randomly to a passable grid

Parameters:

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

Returns:

    true if the teleport worked
engine.Actor:knockback (srcx, srcy, dist, recursive, on_terrain)
Knock back the actor

Parameters:

  • srcx int source x
  • srcy int source y
  • dist number distance to push
  • recursive optional boolean is it recursive?
  • on_terrain optional boolean
engine.Actor:pull (srcx, srcy, dist, recursive)
Pull the actor

Parameters:

  • srcx int source x
  • srcy int source y
  • dist number distance to pull
  • recursive boolean is it recursive?
engine.Actor:deleteFromMap (map)
Remove this actor from specified map

Parameters:

engine.Actor:enoughEnergy (val)
Do we have enough energy?

Parameters:

  • val number

Returns:

    true if we have enough
engine.Actor:useEnergy (val)
Use some energy

Parameters:

  • val number how much energy to use
engine.Actor:reactionToward (target)
What is our reaction toward the target

Parameters:

  • target Actor the target to check against

See also:

engine.Actor: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 Actor the target actor to check
  • def number the default
  • def_pct number the default percent chance

Returns:

  1. true
  2. a number from 0 to 100 representing the "chance" to be seen

Or

  1. false
  2. a number from 0 to 100 representing the "chance" to be seen
engine.Actor:lineFOV (tx, ty, extra_block, block[, sx=self.x][, sy=self.y])
Create a line to target based on field of vision

Parameters:

  • tx int terrain x
  • ty int terrain y
  • extra_block boolean, func or string function that returns a boolean, or string that checks all entities to see if line of sight is blocked
  • block optional boolean boolean of whether or not it's blocked by default
  • sx int actor's x (default self.x)
  • sy int actor's y (default self.y)

Returns:

    fov line from core.fov.line
engine.Actor:hasLOS (x, y[, what=block_sight][, range=self.sight][, source_x=self.x][, source_y=self.y])
Does the actor have LOS to the target

Parameters:

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

Returns:

  1. true
  2. last_x
  3. last_y

Or

  1. false
  2. last_x
  3. last_y
engine.Actor:isNear (x, y, radius)
Are we within a certain distance of the target

Parameters:

  • x int the spot we test for nearness
  • y int the spot we test for nearness
  • radius number how close we should be (defaults to 1)

Returns:

    true if near
engine.Actor:getEntityKind ()
Return the kind of the entity

Returns:

    "actor"
engine.Actor:he_she ()
he/she formatting

Returns:

    string.he_she(self)
engine.Actor:his_her ()
his/her formatting

Returns:

    string.his_her(self)
engine.Actor:him_her ()
him/her formatting

Returns:

    string.him_her(self)
engine.Actor:his_her_self ()
he/she/self formatting

Returns:

    string.hisherself(self)
generated by LDoc 1.4.3