![]() |
naev 0.11.5
|
Handles the Lua faction bindings. More...
#include "nlua_faction.h"#include "array.h"#include "faction.h"#include "log.h"#include "nlua_colour.h"#include "nlua_tex.h"#include "nluadef.h"Go to the source code of this file.
Functions | |
| static LuaFaction | luaL_validfactionSilent (lua_State *L, int ind) |
| static int | factionL_exists (lua_State *L) |
| Lua bindings to deal with factions. | |
| static int | factionL_get (lua_State *L) |
| Gets the faction based on its name. | |
| static int | factionL_getAll (lua_State *L) |
| Gets all the factions. | |
| static int | factionL_player (lua_State *L) |
| Gets the player's faction. | |
| static int | factionL_eq (lua_State *L) |
| __eq (equality) metamethod for factions. | |
| static int | factionL_name (lua_State *L) |
| Gets the faction's translated short name. | |
| static int | factionL_nameRaw (lua_State *L) |
| Gets the faction's raw / "real" (untranslated, internal) name. | |
| static int | factionL_longname (lua_State *L) |
| Gets the faction's translated long name. | |
| static int | factionL_areenemies (lua_State *L) |
| Checks to see if f is an enemy of e. | |
| static int | factionL_areallies (lua_State *L) |
| Checks to see if f is an ally of a. | |
| static int | factionL_usesHiddenJumps (lua_State *L) |
| Gets whether or not a faction uses hidden jumps. | |
| static int | factionL_modplayer (lua_State *L) |
| Modifies the player's standing with the faction. | |
| static int | factionL_modplayersingle (lua_State *L) |
| Modifies the player's standing with the faction. | |
| static int | factionL_modplayerraw (lua_State *L) |
| Modifies the player's standing with the faction. | |
| static int | factionL_setplayerstanding (lua_State *L) |
| Sets the player's standing with the faction. | |
| static int | factionL_playerstanding (lua_State *L) |
| Gets the player's standing with the faction. | |
| static int | factionL_playerstandingdefault (lua_State *L) |
| Gets the player's default standing with the faction. | |
| static int | factionL_enemies (lua_State *L) |
| Gets the enemies of the faction. | |
| static int | factionL_allies (lua_State *L) |
| Gets the allies of the faction. | |
| static int | factionL_logo (lua_State *L) |
| Gets the faction logo. | |
| static int | factionL_colour (lua_State *L) |
| Gets the faction colour. | |
| static int | factionL_isKnown (lua_State *L) |
| Checks to see if a faction is known by the player. | |
| static int | factionL_setKnown (lua_State *L) |
| Sets a faction's known state. | |
| static int | factionL_isInvisible (lua_State *L) |
| Checks to see if a faction is invisible the player. | |
| static int | factionL_isStatic (lua_State *L) |
| Checks to see if a faction has a static standing with the player. | |
| static int | factionL_tags (lua_State *L) |
| Gets the tags a faction has. | |
| static int | factionL_dynAdd (lua_State *L) |
| Adds a faction dynamically. Note that if the faction already exists as a dynamic faction, the existing one is returned. | |
| static int | factionL_dynAlly (lua_State *L) |
| Adds or removes allies to a faction. Only works with dynamic factions. | |
| static int | factionL_dynEnemy (lua_State *L) |
| Adds or removes enemies to a faction. Only works with dynamic factions. | |
| int | nlua_loadFaction (nlua_env env) |
| Loads the faction library. | |
| LuaFaction | lua_tofaction (lua_State *L, int ind) |
| Gets faction at index. | |
| LuaFaction | luaL_validfaction (lua_State *L, int ind) |
| Gets faction (or faction name) at index, raising an error if type isn't a valid faction. | |
| LuaFaction * | lua_pushfaction (lua_State *L, LuaFaction faction) |
| Pushes a faction on the stack. | |
| int | lua_isfaction (lua_State *L, int ind) |
| Checks to see if ind is a faction. | |
Variables | |
| static const luaL_Reg | faction_methods [] |
Handles the Lua faction bindings.
These bindings control the factions.
Definition in file nlua_faction.c.
|
static |
Gets the allies of the faction.
Lua usage parameter: for k,v in pairs(f:allies()) do – Iterate over faction allies
Lua function parameter: Faction f Faction to get allies of. Lua return parameter: {Faction,...} A table containing the allies of the faction.
| L | Lua State |
Lua function: allies
Definition at line 526 of file nlua_faction.c.
|
static |
Checks to see if f is an ally of a.
Lua usage parameter: if f:areAllies( faction.get( "Pirate" ) ) then
Lua function parameter: Faction f Faction to check against. Lua function parameter: faction a Faction to check if is an enemy. Lua return parameter: boolean true if they are enemies, false if they aren't.
| L | Lua State |
Lua function: areAllies
Definition at line 369 of file nlua_faction.c.
|
static |
Checks to see if f is an enemy of e.
Lua usage parameter: if f:areEnemies( faction.get( "Dvaered" ) ) then
Lua function parameter: Faction f Faction to check against. Lua function parameter: Faction e Faction to check if is an enemy. Lua return parameter: string true if they are enemies, false if they aren't.
| L | Lua State |
Lua function: areEnemies
Definition at line 351 of file nlua_faction.c.
|
static |
Gets the faction colour.
Lua function parameter: Faction f Faction to get colour from. Lua return parameter: Colour|nil The faction colour or nil if not applicable.
| L | Lua State |
Lua function: colour
Definition at line 580 of file nlua_faction.c.
|
static |
Adds a faction dynamically. Note that if the faction already exists as a dynamic faction, the existing one is returned.
Lua function parameter: Faction|nil base Faction to base it off of or nil for new faction. Lua function parameter: string name Name to give the faction. Lua function parameter:[opt] string display Display name to give the faction. Lua function parameter:[opt] table params Table of parameters. Options include "ai" (string) to set the AI to use, "clear_allies" (boolean) to clear all allies, "clear_enemies" (boolean) to clear all enemies, "player" (number) to set the default player standing, "colour" (string|colour) which represents the factional colours.
| L | Lua State |
Lua function: dynAdd
Definition at line 687 of file nlua_faction.c.
|
static |
Adds or removes allies to a faction. Only works with dynamic factions.
Lua function parameter: Faction fac Faction to add ally to. Lua function parameter: Faction ally Faction to add as an ally. Lua function parameter:[opt=false] boolean remove Whether or not to remove the ally from the faction instead of adding it.
| L | Lua State |
Lua function: dynAlly
Definition at line 773 of file nlua_faction.c.
|
static |
Adds or removes enemies to a faction. Only works with dynamic factions.
Lua function parameter: Faction fac Faction to add enemy to. Lua function parameter: Faction enemy Faction to add as an enemy. Lua function parameter:[opt=false] boolean remove Whether or not to remove the enemy from the faction instead of adding it.
| L | Lua State |
Lua function: dynEnemy
Definition at line 797 of file nlua_faction.c.
|
static |
Gets the enemies of the faction.
Lua usage parameter: for k,v in pairs(f:enemies()) do – Iterates over enemies
Lua function parameter: Faction f Faction to get enemies of. Lua return parameter: {Faction,...} A table containing the enemies of the faction.
| L | Lua State |
Lua function: enemies
Definition at line 501 of file nlua_faction.c.
|
static |
__eq (equality) metamethod for factions.
You can use the '==' operator within Lua to compare factions with this.
Lua usage parameter: if f == faction.get( "Dvaered" ) then
Lua function parameter: Faction f Faction comparing. Lua function parameter: Faction comp faction to compare against. Lua return parameter: boolean true if both factions are the same.
| L | Lua State |
Lua function: __eq
Definition at line 271 of file nlua_faction.c.
|
static |
Lua bindings to deal with factions.
Use like:
Lua module: faction
Gets a faction if it exists.
Lua usage parameter: f = faction.exists( "Empire" )
Lua function parameter: string name Name of the faction to get if exists. Lua return parameter: Faction The faction matching name or nil if not matched.
| L | Lua State |
Lua function: exists
Definition at line 126 of file nlua_faction.c.
|
static |
Gets the faction based on its name.
Lua usage parameter: f = faction.get( "Empire" )
Lua function parameter: string name Name of the faction to get. Lua return parameter: Faction The faction matching name.
| L | Lua State |
Lua function: get
Definition at line 145 of file nlua_faction.c.
|
static |
Gets all the factions.
Lua return parameter: {Faction,...} An ordered table containing all of the factions.
| L | Lua State |
Lua function: getAll
Definition at line 158 of file nlua_faction.c.
|
static |
Checks to see if a faction is invisible the player.
Lua usage parameter: b = f:invisible()
Lua function parameter: Faction f Faction to check if is invisible to the player. Lua return parameter: boolean true if the faction is invisible to the player.
| L | Lua State |
Lua function: invisible
Definition at line 631 of file nlua_faction.c.
|
static |
Checks to see if a faction is known by the player.
Lua usage parameter: b = f:known()
Lua function parameter: Faction f Faction to check if the player knows. Lua return parameter: boolean true if the player knows the faction.
| L | Lua State |
Lua function: known
Definition at line 599 of file nlua_faction.c.
|
static |
Checks to see if a faction has a static standing with the player.
Lua usage parameter: b = f:static()
Lua function parameter: Faction f Faction to check if has a static standing to the player. Lua return parameter: boolean true if the faction is static to the player.
| L | Lua State |
Lua function: static
Definition at line 647 of file nlua_faction.c.
|
static |
Gets the faction logo.
Lua function parameter: Faction f Faction to get logo from. Lua return parameter: Tex The faction logo or nil if not applicable.
| L | Lua State |
Lua function: logo
Definition at line 563 of file nlua_faction.c.
|
static |
Gets the faction's translated long name.
This translated name should be used for display purposes (e.g. messages) where the longer version of the faction's display name should be used. It cannot be used as an identifier for the faction; for that, use faction.nameRaw() instead.
Lua usage parameter: longname = f:longname() Lua function parameter: Faction f Faction to get long name of. Lua return parameter: string The long name of the faction (translated).
| L | Lua State |
Lua function: longname
Definition at line 334 of file nlua_faction.c.
|
static |
Modifies the player's standing with the faction.
Also modifies standing with allies and enemies of the faction.
Lua usage parameter: f:modPlayer( -5 ) – Lowers faction by 5
Lua function parameter: Faction f Faction to modify player's standing with. Lua function parameter: number mod The modifier to modify faction by.
| L | Lua State |
Lua function: modPlayer
Definition at line 388 of file nlua_faction.c.
|
static |
Modifies the player's standing with the faction.
Does not affect other faction standings and is not processed by the faction Lua script, so it indicates exactly the amount to be changed.
Lua usage parameter: f:modPlayerRaw( 10 )
Lua function parameter: Faction f Faction to modify player's standing with. Lua function parameter: number mod The modifier to modify faction by.
| L | Lua State |
Lua function: modPlayerRaw
Definition at line 427 of file nlua_faction.c.
|
static |
Modifies the player's standing with the faction.
Does not affect other faction standings.
Lua usage parameter: f:modPlayerSingle( 10 )
Lua function parameter: Faction f Faction to modify player's standing with. Lua function parameter: number mod The modifier to modify faction by.
| L | Lua State |
Lua function: modPlayerSingle
Definition at line 407 of file nlua_faction.c.
|
static |
Gets the faction's translated short name.
This translated name should be used for display purposes (e.g. messages) where the shorter version of the faction's display name should be used. It cannot be used as an identifier for the faction; for that, use faction.nameRaw() instead.
Lua usage parameter: shortname = f:name()
Lua function parameter: Faction f The faction to get the name of. Lua return parameter: string The name of the faction.
| L | Lua State |
Lua function: name
Definition at line 293 of file nlua_faction.c.
|
static |
Gets the faction's raw / "real" (untranslated, internal) name.
This untranslated name should be used for identification purposes (e.g. can be passed to faction.get()). It should not be used for display purposes; for that, use faction.name() or faction.longname() instead.
Lua usage parameter: name = f:nameRaw()
Lua function parameter: Faction f The faction to get the name of. Lua return parameter: string The name of the faction.
| L | Lua State |
Lua function: nameRaw
Definition at line 314 of file nlua_faction.c.
|
static |
Gets the player's faction.
Lua usage parameter: pf = faction.player()
Lua return parameter: Faction The player's faction.
| L | Lua State |
Lua function: player
Definition at line 178 of file nlua_faction.c.
|
static |
Gets the player's standing with the faction.
Lua usage parameter: if f:playerStanding() > 70 then – Player is an ally Lua usage parameter: _v, str = f:playerStanding(50) – Get the standing text for a value of 50
Lua function parameter: Faction f Faction to get player's standing with. Lua function parameter: number value Faction standing value to get string of. Lua return parameter: number The value of the standing and the human readable string. Lua return parameter: string The text corresponding to the standing (translated).
| L | Lua State |
Lua function: playerStanding
Definition at line 464 of file nlua_faction.c.
|
static |
Gets the player's default standing with the faction.
Lua function parameter: Faction f Faction to get player's default standing with. Lua return parameter: number The value of the standing and the human readable string.
| L | Lua State |
Lua function: playerStandingDefault
Definition at line 484 of file nlua_faction.c.
|
static |
Sets a faction's known state.
Lua usage parameter: f:setKnown( false ) – Makes faction unknown. Lua function parameter: Faction f Faction 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 614 of file nlua_faction.c.
|
static |
Sets the player's standing with the faction.
Lua usage parameter: f:setPlayerStanding(70) – Make player an ally
Lua function parameter: Faction f Faction to set the player's standing for. Lua function parameter: number value Value to set the player's standing to (from -100 to 100).
| L | Lua State |
Lua function: setPlayerStanding
Definition at line 444 of file nlua_faction.c.
|
static |
Gets the tags a faction has.
Lua usage parameter: for k,v in ipairs(f:tags()) do ... end Lua usage parameter: if f:tags().likes_cheese then ... end Lua function parameter: Faction f Faction to get tags of. Lua return parameter: table A table containing all the tags of the faction.
| L | Lua State |
Lua function: tags
Definition at line 663 of file nlua_faction.c.
|
static |
Gets whether or not a faction uses hidden jumps.
Lua function parameter: Faction f Faction to get whether or not they use hidden jumps. Lua return parameter: boolean true if the faction uses hidden jumps, false otherwise.
| L | Lua State |
Lua function: usesHiddenJumps
Definition at line 549 of file nlua_faction.c.
| int lua_isfaction | ( | lua_State * | L, |
| int | ind ) |
Checks to see if ind is a faction.
| L | Lua state to check. |
| ind | Index position to check. |
Definition at line 243 of file nlua_faction.c.
| LuaFaction * lua_pushfaction | ( | lua_State * | L, |
| LuaFaction | faction ) |
Pushes a faction on the stack.
| L | Lua state to push faction into. |
| faction | Faction to push. |
Definition at line 228 of file nlua_faction.c.
| LuaFaction lua_tofaction | ( | lua_State * | L, |
| int | ind ) |
Gets faction at index.
| L | Lua state to get faction from. |
| ind | Index position to find the faction. |
Definition at line 191 of file nlua_faction.c.
| LuaFaction luaL_validfaction | ( | lua_State * | L, |
| int | ind ) |
Gets faction (or faction name) at index, raising an error if type isn't a valid faction.
| L | Lua state to get faction from. |
| ind | Index position to find the faction. |
Definition at line 213 of file nlua_faction.c.
|
static |
Definition at line 196 of file nlua_faction.c.
| int nlua_loadFaction | ( | nlua_env | env | ) |
Loads the faction library.
| env | Environment to load faction library into. |
Definition at line 98 of file nlua_faction.c.
|
static |
Faction metatable methods.
Definition at line 58 of file nlua_faction.c.