![]() |
naev 0.12.5
|
Handles the Lua outfit bindings. More...
#include "nlua_outfit.h"#include "array.h"#include "damagetype.h"#include "nlua_faction.h"#include "nlua_pilot.h"#include "nlua_ship.h"#include "nlua_tex.h"#include "nluadef.h"#include "player.h"#include "slots.h"
Go to the source code of this file.
Macros | |
| #define | SETFIELD(name, value) |
| #define | SETFIELDI(name, value) |
| #define | SETFIELDB(name, value) |
Functions | |
| static int | outfitL_eq (lua_State *L) |
| Checks to see if two outfits are the same. | |
| static int | outfitL_get (lua_State *L) |
| Gets a outfit. | |
| static int | outfitL_exists (lua_State *L) |
| Gets a outfit if it exists, nil otherwise. | |
| static int | outfitL_getAll (lua_State *L) |
| Gets all the outfits. | |
| static int | outfitL_name (lua_State *L) |
| Gets the translated name of the outfit. | |
| static int | outfitL_nameRaw (lua_State *L) |
| Gets the raw (untranslated) name of the outfit. | |
| static int | outfitL_shortname (lua_State *L) |
| Gets the translated short name of the outfit. | |
| static int | outfitL_type (lua_State *L) |
| Gets the type of an outfit. | |
| static int | outfitL_typeBroad (lua_State *L) |
| Gets the broad type of an outfit. | |
| static int | outfitL_cpu (lua_State *L) |
| Gets the cpu usage of an outfit. | |
| static int | outfitL_mass (lua_State *L) |
| Gets the mass of an outfit. | |
| static int | outfitL_heatFor (lua_State *L) |
| Calculates a heat value to be used with heat up. | |
| static int | outfitL_slot (lua_State *L) |
| Gets the slot name, size and property of an outfit. | |
| static int | outfitL_limit (lua_State *L) |
| Gets the limit string of the outfit. Only one outfit can be equipped at the same time for each limit string. | |
| static int | outfitL_icon (lua_State *L) |
| Gets the store icon for an outfit. | |
| static int | outfitL_price (lua_State *L) |
| Gets the price of an outfit. | |
| static int | outfitL_description (lua_State *L) |
| Gets the description of an outfit (translated). | |
| static int | outfitL_summary (lua_State *L) |
| Gets the summary of an outfit (translated). | |
| static int | outfitL_unique (lua_State *L) |
| Gets whether or not an outfit is unique. | |
| static int | outfitL_friendlyfire (lua_State *L) |
| Gets whether or not a weapon outfit can do friendly fire. | |
| static int | outfitL_pointdefense (lua_State *L) |
| Gets whether or not a weapon outfit is point defense. | |
| static int | outfitL_miss_ships (lua_State *L) |
| Gets whether or not a weapon outfit misses ships. | |
| static int | outfitL_miss_asteroids (lua_State *L) |
| Gets whether or not a weapon outfit misses asteroids. | |
| static int | outfitL_toggleable (lua_State *L) |
| Gets whether or not an outfit is toggleable. | |
| static int | outfitL_getShipStat (lua_State *L) |
| Gets a shipstat from an Outfit by name, or a table containing all the ship stats if not specified. | |
| static int | outfitL_weapStats (lua_State *L) |
| Computes statistics for weapons. | |
| static int | outfitL_specificStats (lua_State *L) |
| Returns raw data specific to each outfit type. | |
| static int | outfitL_illegality (lua_State *L) |
| Gets the factions to which the outfit is illegal to. | |
| static int | outfitL_known (lua_State *L) |
| Gets whether or not the outfit is known to the player, as in they know a spob that sells it or own it. | |
| static int | outfitL_tags (lua_State *L) |
| Gets the outfit tags. | |
| int | nlua_loadOutfit (nlua_env env) |
| Loads the outfit library. | |
| const Outfit * | lua_tooutfit (lua_State *L, int ind) |
| Lua bindings to interact with outfits. | |
| const Outfit * | luaL_checkoutfit (lua_State *L, int ind) |
| Gets outfit at index or raises error if there is no outfit at index. | |
| const Outfit * | luaL_validoutfit (lua_State *L, int ind) |
| Makes sure the outfit is valid or raises a Lua error. | |
| const Outfit ** | lua_pushoutfit (lua_State *L, const Outfit *outfit) |
| Pushes a outfit on the stack. | |
| int | lua_isoutfit (lua_State *L, int ind) |
| Checks to see if ind is a outfit. | |
| static int | getprop (lua_State *L, int prop) |
Variables | |
| static const luaL_Reg | outfitL_methods [] |
Handles the Lua outfit bindings.
Definition in file nlua_outfit.c.
| #define SETFIELD | ( | name, | |
| value ) |
Definition at line 798 of file nlua_outfit.c.
| #define SETFIELDB | ( | name, | |
| value ) |
Definition at line 804 of file nlua_outfit.c.
| #define SETFIELDI | ( | name, | |
| value ) |
Definition at line 801 of file nlua_outfit.c.
|
static |
Definition at line 566 of file nlua_outfit.c.
| int lua_isoutfit | ( | lua_State * | L, |
| int | ind ) |
Checks to see if ind is a outfit.
| L | Lua state to check. |
| ind | Index position to check. |
Definition at line 191 of file nlua_outfit.c.
Pushes a outfit on the stack.
| L | Lua state to push outfit into. |
| outfit | Outfit to push. |
Definition at line 176 of file nlua_outfit.c.
| const Outfit * lua_tooutfit | ( | lua_State * | L, |
| int | ind ) |
Lua bindings to interact with outfits.
This will allow you to create and manipulate outfits in-game.
An example would be:
Lua module: outfit
Gets outfit at index.
| L | Lua state to get outfit from. |
| ind | Index position to find the outfit. |
Definition at line 126 of file nlua_outfit.c.
| const Outfit * luaL_checkoutfit | ( | lua_State * | L, |
| int | ind ) |
Gets outfit at index or raises error if there is no outfit at index.
| L | Lua state to get outfit from. |
| ind | Index position to find outfit. |
Definition at line 137 of file nlua_outfit.c.
| const Outfit * luaL_validoutfit | ( | lua_State * | L, |
| int | ind ) |
Makes sure the outfit is valid or raises a Lua error.
| L | State currently running. |
| ind | Index of the outfit to validate. |
Definition at line 151 of file nlua_outfit.c.
| int nlua_loadOutfit | ( | nlua_env | env | ) |
Loads the outfit library.
| env | Environment to load outfit library into. |
Definition at line 99 of file nlua_outfit.c.
|
static |
Gets the cpu usage of an outfit.
Lua usage parameter: print( o:cpu() ) – Prints the cpu usage of an outfit
Lua function parameter: Outfit o Outfit to get information of. Lua return parameter: string The amount of cpu the outfit uses.
| L | Lua State |
Lua function: cpu
Definition at line 396 of file nlua_outfit.c.
|
static |
Gets the description of an outfit (translated).
Lua usage parameter: description = o:description()
Lua function parameter: outfit|String o Outfit to get the description of. Lua function parameter:[opt=player.pilot()] Pilot p Pilot to set description to. Lua return parameter: string The description (with translating).
| L | Lua State |
Lua function: description
Definition at line 531 of file nlua_outfit.c.
|
static |
Checks to see if two outfits are the same.
Lua usage parameter: if o1 == o2 then – Checks to see if outfit o1 and o2 are the same
Lua function parameter: Outfit o1 First outfit to compare. Lua function parameter: Outfit o2 Second outfit to compare. Lua return parameter: boolean true if both outfits are the same.
| L | Lua State |
Lua function: __eq
Definition at line 217 of file nlua_outfit.c.
|
static |
Gets a outfit if it exists, nil otherwise.
Does not raise any warnings or errors if fails.
Lua usage parameter: s = outfit.exists( "Heavy Laser" ) – Gets the heavy laser if it exists
Lua function parameter: string s Raw (untranslated) name of the outfit to get. Lua return parameter: Outfit|nil The outfit matching name or nil if not found
| L | Lua State |
Lua function: get
Definition at line 259 of file nlua_outfit.c.
|
static |
Gets whether or not a weapon outfit can do friendly fire.
Lua function parameter: outfit|String o Outfit to get the property of of. Lua return parameter: boolean Whether or not the outfit can do friendly fire damage.
| L | Lua State |
Lua function: friendlyfire
Definition at line 594 of file nlua_outfit.c.
|
static |
Gets a outfit.
Will raise an error if fails.
Lua usage parameter: s = outfit.get( "Heavy Laser" ) – Gets the heavy laser
Lua function parameter: string s Raw (untranslated) name of the outfit to get. Lua return parameter: Outfit|nil The outfit matching name or nil if error.
| L | Lua State |
Lua function: get
Definition at line 240 of file nlua_outfit.c.
|
static |
Gets all the outfits.
Lua return parameter: Table Table containing all the outfits.
| L | Lua State |
Lua function: getAll
Definition at line 284 of file nlua_outfit.c.
|
static |
Gets a shipstat from an Outfit by name, or a table containing all the ship stats if not specified.
Lua function parameter: Outfit o Outfit to get ship stat of. Lua function parameter:[opt=nil] string name Name of the ship stat to get. Lua function parameter:[opt=false] boolean internal Whether or not to use the internal representation. Lua return parameter: Value of the ship stat or a tale containing all the ship stats if name is not specified.
| L | Lua State |
Lua function: shipstat
Definition at line 661 of file nlua_outfit.c.
|
static |
Calculates a heat value to be used with heat up.
Lua function parameter: Number heatup How many "pulses" are needed to heat up to 800 kelvin. Each pulse can represent a discrete event or per second if multiplied by dt. Lua return parameter: Number The heat value corresponding to the number of pulses.
| L | Lua State |
Lua function: heatFor
Definition at line 431 of file nlua_outfit.c.
|
static |
Gets the store icon for an outfit.
Lua usage parameter: ico = o:icon() – Gets the shop icon for an outfit
Lua function parameter: Outfit o Outfit to get information of. Lua return parameter: Tex The texture containing the icon of the outfit.
| L | Lua State |
Lua function: icon
Definition at line 497 of file nlua_outfit.c.
|
static |
Gets the factions to which the outfit is illegal to.
Lua function parameter: o Outfit to get illegality status of. Lua return parameter: table Table of all the factions the outfit is illegal to.
| L | Lua State |
Lua function: illegality
Definition at line 920 of file nlua_outfit.c.
|
static |
Gets whether or not the outfit is known to the player, as in they know a spob that sells it or own it.
Definition at line 935 of file nlua_outfit.c.
|
static |
Gets the limit string of the outfit. Only one outfit can be equipped at the same time for each limit string.
Lua function parameter: Outfit o Outfit to get information of. Lua return parameter: string|nil Limit string or nil if not applicable.
| L | Lua State |
Lua function: limit
Definition at line 478 of file nlua_outfit.c.
|
static |
Gets the mass of an outfit.
Lua usage parameter: print( o:mass() ) – Prints the mass of an outfit
Lua function parameter: Outfit o Outfit to get information of. Lua return parameter: string The amount of mass the outfit uses.
| L | Lua State |
Lua function: mass
Definition at line 412 of file nlua_outfit.c.
|
static |
Gets whether or not a weapon outfit misses asteroids.
Lua function parameter: outfit|String o Outfit to get the property of of. Lua return parameter: boolean Whether or not the outfit misses asteroids.
| L | Lua State |
Lua function: missAsteroids
Definition at line 630 of file nlua_outfit.c.
|
static |
Gets whether or not a weapon outfit misses ships.
Lua function parameter: outfit|String o Outfit to get the property of of. Lua return parameter: boolean Whether or not the outfit misses ships.
| L | Lua State |
Lua function: missShips
Definition at line 618 of file nlua_outfit.c.
|
static |
Gets the translated name of the outfit.
This translated name should be used for display purposes (e.g. messages). It cannot be used as an identifier for the outfit; for that, use outfit.nameRaw() instead.
Lua usage parameter: outfitname = o:name() – Equivalent to _(o:nameRaw())
Lua function parameter: Outfit s Outfit to get the translated name of. Lua return parameter: string The translated name of the outfit.
| L | Lua State |
Lua function: name
Definition at line 308 of file nlua_outfit.c.
|
static |
Gets the raw (untranslated) name of the outfit.
This untranslated name should be used for identification purposes (e.g. can be passed to outfit.get()). It should not be used directly for display purposes without manually translating it with _().
Lua usage parameter: outfitrawname = o:nameRaw()
Lua function parameter: Outfit s Outfit to get the raw name of. Lua return parameter: string The raw name of the outfit.
| L | Lua State |
Lua function: nameRaw
Definition at line 328 of file nlua_outfit.c.
|
static |
Gets whether or not a weapon outfit is point defense.
Lua function parameter: outfit|String o Outfit to get the property of of. Lua return parameter: boolean Whether or not the outfit is point defense.
| L | Lua State |
Lua function: pointdefense
Definition at line 606 of file nlua_outfit.c.
|
static |
Gets the price of an outfit.
Lua usage parameter: price = o:price()
Lua function parameter: outfit|String o Outfit to get the price of. Lua return parameter: number The price, in credits.
| L | Lua State |
Lua function: price
Definition at line 514 of file nlua_outfit.c.
|
static |
Gets the translated short name of the outfit.
This translated name should be used when you have abbreviate the outfit greatly, e.g., the GUI. In the case the outfit has no special shortname, it's equivalent to outfit.name().
Lua function parameter: Outfit s Outfit to get the translated short name of. Lua return parameter: string The translated short name of the outfit.
| L | Lua State |
Lua function: shortname
Definition at line 346 of file nlua_outfit.c.
|
static |
Gets the slot name, size and property of an outfit.
Lua usage parameter: slot_name, slot_size, slot_prop = o:slot() – Gets an outfit's slot info
Lua function parameter: Outfit o Outfit to get information of. Lua return parameter: string Human readable name (in English). Lua return parameter: string Human readable size (in English). Lua return parameter: string Human readable property (in English). Lua return parameter: boolean Slot is required. Lua return parameter: boolean Slot is exclusive.
| L | Lua State |
Lua function: slot
Definition at line 459 of file nlua_outfit.c.
|
static |
Returns raw data specific to each outfit type.
Lua return parameter: A table containing the raw values.
| L | Lua State |
Lua function: specificstats
Definition at line 813 of file nlua_outfit.c.
|
static |
Gets the summary of an outfit (translated).
Lua usage parameter: summary = o:summary()
Lua function parameter: outfit|String o Outfit to get the summary of. Lua function parameter:[opt=player.pilot()] Pilot p Pilot to set summary to. Lua function parameter:[opt=false] string noname Whether or not to hide the outfit name at the top. Lua return parameter: string The summary (with translating).
| L | Lua State |
Lua function: summary
Definition at line 554 of file nlua_outfit.c.
|
static |
Gets the outfit tags.
Lua usage parameter: if o:tags["fancy"] then – Has "fancy" tag
Lua function parameter: Outfit o Outfit to get tags of. Lua function parameter:[opt=nil] string tag Tag to check if exists. Lua return parameter: table|boolean Table of tags where the name is the key and true is the value or a boolean value if a string is passed as the second parameter indicating whether or not the specified tag exists.
| L | Lua State |
Lua function: tags
Definition at line 984 of file nlua_outfit.c.
|
static |
Gets whether or not an outfit is toggleable.
Lua function parameter: outfit|String o Outfit to get the property of of. Lua return parameter: boolean Whether or not the outfit is toggleable.
| L | Lua State |
Lua function: toggleable
Definition at line 642 of file nlua_outfit.c.
|
static |
Gets the type of an outfit.
Lua usage parameter: print( o:type() ) – Prints the type of the outfit
Lua function parameter: Outfit o Outfit to get information of. Lua return parameter: string The name of the outfit type (in English).
| L | Lua State |
Lua function: type
Definition at line 362 of file nlua_outfit.c.
|
static |
Gets the broad type of an outfit.
This name is more generic and vague than type().
Lua usage parameter: print( o:typeBroad() ) – Prints the broad type of the outfit
Lua function parameter: Outfit o Outfit to get information of. Lua return parameter: string The name of the outfit broad type (in English).
| L | Lua State |
Lua function: typeBroad
Definition at line 380 of file nlua_outfit.c.
|
static |
Gets whether or not an outfit is unique.
Lua usage parameter: isunique = o:unique()
Lua function parameter: outfit|String o Outfit to get the uniqueness of. Lua return parameter: boolean The uniqueness of the outfit.
| L | Lua State |
Lua function: unique
Definition at line 582 of file nlua_outfit.c.
|
static |
Computes statistics for weapons.
Lua function parameter: Outfit o Outfit to compute for. Lua function parameter:[opt=nil] Pilot p Pilot to use ship stats when computing. Lua return parameter: number Damage per secondof the outfit. Lua return parameter: number Disable per second of the outfit. Lua return parameter: number Energy per second of the outfit. Lua return parameter: number Range of the outfit. Lua return parameter: number trackmin Minimum tracking value of the outfit. Lua return parameter: number trackmax Maximum tracking value of the outfit. Lua return parameter: number lockon Time to lockon.
| L | Lua State |
Lua function: weapstats
Definition at line 687 of file nlua_outfit.c.
|
static |
Outfit metatable methods.
Definition at line 59 of file nlua_outfit.c.