Naev

Module asteroid

Lua bindings to interact with asteroid.

Functions

__eq (a1, a2) Compares two asteroids to see if they are the same.
getAll () Gets all the asteroids in the system.
get (If) Gets an asteroid in the system.
exists (a) Checks to see if an asteroid exists.
state (a) Gets the state of an asteroid.
state (a, s) Sets the state of an asteroid.
field (a) Gets the field the asteroid belongs to (useful for getting more asteroids from the same field).
pos (a) Gets the position of an asteroid.
vel (a) Gets the velocity of an asteroid.
setPos (a, v) Sets the position of an asteroid.
setVel (a, v) Sets the velocity of an asteroid.
scanned (a) Gets whether or not an asteroid got scanned.
timer (a) Gets the time left on the asteroid.
setTimer (a, Time) Sets the time left on the asteroid.
armour (a) Gets the armour (health) left on the asteroid.
setTimer (a, Amount) Sets the armour of the asteroid.
alertRange (a) Gets the alert range of an asteroid.
materials (a) Gets the materials the asteroid can potentially drop.


Functions

__eq (a1, a2)
Compares two asteroids to see if they are the same.

Parameters:

  • a1 Asteroid Asteroid 1 to compare.
  • a2 Asteroid Asteroid 2 to compare.

Returns:

    boolean true if both asteroids are the same.
getAll ()
Gets all the asteroids in the system.

Returns:

    table t A list of all asteroids in the system.
get (If)
Gets an asteroid in the system.

Parameters:

  • If nil, number, Vector or Pilot not supplied, gets a random asteroid, if not it tries to get the asteroid closest to the Vector or Pilot. In the case of a number, it tries to get a random asteroid from the asteroid field with the number as an id.

Returns:

    Asteroid The closest asteroid or nil if not found.
exists (a)
Checks to see if an asteroid exists.

Parameters:

  • a Asteroid Asteroid to check to see if exists.

Returns:

    boolean true if te asteroid exists, false otherwise.
state (a)
Gets the state of an asteroid.

Parameters:

  • a Asteroid Asteroid to check state of.

Returns:

    string State of the asteroid. Can be one of "FG", "XB", "BX", "XX_TO_BG", "FG_TO_BG", "BG_TO_FG", "BG_TO_XX", or "XX".
state (a, s)
Sets the state of an asteroid.

Parameters:

  • a Asteroid Asteroid to set state of.
  • s string State to set. Has to be one of "FG", "XB", "BX", "XX_TO_BG", "FG_TO_BG", "BG_TO_FG", "BG_TO_XX", or "XX".
field (a)
Gets the field the asteroid belongs to (useful for getting more asteroids from the same field).

Parameters:

  • a Asteroid Asteroid to get what field it belongs to.

Returns:

    number ID of the field the asteroid belongs to.
pos (a)
Gets the position of an asteroid.

Parameters:

  • a Asteroid Asteroid to get position of.

Returns:

    Vector Position of the asteroid.
vel (a)
Gets the velocity of an asteroid.

Parameters:

  • a Asteroid Asteroid to get velocity of.

Returns:

    Vector Position of the asteroid.
setPos (a, v)
Sets the position of an asteroid.

Parameters:

  • a Asteroid Asteroid to set position of.
  • v vec2 Position to set to.
setVel (a, v)
Sets the velocity of an asteroid.

Parameters:

  • a Asteroid Asteroid to set velocity of.
  • v vec2 Velocity to set to.
scanned (a)
Gets whether or not an asteroid got scanned.

Parameters:

  • a Asteroid Asteroid to get scanned state of.

Returns:

    boolean Whether or not the asteroid was scanned.
timer (a)
Gets the time left on the asteroid.

Parameters:

  • a Asteroid Asteroid to get time left on.

Returns:

  1. number Seconds left before the asteroid is unavailable.
  2. number Total number of seconds the asteroid had to live.
setTimer (a, Time)
Sets the time left on the asteroid.

Parameters:

  • a Asteroid Asteroid to set time left of.
  • Time number left to set to in seconds.
armour (a)
Gets the armour (health) left on the asteroid.

Parameters:

  • a Asteroid Asteroid to get armour of.

Returns:

    number Armour left before the asteroid is destroyed.
setTimer (a, Amount)
Sets the armour of the asteroid.

Parameters:

  • a Asteroid Asteroid to set armour of.
  • Amount number to set the armour to (negative values will explode it).
alertRange (a)
Gets the alert range of an asteroid.

Parameters:

  • a Asteroid Asteroid to get alert range of.

Returns:

    number Alert range of the asteroid.
materials (a)
Gets the materials the asteroid can potentially drop.

Parameters:

  • a Asteroid Asteroid to get materials of.

Returns:

    table Table containing the materials.
generated by LDoc 1.4.6 Last updated 2022-10-02 16:01:35