![]() |
naev 0.12.5
|
Lua player module. More...
#include "nlua_player.h"#include "array.h"#include "board.h"#include "camera.h"#include "comm.h"#include "event.h"#include "gui.h"#include "gui_omsg.h"#include "hook.h"#include "info.h"#include "land.h"#include "land_outfits.h"#include "map.h"#include "map_overlay.h"#include "menu.h"#include "mission.h"#include "ndata.h"#include "nlua_colour.h"#include "nlua_commodity.h"#include "nlua_misn.h"#include "nlua_outfit.h"#include "nlua_pilot.h"#include "nlua_ship.h"#include "nlua_spob.h"#include "nlua_system.h"#include "nlua_time.h"#include "nlua_vec2.h"#include "nluadef.h"#include "pause.h"#include "player.h"#include "player_autonav.h"#include "player_fleet.h"#include "player_gui.h"#include "player_inventory.h"#include "rng.h"#include "save.h"#include "sound.h"#include "start.h"
Go to the source code of this file.
Macros | |
| #define | PLAYER_CHECK() |
Functions | |
| static int | playerL_getname (lua_State *L) |
| Lua bindings to interact with the player. | |
| static int | playerL_shipname (lua_State *L) |
| Gets the player's ship's name (given by the player). | |
| static int | playerL_pay (lua_State *L) |
| Pays the player an amount of money. | |
| static int | playerL_credits (lua_State *L) |
| Gets how many credits the player has on him. | |
| static int | playerL_wealth (lua_State *L) |
| Gets how many credits the player owns both directly, and in the form of assets (ships, outfits, ...). | |
| static int | playerL_msg (lua_State *L) |
| Sends the player an in-game message. | |
| static int | playerL_msgClear (lua_State *L) |
| Clears the player's message buffer. | |
| static int | playerL_msgToggle (lua_State *L) |
| Clears the player's message buffer. | |
| static int | playerL_omsgAdd (lua_State *L) |
| Adds an overlay message. | |
| static int | playerL_omsgChange (lua_State *L) |
| Changes an overlay message. | |
| static int | playerL_omsgRm (lua_State *L) |
| Removes an overlay message. | |
| static int | playerL_allowSave (lua_State *L) |
| Sets player save ability. | |
| static int | playerL_getPosition (lua_State *L) |
| Gets the player's position. | |
| static int | playerL_getPilot (lua_State *L) |
| Gets the player's associated pilot. | |
| static int | playerL_jumps (lua_State *L) |
| Gets a player's jump range based on their remaining fuel. | |
| static int | playerL_fuel (lua_State *L) |
| Gets the amount of fuel a player has. | |
| static int | playerL_refuel (lua_State *L) |
| Refuels the player. | |
| static int | playerL_autonav (lua_State *L) |
| Checks to see if the player has autonav enabled. | |
| static int | playerL_autonavSetSpeed (lua_State *L) |
| Sets the autonav speed. | |
| static int | playerL_autonavSetTarget (lua_State *L) |
| Set the autonav target system to travel to. | |
| static int | playerL_autonavSetPos (lua_State *L) |
| Indicates the player where their autonav target position is. | |
| static int | playerL_autonavRoute (lua_State *L) |
| Gets the player's autonav route. | |
| static int | playerL_autonavDest (lua_State *L) |
| Gets the player's long term autonav destination. | |
| static int | playerL_autonavAbort (lua_State *L) |
| Stops the players autonav if active. | |
| static int | playerL_autonavReset (lua_State *L) |
| Resets the game speed without disabling autonav. | |
| static int | playerL_autonavEnd (lua_State *L) |
| Ends the autonav system. You probably want to use player.autonavAbort instead of this. | |
| static int | playerL_dt_default (lua_State *L) |
| Gets the current time modifier for the player. | |
| static int | playerL_speed (lua_State *L) |
| Gets the current speed of the player. | |
| static int | playerL_setSpeed (lua_State *L) |
| Sets the game speed directly. | |
| static int | playerL_cinematics (lua_State *L) |
| Puts the game in cinematics mode or back to regular mode. | |
| static int | playerL_cinematicsCheck (lua_State *L) |
| Checks to see if the game is in cinematics mode. | |
| static int | playerL_damageSPFX (lua_State *L) |
| Applies the damage effects to the player. | |
| static int | playerL_screenshot (lua_State *L) |
| Takes a screenshot (same as the keyboard action). | |
| static int | playerL_tryBoard (lua_State *L) |
| Tries to make the player board their target. | |
| static int | playerL_unboard (lua_State *L) |
| Unboards the player from its boarded target. | |
| static int | playerL_isLanded (lua_State *L) |
| Checks to see if the player is landed or not. | |
| static int | playerL_takeoff (lua_State *L) |
| Forces the player to take off if they are landed. | |
| static int | playerL_tryLand (lua_State *L) |
| Tries to make the player land. | |
| static int | playerL_land (lua_State *L) |
| Automagically lands the player on a spob. | |
| static int | playerL_landAllow (lua_State *L) |
| Allows or disallows the player to land. | |
| static int | playerL_landWindow (lua_State *L) |
| Sets the active land window. | |
| static int | playerL_commOpen (lua_State *L) |
| Opens communication with a pilot or spob. | |
| static int | playerL_commClose (lua_State *L) |
| Forces the player to close comm if they are chatting. | |
| static int | playerL_shipvarPeek (lua_State *L) |
| Peeks at a ship variable. | |
| static int | playerL_shipvarPush (lua_State *L) |
| Pushes a ship variable. | |
| static int | playerL_shipvarPop (lua_State *L) |
| Pops a ship variable. | |
| static int | playerL_ships (lua_State *L) |
| Gets the names of the player's ships. | |
| static int | playerL_shipOutfits (lua_State *L) |
| Gets the outfits for one of the player's ships. | |
| static int | playerL_shipMetadata (lua_State *L) |
| Gets meta-data about one of the player's ships. | |
| static int | playerL_shipDeploy (lua_State *L) |
| Sets the deployed status of a player's ship. | |
| static int | playerL_outfits (lua_State *L) |
| Gets all the outfits the player owns. | |
| static int | playerL_outfitNum (lua_State *L) |
| Gets the number of outfits the player owns in their list (excludes equipped on ships). | |
| static int | playerL_outfitAdd (lua_State *L) |
| Adds an outfit to the player's outfit list. | |
| static int | playerL_outfitRm (lua_State *L) |
| Removes an outfit from the player's outfit list. | |
| static int | playerL_shipAdd (lua_State *L) |
| Gives the player a new ship. | |
| static int | playerL_shipSwap (lua_State *L) |
| Swaps the player's current ship with a ship they own by name. | |
| static int | playerL_missions (lua_State *L) |
| Gets the list of the player's active missions. | |
| static int | playerL_misnActive (lua_State *L) |
| Checks to see if the player has a mission active. | |
| static int | playerL_misnDone (lua_State *L) |
| Checks to see if player has done a mission. | |
| static int | playerL_misnDoneList (lua_State *L) |
| Gets a list of all the missions the player has done. | |
| static int | playerL_evtActive (lua_State *L) |
| Checks to see if the player has an event active. | |
| static int | playerL_evtDone (lua_State *L) |
| Checks to see if player has done an event. | |
| static int | playerL_evtDoneList (lua_State *L) |
| Gets a list of all the events the player has done. | |
| static int | playerL_gui (lua_State *L) |
| Gets the player's current GUI. | |
| static int | playerL_guiList (lua_State *L) |
| Lists the GUIs the player can use. | |
| static int | playerL_guiSet (lua_State *L) |
| Sets the player's GUI. | |
| static int | playerL_fleetList (lua_State *L) |
| Lists the ships in the player's fleet. | |
| static int | playerL_fleetCargoFree (lua_State *L) |
| Gets the amount of cargo space free in the player's fleet. | |
| static int | playerL_fleetCargoMissionFree (lua_State *L) |
| Gets the free space for mission cargos on the player's ship. This can be less than the amount of free space in the player's fleet since the other fleet ships can not carry mission cargo. | |
| static int | playerL_fleetCargoUsed (lua_State *L) |
| Gets the amount of cargo space used in the player's fleet. | |
| static int | playerL_fleetCargoOwned (lua_State *L) |
| Gets the amount of cargo space used by a specific commodity in the player's fleet. | |
| static int | playerL_fleetCargoAdd (lua_State *L) |
| Tries to add an amount of commodity to the player's fleet. | |
| static int | playerL_fleetCargoRm (lua_State *L) |
| Tries to remove an amount of commodity to the player's fleet. | |
| static int | playerL_fleetCargoJet (lua_State *L) |
| Tries to remove an amount of commodity to the player's fleet and jettisons it into space. | |
| static int | playerL_fleetCargoList (lua_State *L) |
| Gets the list of all the cargos in the player's fleet. | |
| static int | playerL_inventory (lua_State *L) |
| Gets the contents of the player's inventory. | |
| static int | playerL_inventoryAdd (lua_State *L) |
| Adds an item to the player's in-game inventory. | |
| static int | playerL_inventoryRm (lua_State *L) |
| Removes an item to the player's in-game inventory. | |
| static int | playerL_inventoryOwned (lua_State *L) |
| Checks to see how much of an item the player has in their inventory. | |
| static int | playerL_teleport (lua_State *L) |
| Teleports the player to a new spob or system (only if not landed). | |
| static int | playerL_dt_mod (lua_State *L) |
| Gets the dt_mod of the player, which multiplies all time stuff. | |
| static int | playerL_fleetCapacity (lua_State *L) |
| Gets the fleet capacity (and used) of the player. | |
| static int | playerL_fleetCapacitySet (lua_State *L) |
| Sets the fleet capacity of the player. | |
| static int | playerL_chapter (lua_State *L) |
| Gets the player's current chapter. | |
| static int | playerL_chapterSet (lua_State *L) |
| Sets the player's current chapter. | |
| static int | playerL_infoButtonRegister (lua_State *L) |
| Registers a button in the info window. | |
| static int | playerL_infoButtonUnregister (lua_State *L) |
| Unregisters a button in the info window. | |
| static int | playerL_canDiscover (lua_State *L) |
| Global toggle to whether or not the player can discover space objects and jumps. Meant to be used with cutscenes that use player.teleport(). | |
| static int | playerL_save (lua_State *L) |
| Saves the game. | |
| static int | playerL_saveBackup (lua_State *L) |
| Backs up the player's last autosave with a custom name. | |
| static int | playerL_gameover (lua_State *L) |
| Gives the player a game over message. | |
| static int | playerL_start (lua_State *L) |
| Gets information about the player's starting point. | |
| int | nlua_loadPlayer (nlua_env env) |
| Loads the player Lua library. | |
| static PlayerShip_t * | playerL_shipvarShip (lua_State *L, int idx) |
Variables | |
| static const luaL_Reg | playerL_methods [] |
Lua player module.
Definition in file nlua_player.c.
| #define PLAYER_CHECK | ( | ) |
Definition at line 59 of file nlua_player.c.
| int nlua_loadPlayer | ( | nlua_env | env | ) |
Loads the player Lua library.
| env | Lua environment. |
Definition at line 269 of file nlua_player.c.
|
static |
Sets player save ability.
Lua usage parameter: player.allowSave( b ) Lua function parameter:[opt=true] boolean b true if the player is allowed to save, false otherwise.
| L | Lua State |
Lua function: allowSave
Definition at line 571 of file nlua_player.c.
|
static |
Checks to see if the player has autonav enabled.
Lua usage parameter: autonav = player.autonav() Lua return parameter: boolean true if the player has autonav enabled. Lua return parameter: number Speed of the current autonav.
| L | Lua State |
Lua function: autonav
Definition at line 687 of file nlua_player.c.
|
static |
Stops the players autonav if active.
Lua usage parameter: sys, jumps = player.autonavAbort()
Lua function parameter:[opt] string msg Abort message.
| L | Lua State |
Lua function: autonavAbort
Definition at line 812 of file nlua_player.c.
|
static |
Gets the player's long term autonav destination.
Lua usage parameter: sys, jumps = player.autonavDest()
Lua return parameter: System|nil The destination system (or nil if none selected). Lua return parameter: number|nil The number of jumps left.
| L | Lua State |
Lua function: autonavDest
Definition at line 763 of file nlua_player.c.
|
static |
Ends the autonav system. You probably want to use player.autonavAbort instead of this.
| L | Lua State |
Lua function: autonavEnd
Definition at line 844 of file nlua_player.c.
|
static |
Resets the game speed without disabling autonav.
Lua function parameter:[opt=0.] number timer How many seconds to wait before starting autonav up again.
| L | Lua State |
Lua function: autonavReset
Definition at line 829 of file nlua_player.c.
|
static |
Gets the player's autonav route.
Lua usage parameter: syslist = player.autonavRoute()
Lua return parameter: Table A table of systems indicating the route of the player.
| L | Lua State |
Lua function: autonavRoute
Definition at line 789 of file nlua_player.c.
|
static |
Indicates the player where their autonav target position is.
Lua function parameter: Vec2|nil pos Position to mark as autonav destination or nil to clear.
| L | Lua State |
Lua function: autonavSetPos
Definition at line 743 of file nlua_player.c.
|
static |
Sets the autonav speed.
Definition at line 698 of file nlua_player.c.
|
static |
Set the autonav target system to travel to.
Lua function parameter: StarSystem sys Star system to set as autonav target. Lua function parameter: boolean add Whether or not this should be added to the current route.
| L | Lua State |
Lua function: autonavSetTarget
Definition at line 722 of file nlua_player.c.
|
static |
Global toggle to whether or not the player can discover space objects and jumps. Meant to be used with cutscenes that use player.teleport().
Lua function parameter:[opt=false] Whether or not the player can discover objects.
| L | Lua State |
Lua function: canDiscover
Definition at line 2644 of file nlua_player.c.
|
static |
Gets the player's current chapter.
Lua return parameter: string The player's current chapter.
| L | Lua State |
Lua function: chapter
Definition at line 2575 of file nlua_player.c.
|
static |
Sets the player's current chapter.
Lua function parameter: string chapter The name of the chapter to set the player to.
| L | Lua State |
Lua function: chapterSet
Definition at line 2588 of file nlua_player.c.
|
static |
Puts the game in cinematics mode or back to regular mode.
Possible options are:
Lua usage parameter: player.cinematics( true, { gui = true } ) – Enables cinematics without hiding gui.
Lua function parameter: boolean enable If true sets cinematics mode, if false disables. Defaults to disable. Lua function parameter: table options Table of options.
| L | Lua State |
Lua function: cinematics
Definition at line 922 of file nlua_player.c.
|
static |
Checks to see if the game is in cinematics mode.
Definition at line 997 of file nlua_player.c.
|
static |
Forces the player to close comm if they are chatting.
| L | Lua State |
Lua function: commClose
Definition at line 1331 of file nlua_player.c.
|
static |
Opens communication with a pilot or spob.
Will do no checks with spobs.
Lua function parameter: Pilot|Spob Target to open communication channel with. Lua return parameter: boolean true on success, false if failed to open.
| L | Lua State |
Lua function: commOpen
Definition at line 1309 of file nlua_player.c.
|
static |
Gets how many credits the player has on him.
Lua usage parameter: monies = player.credits() Lua usage parameter: monies, readable = player.credits( 2 )
Lua function parameter:[opt] number decimal Optional argument that makes it return human readable form with so many decimals. Lua return parameter: number The amount of credits in numerical form. Lua return parameter: string The amount of credits in human-readable form.
| L | Lua State |
Lua function: credits
Definition at line 371 of file nlua_player.c.
|
static |
Applies the damage effects to the player.
Lua function parameter: number mod How strong the effect should be. It should be a value between 0 and 1, usually corresponding to how much armour damage the player has taken with respect to their total armour.
| L | Lua State |
Lua function: damageSPFX
Definition at line 1011 of file nlua_player.c.
|
static |
Gets the current time modifier for the player.
Lua return parameter: number Current time modifier.
| L | Lua State |
Lua function: dt_defaults
Definition at line 858 of file nlua_player.c.
|
static |
Gets the dt_mod of the player, which multiplies all time stuff.
Lua return parameter: number The dt_mod of the player.
| L | Lua State |
Lua function: dt_mod
Definition at line 2523 of file nlua_player.c.
|
static |
Checks to see if the player has an event active.
Lua usage parameter: if player.evtActive( "Shipwreck" ) then – The shipwreck event is active
Lua function parameter: string name Name of the mission to check. Lua return parameter: boolean true if the mission is active, false if it isn't.
| L | Lua State |
Lua function: evtActive
Definition at line 1981 of file nlua_player.c.
|
static |
Checks to see if player has done an event.
This only works with events that have the unique flag.
Lua usage parameter: if player.evtDone( "Shipwreck" ) then – Player finished event Lua function parameter: string name Name of the event to check. Lua return parameter: boolean true if event was finished, false if it wasn't.
| L | Lua State |
Lua function: evtDone
Definition at line 2002 of file nlua_player.c.
|
static |
Gets a list of all the events the player has done.
Lua return parameter: table List of all the events the player has done.
| L | Lua State |
Lua function: evtDoneList
Definition at line 2019 of file nlua_player.c.
|
static |
Gets the fleet capacity (and used) of the player.
Lua return parameter: number Total fleet capacity of the player. Lua return parameter: number Currently used fleet capacity of the player. Lua return parameter: boolean Can take off.
| L | Lua State |
Lua function: fleetCapacity
Definition at line 2537 of file nlua_player.c.
|
static |
Sets the fleet capacity of the player.
Lua function parameter: number capacity Fleet capacity to set the player to.
| L | Lua State |
Lua function: fleetCapacitySet
Definition at line 2562 of file nlua_player.c.
|
static |
Tries to add an amount of commodity to the player's fleet.
Lua function parameter: Commodity c Commodity to add to the player fleet. Lua function parameter: number q Amount to add. Lua return parameter: number Amount of commodity added to the player fleet.
| L | Lua State |
Lua function: fleetCargoAdd
Definition at line 2192 of file nlua_player.c.
|
static |
Gets the amount of cargo space free in the player's fleet.
Lua return parameter: number Amount of free cargo space.
| L | Lua State |
Lua function: fleetCargoFree
Definition at line 2123 of file nlua_player.c.
|
static |
Tries to remove an amount of commodity to the player's fleet and jettisons it into space.
Lua function parameter: Commodity c Commodity to remove from the player fleet. Lua function parameter: number q Amount to remove. Lua return parameter: number Amount of commodity removed from the player fleet.
| L | Lua State |
Lua function: fleetCargoJet
Definition at line 2231 of file nlua_player.c.
|
static |
Gets the list of all the cargos in the player's fleet.
Lua usage parameter: for k,v in ipairs( player.fleetCargoList() ) do print( v.c, v.q ) end
Lua return parameter: table A table containing table entries of the form {c = commodity, q = quantity }.
| L | Lua State |
Lua function: fleetCargoList
Definition at line 2251 of file nlua_player.c.
|
static |
Gets the free space for mission cargos on the player's ship. This can be less than the amount of free space in the player's fleet since the other fleet ships can not carry mission cargo.
Lua return parameter: number Amount of free cargo space for mission cargos.
| L | Lua State |
Lua function: fleetCargoMissionFree
Definition at line 2140 of file nlua_player.c.
|
static |
Gets the amount of cargo space used by a specific commodity in the player's fleet.
Lua function parameter: Commodity c Commodity to check how much the player has in their fleet. Lua return parameter: number Amount of used cargo space for the commodity.
| L | Lua State |
Lua function: fleetCargoOwned
Definition at line 2174 of file nlua_player.c.
|
static |
Tries to remove an amount of commodity to the player's fleet.
Lua function parameter: Commodity c Commodity to remove from the player fleet. Lua function parameter: number q Amount to remove. Lua return parameter: number Amount of commodity removed from the player fleet.
| L | Lua State |
Lua function: fleetCargoRm
Definition at line 2211 of file nlua_player.c.
|
static |
Gets the amount of cargo space used in the player's fleet.
Lua return parameter: number Amount of used cargo space.
| L | Lua State |
Lua function: fleetCargoUsed
Definition at line 2156 of file nlua_player.c.
|
static |
Lists the ships in the player's fleet.
Lua return parameter: table Table containing the pilots in the player fleet or false if they are not spawned yet.
| L | Lua State |
Lua function: fleetList
Definition at line 2090 of file nlua_player.c.
|
static |
Gets the amount of fuel a player has.
Lua usage parameter: fuel, consumption = player.fuel()
Lua return parameter: number The player's fuel and Lua return parameter: number The amount of fuel needed per jump.
| L | Lua State |
Lua function: fuel
Definition at line 642 of file nlua_player.c.
|
static |
Gives the player a game over message.
| L | Lua State |
Lua function: gameover
Definition at line 2710 of file nlua_player.c.
|
static |
Lua bindings to interact with the player.
These bindings let you modify stuff about the player and find out special information. General usage would be calls like:
Lua module: player
Gets the player's name.
Lua return parameter: string The name of the player.
| L | Lua State |
Lua function: name
Definition at line 292 of file nlua_player.c.
|
static |
Gets the player's associated pilot.
Lua return parameter: Pilot The player's pilot.
| L | Lua State |
Lua function: pilot
Definition at line 608 of file nlua_player.c.
|
static |
Gets the player's position.
Lua usage parameter: v = player.pos()
Lua return parameter: Vec2 The position of the player.
| L | Lua State |
Lua function: pos
Definition at line 595 of file nlua_player.c.
|
static |
Gets the player's current GUI.
Lua return parameter: string The player's current GUI.
| L | Lua State |
Lua function: gui
Definition at line 2040 of file nlua_player.c.
|
static |
Lists the GUIs the player can use.
Lua return parameter: table Table containing the names of all the GUIs the player can use.
| L | Lua State |
Lua function: guiList
Definition at line 2053 of file nlua_player.c.
|
static |
Sets the player's GUI.
Lua return parameter: string The player's current GUI.
| L | Lua State |
Lua function: guiSet
Definition at line 2072 of file nlua_player.c.
|
static |
Registers a button in the info window.
Lua function parameter: string caption Caption of the button. Lua function parameter: function func Function to run when clicked. Lua function parameter:[opt] number priority Button priority, lower is more important. Lua function parameter:[opt] string key Hotkey for using the button without it being focused. Lua return parameter: number ID of the info window button for use with player.infoButtonUnregister.
| L | Lua State |
Lua function: infoButtonRegister
Definition at line 2609 of file nlua_player.c.
|
static |
Unregisters a button in the info window.
Lua function parameter: number ID of the button to unregister.
| L | Lua State |
Lua function: infoButtonUnregister
Definition at line 2628 of file nlua_player.c.
|
static |
Gets the contents of the player's inventory.
Note that this does not get licenses.
Lua return parameter: table A table containing inventory items in the form of subtables with a "name" and "quantity" field.
| L | Lua State |
Lua function: inventory
Definition at line 2288 of file nlua_player.c.
|
static |
Adds an item to the player's in-game inventory.
Lua function parameter: string name The name of the item to add. Lua function parameter: integer quantity The amount of the item to add. Lua return parameter: integer The amount of the item added.
| L | Lua State |
Lua function: inventoryAdd
Definition at line 2319 of file nlua_player.c.
|
static |
Checks to see how much of an item the player has in their inventory.
Lua function parameter: string name The name of the item to check. Lua return parameter: integer The amount of the item the player has (0 if none).
| L | Lua State |
Lua function: inventoryAdd
Definition at line 2356 of file nlua_player.c.
|
static |
Removes an item to the player's in-game inventory.
Lua function parameter: string name The name of the item to remove. Lua function parameter: integer quantity The amount of the item to remove. Lua return parameter: integer The amount of the item removed.
| L | Lua State |
Lua function: inventoryAdd
Definition at line 2338 of file nlua_player.c.
|
static |
Checks to see if the player is landed or not.
Lua return parameter: boolean Whether or not the player is currently landed.
| L | Lua State |
Lua function: isLanded
Definition at line 1081 of file nlua_player.c.
|
static |
Gets a player's jump range based on their remaining fuel.
Lua usage parameter: jumps = player.jumps()
Lua return parameter: number The player's maximum number of jumps.
| L | Lua State |
Lua function: jumps
Definition at line 624 of file nlua_player.c.
|
static |
Automagically lands the player on a spob.
Note that this will teleport the player to the system in question as necessary.
Lua function parameter: Spob spb Spob to land the player on.
| L | Lua State |
Lua function: land
Definition at line 1147 of file nlua_player.c.
|
static |
Allows or disallows the player to land.
This will allow or disallow landing on a system level and is reset when the player enters another system.
Lua usage parameter: player.landAllow() – Allows the player to land Lua usage parameter: player.landAllow( false ) – Doesn't allow the player to land. Lua usage parameter: player.landAllow( false, "No landing." ) – Doesn't allow the player to land with the message "No landing."
Lua function parameter:[opt=true] boolean b Whether or not to allow the player to land. Lua function parameter:[opt] string msg Message displayed when player tries to land (only if disallowed to land). Can be omitted to use default.
| L | Lua State |
Lua function: landAllow
Definition at line 1227 of file nlua_player.c.
|
static |
Sets the active land window.
Valid windows are:
Lua usage parameter: player.landWindow( "outfits" ) Lua function parameter: string winname Name of the window. Lua return parameter: boolean True on success.
| L | Lua State |
Lua function: landWindow
Definition at line 1265 of file nlua_player.c.
|
static |
Checks to see if the player has a mission active.
Lua usage parameter: if player.misnActive( "The Space Family" ) then – Player is doing space family mission
Lua function parameter: string name Name of the mission to check. Lua return parameter: boolean|number Number of instances if the mission is active, false if it isn't.
| L | Lua State |
Lua function: misnActive
Definition at line 1913 of file nlua_player.c.
|
static |
Checks to see if player has done a mission.
This only works with missions that have the unique flag.
Lua usage parameter: if player.misnDone( "The Space Family" ) then – Player finished mission Lua function parameter: string name Name of the mission to check. Lua return parameter: boolean true if mission was finished, false if it wasn't.
| L | Lua State |
Lua function: misnDone
Definition at line 1939 of file nlua_player.c.
|
static |
Gets a list of all the missions the player has done.
Lua return parameter: table List of all the missions the player has done.
| L | Lua State |
Lua function: misnDoneList
Definition at line 1956 of file nlua_player.c.
|
static |
Gets the list of the player's active missions.
Lua usage parameter: n = #player.missions() – number of active missions
Lua return parameter: table Table containing the metadat of active missions as tables. Fields include "name", "desc", "reward", "loc", "chance", "spob", "system", "chapter", "cond", "done", "priority", "unique", and "tags".
| L | Lua State |
Lua function: missions
Definition at line 1834 of file nlua_player.c.
|
static |
Sends the player an in-game message.
Lua function parameter: string message Message to send the player. Lua function parameter:[opt=false] boolean display Display the message over the player's ship (like a broadcast message).
| L | Lua State |
Lua function: msg
Definition at line 440 of file nlua_player.c.
|
static |
Clears the player's message buffer.
| L | Lua State |
Lua function: msgClear
Definition at line 457 of file nlua_player.c.
|
static |
Clears the player's message buffer.
Lua function parameter:( boolean enable Whether or not to enable the player receiving messages.
| L | Lua State |
Lua function: msgToggle
Definition at line 471 of file nlua_player.c.
|
static |
Adds an overlay message.
Lua usage parameter: player.omsgAdd( "some_message", 5 ) Lua function parameter: string msg Message to add. Lua function parameter:[opt=10] number duration Duration to add message in seconds (if
| L | Lua State |
Definition at line 490 of file nlua_player.c.
|
static |
Changes an overlay message.
Lua usage parameter: player.omsgChange( omsg_id, "new message", 3 ) Lua function parameter: number id ID of the overlay message to change. Lua function parameter: string msg Message to change to. Lua function parameter: number duration New duration to set in seconds (0. for infinity). Lua return parameter: boolean true if all went well, false otherwise.
| L | Lua State |
Lua function: omsgChange
Definition at line 526 of file nlua_player.c.
|
static |
Removes an overlay message.
Lua usage parameter: player.omsgRm( msg_id ) Lua function parameter: number id ID of the overlay message to remove.
| L | Lua State |
Lua function: omsgRm
Definition at line 556 of file nlua_player.c.
|
static |
Adds an outfit to the player's outfit list.
Lua usage parameter: player.outfitAdd( "Laser Cannon" ) – Gives the player a laser cannon Lua usage parameter: player.outfitAdd( "Plasma Blaster", 2 ) – Gives the player two plasma blasters
Lua function parameter: string name Name of the outfit to give. Lua function parameter:[opt=1] number q Quantity to give.
| L | Lua State |
Lua function: outfitAdd
Definition at line 1690 of file nlua_player.c.
|
static |
Gets the number of outfits the player owns in their list (excludes equipped on ships).
Lua usage parameter: q = player.outfitNum( "Laser Cannon MK0", true ) – Number of 'Laser Cannon MK0' the player owns (unequipped)
Lua function parameter: string name Name of the outfit to remove. Lua function parameter:[opt=false] bool unequipped_only Whether or not to check only the unequipped outfits and not equipped outfits. Defaults to false. Lua return parameter: number The quantity the player owns.
| L | Lua State |
Lua function: outfitNum
Definition at line 1656 of file nlua_player.c.
|
static |
Removes an outfit from the player's outfit list.
"all" will remove all outfits.
Lua usage parameter: player.outfitRm( "Plasma Blaster", 2 ) – Removes two plasma blasters from the player
Lua function parameter: string name Name of the outfit to give. Lua function parameter:[opt] number q Quantity to remove (default 1).
| L | Lua State |
Lua function: outfitRm
Definition at line 1718 of file nlua_player.c.
|
static |
Gets all the outfits the player owns.
If you want the quantity, call player.outfitNum() on the individual outfit.
Lua usage parameter: player.outfits() – A table of all the player's outfits.
Lua function parameter:[opt=false] bool unequipped_only Whether or not to check only the unequipped outfits and not equipped outfits. Defaults to false. Lua return parameter: {Outfit,...} Table of outfits.
| L | Lua State |
Lua function: outfits
Definition at line 1604 of file nlua_player.c.
|
static |
Pays the player an amount of money.
Lua usage parameter: player.pay( 500 ) – Gives player 500 credits
Lua function parameter: number amount Amount of money to pay the player in credits. Lua function parameter:[opt] boolean|string nohooks Set to true to not trigger pay hooks, or a string value to pass that to the pay hook instead.
| L | Lua State |
Lua function: pay
Definition at line 323 of file nlua_player.c.
|
static |
Refuels the player.
Lua usage parameter: player.refuel() – Refuel fully Lua usage parameter: player.refuel( 200 ) – Refuels partially
Lua function parameter:[opt] number fuel Amount of fuel to add, will set to max if nil.
| L | Lua State |
Lua function: refuel
Definition at line 663 of file nlua_player.c.
|
static |
Saves the game.
Lua function parameter:[opt="autosave"] string name What to name the save. Lua function parameter:[opt=nil] Spob|string Spob or name of spob to save the player at.
| L | Lua State |
Lua function: save
Definition at line 2658 of file nlua_player.c.
|
static |
Backs up the player's last autosave with a custom name.
Lua function parameter: string name Name to give the copy of the autosave. Lua return parameter: boolean true on success.
| L | Lua State |
Lua function: saveBackup
Definition at line 2691 of file nlua_player.c.
|
static |
Takes a screenshot (same as the keyboard action).
| L | Lua State |
Lua function: screenshot
Definition at line 1024 of file nlua_player.c.
|
static |
Sets the game speed directly.
Lua function parameter: number speed Speed to set the game to. If omitted it will reset the game speed. Lua function parameter:[opt=speed] number sound Sound speed to set to. Lua function parameter:[opt=false] boolean noset Avoid setting player.speed. Useful for autonav.
| L | Lua State |
Lua function: setSpeed
Definition at line 886 of file nlua_player.c.
|
static |
Gives the player a new ship.
Lua usage parameter: player.shipAdd( "Pirate Kestrel", _("Seiryuu"), _("") ) – Gives the player a Pirate Kestrel named Seiryuu if player cancels the naming.
Lua function parameter: string ship Name of the ship to add. Lua function parameter:[opt=ship.get(ship):name()] string name Name to give the ship if player refuses to name it (defaults to shipname if omitted). Lua function parameter:[opt] string acquired A description of how the ship was acquired. Lua function parameter:[opt=false] boolean noname If true does not let the player name the ship. Lua return parameter: string The new ship's name.
| L | Lua State |
Lua function: shipAdd
Definition at line 1777 of file nlua_player.c.
|
static |
Sets the deployed status of a player's ship.
Lua function parameter: string shipname Name of the ship to set deployed status of. Lua function parameter:[opt=false] boolean deploy Whether or not to set the deployed status of the ship.
| L | Lua State |
Lua function: shipDeploy
Definition at line 1582 of file nlua_player.c.
|
static |
Gets meta-data about one of the player's ships.
Lua function parameter:[nil=Current ship] string name Name of the ship to get the meta-data of. Lua return parameter: Table of meta-data.
| L | Lua State |
Lua function: shipMetadata
Definition at line 1507 of file nlua_player.c.
|
static |
Gets the player's ship's name (given by the player).
Lua return parameter: string The name of the ship the player is currently in.
| L | Lua State |
Lua function: ship
Definition at line 307 of file nlua_player.c.
|
static |
Gets the outfits for one of the player's ships.
Lua usage parameter: outfits = player.shipOutfits("Llama") – Gets the Llama's outfits
Lua function parameter:[nil=Current ship] string name Name of the ship to get the outfits of. Lua return parameter: {Outfit,...} Table of outfits.
| L | Lua State |
Lua function: shipOutfits
Definition at line 1451 of file nlua_player.c.
|
static |
Gets the names of the player's ships.
Lua usage parameter: names = player.ships() – The player's ship names.
Lua return parameter: {String,...} Table of ship names.
| L | Lua State |
Lua function: ships
Definition at line 1415 of file nlua_player.c.
|
static |
Swaps the player's current ship with a ship they own by name.
Lua function parameter: string ship Name of the ship to swap to. (this is name given by the player, not ship name) Lua function parameter:[opt=false] boolean ignore_cargo Whether or not to ignore cargo and not move it, or try to move it over. Lua function parameter:[opt=false] boolean remove If true removes the player's current ship (so it replaces and doesn't swap).
| L | Lua State |
Lua function: shipSwap
Definition at line 1810 of file nlua_player.c.
|
static |
Peeks at a ship variable.
Lua usage parameter: local exp = player.shipvarPeek( "exp" ) – Checks the value of the "exp" ship var on the player's current ship
Lua function parameter: string varname Name of the variable to check value of. Lua function parameter:[opt] string shipname Name of the ship to check variable of. Defaults to player's current ship.
| L | Lua State |
Lua function: shipvarPeek
Definition at line 1356 of file nlua_player.c.
|
static |
Pops a ship variable.
Lua function parameter: string varname Name of the variable to pop. Lua function parameter:[opt] string shipname Name of the ship to pop variable from. Defaults to player's current ship.
| L | Lua State |
Lua function: shipvarPop
Definition at line 1396 of file nlua_player.c.
|
static |
Pushes a ship variable.
Lua function parameter: string varname Name of the variable to set value of. Lua function parameter: val Value to push. Lua function parameter:[opt] string shipname Name of the ship to push variable to. Defaults to player's current ship.
| L | Lua State |
Lua function: shipvarPush
Definition at line 1376 of file nlua_player.c.
|
static |
Definition at line 1338 of file nlua_player.c.
|
static |
Gets the current speed of the player.
Lua return parameter: number Current speed modifier.
| L | Lua State |
Lua function: sped
Definition at line 870 of file nlua_player.c.
|
static |
Gets information about the player's starting point.
Lua return parameter: Returns a table containing the different start information as keys and the corresponding information as values. Fields include things such as "name" for the campaign name, "ship" for the starting ship, "shipname" for the starting shp name, etc. Please refer to dat/start.xml for more details of available fields.
| L | Lua State |
Lua function: start
Definition at line 2728 of file nlua_player.c.
|
static |
Forces the player to take off if they are landed.
Assume the pilot is still landed until the current running function returns If you want to create pilots on take off please hook the takeoff/land hooks.
| L | Lua State |
Lua function: takeoff
Definition at line 1095 of file nlua_player.c.
|
static |
Teleports the player to a new spob or system (only if not landed).
If the destination is a system, the coordinates of the player will not change. If the destination is a spob, the player will be placed over that spob.
Lua usage parameter: player.teleport( system.get("Arcanis") ) – Teleports the player to Arcanis. Lua usage parameter: player.teleport( "Arcanis" ) – Teleports the player to Arcanis. Lua usage parameter: player.teleport( "Dvaer Prime" ) – Teleports the player to Dvaer, and relocates him to Dvaer Prime. Lua usage parameter: player.teleport( "Sol", true ) – Teleports the player to SOL, but doesn't run any initial simulation
Lua function parameter: System|Spob|string dest System or name of a system or spob or name of a spob to teleport the player to. Lua function parameter:[opt=false] boolean no_simulate Don't simulate the when teleporting if true. Lua function parameter:[opt=false] boolean silent Doesn't display any entering system messages.
| L | Lua State |
Lua function: teleport
Definition at line 2389 of file nlua_player.c.
|
static |
Tries to make the player board their target.
Lua function parameter: boolean noisy Whether or not to do player messages. Lua return parameter: string Status of the boarding attempt. Can be "impossible", "retry", "ok", or "error".
| L | Lua State |
Lua function: tryBoard
Definition at line 1039 of file nlua_player.c.
|
static |
Tries to make the player land.
Lua function parameter: boolean noisy Whether or not to do player messages. Lua return parameter: string Status of the boarding attempt. Can be "impossible", "retry", "ok", or "error".
| L | Lua State |
Lua function: tryBoard
Definition at line 1118 of file nlua_player.c.
|
static |
Unboards the player from its boarded target.
Use from inside a board hook.
Lua usage parameter: player.unboard()
| L | Lua State |
Lua function: unboard
Definition at line 1068 of file nlua_player.c.
|
static |
Gets how many credits the player owns both directly, and in the form of assets (ships, outfits, ...).
Lua usage parameter: monies = player.wealth() Lua usage parameter: monies, readable = player.wealth( 2 )
Lua function parameter:[opt] number decimal Optional argument that makes it return human readable form with so many decimals. Lua return parameter: number The player's wealth in numerical form. Lua return parameter: string The player's wealth in human-readable form.
| L | Lua State |
Lua function: wealth
Definition at line 402 of file nlua_player.c.
|
static |
Player Lua methods.
Definition at line 170 of file nlua_player.c.