![]() |
naev 0.12.6
|
Bindings for asteroids from Lua. More...
#include "nlua_asteroid.h"#include "array.h"#include "nlua_commodity.h"#include "nlua_pilot.h"#include "nlua_vec2.h"#include "nluadef.h"#include "rng.h"#include "space.h"
Go to the source code of this file.
Functions | |
| static int | asteroidL_eq (lua_State *L) |
| Lua bindings to interact with asteroid. | |
| static int | asteroidL_tostring (lua_State *L) |
| Gets the asteroid's current (translated) name or notes it is inexistent. | |
| static int | asteroidL_getAll (lua_State *L) |
| Gets all the asteroids in the system. | |
| static int | asteroidL_get (lua_State *L) |
| Gets an asteroid in the system. | |
| static int | asteroidL_exists (lua_State *L) |
| Checks to see if an asteroid exists. | |
| static int | asteroidL_state (lua_State *L) |
| Gets the state of an asteroid. | |
| static int | asteroidL_setState (lua_State *L) |
| Sets the state of an asteroid. | |
| static int | asteroidL_field (lua_State *L) |
| Gets the field the asteroid belongs to (useful for getting more asteroids from the same field). | |
| static int | asteroidL_pos (lua_State *L) |
| Gets the position of an asteroid. | |
| static int | asteroidL_vel (lua_State *L) |
| Gets the velocity of an asteroid. | |
| static int | asteroidL_setPos (lua_State *L) |
| Sets the position of an asteroid. | |
| static int | asteroidL_setVel (lua_State *L) |
| Sets the velocity of an asteroid. | |
| static int | asteroidL_scanned (lua_State *L) |
| Gets whether or not an asteroid got scanned. | |
| static int | asteroidL_timer (lua_State *L) |
| Gets the time left on the asteroid. | |
| static int | asteroidL_setTimer (lua_State *L) |
| Sets the time left on the asteroid. | |
| static int | asteroidL_armour (lua_State *L) |
| Gets the armour (health) left on the asteroid. | |
| static int | asteroidL_setArmour (lua_State *L) |
| Sets the armour of the asteroid. | |
| static int | asteroidL_alertRange (lua_State *L) |
| Gets the alert range of an asteroid. | |
| static int | asteroidL_materials (lua_State *L) |
| Gets the materials the asteroid can potentially drop. | |
| int | nlua_loadAsteroid (nlua_env env) |
| Loads the asteroid library. | |
| LuaAsteroid_t * | lua_toasteroid (lua_State *L, int ind) |
| Gets asteroid at index. | |
| LuaAsteroid_t * | luaL_checkasteroid (lua_State *L, int ind) |
| Gets asteroid at index or raises error if there is no asteroid at index. | |
| Asteroid * | luaL_validasteroid (lua_State *L, int ind) |
| Gets asteroid at index raising an error if type doesn't match. | |
| LuaAsteroid_t * | lua_pushasteroid (lua_State *L, LuaAsteroid_t asteroid) |
| Pushes a asteroid on the stack. | |
| int | lua_isasteroid (lua_State *L, int ind) |
| Checks to see if ind is a asteroid. | |
Variables | |
| static const luaL_Reg | asteroidL_methods [] |
Bindings for asteroids from Lua.
Definition in file nlua_asteroid.c.
|
static |
Gets the alert range of an asteroid.
Lua function parameter: Asteroid a Asteroid to get alert range of. Lua return parameter: number Alert range of the asteroid.
| L | Lua State |
Lua function: alertRange
Definition at line 618 of file nlua_asteroid.c.
|
static |
Gets the armour (health) left on the asteroid.
Lua function parameter: Asteroid a Asteroid to get armour of. Lua return parameter: number Armour left before the asteroid is destroyed.
| L | Lua State |
Lua function: armour
Definition at line 587 of file nlua_asteroid.c.
|
static |
Lua bindings to interact with asteroid.
Lua module: asteroid
Compares two asteroids to see if they are the same.
Lua function parameter: Asteroid a1 Asteroid 1 to compare. Lua function parameter: Asteroid a2 Asteroid 2 to compare. Lua return parameter: boolean true if both asteroids are the same.
| L | Lua State |
Lua function: __eq
Definition at line 200 of file nlua_asteroid.c.
|
static |
Checks to see if an asteroid exists.
Lua function parameter: Asteroid a Asteroid to check to see if exists. Lua return parameter: boolean true if te asteroid exists, false otherwise.
| L | Lua State |
Lua function: exists
Definition at line 362 of file nlua_asteroid.c.
|
static |
Gets the field the asteroid belongs to (useful for getting more asteroids from the same field).
Lua function parameter: Asteroid a Asteroid to get what field it belongs to. Lua return parameter: number ID of the field the asteroid belongs to.
| L | Lua State |
Lua function: field
Definition at line 470 of file nlua_asteroid.c.
|
static |
Gets an asteroid in the system.
Lua function parameter: nil|number|Vector|Pilot If 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. Lua return parameter: Asteroid The closest asteroid or nil if not found.
| L | Lua State |
Lua function: get
Definition at line 265 of file nlua_asteroid.c.
|
static |
Gets all the asteroids in the system.
Lua return parameter: table t A list of all asteroids in the system.
| L | Lua State |
Lua function: getAll
Definition at line 234 of file nlua_asteroid.c.
|
static |
Gets the materials the asteroid can potentially drop.
Lua function parameter: Asteroid a Asteroid to get materials of. Lua return parameter: table Table containing the materials.
| L | Lua State |
Lua function: materials
Definition at line 632 of file nlua_asteroid.c.
|
static |
Gets the position of an asteroid.
Lua function parameter: Asteroid a Asteroid to get position of. Lua return parameter: Vector Position of the asteroid.
| L | Lua State |
Lua function: pos
Definition at line 484 of file nlua_asteroid.c.
|
static |
Gets whether or not an asteroid got scanned.
Lua function parameter: Asteroid a Asteroid to get scanned state of. Lua return parameter: boolean Whether or not the asteroid was scanned.
| L | Lua State |
Lua function: scanned
Definition at line 542 of file nlua_asteroid.c.
|
static |
Sets the armour of the asteroid.
Lua function parameter: Asteroid a Asteroid to set armour of. Lua function parameter: number Amount to set the armour to (negative values will explode it).
| L | Lua State |
Lua function: setTimer
Definition at line 602 of file nlua_asteroid.c.
|
static |
Sets the position of an asteroid.
Lua function parameter: Asteroid a Asteroid to set position of. Lua function parameter: vec2 v Position to set to.
| L | Lua State |
Lua function: setPos
Definition at line 512 of file nlua_asteroid.c.
|
static |
Sets the state of an asteroid.
Lua function parameter: Asteroid a Asteroid to set state of. Lua function parameter: string s 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".
| L | Lua State |
Lua function: state
Definition at line 437 of file nlua_asteroid.c.
|
static |
Sets the time left on the asteroid.
Lua function parameter: Asteroid a Asteroid to set time left of. Lua function parameter: number Time left to set to in seconds.
| L | Lua State |
Lua function: setTimer
Definition at line 572 of file nlua_asteroid.c.
|
static |
Sets the velocity of an asteroid.
Lua function parameter: Asteroid a Asteroid to set velocity of. Lua function parameter: vec2 v Velocity to set to.
| L | Lua State |
Lua function: setVel
Definition at line 527 of file nlua_asteroid.c.
|
static |
Gets the state of an asteroid.
Lua function parameter: Asteroid a Asteroid to check state of. Lua return parameter: 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".
| L | Lua State |
Lua function: state
Definition at line 395 of file nlua_asteroid.c.
|
static |
Gets the time left on the asteroid.
Lua function parameter: Asteroid a Asteroid to get time left on. Lua return parameter: number Seconds left before the asteroid is unavailable. Lua return parameter: number Total number of seconds the asteroid had to live.
| L | Lua State |
Lua function: timer
Definition at line 557 of file nlua_asteroid.c.
|
static |
Gets the asteroid's current (translated) name or notes it is inexistent.
Lua usage parameter: tostring(a)
Lua function parameter: Asteroid a Asteroid to convert to string. Lua return parameter: string A string representation of the asteroid. if not existent.
| L | Lua State |
Lua function: __tostring
Definition at line 219 of file nlua_asteroid.c.
|
static |
Gets the velocity of an asteroid.
Lua function parameter: Asteroid a Asteroid to get velocity of. Lua return parameter: Vector Position of the asteroid.
| L | Lua State |
Lua function: vel
Definition at line 498 of file nlua_asteroid.c.
| int lua_isasteroid | ( | lua_State * | L, |
| int | ind ) |
Checks to see if ind is a asteroid.
| L | Lua state to check. |
| ind | Index position to check. |
Definition at line 170 of file nlua_asteroid.c.
| LuaAsteroid_t * lua_pushasteroid | ( | lua_State * | L, |
| LuaAsteroid_t | asteroid ) |
Pushes a asteroid on the stack.
| L | Lua state to push asteroid into. |
| asteroid | Asteroid to push. |
Definition at line 154 of file nlua_asteroid.c.
| LuaAsteroid_t * lua_toasteroid | ( | lua_State * | L, |
| int | ind ) |
Gets asteroid at index.
| L | Lua state to get asteroid from. |
| ind | Index position to find the asteroid. |
Definition at line 87 of file nlua_asteroid.c.
| LuaAsteroid_t * luaL_checkasteroid | ( | lua_State * | L, |
| int | ind ) |
Gets asteroid at index or raises error if there is no asteroid at index.
| L | Lua state to get asteroid from. |
| ind | Index position to find asteroid. |
Definition at line 99 of file nlua_asteroid.c.
| Asteroid * luaL_validasteroid | ( | lua_State * | L, |
| int | ind ) |
Gets asteroid at index raising an error if type doesn't match.
| L | Lua state to get system from. |
| ind | Index position of system. |
Definition at line 113 of file nlua_asteroid.c.
| int nlua_loadAsteroid | ( | nlua_env | env | ) |
Loads the asteroid library.
| env | Lua environment. |
Definition at line 74 of file nlua_asteroid.c.
|
static |
AsteroidLua methods.
Definition at line 46 of file nlua_asteroid.c.