![]() |
naev 0.12.5
|
Lua spob module. More...
#include "nlua_spob.h"#include "array.h"#include "land.h"#include "land_outfits.h"#include "map_overlay.h"#include "nlua_colour.h"#include "nlua_commodity.h"#include "nlua_faction.h"#include "nlua_outfit.h"#include "nlua_ship.h"#include "nlua_system.h"#include "nlua_tex.h"#include "nlua_time.h"#include "nlua_vec2.h"#include "nluadef.h"#include "nmath.h"
Go to the source code of this file.
Functions | |
| static int | spobL_cur (lua_State *L) |
| Gets the current spob - MUST BE LANDED. | |
| static int | spobL_get (lua_State *L) |
| Gets a spob. | |
| static int | spobL_getS (lua_State *L) |
| Gets a spob and its corresponding system. | |
| static int | spobL_getLandable (lua_State *L) |
| Gets a spob only if it's landable. | |
| static int | spobL_getAll (lua_State *L) |
| Gets all the spobs. Lua function parameter: boolean all_spob Whether or not to get all Spob, including those that may not be located in a system at the time. Lua return parameter: {Spob,...} An ordered list of all the spobs. | |
| static int | spobL_system (lua_State *L) |
| Gets the system corresponding to a spob. Lua function parameter: Spob p Spob to get system of. Lua return parameter: System|nil The system to which the spob belongs or nil if it has none. | |
| static int | spobL_eq (lua_State *L) |
| You can use the '==' operator within Lua to compare spobs with this. | |
| static int | spobL_name (lua_State *L) |
| Gets the spob's translated name. | |
| static int | spobL_nameRaw (lua_State *L) |
| Gets the spob's raw (untranslated) name. | |
| static int | spobL_population (lua_State *L) |
| Gets the spob's population. | |
| static int | spobL_radius (lua_State *L) |
| Gets the spob's radius. | |
| static int | spobL_faction (lua_State *L) |
| Gets the spob's faction. | |
| static int | spobL_reputation (lua_State *L) |
| Gets the local reputation of the faction at a spob. | |
| static int | spobL_colour (lua_State *L) |
| Gets a spob's colour based on its friendliness or hostility to the player. | |
| static int | spobL_colourChar (lua_State *L) |
| Gets a spob's colour based on its friendliness or hostility to the player. | |
| static int | spobL_class (lua_State *L) |
| Gets the spob's class. | |
| static int | spobL_classLong (lua_State *L) |
| Gets the spob's class in long human-readable format already translated. | |
| static int | spobL_position (lua_State *L) |
| Gets the position of the spob in the system. | |
| static int | spobL_services (lua_State *L) |
| Checks for spob services. | |
| static int | spobL_flags (lua_State *L) |
| Checks for spob flags. | |
| static int | spobL_canland (lua_State *L) |
| Gets whether or not the player can land on the spob (or bribe it). | |
| static int | spobL_landAllow (lua_State *L) |
| Allows the player land on a spob no matter what. The override lasts until the player jumps or lands. | |
| static int | spobL_landDeny (lua_State *L) |
| Disallows a player from landing on a spob. The override lasts until the player jumps or lands. | |
| static int | spobL_getLandAllow (lua_State *L) |
| Gets the land allow override status for a spob. | |
| static int | spobL_getLandDeny (lua_State *L) |
| Gets the land deny override status for a spob. | |
| static int | spobL_gfxSpace (lua_State *L) |
| Gets the texture of the spob in space. | |
| static int | spobL_gfxExterior (lua_State *L) |
| Gets the texture of the spob in exterior. | |
| static int | spobL_gfxExteriorPath (lua_State *L) |
| Gets the path of the spob in exterior. | |
| static int | spobL_gfxComm (lua_State *L) |
| Gets the texture of the spob for the communication window. | |
| static int | spobL_shipsSold (lua_State *L) |
| Gets the ships sold at a spob. | |
| static int | spobL_outfitsSold (lua_State *L) |
| Gets the outfits sold at a spob. | |
| static int | spobL_commoditiesSold (lua_State *L) |
| Gets the commodities sold at a spob. | |
| static int | spobL_isBlackMarket (lua_State *L) |
| Checks to see if a spob is a black market. | |
| static int | spobL_isKnown (lua_State *L) |
| Checks to see if a spob is known by the player. | |
| static int | spobL_setKnown (lua_State *L) |
| Sets a spobs's known state. | |
| static int | spobL_isHostile (lua_State *L) |
| Checks to see if a spob currently has the hostile flag set. | |
| static int | spobL_setHostile (lua_State *L) |
| Sets the hostile flag of a spob. | |
| static int | spobL_recordCommodityPriceAtTime (lua_State *L) |
| Records commodity prices at a given time, adding to players stats. | |
| static int | spobL_tags (lua_State *L) |
| Gets the spob tags. | |
| int | nlua_loadSpob (nlua_env env) |
| Loads the spob library. | |
| LuaSpob | lua_tospob (lua_State *L, int ind) |
| This module allows you to handle the spobs from Lua. | |
| LuaSpob | luaL_checkspob (lua_State *L, int ind) |
| Gets spob at index raising an error if isn't a spob. | |
| Spob * | luaL_validspob (lua_State *L, int ind) |
| Gets a spob directly. | |
| LuaSpob * | lua_pushspob (lua_State *L, LuaSpob spob) |
| Pushes a spob on the stack. | |
| int | lua_isspob (lua_State *L, int ind) |
| Checks to see if ind is a spob. | |
| static int | spobL_getBackend (lua_State *L, int system, int landable) |
| static int | landAllowDeny (lua_State *L, int allowdeny) |
Variables | |
| static const luaL_Reg | spob_methods [] |
Lua spob module.
Definition in file nlua_spob.c.
|
static |
Definition at line 753 of file nlua_spob.c.
| int lua_isspob | ( | lua_State * | L, |
| int | ind ) |
Checks to see if ind is a spob.
| L | Lua state to check. |
| ind | Index position to check. |
Definition at line 218 of file nlua_spob.c.
| LuaSpob * lua_pushspob | ( | lua_State * | L, |
| LuaSpob | spob ) |
Pushes a spob on the stack.
| L | Lua state to push spob into. |
| spob | Spob to push. |
Definition at line 203 of file nlua_spob.c.
| LuaSpob lua_tospob | ( | lua_State * | L, |
| int | ind ) |
This module allows you to handle the spobs from Lua.
Generally you do something like:
Lua module: spob
Gets spob at index.
| L | Lua state to get spob from. |
| ind | Index position to find the spob. |
Definition at line 152 of file nlua_spob.c.
| LuaSpob luaL_checkspob | ( | lua_State * | L, |
| int | ind ) |
Gets spob at index raising an error if isn't a spob.
| L | Lua state to get spob from. |
| ind | Index position to find the spob. |
Definition at line 163 of file nlua_spob.c.
| Spob * luaL_validspob | ( | lua_State * | L, |
| int | ind ) |
Gets a spob directly.
| L | Lua state to get spob from. |
| ind | Index position to find the spob. |
Definition at line 177 of file nlua_spob.c.
| int nlua_loadSpob | ( | nlua_env | env | ) |
Loads the spob library.
| env | Environment to load spob library into. |
Definition at line 124 of file nlua_spob.c.
|
static |
Gets whether or not the player can land on the spob (or bribe it).
Lua usage parameter: can_land, can_bribe = p:canLand() Lua function parameter: Spob p Spob to get land and bribe status of. Lua return parameter: boolean The land status of the spob.
| L | Lua State |
Lua function: canLand
Definition at line 745 of file nlua_spob.c.
|
static |
Gets the spob's class.
Usually classes are characters for spobs and numbers for stations.
Lua usage parameter: c = p:class() Lua function parameter: Spob p Spob to get the class of. Lua return parameter: string The class of the spob in a one char identifier.
| L | Lua State |
Lua function: class
Definition at line 648 of file nlua_spob.c.
|
static |
Gets the spob's class in long human-readable format already translated.
Lua usage parameter: c = p:classLong() Lua function parameter: Spob p Spob to get the class of. Lua return parameter: string The class of the spob in descriptive form such as "Pelagic".
| L | Lua State |
Lua function: classLong
Definition at line 665 of file nlua_spob.c.
|
static |
Gets a spob's colour based on its friendliness or hostility to the player.
Lua usage parameter: col = p:colour()
Lua function parameter: Spob spb Spob to get the colour of. Lua return parameter: Colour The spob's colour.
| L | Lua State |
Lua function: colour
Definition at line 608 of file nlua_spob.c.
|
static |
Gets a spob's colour based on its friendliness or hostility to the player.
Lua usage parameter: col = p:colourChar()
Lua function parameter: Spob spb Spob to get the colour of. Lua return parameter: string The spob's colour character for use with special printing sequences..
| L | Lua State |
Lua function: colourChar
Definition at line 627 of file nlua_spob.c.
|
static |
Gets the commodities sold at a spob.
Lua function parameter: Pilot p Spob to get commodities sold at. Lua return parameter: {Commodity,...} An ordered table containing all the commodities sold (empty if none sold).
| L | Lua State |
Lua function: commoditiesSold
Definition at line 981 of file nlua_spob.c.
|
static |
Gets the current spob - MUST BE LANDED.
Lua usage parameter: p,s = spob.cur() – Gets current spob (assuming landed)
Lua return parameter: Spob The spob the player is landed on. Lua return parameter: System The system it is in.
| L | Lua State |
Lua function: cur
Definition at line 243 of file nlua_spob.c.
|
static |
You can use the '==' operator within Lua to compare spobs with this.
Lua usage parameter: if p.__eq( spob.get( "Anecu" ) ) then – Do something Lua usage parameter: if p == spob.get( "Anecu" ) then – Do something Lua function parameter: Spob p Spob comparing. Lua function parameter: Spob comp spob to compare against. Lua return parameter: boolean true if both spobs are the same.
| L | Lua State |
Lua function: __eq
Definition at line 482 of file nlua_spob.c.
|
static |
Gets the spob's faction.
Lua usage parameter: f = p:faction() Lua function parameter: Spob p Spob to get the faction of. Lua return parameter: Faction The spob's faction, or nil if it has no faction.
| L | Lua State |
Lua function: faction
Definition at line 573 of file nlua_spob.c.
|
static |
Checks for spob flags.
Possible services are:
Lua usage parameter: if p:flags()["nomissionspawn"] then – Spob doesn't spawn missions Lua function parameter: Spob p Spob to get the services of. Lua return parameter: table Table containing all the services.
| L | Lua State |
Lua function: services
Definition at line 725 of file nlua_spob.c.
|
static |
Gets a spob.
Possible values of param:
Lua usage parameter: p = spob.get( "Anecu" ) – Gets spob by name Lua usage parameter: p = spob.get( faction.get( "Empire" ) ) – Gets random Empire spob Lua usage parameter: p = spob.get(true) – Gets completely random spob Lua usage parameter: p = spob.get( { faction.get("Empire"), faction.get("Dvaered") } ) – Random spob belonging to Empire or Dvaered Lua function parameter: boolean|Faction|string|table param See description. Lua return parameter: Spob The matching spob.
| L | Lua State |
Lua function: get
Definition at line 384 of file nlua_spob.c.
|
static |
Gets all the spobs. Lua function parameter: boolean all_spob Whether or not to get all Spob, including those that may not be located in a system at the time. Lua return parameter: {Spob,...} An ordered list of all the spobs.
| L | Lua State |
Lua function: getAll
Definition at line 438 of file nlua_spob.c.
|
static |
Definition at line 255 of file nlua_spob.c.
|
static |
Gets a spob only if it's landable.
It works exactly the same as spob.get(), but it can only return landable spobs. So if the target is not landable it returns nil.
Lua function parameter: boolean|Faction|string|table param See spob.get() description. Lua return parameter: Spob The matching spob, if it is landable. Lua return parameter: System The system it is in.
| L | Lua State |
Lua function: getLandable
Definition at line 426 of file nlua_spob.c.
|
static |
Gets the land allow override status for a spob.
Lua usage parameter: if p:getLandAllow() then – Player can definitely land. Lua function parameter: Spob p Spob to check. Lua return parameter: b Whether or not the player is always allowed to land.
| L | Lua State |
Lua function: getLandAllow
Definition at line 814 of file nlua_spob.c.
|
static |
Gets the land deny override status for a spob.
Lua usage parameter: if p:getLandDeny() then – Player can definitely not land Lua function parameter: Spob p Spob to check. Lua return parameter: b Whether or not the player is always disallowed to land.
| L | Lua State |
Lua function: getLandDeny
Definition at line 829 of file nlua_spob.c.
|
static |
Gets a spob and its corresponding system.
Possible values of param:
Lua usage parameter: p,s = spob.get( "Anecu" ) – Gets spob by name Lua usage parameter: p,s = spob.get( faction.get( "Empire" ) ) – Gets random Empire spob Lua usage parameter: p,s = spob.get(true) – Gets completely random spob Lua usage parameter: p,s = spob.get( { faction.get("Empire"), faction.get("Dvaered") } ) – Random spob belonging to Empire or Dvaered Lua function parameter: boolean|Faction|string|table param See description. Lua return parameter: Spob The matching spob. Lua return parameter: System The system it is in.
| L | Lua State |
Lua function: getS
Definition at line 410 of file nlua_spob.c.
|
static |
Gets the texture of the spob for the communication window.
Lua usage parameter: gfx = p:gfxComm() Lua function parameter: Spob p Spob Spob to get texture of. Lua return parameter: Tex The communication texture of the spob.
| L | Lua State |
Lua function: gfxComm
Definition at line 916 of file nlua_spob.c.
|
static |
Gets the texture of the spob in exterior.
Lua usage parameter: gfx = p:gfxExterior() Lua function parameter: Spob p Spob Spob to get texture of. Lua return parameter: Tex The exterior texture of the spob.
| L | Lua State |
Lua function: gfxExterior
Definition at line 882 of file nlua_spob.c.
|
static |
Gets the path of the spob in exterior.
Lua function parameter: Spob p Spob Spob to get texture of. Lua return parameter: string The path to the exterior texture.
| L | Lua State |
Lua function: gfxExteriorPath
Definition at line 901 of file nlua_spob.c.
|
static |
Gets the texture of the spob in space.
Lua usage parameter: gfx = p:gfxSpace() Lua function parameter: Spob p Spob to get texture of. Lua return parameter: Tex The space texture of the spob.
| L | Lua State |
Lua function: gfxSpace
Definition at line 859 of file nlua_spob.c.
|
static |
Checks to see if a spob is a black market.
Lua usage parameter: b = p:blackmarket()
Lua function parameter: Spob p Spob to check if it's a black market. Lua return parameter: boolean true if the spob is a black market.
| L | Lua State |
Lua function: blackmarket
Definition at line 1005 of file nlua_spob.c.
|
static |
Checks to see if a spob currently has the hostile flag set.
Lua function parameter: Spob spb Spob to check hostile flag status of. Lua return parameter: boolean Whether or not the spob is hostile.
| L | Lua State |
Lua function: hostile
Definition at line 1064 of file nlua_spob.c.
|
static |
Checks to see if a spob is known by the player.
Lua usage parameter: b = p:known()
Lua function parameter: Spob p Spob to check if the player knows. Lua return parameter: boolean true if the player knows the spob.
| L | Lua State |
Lua function: known
Definition at line 1021 of file nlua_spob.c.
|
static |
Allows the player land on a spob no matter what. The override lasts until the player jumps or lands.
Lua usage parameter: p:landAllow( true ) – Player can land on spob p now. Lua function parameter: Spob p Spob to forcibly allow the player to land on. Lua function parameter:[opt=false] boolean b Whether or not the player should be allowed to land, true enables, false disables override. Lua function parameter:[opt=nil] string msg Message to give the player when allowing them to land. Setting a message will bypass any custom Lua, otherwise it'll default to using Lua and, in the case there is no Lua, a default message.
| L | Lua State |
Lua function: landAllow
Definition at line 783 of file nlua_spob.c.
|
static |
Disallows a player from landing on a spob. The override lasts until the player jumps or lands.
Lua usage parameter: p:landDeny( true ) – Player can land on spob p now. Lua function parameter: Spob p Spob to forcibly disallow the player to land on. Lua function parameter:[opt=false] boolean b Whether or not the player should be disallowed to land, true disables, false disables override. Lua function parameter:[opt=nil] string msg Message to give the player when disallowing them to land. Setting a message will bypass any custom Lua, otherwise it'll default to using Lua and, in the case there is no Lua, a default message.
| L | Lua State |
Lua function: landDeny
Definition at line 801 of file nlua_spob.c.
|
static |
Gets the spob's translated name.
This translated name should be used for display purposes (e.g. messages). It cannot be used as an identifier for the spob; for that, use spob.nameRaw() instead.
Note that it can be overwritten by the spob's display name which makes it not equivalent to _(p:nameRaw()) in some cases.
Lua usage parameter: name = p:name() Lua function parameter: Spob p Spob to get the translated name of. Lua return parameter: string The translated name of the spob.
| L | Lua State |
Lua function: name
Definition at line 507 of file nlua_spob.c.
|
static |
Gets the spob's raw (untranslated) name.
This untranslated name should be used for identification purposes (e.g. can be passed to spob.get()). It should not be used directly for display purposes without manually translating it with _().
Lua usage parameter: name = p:nameRaw() Lua function parameter: Spob p Spob to get the raw name of. Lua return parameter: string The raw name of the spob.
| L | Lua State |
Lua function: nameRaw
Definition at line 526 of file nlua_spob.c.
|
static |
Gets the outfits sold at a spob.
Lua function parameter: Spob p Spob to get outfits sold at. Lua return parameter: {Outfit,...} An ordered table containing all the outfits sold (empty if none sold).
| L | Lua State |
Lua function: outfitsSold
Definition at line 957 of file nlua_spob.c.
|
static |
Gets the spob's population.
Lua function parameter: Spob p Spob to get the population of. Lua return parameter: number The spob's population.
| L | Lua State |
Lua function: population
Definition at line 540 of file nlua_spob.c.
|
static |
Gets the position of the spob in the system.
Lua usage parameter: v = p:pos() Lua function parameter: Spob p Spob to get the position of. Lua return parameter: Vec2 The position of the spob in the system.
| L | Lua State |
Lua function: pos
Definition at line 844 of file nlua_spob.c.
|
static |
Gets the spob's radius.
Lua usage parameter: radius = p:radius() Lua function parameter: Spob p Spob to get the radius of. Lua return parameter: number The spob's graphics radius.
| L | Lua State |
Lua function: radius
Definition at line 555 of file nlua_spob.c.
|
static |
Records commodity prices at a given time, adding to players stats.
Lua usage parameter: p:recordCommodityPriceAtTime( t ) Lua function parameter: Spob p Spob to record prices at Lua function parameter: ntime_t t Time at which to record prices.
| L | Lua State |
Lua function: recordCommodityPriceAtTime
Definition at line 1096 of file nlua_spob.c.
|
static |
Gets the local reputation of the faction at a spob.
Lua function parameter: Spob spb Spob to get the reputation of. Lua return parameter: number The reputation of the player at the space object.
| L | Lua State |
Lua function: reputation
Definition at line 589 of file nlua_spob.c.
|
static |
Checks for spob services.
Possible services are:
Lua usage parameter: if p:services()["refuel"] then – Spob has refuel service. Lua usage parameter: if p:services()["shipyard"] then – Spob has shipyard service. Lua function parameter: Spob p Spob to get the services of. Lua return parameter: table Table containing all the services.
| L | Lua State |
Lua function: services
Definition at line 692 of file nlua_spob.c.
|
static |
Sets the hostile flag of a spob.
Lua function parameter: Spob spb Spob to set hostile flag. Lua return parameter: boolean Whether or not to set the hostile status.
| L | Lua State |
Lua function: setHostile
Definition at line 1078 of file nlua_spob.c.
|
static |
Sets a spobs's known state.
Lua usage parameter: p:setKnown( false ) – Makes spob unknown. Lua function parameter: Spob p Spob to set known. Lua function parameter:[opt=false] boolean b Whether or not to set as known.
| L | Lua State |
Lua function: setKnown
Definition at line 1036 of file nlua_spob.c.
|
static |
Gets the ships sold at a spob.
Lua function parameter: Spob p Spob to get ships sold at. Lua return parameter: {Ship,...} An ordered table containing all the ships sold (empty if none sold).
| L | Lua State |
Lua function: shipsSold
Definition at line 933 of file nlua_spob.c.
|
static |
Gets the system corresponding to a spob. Lua function parameter: Spob p Spob to get system of. Lua return parameter: System|nil The system to which the spob belongs or nil if it has none.
| L | Lua State |
Lua function: system
Definition at line 460 of file nlua_spob.c.
|
static |
Gets the spob tags.
Lua usage parameter: if spob.cur():tags()["fancy"] then – Has "fancy" tag
Lua function parameter: Spob p Spob 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 1116 of file nlua_spob.c.
|
static |
Spob metatable methods.
Definition at line 75 of file nlua_spob.c.