![]() |
naev 0.11.5
|
Handles the Lua pilot bindings. More...
#include "nlua_pilot.h"#include "ai.h"#include "array.h"#include "camera.h"#include "damagetype.h"#include "debug.h"#include "escort.h"#include "gui.h"#include "land_outfits.h"#include "log.h"#include "map.h"#include "nlua.h"#include "nlua_asteroid.h"#include "nlua_canvas.h"#include "nlua_colour.h"#include "nlua_gfx.h"#include "nlua_commodity.h"#include "nlua_faction.h"#include "nlua_jump.h"#include "nlua_pilotoutfit.h"#include "nlua_outfit.h"#include "nlua_spob.h"#include "nlua_ship.h"#include "nlua_system.h"#include "nlua_vec2.h"#include "nlua_tex.h"#include "nluadef.h"#include "pilot.h"#include "pilot_heat.h"#include "player.h"#include "rng.h"#include "space.h"#include "start.h"#include "weapon.h"Go to the source code of this file.
Data Structures | |
| struct | pL_flag |
| Small struct to handle flags. More... | |
Macros | |
| #define | PUSH_DOUBLE(L, name, value) |
| #define | PUSH_INT(L, name, value) |
Functions | |
| static int | pilotL_getFriendOrFoe (lua_State *L, int friend) |
| static Task * | pilotL_newtask (lua_State *L, Pilot *p, const char *task) |
| Does a new task. | |
| static int | outfit_compareActive (const void *slot1, const void *slot2) |
| qsort compare function for active outfits. | |
| static int | pilotL_setFlagWrapper (lua_State *L, int flag) |
| Wrapper to simplify flag setting stuff. | |
| static int | pilot_outfitAddSlot (Pilot *p, const Outfit *o, PilotOutfitSlot *s, int bypass_cpu, int bypass_slot) |
| Adds an outfit to a specific slot. | |
| static int | luaL_checkweapset (lua_State *L, int idx) |
| static PilotOutfitSlot * | luaL_checkslot (lua_State *L, Pilot *p, int idx) |
| static int | pilotL_add (lua_State *L) |
| Adds a ship with an AI and faction to the system (instead of a predefined fleet). | |
| static int | pilotL_clone (lua_State *L) |
| Clones a pilot. It will share nearly all properties including outfits. | |
| static int | pilotL_remove (lua_State *L) |
| Removes a pilot without explosions or anything. | |
| static int | pilotL_explode (lua_State *L) |
| Removes a pilot as if it exploded. | |
| static int | pilotL_clear (lua_State *L) |
| Clears the current system of pilots. Used for epic battles and such. | |
| static int | pilotL_clearSelect (lua_State *L) |
| Removes all pilots belonging to a faction from the system. | |
| static int | pilotL_canSpawn (lua_State *L) |
| Returns if pilots can can spawn naturally in the current system. | |
| static int | pilotL_toggleSpawn (lua_State *L) |
| Disables or enables pilot spawning in the current system. | |
| static int | pilotL_getPilots (lua_State *L) |
| Gets the pilots available in the system by a certain criteria. | |
| static int | pilotL_getAllies (lua_State *L) |
| Gets friendly pilots to a pilot (or faction) within a certain distance. | |
| static int | pilotL_getEnemies (lua_State *L) |
| Gets hostile pilots to a pilot (or faction) within a certain distance. | |
| static int | pilotL_getVisible (lua_State *L) |
| Gets visible pilots to a pilot. | |
| static int | pilotL_getInrange (lua_State *L) |
| Gets visible pilots to a pilot within a certain distance. | |
| static int | pilotL_eq (lua_State *L) |
| Checks to see if pilot and p are the same. | |
| static int | pilotL_tostring (lua_State *L) |
| Gets the pilot's current (translated) name or notes it is inexistent. | |
| static int | pilotL_name (lua_State *L) |
| Gets the pilot's current (translated) name. | |
| static int | pilotL_id (lua_State *L) |
| Gets the ID of the pilot. | |
| static int | pilotL_exists (lua_State *L) |
| Checks to see if pilot is still in the system and alive. | |
| static int | pilotL_target (lua_State *L) |
| Gets the pilot target of the pilot. | |
| static int | pilotL_setTarget (lua_State *L) |
| Sets the pilot target of the pilot. | |
| static int | pilotL_targetAsteroid (lua_State *L) |
| Gets the asteroid target of the pilot. | |
| static int | pilotL_setTargetAsteroid (lua_State *L) |
| Sets the pilot's asteroid target. | |
| static int | pilotL_inrange (lua_State *L) |
| Checks to see if a target pilot is in range of a pilot. | |
| static int | pilotL_scandone (lua_State *L) |
| Checks to see if a pilot is done scanning its target. | |
| static int | pilotL_withPlayer (lua_State *L) |
| Checks to see if pilot is with player. | |
| static int | pilotL_nav (lua_State *L) |
| Gets the nav target of the pilot. | |
| static int | pilotL_navSpob (lua_State *L) |
| Gets the nav spob target of the pilot. | |
| static int | pilotL_navJump (lua_State *L) |
| Gets the nav jump target of the pilot. | |
| static int | pilotL_navJumpSet (lua_State *L) |
| Sets the hyperspace navigation target for the pilot. | |
| static int | pilotL_weapsetActive (lua_State *L) |
| Gets the ID (number from 1 to 10) of the current active weapset. | |
| static int | pilotL_weapsetSetActive (lua_State *L) |
| Sets the ID (number from 1 to 10) of the current active weapset. | |
| static int | pilotL_weapset (lua_State *L) |
| Gets the weapset weapon of the pilot. | |
| static int | pilotL_weapsetList (lua_State *L) |
| Get a list of all the outfits in a weapon set. | |
| static int | pilotL_weapsetType (lua_State *L) |
| Sets the type of a weapon set for a pilot. | |
| static int | pilotL_weapsetAdd (lua_State *L) |
| Adds an outfit to a pilot's weapon set. | |
| static int | pilotL_weapsetAddType (lua_State *L) |
| Adds an outfit to a pilot's weapon set. | |
| static int | pilotL_weapsetRm (lua_State *L) |
| Removes an outfit from a pilot's weapon set. | |
| static int | pilotL_weapsetCleanup (lua_State *L) |
| Cleans up a weapon set. This removes all properties of the weapon set and resets it. | |
| static int | pilotL_weapsetHeat (lua_State *L) |
| Gets heat information for a weapon set. | |
| static int | pilotL_weapsetSetInrange (lua_State *L) |
| Sets whether a pilot's weapon set does inrange checks. | |
| static int | pilotL_weapsetAmmo (lua_State *L) |
| Gets the ammo left of a weapon set. | |
| static int | pilotL_actives (lua_State *L) |
| Gets the active outfits and their states of the pilot. | |
| static int | pilotL_outfitsList (lua_State *L) |
| Gets the outfits of a pilot. | |
| static int | pilotL_outfits (lua_State *L) |
| Gets a mapping of outfit slot IDs and outfits of a pilot. | |
| static int | pilotL_outfitsEquip (lua_State *L) |
| Equips a pilot with a set of outfits. | |
| static int | pilotL_outfitGet (lua_State *L) |
| Gets a pilot's outfit by ID. | |
| static int | pilotL_outfitToggle (lua_State *L) |
| Toggles an outfit. | |
| static int | pilotL_outfitReady (lua_State *L) |
| Sees if an outfit is ready to use. | |
| static int | pilotL_rename (lua_State *L) |
| Changes the pilot's name. | |
| static int | pilotL_position (lua_State *L) |
| Gets the pilot's position. | |
| static int | pilotL_velocity (lua_State *L) |
| Gets the pilot's velocity. | |
| static int | pilotL_isStopped (lua_State *L) |
| Checks to see if a pilot is stopped. | |
| static int | pilotL_dir (lua_State *L) |
| Gets the pilot's direction. | |
| static int | pilotL_signature (lua_State *L) |
| Gets the pilot's signature. | |
| static int | pilotL_temp (lua_State *L) |
| Gets the temperature of a pilot. | |
| static int | pilotL_mass (lua_State *L) |
| Gets the mass of a pilot. | |
| static int | pilotL_accel (lua_State *L) |
| Gets the accel of a pilot. | |
| static int | pilotL_speed (lua_State *L) |
| Gets the speed of a pilot. | |
| static int | pilotL_speed_max (lua_State *L) |
| Gets the maximum speed of a pilot. | |
| static int | pilotL_turn (lua_State *L) |
| Gets the turn of a pilot. | |
| static int | pilotL_faction (lua_State *L) |
| Gets the pilot's faction. | |
| static int | pilotL_areEnemies (lua_State *L) |
| Checks to see if two pilots are enemies. | |
| static int | pilotL_areAllies (lua_State *L) |
| Checks to see if two pilots are allies. | |
| static int | pilotL_spaceworthy (lua_State *L) |
| Checks the pilot's spaceworthiness. | |
| static int | pilotL_setPosition (lua_State *L) |
| Sets the pilot's position. | |
| static int | pilotL_setVelocity (lua_State *L) |
| Sets the pilot's velocity. | |
| static int | pilotL_setDir (lua_State *L) |
| Sets the pilot's direction. | |
| static int | pilotL_broadcast (lua_State *L) |
| Makes the pilot broadcast a message. | |
| static int | pilotL_comm (lua_State *L) |
| Sends a message to the target or player if no target is passed. | |
| static int | pilotL_setFaction (lua_State *L) |
| Sets the pilot's faction. | |
| static int | pilotL_setHostile (lua_State *L) |
| Controls the pilot's hostility towards the player. | |
| static int | pilotL_setFriendly (lua_State *L) |
| Controls the pilot's friendliness towards the player. | |
| static int | pilotL_setInvincible (lua_State *L) |
| Sets the pilot's invincibility status. | |
| static int | pilotL_setInvincPlayer (lua_State *L) |
| Sets the pilot's invincibility status towards the player. | |
| static int | pilotL_setHide (lua_State *L) |
| Sets the pilot's hide status. | |
| static int | pilotL_setInvisible (lua_State *L) |
| Sets the pilot's invisibility status. | |
| static int | pilotL_setNoRender (lua_State *L) |
| Sets the pilot's norender status. | |
| static int | pilotL_setVisplayer (lua_State *L) |
| Marks the pilot as always visible for the player. | |
| static int | pilotL_setVisible (lua_State *L) |
| Marks the pilot as always visible for other pilots. | |
| static int | pilotL_setHilight (lua_State *L) |
| Makes pilot stand out on radar and the likes. | |
| static int | pilotL_setBribed (lua_State *L) |
| Makes pilot act as if bribed by the player. | |
| static int | pilotL_getColour (lua_State *L) |
| Gets the pilot's colour based on hostility or friendliness to the player. | |
| static int | pilotL_colourChar (lua_State *L) |
| Gets the pilot's colour character based on hostility or friendliness to the player. For use with functions that print to the screen. | |
| static int | pilotL_getHostile (lua_State *L) |
| Returns whether the pilot is hostile to the player. | |
| static int | pilotL_flags (lua_State *L) |
| Gets the pilot's flags. | |
| static int | pilotL_hasIllegal (lua_State *L) |
| Checks to see if the pilot has illegal stuff to a faction. | |
| static int | pilotL_setActiveBoard (lua_State *L) |
| Allows the pilot to be boarded when not disabled. | |
| static int | pilotL_setNoDeath (lua_State *L) |
| Makes it so the pilot never dies, stays at 1. armour. | |
| static int | pilotL_disable (lua_State *L) |
| Disables a pilot. | |
| static int | pilotL_cooldown (lua_State *L) |
| Gets a pilot's cooldown state. | |
| static int | pilotL_setCooldown (lua_State *L) |
| Starts or stops a pilot's cooldown mode. | |
| static int | pilotL_cooldownCycle (lua_State *L) |
| Makes the pilot do an instant full cooldown cycle. | |
| static int | pilotL_setNoJump (lua_State *L) |
| Enables or disables a pilot's hyperspace engine. | |
| static int | pilotL_setNoLand (lua_State *L) |
| Enables or disables landing for a pilot. | |
| static int | pilotL_setNoClear (lua_State *L) |
| Enables or disables making the the pilot exempt from pilot.clear(). | |
| static int | pilotL_outfitAdd (lua_State *L) |
| Adds an outfit to a pilot. | |
| static int | pilotL_outfitRm (lua_State *L) |
| Removes an outfit from a pilot. | |
| static int | pilotL_outfitSlot (lua_State *L) |
| Checks to see outfit a pilot has in a slot. | |
| static int | pilotL_outfitAddSlot (lua_State *L) |
| Adds an outfit to a pilot by slot name. | |
| static int | pilotL_outfitRmSlot (lua_State *L) |
| Removes an outfit from a pilot's named slot. | |
| static int | pilotL_outfitAddIntrinsic (lua_State *L) |
| Adds an intrinsic outfit to the pilot. | |
| static int | pilotL_outfitRmIntrinsic (lua_State *L) |
| Removes an intrinsic outfit from the pilot. | |
| static int | pilotL_getFuel (lua_State *L) |
| Gets the amount of fuel the pilot has. | |
| static int | pilotL_setFuel (lua_State *L) |
| Sets the fuel of a pilot. | |
| static int | pilotL_intrinsicReset (lua_State *L) |
| Resets the intrinsic stats of a pilot. | |
| static int | pilotL_intrinsicSet (lua_State *L) |
| Allows setting intrinsic stats of a pilot. | |
| static int | pilotL_intrinsicGet (lua_State *L) |
| Allows getting an intrinsic stats of a pilot, or gets all of them if name is not specified. | |
| static int | pilotL_shippropReset (lua_State *L) |
| Resets the ship property stats of a pilot. | |
| static int | pilotL_shippropSet (lua_State *L) |
| Allows setting ship property stats of a pilot. | |
| static int | pilotL_shippropGet (lua_State *L) |
| Allows getting an ship property stats of a pilot, or gets all of them if name is not specified. | |
| static int | pilotL_effectClear (lua_State *L) |
| Clears the effect on a pilot. | |
| static int | pilotL_effectAdd (lua_State *L) |
| Adds an effect to a pilot. | |
| static int | pilotL_effectRm (lua_State *L) |
| Removes an effect from the pilot. | |
| static int | pilotL_effectGet (lua_State *L) |
| Gets the effects on a pilot. | |
| static int | pilotL_ai (lua_State *L) |
| Gets the pilot's AI. | |
| static int | pilotL_changeAI (lua_State *L) |
| Changes the pilot's AI. | |
| static int | pilotL_setTemp (lua_State *L) |
| Sets the temperature of a pilot. | |
| static int | pilotL_setHealth (lua_State *L) |
| Sets the health of a pilot. | |
| static int | pilotL_setHealthAbs (lua_State *L) |
| Sets the health of a pilot in absolute value. | |
| static int | pilotL_addHealth (lua_State *L) |
| Adds health to a pilot. | |
| static int | pilotL_setEnergy (lua_State *L) |
| Sets the energy of a pilot. | |
| static int | pilotL_addEnergy (lua_State *L) |
| Adds (or subtracts) energy to a pilot. | |
| static int | pilotL_fillAmmo (lua_State *L) |
| Fills up the pilot's ammo. | |
| static int | pilotL_setNoBoard (lua_State *L) |
| Sets the ability to board the pilot. | |
| static int | pilotL_setNoDisable (lua_State *L) |
| Sets the ability of the pilot to be disabled. | |
| static int | pilotL_setSpeedLimit (lua_State *L) |
| Limits the speed of a pilot. | |
| static int | pilotL_getHealth (lua_State *L) |
| Gets the pilot's health. | |
| static int | pilotL_getArmour (lua_State *L) |
| Gets the pilot's armour. | |
| static int | pilotL_getShield (lua_State *L) |
| Gets the pilot's shield. | |
| static int | pilotL_getEnergy (lua_State *L) |
| Gets the pilot's energy. | |
| static int | pilotL_getLockon (lua_State *L) |
| Gets the lockons on the pilot. | |
| static int | pilotL_getStats (lua_State *L) |
| Gets stats of the pilot. | |
| static int | pilotL_getShipStat (lua_State *L) |
| Gets a shipstat from a Pilot by name, or a table containing all the ship stats if not specified. | |
| static int | pilotL_getDetectedDistance (lua_State *L) |
| Gets the distance that a pilot can be currently detect at. | |
| static int | pilotL_cargoFree (lua_State *L) |
| Gets the free cargo space the pilot has. | |
| static int | pilotL_cargoHas (lua_State *L) |
| Checks to see how many tonnes of a specific type of cargo the pilot has. | |
| static int | pilotL_cargoAdd (lua_State *L) |
| Tries to add cargo to the pilot's ship. | |
| static int | pilotL_cargoRm (lua_State *L) |
| Tries to remove cargo from the pilot's ship. | |
| static int | pilotL_cargoJet (lua_State *L) |
| Tries to remove a cargo from a pilot's ship and jet it into space. | |
| static int | pilotL_cargoList (lua_State *L) |
| Lists the cargo the pilot has. | |
| static int | pilotL_credits (lua_State *L) |
| Handles the pilots credits. | |
| static int | pilotL_worth (lua_State *L) |
| Gets the worth of a pilot (total value of ship and outfits). | |
| static int | pilotL_ship (lua_State *L) |
| Gets the pilot's ship. | |
| static int | pilotL_points (lua_State *L) |
| Gets the points the pilot costs. | |
| static int | pilotL_radius (lua_State *L) |
| Gets the rough radius of the ship, useful for collision stuff. | |
| static int | pilotL_idle (lua_State *L) |
| Checks to see if the pilot is idle. | |
| static int | pilotL_control (lua_State *L) |
| Sets manual control of the pilot. | |
| static int | pilotL_memory (lua_State *L) |
| Gets a pilots memory table. | |
| static int | pilotL_shipmemory (lua_State *L) |
| Gets a pilots ship memory table. | |
| static int | pilotL_ainame (lua_State *L) |
| Gets the name of the task the pilot is currently doing. | |
| static int | pilotL_task (lua_State *L) |
| Gets the name and data of a pilot's current task. | |
| static int | pilotL_taskname (lua_State *L) |
| Gets the name of the task the pilot is currently doing. | |
| static int | pilotL_taskstack (lua_State *L) |
| Gets the name of all the pilot's current tasks (not subtasks). | |
| static int | pilotL_taskdata (lua_State *L) |
| Gets the data of the task the pilot is currently doing. | |
| static int | pilotL_taskclear (lua_State *L) |
| Clears all the tasks of the pilot. | |
| static int | pilotL_pushtask (lua_State *L) |
| Pushes a new task to the pilot's AI. | |
| static int | pilotL_poptask (lua_State *L) |
| Pops the current task from the pilot's AI. | |
| static int | pilotL_refuel (lua_State *L) |
| Tries to refuel a pilot. | |
| static int | pilotL_moveto (lua_State *L) |
| Makes the pilot move to a position. | |
| static int | pilotL_face (lua_State *L) |
| Makes the pilot face a target. | |
| static int | pilotL_brake (lua_State *L) |
| Makes the pilot brake. | |
| static int | pilotL_follow (lua_State *L) |
| Makes the pilot follow another pilot. | |
| static int | pilotL_attack (lua_State *L) |
| Makes the pilot attack another pilot. | |
| static int | pilotL_board (lua_State *L) |
| Makes the pilot board another pilot. | |
| static int | pilotL_runaway (lua_State *L) |
| Makes the pilot runaway from another pilot. | |
| static int | pilotL_gather (lua_State *L) |
| Makes the pilot gather stuff. | |
| static int | pilotL_canHyperspace (lua_State *L) |
| Checks to see if the pilot can currently hyperspace (as in has target jump and is in range). | |
| static int | pilotL_hyperspace (lua_State *L) |
| Tells the pilot to hyperspace. | |
| static int | pilotL_stealth (lua_State *L) |
| Tells the pilot to try to stealth. | |
| static int | pilotL_tryStealth (lua_State *L) |
| Tries to make the pilot stealth. | |
| static int | pilotL_land (lua_State *L) |
| Tells the pilot to land. | |
| static int | pilotL_hailPlayer (lua_State *L) |
| Marks the pilot as hailing the player. | |
| static int | pilotL_msg (lua_State *L) |
| Sends a message to another pilot. | |
| static int | pilotL_mothership (lua_State *L) |
| Gets a pilots mothership (only exists for deployed pilots). Guaranteed to exist or will be nil. | |
| static int | pilotL_leader (lua_State *L) |
| Gets a pilots leader. Guaranteed to exist or will be nil. | |
| static int | pilotL_setLeader (lua_State *L) |
| Set a pilots leader. | |
| static int | pilotL_followers (lua_State *L) |
| Get all of a pilots followers. | |
| static int | pilotL_hookClear (lua_State *L) |
| Clears the pilot's hooks. | |
| static int | pilotL_choosePoint (lua_State *L) |
| Returns a suitable jumpin spot for a given pilot. Lua usage parameter: point = pilot.choosePoint( f, i, g ) | |
| static int | pilotL_collisionTest (lua_State *L) |
| Tests to see if two ships collide. | |
| static int | pilotL_damage (lua_State *L) |
| Damages a pilot. | |
| static int | pilotL_kill (lua_State *L) |
| Kills a pilot. | |
| static int | pilotL_knockback (lua_State *L) |
| Knocks back a pilot. It can either accept two pilots, or a pilot and an element represented by mass, velocity, and position. | |
| static int | pilotL_calcStats (lua_State *L) |
| Forces a recomputation of the pilots' stats. | |
| static int | pilotL_showEmitters (lua_State *L) |
| Toggles the emitter marker. | |
| static int | pilotL_shipvarPeek (lua_State *L) |
| Peeks at a ship variable. | |
| static int | pilotL_shipvarPush (lua_State *L) |
| Pushes a ship variable. | |
| static int | pilotL_shipvarPop (lua_State *L) |
| Pops a ship variable. | |
| static int | pilotL_render (lua_State *L) |
| Renders the pilot to a canvas. | |
| static int | pilotL_renderTo (lua_State *L) |
| Renders the pilot to a canvas. | |
| int | nlua_loadPilot (nlua_env env) |
| Loads the pilot library. | |
| LuaPilot | lua_topilot (lua_State *L, int ind) |
| Lua bindings to interact with pilots. | |
| LuaPilot | luaL_checkpilot (lua_State *L, int ind) |
| Gets pilot at index or raises error if there is no pilot at index. | |
| Pilot * | luaL_validpilot (lua_State *L, int ind) |
| Makes sure the pilot is valid or raises a Lua error. | |
| LuaPilot * | lua_pushpilot (lua_State *L, LuaPilot pilot) |
| Pushes a pilot on the stack. | |
| int | lua_ispilot (lua_State *L, int ind) |
| Checks to see if ind is a pilot. | |
| static void | clearSelect (Pilot *const *pilot_stack, int f) |
| void | toggleSpawn (int f, int b) |
| static int | getFriendOrFoeTest (const Pilot *p, const Pilot *plt, int friend, double dd, int inrange, int dis, int fighters, const vec2 *v, LuaFaction lf) |
| static int | weapsetItem (lua_State *L, int *k, Pilot *p, const PilotOutfitSlot *slot, const Pilot *target) |
| Sets up an item in a weapon set. | |
| static int | outfitToggle (lua_State *L, Pilot *p, int id, int activate) |
| static int | pilotL_cargoRmHelper (lua_State *L, int jet) |
| static const CollPoly * | getCollPoly (const Pilot *p) |
Variables | |
| Pilot * | cur_pilot |
| static const luaL_Reg | pilotL_methods [] |
| static const struct pL_flag | pL_flags [] |
Handles the Lua pilot bindings.
These bindings control the spobs and systems.
Definition in file nlua_pilot.c.
| #define PUSH_DOUBLE | ( | L, | |
| name, | |||
| value ) |
Definition at line 4744 of file nlua_pilot.c.
| #define PUSH_INT | ( | L, | |
| name, | |||
| value ) |
Definition at line 4748 of file nlua_pilot.c.
|
static |
Definition at line 874 of file nlua_pilot.c.
Definition at line 6328 of file nlua_pilot.c.
|
static |
Definition at line 1070 of file nlua_pilot.c.
| int lua_ispilot | ( | lua_State * | L, |
| int | ind ) |
Checks to see if ind is a pilot.
| L | Lua state to check. |
| ind | Index position to check. |
Definition at line 578 of file nlua_pilot.c.
| LuaPilot * lua_pushpilot | ( | lua_State * | L, |
| LuaPilot | pilot ) |
Pushes a pilot on the stack.
| L | Lua state to push pilot into. |
| pilot | Pilot to push. |
Definition at line 563 of file nlua_pilot.c.
| LuaPilot lua_topilot | ( | lua_State * | L, |
| int | ind ) |
Lua bindings to interact with pilots.
This will allow you to create and manipulate pilots in-game.
An example would be:
Lua module: pilot
Gets pilot at index.
| L | Lua state to get pilot from. |
| ind | Index position to find the pilot. |
Definition at line 522 of file nlua_pilot.c.
| LuaPilot luaL_checkpilot | ( | lua_State * | L, |
| int | ind ) |
Gets pilot at index or raises error if there is no pilot at index.
| L | Lua state to get pilot from. |
| ind | Index position to find pilot. |
Definition at line 533 of file nlua_pilot.c.
|
static |
Definition at line 2018 of file nlua_pilot.c.
|
static |
Definition at line 2010 of file nlua_pilot.c.
| Pilot * luaL_validpilot | ( | lua_State * | L, |
| int | ind ) |
Makes sure the pilot is valid or raises a Lua error.
| L | State currently running. |
| ind | Index of the pilot to validate. |
Definition at line 547 of file nlua_pilot.c.
| int nlua_loadPilot | ( | nlua_env | env | ) |
Loads the pilot library.
| env | Environment to load library into. |
Definition at line 468 of file nlua_pilot.c.
|
static |
qsort compare function for active outfits.
Definition at line 2484 of file nlua_pilot.c.
|
static |
Definition at line 2662 of file nlua_pilot.c.
|
static |
Adds an outfit to a specific slot.
Definition at line 3601 of file nlua_pilot.c.
|
static |
Gets the accel of a pilot.
Lua function parameter: Pilot p Pilot to get accel of. Lua return parameter: number The pilot's current accel.
| L | Lua State |
Lua function: accel
Definition at line 2887 of file nlua_pilot.c.
|
static |
Gets the active outfits and their states of the pilot.
The active outfits have the following structure:
An example would be:
Lua usage parameter: act_outfits = p:actives() – Gets the table of active outfits
Lua function parameter: Pilot p Pilot to get active outfits of. Lua function parameter:[opt=false] boolean sort Whether or not to sort the otufits. Lua return parameter: table The table with each active outfit's information.
| L | Lua State |
Lua function: actives
Definition at line 2338 of file nlua_pilot.c.
|
static |
Adds a ship with an AI and faction to the system (instead of a predefined fleet).
Lua usage parameter: p = pilot.add( "Empire Shark", "Empire" ) – Creates a standard Empire Shark. Lua usage parameter: p = pilot.add( "Pirate Hyena", "Pirate", _("Blackbeard") ) – Just adds the pilot (will jump in or take off). Lua usage parameter: p = pilot.add( "Llama", "Trader", nil, _("Trader Llama"), {ai="dummy"} ) – Overrides AI with dummy ai. Lua usage parameter: p = pilot.add( "Gawain", "Civilian", vec2.new( 1000, 200 ) ) – Pilot won't jump in, will just appear. Lua usage parameter: p = pilot.add( "Empire Pacifier", "Empire", system.get("Goddard") ) – Have the pilot jump in from the system. Lua usage parameter: p = pilot.add( "Goddard", "Goddard", spob.get("Zhiru") , _("Goddard Goddard") ) – Have the pilot take off from a spob.
How param works (by type of value passed):
true: Acts like nil, but does not avoid jump points with no presence
Lua function parameter: Ship|string shipname Name of the ship to add. Lua function parameter: Faction |stringfaction Faction to give the pilot. Lua function parameter: System|Spob|Vec2 param Position to create pilot at, if it's a system it'll try to jump in from that system, if it's a spob it'll try to take off from it. Lua function parameter:[opt] string pilotname Name to give the pilot. Defaults to shipname. Lua function parameter:[opt] table parameters Table of extra keyword arguments. Supported arguments: "ai" (string): AI to give the pilot. Defaults to the faction's AI. "naked" (boolean): Whether or not to have the pilot spawn without outfits. Defaults to false. "stealth" (boolean): Whether or not to have the pilot spawn in stealth mode. Defaults to false. Lua return parameter: Pilot The created pilot.
| L | Lua State |
Lua function: add
Definition at line 658 of file nlua_pilot.c.
|
static |
Adds (or subtracts) energy to a pilot.
Lua function parameter: Pilot p Pilot to set energy of. Lua function parameter: number energy Energy value to add.
| L | Lua State |
Lua function: addEnergy
Definition at line 4523 of file nlua_pilot.c.
|
static |
Adds health to a pilot.
Does not revive dead pilots, use setHealth for that.
Lua function parameter: Pilot p Pilot to add health to. Lua function parameter:[opt=0.] number armour Armour to add. Lua function parameter:[opt=0.] number shield Shield to add.
| L | Lua State |
Lua function: addHealth
Definition at line 4470 of file nlua_pilot.c.
|
static |
Gets the pilot's AI.
Lua function parameter: Pilot p Pilot to get AI of. Lua return parameter: string Name of the AI being used.
| L | Lua State |
Lua function: ai
Definition at line 4289 of file nlua_pilot.c.
|
static |
Gets the name of the task the pilot is currently doing.
Lua function parameter: Pilot p Pilot to get task name of. Lua return parameter: string Name of the task.
| L | Lua State |
Lua function: ainame
Definition at line 5410 of file nlua_pilot.c.
|
static |
Checks to see if two pilots are allies.
Lua function parameter: Pilot p Pilot to check. Lua function parameter: Pilot t Target pilot to check. Lua return parameter: boolean true if both p and t are allies, false otherwise.
| L | Lua State |
Lua function: areAllies
Definition at line 2977 of file nlua_pilot.c.
|
static |
Checks to see if two pilots are enemies.
Lua function parameter: Pilot p Pilot to check. Lua function parameter: Pilot t Target pilot to check. Lua return parameter: boolean true if both p and t are enemies, false otherwise.
| L | Lua State |
Lua function: areEnemies
Definition at line 2961 of file nlua_pilot.c.
|
static |
Makes the pilot attack another pilot.
Pilot must be under manual control for this to work.
Lua usage parameter: p:attack( another_pilot ) – Attack another pilot Lua usage parameter: p:attack() – Attack nearest pilot.
Lua function parameter: Pilot p Pilot to tell to attack another pilot. Lua function parameter:[opt] Pilot pt Target pilot to attack (or nil to attack nearest enemy). See also: control
| L | Lua State |
Lua function: attack
Definition at line 5777 of file nlua_pilot.c.
|
static |
Makes the pilot board another pilot.
Pilot must be under manual control for this to work.
Lua usage parameter: p:board( another_pilot ) – Attack another pilot
Lua function parameter: Pilot p Pilot to tell to board another pilot. Lua function parameter: Pilot pt Target pilot to board See also: control
| L | Lua State |
Lua function: board
Definition at line 5815 of file nlua_pilot.c.
|
static |
Makes the pilot brake.
Pilot must be under manual control for this to work.
Lua function parameter: Pilot p Pilot to tell to brake. See also: control
| L | Lua State |
Lua function: brake
Definition at line 5721 of file nlua_pilot.c.
|
static |
Makes the pilot broadcast a message.
Lua usage parameter: p:broadcast(_("Mayday! Requesting assistance!")) Lua usage parameter: p:broadcast(_("Help!"), true ) – Will ignore interference Lua usage parameter: pilot.broadcast( _("Message Buoy"), _("Important annauncement") ) – Messages player ignoring interference
Lua function parameter: Pilot|string p Pilot to broadcast the message, or string to use as a fictional pilot name. In the case of a string, interference is always ignored, and instead of the ignore_int parameter, a colour character such as 'F' or 'H' can be optionally passed. Lua function parameter: string msg Message to broadcast. Lua function parameter:[opt=false] boolean ignore_int Whether or not it should ignore interference.
| L | Lua State |
Lua function: broadcast
Definition at line 3092 of file nlua_pilot.c.
|
static |
Forces a recomputation of the pilots' stats.
Lua function parameter: Pilot p Pilot to recalculate stats of.
| L | Lua State |
Lua function: calcStats
Definition at line 6515 of file nlua_pilot.c.
|
static |
Checks to see if the pilot can currently hyperspace (as in has target jump and is in range).
Lua function parameter: Pilot p Pilot to check if they can hyperspace. Lua return parameter: boolean Whether or not the pilot can hyperspace.
| L | Lua State |
Lua function: canHyperspace
Definition at line 5917 of file nlua_pilot.c.
|
static |
Returns if pilots can can spawn naturally in the current system.
Lua return parameter: boolean The current spawn state.
| L | Lua State |
Lua function: canSpawn
Definition at line 938 of file nlua_pilot.c.
|
static |
Tries to add cargo to the pilot's ship.
Lua usage parameter: n = pilot.cargoAdd( player.pilot(), "Food", 20 )
Lua function parameter: Pilot p The pilot to add cargo to. Lua function parameter: Commodity|string cargo Type of cargo to add, either as a Commodity object or as the raw (untranslated) name of a commodity. Lua function parameter: number quantity Quantity of cargo to add. Lua return parameter: number The quantity of cargo added.
| L | Lua State |
Lua function: cargoAdd
Definition at line 4905 of file nlua_pilot.c.
|
static |
Gets the free cargo space the pilot has.
Lua function parameter: Pilot p The pilot to get the free cargo space of. Lua return parameter: number The free cargo space in tonnes of the player.
| L | Lua State |
Lua function: cargoFree
Definition at line 4866 of file nlua_pilot.c.
|
static |
Checks to see how many tonnes of a specific type of cargo the pilot has.
Lua function parameter: Pilot p The pilot to get the cargo count of. Lua function parameter: Commodity|string cargo Type of cargo to check, either as a Commodity object or as the raw (untranslated) name of a commodity. Lua return parameter: number The amount of cargo the player has.
| L | Lua State |
Lua function: cargoHas
Definition at line 4883 of file nlua_pilot.c.
|
static |
Tries to remove a cargo from a pilot's ship and jet it into space.
Lua function parameter: Pilot p The pilot to remove cargo from. Lua function parameter: Commodity|string cargo Type of cargo to remove, either as a Commodity object or as the raw (untranslated) name of a commodity. You can also pass the special value "all" to remove all cargo from the pilot, except for mission cargo. Lua function parameter: number quantity Quantity of the cargo to remove. Lua return parameter: number The number of cargo removed.
| L | Lua State |
Lua function: cargoJet
Definition at line 4990 of file nlua_pilot.c.
|
static |
Lists the cargo the pilot has.
The list has the following members:
Lua usage parameter: for i, v in ipairs(pilot.cargoList(player.pilot())) do print( string.format("%s: %d", v.name, v.q ) ) end
Lua function parameter: Pilot p Pilot to list cargo of. Lua return parameter: table An ordered list with the names of the cargo the pilot has.
| L | Lua State |
Lua function: cargoList
Definition at line 5012 of file nlua_pilot.c.
|
static |
Tries to remove cargo from the pilot's ship.
Lua usage parameter: n = pilot.cargoRm(player.pilot(), "Food", 20) Lua usage parameter: n = pilot.cargoRm(player.pilot(), "all") – Removes all cargo from the player
Lua function parameter: Pilot p The pilot to remove cargo from. Lua function parameter: Commodity|string cargo Type of cargo to remove, either as a Commodity object or as the raw (untranslated) name of a commodity. You can also pass the special value "all" to remove all cargo from the pilot, except for mission cargo. Lua function parameter: number quantity Quantity of the cargo to remove. Lua return parameter: number The number of cargo removed.
| L | Lua State |
Lua function: cargoRm
Definition at line 4973 of file nlua_pilot.c.
|
static |
Definition at line 4921 of file nlua_pilot.c.
|
static |
Changes the pilot's AI.
Lua usage parameter: p:changeAI( "empire" ) – set the pilot to use the Empire AI
Lua function parameter: Pilot p Pilot to change AI of. Lua function parameter: string newai Name of Ai to use.
| L | Lua State |
Lua function: changeAI
Definition at line 4307 of file nlua_pilot.c.
|
static |
Returns a suitable jumpin spot for a given pilot. Lua usage parameter: point = pilot.choosePoint( f, i, g )
Lua function parameter: Faction f Faction the pilot will belong to. Lua function parameter:[opt=false] boolean i Whether to ignore rules. Lua function parameter:[opt=false] boolean g Whether to behave as guerilla (spawn in deep space) Lua return parameter: Spob|Vec2|Jump A randomly chosen suitable spawn point.
| L | Lua State |
Lua function: choosePoint
Definition at line 604 of file nlua_pilot.c.
|
static |
Clears the current system of pilots. Used for epic battles and such.
Be careful with this command especially in big systems. It will most likely cause issues if multiple missions are in the same system.
Lua usage parameter: pilot.clear()
| L | Lua State |
Lua function: clear
Definition at line 924 of file nlua_pilot.c.
|
static |
Removes all pilots belonging to a faction from the system.
Lua function parameter: Faction|table fac Faction name/object or table of faction name/objects to selectively clear.
Lua usage parameter: pilot.clearSelect("Empire")
| L | Lua State |
Lua function: clearSelect
Definition at line 896 of file nlua_pilot.c.
|
static |
Clones a pilot. It will share nearly all properties including outfits.
Lua function parameter: Pilot p Pilot to clone. Lua return parameter: Pilot A new clone of the pilot.
| L | Lua State |
Lua function: clone
Definition at line 806 of file nlua_pilot.c.
|
static |
Tests to see if two ships collide.
Lua function parameter: Pilot p First pilot to check. Lua function parameter: Pilot|Asteroid t Second object to check. Lua return parameter: Vec2|nil nil if no collision, or Vec2 with collision point if collided.
| L | Lua State |
Lua function: collisionTest
Definition at line 6341 of file nlua_pilot.c.
|
static |
Gets the pilot's colour character based on hostility or friendliness to the player. For use with functions that print to the screen.
Lua function parameter: Pilot p Pilot to get the colour of. Lua return parameter: string Character representing the pilot's colour for use with specila printing characters.
| L | Lua State |
Lua function: colour
Definition at line 5099 of file nlua_pilot.c.
|
static |
Sends a message to the target or player if no target is passed.
Lua usage parameter: p:comm( _("How are you doing?") ) – Messages the player Lua usage parameter: p:comm( _("You got this?"), true ) – Messages the player ignoring interference Lua usage parameter: p:comm( target, _("Heya!") ) – Messages target Lua usage parameter: p:comm( target, _("Got this?"), true ) – Messages target ignoring interference Lua usage parameter: pilot.comm( _("Message Buoy"), _("Important information just for you!") ) – Messages player ignoring interference
Lua function parameter: Pilot|string p Pilot to message the player, or string to use as a fictional pilot name. In the case of a string, interference is always ignored, and instead of ignore_int, a colour character such as 'F' or 'H' can be passed. Lua function parameter: Pilot target Target to send message to. Lua function parameter: string msg Message to send. Lua function parameter:[opt=false] boolean|colour param1 Whether or not it should ignore interference in the case a pilot is being used, otherwise it is a colour string such as 'N' that can be used to colour the text.. Lua function parameter:[opt=false] boolean raw Whether or not to just display the raw text without quotation marks instead of a "message".
| L | Lua State |
Lua function: comm
Definition at line 3132 of file nlua_pilot.c.
|
static |
Sets manual control of the pilot.
Note that this will reset the pilot's current task when the state changes. In the case of the player, it will also clear autonav.
Lua usage parameter: p:control() – Same as p:control(true), enables manual control of the pilot Lua usage parameter: p:control(false) – Restarts AI control of the pilot Lua usage parameter: p:control( true, true ) – Enables manual control of the pilot and resets tasks.
Lua function parameter: Pilot p Pilot to change manual control settings. Lua function parameter:[opt=true] boolean enable If true or nil enables pilot manual control, otherwise enables automatic AI. Lua function parameter:[opt=true if changing modes] boolean Whether or not to clear the tasks for the pilot. Defaults to true when changing from manual to normal mode or viceversa. See also: moveto See also: brake See also: follow See also: attack See also: runaway See also: hyperspace See also: land
| L | Lua State |
Lua function: control
Definition at line 5321 of file nlua_pilot.c.
|
static |
Gets a pilot's cooldown state.
Lua usage parameter: cooldown, braking = p:cooldown()
Lua function parameter: Pilot p Pilot to check the cooldown status of. Lua return parameter: boolean Cooldown status. Lua return parameter: boolean Cooldown braking status.
| L | Lua State |
Lua function: cooldown
Definition at line 3500 of file nlua_pilot.c.
|
static |
Makes the pilot do an instant full cooldown cycle.
Lua function parameter: Pilot p Pilot to perform cycle.
| L | Lua State |
Lua function: cooldownCycle
Definition at line 3544 of file nlua_pilot.c.
|
static |
Handles the pilots credits.
Lua function parameter: Pilot p Pilot to manipulate credits of. Lua function parameter:[opt=0] number cred Credits to give to the pilot. Lua return parameter: number The credits the pilot has.
| L | Lua State |
Lua function: credits
Definition at line 5052 of file nlua_pilot.c.
|
static |
Damages a pilot.
Lua function parameter: Pilot p Pilot being damaged. Lua function parameter: number dmg Damage being done. Lua function parameter:[opt=0.] number disable Disable being done. Lua function parameter:[opt=0.] number penetration Penetration (in %). Lua function parameter:[opt="raw"] string type Damage type being done. Lua function parameter:[opt=nil] Pilot shooter Pilot doing the damage. Lua return parameter: number Amount of damage done.
| L | Lua State |
Lua function: damage
Definition at line 6397 of file nlua_pilot.c.
|
static |
Gets the pilot's direction.
Lua usage parameter: d = p:dir()
Lua function parameter: Pilot p Pilot to get the direction of. Lua return parameter: number The pilot's current direction as a number (in radians).
| L | Lua State |
Lua function: dir
Definition at line 2841 of file nlua_pilot.c.
|
static |
Disables a pilot.
Lua usage parameter: p:disable()
Lua function parameter: Pilot p Pilot to disable. Lua function parameter:[opt=false] boolean nopermanent Whether or not the disable should be not permanent.
| L | Lua State |
Lua function: disable
Definition at line 3471 of file nlua_pilot.c.
|
static |
Adds an effect to a pilot.
Lua function parameter: Pilot p Pilot to add effect to. Lua function parameter: string name Name of the effect to add. Lua function parameter:[opt=-1] duration Duration of the effect or set to negative to be default. Lua function parameter:[opt=1] scale Scaling factor. Lua return parameter: boolean Whether or not the effect was successfully added.
| L | Lua State |
Lua function: effectAdd
Definition at line 4192 of file nlua_pilot.c.
|
static |
Clears the effect on a pilot.
Lua function parameter: Pilot p Pilot to clear effects of. Lua function parameter: boolean keepdebuffs Whether or not to keep debuffs. Lua function parameter: boolean keepbuffs Whether or not to keep buffs. Lua function parameter: boolean keepothers Whether or not to keep others.
| L | Lua State |
Lua function: effectClear
Definition at line 4168 of file nlua_pilot.c.
|
static |
Gets the effects on a pilot.
Lua function parameter: Pilot p Pilot to get effects of. Lua return parameter: table Table of effects which are treated as tables with "name" and "timer" elements.
| L | Lua State |
Lua function: effects
Definition at line 4244 of file nlua_pilot.c.
|
static |
Removes an effect from the pilot.
Lua function parameter: Pilot p Pilot to remove effect from. Lua function parameter: string|integer name Name of the effect to add or index in the case of being a number. Lua function parameter: boolean all Remove all instances of the effect or only the most first instance. Only valid in the case the name is specified as a string.
| L | Lua State |
Lua function: effectRm
Definition at line 4217 of file nlua_pilot.c.
|
static |
Checks to see if pilot and p are the same.
Lua usage parameter: if p == p2 then – Pilot 'p' and 'p2' match.
Lua function parameter: Pilot p Pilot to compare. Lua function parameter: Pilot comp Pilot to compare against. Lua return parameter: boolean true if they are the same.
| L | Lua State |
Lua function: __eq
Definition at line 1357 of file nlua_pilot.c.
|
static |
Checks to see if pilot is still in the system and alive.
Pilots cease to exist if they die or jump out.
Lua usage parameter: if p:exists() then – Pilot still exists
Lua function parameter: Pilot p Pilot to check to see if is still exists. Lua return parameter: boolean true if pilot is still exists.
| L | Lua State |
Lua function: exists
Definition at line 1428 of file nlua_pilot.c.
|
static |
Removes a pilot as if it exploded.
Note that this triggers the exploded hook which can cause the explosion to fail unlike pilot.rm.
Lua usage parameter: p:exploded() – pilot will be destroyed
Lua function parameter: Pilot p Pilot to remove. Lua return parameter: boolean true if exploded succeeded, false otherwise (such as when stopped by a hook).
| L | Lua State |
Lua function: explode
Definition at line 851 of file nlua_pilot.c.
|
static |
Makes the pilot face a target.
Lua usage parameter: p:face( enemy_pilot ) – Face enemy pilot Lua usage parameter: p:face( vec2.new( 0, 0 ) ) – Face origin Lua usage parameter: p:face( enemy_pilot, true ) – Task lasts until the enemy pilot is faced
Lua function parameter: Pilot p Pilot to add task to. Lua function parameter: Vec2|Pilot target Target to face. Lua function parameter:[opt=false] boolean towards Makes the task end when the target is faced (otherwise it's an enduring state).
| L | Lua State |
Lua function: face
Definition at line 5679 of file nlua_pilot.c.
|
static |
Gets the pilot's faction.
Lua usage parameter: f = p:faction()
Lua function parameter: Pilot p Pilot to get the faction of. Lua return parameter: Faction The faction of the pilot.
| L | Lua State |
Lua function: faction
Definition at line 2946 of file nlua_pilot.c.
|
static |
Fills up the pilot's ammo.
Lua function parameter: Pilot p Pilot to fill ammo.
| L | Lua State |
Lua function: fillAmmo
Definition at line 4538 of file nlua_pilot.c.
|
static |
Gets the pilot's flags.
Valid flags are:
Lua function parameter: Pilot p Pilot to get flags of. Lua function parameter:[opt] string name If provided, return only the individual flag. Lua return parameter: table Table with flag names an index, boolean as value.
| L | Lua State |
Lua function: flags
Definition at line 5197 of file nlua_pilot.c.
|
static |
Makes the pilot follow another pilot.
Pilot must be under manual control for this to work.
Lua function parameter: Pilot p Pilot to tell to follow another pilot. Lua function parameter: Pilot pt Target pilot to follow. Lua function parameter:[opt=false] boolean accurate If true, use a PD controller which parameters can be defined using the pilot's memory. See also: control See also: memory
| L | Lua State |
Lua function: follow
Definition at line 5741 of file nlua_pilot.c.
|
static |
Get all of a pilots followers.
Lua function parameter: Pilot p Pilot to get the followers of. Lua return parameter: {Pilot,...} Table of followers.
| L | Lua State |
Lua function: followers
Definition at line 6294 of file nlua_pilot.c.
|
static |
Makes the pilot gather stuff.
Lua usage parameter: p:gather( ) – Try to gather stuff See also: control
| L | Lua State |
Lua function: gather
Definition at line 5902 of file nlua_pilot.c.
|
static |
Gets friendly pilots to a pilot (or faction) within a certain distance.
Lua usage parameter: p:getAllies( 5000 ) – get allies within 5000 Lua usage parameter: pilot.getAllies( faction.get("Pirate"), 5000, vec2.new(0,0) ) – Got allies of "Pirate" faction 5000 units from origin
Lua function parameter: Pilot|faction pilot Pilot or to get allies of. Lua function parameter:[opt=infinity] number dist Distance to look for allies. Lua function parameter:[opt=pilot.pos] Vec2 pos Position to check from. Lua function parameter:[opt=false] boolean ignore_range Whether or not to only check for pilots in range (only in the case of pilot, not faction) Lua function parameter:[opt=false] boolean disabled Whether or not to count disabled pilots. Lua function parameter:[opt=false] boolean fighters Whether or not to count deployed fighters. Lua return parameter: {Pilot,...} A table containing the pilots.
| L | Lua State |
Lua function: getAllies
Definition at line 1224 of file nlua_pilot.c.
|
static |
Gets the pilot's armour.
Lua usage parameter: armour = p:armour()
Lua function parameter: Pilot p Pilot to get armour of. Lua function parameter:[opt=false] boolean absolute Whether or not it shouldn't be relative and be absolute instead. Lua return parameter: number The armour in % [0:100] if relative or absolute value otherwise.
| L | Lua State |
Lua function: armour
Definition at line 4675 of file nlua_pilot.c.
|
static |
Gets the pilot's colour based on hostility or friendliness to the player.
Lua usage parameter: p:colour()
Lua function parameter: Pilot p Pilot to get the colour of. Lua return parameter: Colour The pilot's colour.
| L | Lua State |
Lua function: colour
Definition at line 5084 of file nlua_pilot.c.
|
static |
Gets the distance that a pilot can be currently detect at.
Lua function parameter: Pilot p Pilot to get the distance they can be detected at.
| L | Lua State |
Lua function: detectedDistance
Definition at line 4849 of file nlua_pilot.c.
|
static |
Gets hostile pilots to a pilot (or faction) within a certain distance.
Lua usage parameter: p:getEnemies( 5000 ) – get hostiles within 5000 Lua usage parameter: pilot.getEnemies( faction.get("Pirate"), 5000, vec2.new(0,0) ) – Got hostiles of "Pirate" faction 5000 units from origin
Lua function parameter: Pilot|faction pilot Pilot or to get hostiles of. Lua function parameter:[opt=infinity] number dist Distance to look for hostiles. Lua function parameter:[opt=pilot.pos] Vec2 pos Position to check from. Lua function parameter:[opt=false] boolean ignore_range Whether or not to ignore checks for pilots in range (only in the case of pilot, not faction) Lua function parameter:[opt=false] boolean disabled Whether or not to count disabled pilots. Lua function parameter:[opt=false] boolean fighters Whether or not to count deployed fighters. Lua return parameter: {Pilot,...} A table containing the pilots.
| L | Lua State |
Lua function: getEnemies
Definition at line 1246 of file nlua_pilot.c.
|
static |
Gets the pilot's energy.
Lua usage parameter: energy = p:energy()
Lua function parameter: Pilot p Pilot to get energy of. Lua function parameter:[opt=false] boolean absolute Whether or not to return the absolute numeric value instead of the relative value. Lua return parameter: number The energy of the pilot in % [0:100].
| L | Lua State |
Lua function: energy
Definition at line 4717 of file nlua_pilot.c.
|
static |
Definition at line 1133 of file nlua_pilot.c.
|
static |
Gets the amount of fuel the pilot has.
Lua return parameter: number The amount of fuel the pilot has.
| L | Lua State |
Lua function: fuel
Definition at line 3965 of file nlua_pilot.c.
|
static |
Gets the pilot's health.
Lua usage parameter: armour, shield, stress, dis = p:health()
Lua function parameter: Pilot p Pilot to get health of. Lua function parameter:[opt=false] boolean absolute Whether or not it shouldn't be relative and be absolute instead. Lua return parameter: number The armour in % [0:100] if relative or absolute value otherwise. Lua return parameter: number The shield in % [0:100] if relative or absolute value otherwise. Lua return parameter: number The stress in % [0:100]. Lua return parameter: boolean Indicates if pilot is disabled.
| L | Lua State |
Lua function: health
Definition at line 4647 of file nlua_pilot.c.
|
static |
Returns whether the pilot is hostile to the player.
Lua usage parameter: p:hostile()
Lua function parameter: Pilot p Pilot to get the hostility of. Lua return parameter: boolean The pilot's hostility status.
| L | Lua State |
Lua function: hostile
Definition at line 5118 of file nlua_pilot.c.
|
static |
Gets visible pilots to a pilot within a certain distance.
Lua function parameter: vec2 pos Position to get pilots in range of. Lua function parameter: number d Distance to get pilots in. Lua function parameter:[opt=false] boolean disabled Whether or not to count disabled pilots. Lua return parameter: {Pilot,...} A table containing the pilots.
| L | Lua State |
Lua function: getInrange
Definition at line 1304 of file nlua_pilot.c.
|
static |
Gets the lockons on the pilot.
Lua usage parameter: lockon = p:lockon()
Lua function parameter: Pilot p Pilot to get lockons of. Lua return parameter: number The number of lockons on the pilot.
| L | Lua State |
Lua function: lockon
Definition at line 4737 of file nlua_pilot.c.
|
static |
Gets the pilots available in the system by a certain criteria.
Lua usage parameter: p = pilot.get() – Gets all the pilots Lua usage parameter: p = pilot.get( { faction.get("Empire") } ) – Only gets empire pilots. Lua usage parameter: p = pilot.get( nil, true ) – Gets all pilots including disabled Lua usage parameter: p = pilot.get( { faction.get("Empire") }, true ) – Only empire pilots with disabled
Lua function parameter: Faction|{Faction,...} factions If f is a table of factions, it will only get pilots matching those factions. Otherwise it gets all the pilots. Lua function parameter: boolean disabled Whether or not to get disabled ships (default is off if parameter is omitted). Lua return parameter: {Pilot,...} A table containing the pilots.
| L | Lua State |
Lua function: get
Definition at line 1010 of file nlua_pilot.c.
|
static |
Gets the pilot's shield.
Lua usage parameter: shield = p:shield()
Lua function parameter: Pilot p Pilot to get shield of. Lua function parameter:[opt=false] boolean absolute Whether or not it shouldn't be relative and be absolute instead. Lua return parameter: number The shield in % [0:100] if relative or absolute value otherwise.
| L | Lua State |
Lua function: shield
Definition at line 4696 of file nlua_pilot.c.
|
static |
Gets a shipstat from a Pilot by name, or a table containing all the ship stats if not specified.
Lua usage parameter: local mod = p:shipstat("tur_damage",true) – Gets turret damage bonus with internal representation
Lua function parameter: Pilot p Pilot 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 table containing all the ship stats if name is not specified.
| L | Lua State |
Lua function: shipstat
Definition at line 4834 of file nlua_pilot.c.
|
static |
Gets stats of the pilot.
Some of the stats are:
Lua usage parameter: stats = p:stats() print(stats.armour)
Lua function parameter: Pilot p Pilot to get stats of. Lua return parameter: table A table containing the stats of p.
| L | Lua State |
Lua function: stats
Definition at line 4785 of file nlua_pilot.c.
|
static |
Gets visible pilots to a pilot.
Lua function parameter: Pilot pilot Pilot to get visible pilots of. Lua function parameter:[opt=false] boolean disabled Whether or not to count disabled pilots. Lua return parameter: {Pilot,...} A table containing the pilots.
| L | Lua State |
Lua function: getVisible
Definition at line 1264 of file nlua_pilot.c.
|
static |
Marks the pilot as hailing the player.
Automatically deactivated when pilot is hailed.
Lua usage parameter: p:hailPlayer() – Player will be informed he's being hailed and pilot will have an icon Lua function parameter: Pilot p Pilot to hail the player. Lua function parameter:[opt=true] boolean enable If true hails the pilot, if false disables the hailing.
| L | Lua State |
Lua function: hailPlayer
Definition at line 6077 of file nlua_pilot.c.
|
static |
Checks to see if the pilot has illegal stuff to a faction.
Lua function parameter: Pilot p Pilot to check. Lua function parameter: Faction f Faction to see if it is illegal to.
| L | Lua State |
Lua function: hasIllegal
Definition at line 5230 of file nlua_pilot.c.
|
static |
Clears the pilot's hooks.
Clears all the hooks set on the pilot.
Lua usage parameter: p:hookClear() Lua function parameter: Pilot p Pilot to clear hooks.
| L | Lua State |
Lua function: hookClear
Definition at line 6321 of file nlua_pilot.c.
|
static |
Tells the pilot to hyperspace.
Pilot must be under manual control for this to work.
Lua function parameter: Pilot p Pilot to tell to hyperspace. Lua function parameter:[opt] System|Jump sys Optional System to jump to, uses random if nil. Lua function parameter:[opt=false] boolean noshoot Forbids to shoot at targets with turrets while running away. See also: control
| L | Lua State |
Lua function: hyperspace
Definition at line 5935 of file nlua_pilot.c.
|
static |
Gets the ID of the pilot.
Lua usage parameter: id = p:id()
Lua function parameter: p Pilot Pilot to get the ID of. Lua return parameter: number The ID of the current pilot.
| L | Lua State |
Lua function: id
Definition at line 1410 of file nlua_pilot.c.
|
static |
Checks to see if the pilot is idle.
Lua usage parameter: idle = p:idle() – Returns true if the pilot is idle
Lua function parameter: Pilot p Pilot to check to see if is idle. Lua return parameter: boolean true if pilot is idle, false otherwise
| L | Lua State |
Lua function: idle
Definition at line 5293 of file nlua_pilot.c.
|
static |
Checks to see if a target pilot is in range of a pilot.
TODO add supports for spobs and jump points.
Lua usage parameter: detected, scanned = p:inrange( target )
Lua function parameter: Pilot p Pilot to see if another pilot is in range. Lua function parameter: Pilot|Asteroid|Vec2 target Target pilot or asteroid to check if in range. Lua return parameter: boolean True if the pilot is visible at all. Lua return parameter: boolean True if the pilot is visible and well-defined (not fuzzy). Always true if target is not a Pilot.
| L | Lua State |
Lua function: inrange
Definition at line 1546 of file nlua_pilot.c.
|
static |
Allows getting an intrinsic stats of a pilot, or gets all of them if name is not specified.
Lua function parameter: Pilot p Pilot to get stat of. Lua function parameter:[opt=nil] string name Name of the stat to get. It is the same as in the xml. Lua function parameter:[opt=false] boolean internal Whether or not to use the internal representation. Lua function parameter: Value of the stat or a table containing all the stats if name is not specified.
| L | Lua State |
Lua function: intrinsicGet
Definition at line 4068 of file nlua_pilot.c.
|
static |
Resets the intrinsic stats of a pilot.
| L | Lua State |
Lua function: intrinsicReset
Definition at line 4010 of file nlua_pilot.c.
|
static |
Allows setting intrinsic stats of a pilot.
Lua usage parameter: p:intrinsicSet( "turn", -50 ) – Lowers p's turn by 50%
Lua function parameter: Pilot p Pilot to set stat of. Lua function parameter: string name Name of the stat to set. It is the same as in the xml. Lua function parameter: number value Value to set the stat to. Lua function parameter: boolean replace Whether or not to add to the stat or replace it.
| L | Lua State |
Lua function: intrinsicSet
Definition at line 4030 of file nlua_pilot.c.
|
static |
Checks to see if a pilot is stopped.
Lua usage parameter: if p:isStopped() then ... end
Lua function parameter: Pilot p Pilot to get the velocity of. Lua return parameter: boolean Whether the pilot is stopped or not.
| L | Lua State |
Lua function: isStopped
Definition at line 2809 of file nlua_pilot.c.
|
static |
Kills a pilot.
Can fail to kill a pilot if they have a hook that regenerates them.
Lua function parameter: Pilot p Pilot to kill.
| L | Lua State |
Lua function: kill
Definition at line 6426 of file nlua_pilot.c.
|
static |
Knocks back a pilot. It can either accept two pilots, or a pilot and an element represented by mass, velocity, and position.
Lua usage parameter: pilota:knockback( pilotb, 0. ) – Inelastic collision between pilota and pilotb Lua usage parameter: pilota:knockback( 100, vec2.new(0,0) ) – Elastic collision between a 100 mass object with no velocity and pilota
Lua function parameter: Pilot p Pilot being knocked back. Lua function parameter: number m Mass of object knocking back pilot. Lua function parameter: Vec2 v Velocity of object knocking back pilot. Lua function parameter:[opt=p:pos()] Vec2 p Position of the object knocking back the pilot. Lua function parameter:[opt=1.] number e Coefficient of restitution. Use 1. for elastic collisions, and 0. for inelastic collisions.
| L | Lua State |
Lua function: knockback
Definition at line 6447 of file nlua_pilot.c.
|
static |
Tells the pilot to land.
Pilot must be under manual control for this to work.
Lua function parameter: Pilot p Pilot to tell to land. Lua function parameter:[opt] Spob spob Spob to land on, uses random if nil. Lua function parameter:[opt=false] boolean noshoot Forbids to shoot at targets with turrets while running away. See also: control
| L | Lua State |
Lua function: land
Definition at line 6024 of file nlua_pilot.c.
|
static |
Gets a pilots leader. Guaranteed to exist or will be nil.
Lua function parameter: Pilot p Pilot to get the leader of. Lua return parameter: Pilot|nil The leader or nil.
| L | Lua State |
Lua function: leader
Definition at line 6176 of file nlua_pilot.c.
|
static |
Gets the mass of a pilot.
Lua usage parameter: m = p:mass()
Lua function parameter: Pilot p Pilot to get mass of. Lua return parameter: number The pilot's current mass (in tonnes).
| L | Lua State |
Lua function: mass
Definition at line 2873 of file nlua_pilot.c.
|
static |
Gets a pilots memory table.
The resulting table is indexable and mutable.
Lua usage parameter: aggr = p:memory().aggressive Lua usage parameter: p:memory().aggressive = false
Lua function parameter: Pilot p Pilot to read memory of.
| L | Lua State |
Lua function: memory
Definition at line 5373 of file nlua_pilot.c.
|
static |
Gets a pilots mothership (only exists for deployed pilots). Guaranteed to exist or will be nil.
Lua function parameter: Pilot p Pilot to get the mothership of. Lua return parameter: Pilot|nil The mothership or nil.
| L | Lua State |
Lua function: mothership
Definition at line 6153 of file nlua_pilot.c.
|
static |
Makes the pilot move to a position.
Pilot must be under manual control for this to work.
Lua usage parameter: p:moveto( v ) – Goes to v precisely and braking Lua usage parameter: p:moveto( v, true, true ) – Same as p:moveto( v ) Lua usage parameter: p:moveto( v, false ) – Goes to v without braking compensating velocity Lua usage parameter: p:moveto( v, false, false ) – Really rough approximation of going to v without braking
Lua function parameter: Pilot p Pilot to tell to go to a position. Lua function parameter: Vec2 v Vector target for the pilot. Lua function parameter:[opt=1] boolean brake If true (or nil) brakes the pilot near target position, otherwise pops the task when it is about to brake. Lua function parameter:[opt=1] boolean compensate If true (or nil) compensates for velocity, otherwise it doesn't. It only affects if brake is not set. See also: control
| L | Lua State |
Lua function: moveto
Definition at line 5630 of file nlua_pilot.c.
|
static |
Sends a message to another pilot.
Do not confuse with pilot.comm! This is meant to be used by AI and other scripts.
Lua function parameter: Pilot p Pilot to send message. Lua function parameter: Pilot|{Pilot,...} receiver Pilot(s) to receive message. Lua function parameter: string type Type of message. Lua function parameter:[opt] data Data to send with message.
| L | Lua State |
Lua function: msg
Definition at line 6116 of file nlua_pilot.c.
|
static |
Gets the pilot's current (translated) name.
Lua usage parameter: name = p:name()
Lua function parameter: Pilot p Pilot to get the name of. Lua return parameter: string The current name of the pilot.
| L | Lua State |
Lua function: name
Definition at line 1394 of file nlua_pilot.c.
|
static |
Gets the nav target of the pilot.
Lua usage parameter: spob, hyperspace = p:nav()
Lua function parameter: Pilot p Pilot to get nav info of. Lua return parameter: Spob|nil The pilot's spob target. Lua return parameter: System|nil The pilot's hyperspace target.
| L | Lua State |
Lua function: nav
Definition at line 1622 of file nlua_pilot.c.
|
static |
Gets the nav jump target of the pilot.
Lua function parameter: Pilot p Pilot to get nav info of. Lua return parameter: Jump|nil The pilot's hyperspace target.
| L | Lua State |
Lua function: navJump
Definition at line 1672 of file nlua_pilot.c.
|
static |
Sets the hyperspace navigation target for the pilot.
Lua function parameter: Pilot p Pilot to set hyperspace navigation target for. Lua function parameter: Jump|nil jp Jump point to set as navigation target or nil to disable.
| L | Lua State |
Lua function: navJumpSet
Definition at line 1696 of file nlua_pilot.c.
|
static |
Gets the nav spob target of the pilot.
Lua function parameter: Pilot p Pilot to get nav info of. Lua return parameter: Spob|nil The pilot's spob target.
| L | Lua State |
Lua function: navSpob
Definition at line 1652 of file nlua_pilot.c.
Does a new task.
Definition at line 5591 of file nlua_pilot.c.
|
static |
Adds an outfit to a pilot.
This by default tries to add them to the first empty or defaultly equipped slot. Will not overwrite existing non-default outfits.
Lua usage parameter: added = p:outfitAdd( "Laser Cannon", 5 ) – Adds 5 laser cannons to p
Lua function parameter: Pilot p Pilot to add outfit to. Lua function parameter: string|outfit outfit Outfit or name of the outfit to add. Lua function parameter:[opt=1] number q Quantity of the outfit to add. Lua function parameter:[opt=false] boolean bypass_cpu Whether to skip CPU checks when adding an outfit. Lua function parameter:[opt=false] boolean bypass_slot Whether or not to skip slot size checks before adding an outfit. Not that this implies skipping the CPU checks. Lua return parameter: number The number of outfits added. Lua return parameter: number The id of the slot of the first outfit added if applicable.
| L | Lua State |
Lua function: outfitAdd
Definition at line 3663 of file nlua_pilot.c.
|
static |
Adds an intrinsic outfit to the pilot.
Intrinsic outfits are outfits that are associated with a ship, but not their slots.
Lua function parameter: Pilot p Pilot to add intrinsic outfit to. Lua function parameter: Outfit o Outfit to add as intrinsic outfit (must be modifier outfit).
| L | Lua State |
Lua function: outfitAddIntrinsic
Definition at line 3925 of file nlua_pilot.c.
|
static |
Adds an outfit to a pilot by slot name.
Lua function parameter: Pilot p Pilot to add outfit to. Lua function parameter: string|outfit outfit Outfit or name of the outfit to add. Lua function parameter: string|integer slot Slot to add to. Can be passed as a slot name (string) or slot id (integer). Lua function parameter:[opt=false] boolean bypass_cpu Whether to skip CPU checks when adding an outfit. Lua function parameter:[opt=false] boolean|string bypass_slot Whether or not to skip slot size checks before adding an outfit. Not that this implies skipping the CPU checks. In the case bypass_slot is a string, the outfit gets added to the named slot if possible (no slot check). Lua return parameter: boolean Whether or not the outfit was added.
| L | Lua State |
Lua function: outfitAddSlot
Definition at line 3757 of file nlua_pilot.c.
|
static |
Gets a pilot's outfit by ID.
Lua function parameter: Pilot p Pilot to get outfit of. Lua function parameter: number id ID of the outfit to get. Lua return parameter: Outfit|nil Outfit equipped in the slot or nil otherwise.
| L | Lua State |
Lua function: outfitGet
Definition at line 2647 of file nlua_pilot.c.
|
static |
Sees if an outfit is ready to use.
Lua function parameter: Pilot p Pilot to toggle outfit of. Lua function parameter: integer id ID of the pilot outfit. Lua return parameter: boolean Whether or not the outfit is ready to use.
| L | Lua State |
Lua function: outfitReady
Definition at line 2731 of file nlua_pilot.c.
|
static |
Removes an outfit from a pilot.
"all" will remove all outfits except cores and locked outfits. "cores" will remove all cores, but nothing else.
Lua usage parameter: p:outfitRm( "all" ) – Leaves the pilot naked (except for cores and locked outfits). Lua usage parameter: p:outfitRm( "cores" ) – Strips the pilot of its cores, leaving it dead in space. Lua usage parameter: p:outfitRm( "Neutron Disruptor" ) – Removes a neutron disruptor. Lua usage parameter: p:outfitRm( "Neutron Disruptor", 2 ) – Removes two neutron disruptor.
Lua function parameter: Pilot p Pilot to remove outfit from. Lua function parameter: string|outfit outfit Outfit or name of the outfit to remove. Lua function parameter: number q Quantity of the outfit to remove. Lua return parameter: number The number of outfits removed.
| L | Lua State |
Lua function: outfitRm
Definition at line 3815 of file nlua_pilot.c.
|
static |
Removes an intrinsic outfit from the pilot.
Intrinsic outfits are outfits that are associated with a ship, but not their slots.
Lua function parameter: Pilot p Pilot to remove intrinsic outfit from. Lua function parameter: Outfit o Outfit to remove from intrinsic outfits. Lua return parameter: boolean true if outfit was removed, false otherwise.
| L | Lua State |
Lua function: outfitRmIntrinsic
Definition at line 3951 of file nlua_pilot.c.
|
static |
Removes an outfit from a pilot's named slot.
Note that this only works with the name="foo" property of slots. It is not meant to be used with unnamed slots. By default all slots are unnamed unless specified.
Lua function parameter: Pilot p Pilot to remove outfit from. Lua function parameter: string|integer slot Slot to remove from. Can be passed as a slot name (string) or slot id (integer). Lua return parameter: boolean true on success.
| L | Lua State |
Lua function: outfitRmSlot
Definition at line 3894 of file nlua_pilot.c.
|
static |
Gets a mapping of outfit slot IDs and outfits of a pilot.
Lua function parameter: Pilot p Pilot to get outfits of. Lua return parameter: table Ordered table of outfits. If an outfit is not equipped at slot it sets the value to false.
| L | Lua State |
Lua function: outfits
Definition at line 2581 of file nlua_pilot.c.
|
static |
Equips a pilot with a set of outfits.
Lua function parameter: Pilot p Pilot to set equipment of. Lua function parameter: table o Table of outfits to equip the pilot (should be likely taken from pilot.outfits). The key should be the slot id and the value should be the outfit or false if there is no outfit in that slot. Lua return parameter: boolean If all the outfits were equipped successfully or not.
| L | Lua State |
Lua function: outfits
Definition at line 2604 of file nlua_pilot.c.
|
static |
Gets the outfits of a pilot.
Lua function parameter: Pilot p Pilot to get outfits of. Lua function parameter:[opt=nil] string What slot type to get outfits of. Can be either nil, "weapon", "utility", "structure", "intrinsic", or "all". nil implies returning all non-intrinsic outfits. Lua function parameter:[opt=false] boolean skip_locked Whether or not locked outfits should be ignored. Lua return parameter: table The outfits of the pilot in an ordered list.
| L | Lua State |
Lua function: outfitsList
Definition at line 2514 of file nlua_pilot.c.
|
static |
Checks to see outfit a pilot has in a slot.
Lua function parameter: Pilot p Pilot to check outfit slot of. Lua function parameter: string|integer slot Slot to check. Can be passed as a slot name (string) or slot id (integer). Lua return parameter: Outfit|nil Outfit if applicable or nil otherwise.
| L | Lua State |
Lua function: outfitSlot
Definition at line 3733 of file nlua_pilot.c.
|
static |
Toggles an outfit.
Lua function parameter: Pilot p Pilot to toggle outfit of. Lua function parameter: table|integer id ID of the pilot outfit, or table of pilot outfit ids. Lua function parameter:[opt=false] boolean activate Whether or not to activate or deactivate the outfit.
| L | Lua State |
Lua function: outfitToggle
Definition at line 2691 of file nlua_pilot.c.
|
static |
Gets the points the pilot costs.
Note currently equivalent to p:ship():points().
Lua function parameter: Pilot p Pilot to get points of. Lua return parameter: number The points of the pilot.
| L | Lua State |
Lua function: points
Definition at line 5277 of file nlua_pilot.c.
|
static |
Pops the current task from the pilot's AI.
Equivalent to ai.poptask().
Lua function parameter: Pilot p Pilot to pop task from.
| L | Lua State |
Lua function: poptask
Definition at line 5555 of file nlua_pilot.c.
|
static |
Gets the pilot's position.
Lua usage parameter: v = p:pos()
Lua function parameter: Pilot p Pilot to get the position of. Lua return parameter: Vec2 The pilot's current position.
| L | Lua State |
Lua function: pos
Definition at line 2777 of file nlua_pilot.c.
|
static |
Pushes a new task to the pilot's AI.
Equivalent to ai.pushtask()
Lua function parameter: Pilot p Pilot to push task to. Lua function parameter: string func Name of the function to be run. Lua function parameter: any data Data to be passed to the function.
| L | Lua State |
Lua function: pushtask
Definition at line 5531 of file nlua_pilot.c.
|
static |
Gets the rough radius of the ship, useful for collision stuff.
Lua function parameter: Pilot p Pilot to get radius of. Lua return parameter: number THe radius of the pilot.
| L | Lua State |
Lua function: radius
Definition at line 5261 of file nlua_pilot.c.
|
static |
Tries to refuel a pilot.
Lua function parameter: Pilot p Pilot to do the refueling. Lua function parameter: Pilot target Target pilot to give fuel to. Lua function parameter:[opt=100] number amount Amount to refuel.
| L | Lua State |
Lua function: refuel
Definition at line 5574 of file nlua_pilot.c.
|
static |
Removes a pilot without explosions or anything.
Does nothing if the pilot does not exist.
Lua usage parameter: p:rm() – pilot will be destroyed
Lua function parameter: Pilot p Pilot to remove.
| L | Lua State |
Lua function: rm
Definition at line 824 of file nlua_pilot.c.
|
static |
Changes the pilot's name.
Lua usage parameter: p:rename( _("Black Beard") )
Lua function parameter: Pilot p Pilot to change name of. Lua function parameter: string name Name to change to.
| L | Lua State |
Lua function: rename
Definition at line 2755 of file nlua_pilot.c.
|
static |
Renders the pilot to a canvas.
Lua function parameter: Pilot p Pilot whose ship is being rendered. Lua return parameter: Canvas The canvas with the pilot drawn on it.
| L | Lua State |
Lua function: render
Definition at line 6618 of file nlua_pilot.c.
|
static |
Renders the pilot to a canvas.
Lua function parameter: Pilot p Pilot whose ship is being rendered. Lua function parameter: Canvas The canvas to draw to (uses bottom-left corner). Lua return parameter: number Width drawn. Lua return parameter: number Height drawn.
| L | Lua State |
Lua function: renderTo
Definition at line 6646 of file nlua_pilot.c.
|
static |
Makes the pilot runaway from another pilot.
By default the pilot tries to jump when running away. Third argument is destination: if false or nil, destination is automatically chosen. If true, the pilot does not jump nor land and stays in system. If Jump is given, the pilot tries to use this jump to go hyperspace. If Spob is given, the pilot tries to land on it.
Lua usage parameter: p:runaway( p_enemy ) – Run away from p_enemy Lua usage parameter: p:runaway( p_enemy, true ) – Run away from p_enemy but do not jump Lua function parameter: Pilot p Pilot to tell to runaway from another pilot. Lua function parameter: Pilot tp Target pilot to runaway from. Lua function parameter:[opt=false] boolean|Jump|Spob destination. See also: control
| L | Lua State |
Lua function: runaway
Definition at line 5849 of file nlua_pilot.c.
|
static |
Checks to see if a pilot is done scanning its target.
Lua return parameter: boolean True if the pilot has finished scanning their target.
| L | Lua State |
Lua function: scandone
Definition at line 1591 of file nlua_pilot.c.
|
static |
Allows the pilot to be boarded when not disabled.
Lua usage parameter: p:setActiveBoard( true )
Lua function parameter: Pilot p Pilot to set boardability of. Lua function parameter:[opt=true] boolean state State to set boardability.
| L | Lua State |
Lua function: setActiveBoard
Definition at line 3443 of file nlua_pilot.c.
|
static |
Makes pilot act as if bribed by the player.
Lua usage parameter: p:setBribed( true )
Lua function parameter: Pilot p Pilot to set bribed status of. Lua function parameter:[opt=true] boolean state State to set bribed.
| L | Lua State |
Lua function: setHilight
Definition at line 3429 of file nlua_pilot.c.
|
static |
Starts or stops a pilot's cooldown mode.
Lua usage parameter: p:setCooldown( true )
Lua function parameter: Pilot p Pilot to modify the cooldown status of. Lua function parameter:[opt=true] boolean state Whether to enable or disable cooldown.
| L | Lua State |
Lua function: setCooldown
Definition at line 3517 of file nlua_pilot.c.
|
static |
Sets the pilot's direction.
Lua usage parameter: p:setDir( math.pi/2 )
Lua function parameter: Pilot p Pilot to set the direction of. Lua function parameter: number dir Direction to set, in radians.
| L | Lua State |
Lua function: setDir
Definition at line 3066 of file nlua_pilot.c.
|
static |
Sets the energy of a pilot.
Lua usage parameter: p:setEnergy( 100 ) – Sets pilot to full energy. Lua usage parameter: p:setEnergy( 70 ) – Sets pilot to 70% energy.
Lua function parameter: Pilot p Pilot to set energy of. Lua function parameter: number energy Value to set energy to, should be double from 0-100 (in percent). Lua function parameter:[opt=false] boolean absolute Whether or not it is being set in relative value or absolute.
| L | Lua State |
Lua function: setEnergy
Definition at line 4501 of file nlua_pilot.c.
|
static |
Sets the pilot's faction.
Lua usage parameter: p:setFaction( "Empire" ) Lua usage parameter: p:setFaction( faction.get( "Dvaered" ) )
Lua function parameter: Pilot p Pilot to change faction of. Lua function parameter: Faction faction Faction to set by name or faction.
| L | Lua State |
Lua function: setFaction
Definition at line 3218 of file nlua_pilot.c.
|
static |
Wrapper to simplify flag setting stuff.
Definition at line 482 of file nlua_pilot.c.
|
static |
Controls the pilot's friendliness towards the player.
Lua usage parameter: p:setFriendly() – Pilot is now friendly. Lua usage parameter: p:setFriendly(false) – Make pilot non-friendly.
Lua function parameter: Pilot p Pilot to set the friendliness of. Lua function parameter:[opt=true] boolean state Whether to set or unset friendly.
| L | Lua State |
Lua function: setFriendly
Definition at line 3269 of file nlua_pilot.c.
|
static |
Sets the fuel of a pilot.
Lua usage parameter: p:setFuel( true ) – Sets fuel to max
Lua function parameter: Pilot p Pilot to set fuel of. Lua function parameter: boolean|number f true sets fuel to max, false sets fuel to 0, a number sets fuel to that amount in units. Lua return parameter: number The amount of fuel the pilot has.
| L | Lua State |
Lua function: setFuel
Definition at line 3983 of file nlua_pilot.c.
|
static |
Sets the health of a pilot.
This recovers the pilot's disabled state, although they may become disabled afterwards.
Lua usage parameter: p:setHealth( 100, 100 ) – Sets pilot to full health Lua usage parameter: p:setHealth( 70, 0 ) – Sets pilot to 70% armour Lua usage parameter: p:setHealth( 100, 100, 0 ) – Sets pilot to full health and no stress
Lua function parameter: Pilot p Pilot to set health of. Lua function parameter:[opt=current armour] number armour Value to set armour to, should be double from 0-100 (in percent). Lua function parameter:[opt=current shield] number shield Value to set shield to, should be double from 0-100 (in percent). Lua function parameter:[opt=0] number stress Value to set stress (disable damage) to, should be double from 0-100 (in percent of current armour).
| L | Lua State |
Lua function: setHealth
Definition at line 4377 of file nlua_pilot.c.
|
static |
Sets the health of a pilot in absolute value.
This recovers the pilot's disabled state, although they may become disabled afterwards.
Lua function parameter: Pilot p Pilot to set health of. Lua function parameter:[opt=current armour] number armour Value to set armour to, in absolute value. Lua function parameter:[opt=current shield] number shield Value to set shield to, in absolute value Lua function parameter:[opt=current stress] number stress Value to set stress (disable damage) to, in absolute value.
| L | Lua State |
Lua function: setHealth
Definition at line 4426 of file nlua_pilot.c.
|
static |
Sets the pilot's hide status.
A hidden pilot is neither updated nor drawn. It stays frozen in time until the hide is lifted.
Lua usage parameter: p:setHide() – p will disappear Lua usage parameter: p:setHide(true) – p will disappear Lua usage parameter: p:setHide(false) – p will appear again
Lua function parameter: Pilot p Pilot to set hidden status of. Lua function parameter: boolean state State to set hide.
| L | Lua State |
Lua function: setHide
Definition at line 3337 of file nlua_pilot.c.
|
static |
Makes pilot stand out on radar and the likes.
This makes the pilot stand out in the map overlay and radar to increase noticability.
Lua usage parameter: p:setHilight( true )
Lua function parameter: Pilot p Pilot to set hilight status of. Lua function parameter:[opt=true] boolean state State to set hilight.
| L | Lua State |
Lua function: setHilight
Definition at line 3415 of file nlua_pilot.c.
|
static |
Controls the pilot's hostility towards the player.
Lua usage parameter: p:setHostile() – Pilot is now hostile. Lua usage parameter: p:setHostile(false) – Make pilot non-hostile.
Lua function parameter: Pilot p Pilot to set the hostility of. Lua function parameter:[opt=true] boolean state Whether to set or unset hostile.
| L | Lua State |
Lua function: setHostile
Definition at line 3238 of file nlua_pilot.c.
|
static |
Sets the pilot's invincibility status.
Lua usage parameter: p:setInvincible() – p can not be hit anymore Lua usage parameter: p:setInvincible(true) – p can not be hit anymore Lua usage parameter: p:setInvincible(false) – p can be hit again
Lua function parameter: Pilot p Pilot to set invincibility status of. Lua function parameter:[opt=true] boolean state State to set invincibility.
| L | Lua State |
Lua function: setInvincible
Definition at line 3302 of file nlua_pilot.c.
|
static |
Sets the pilot's invincibility status towards the player.
Lua usage parameter: p:setInvincPlayer() – p can not be hit by the player anymore Lua usage parameter: p:setInvincPlayer(true) – p can not be hit by the player anymore Lua usage parameter: p:setInvincPlayer(false) – p can be hit by the player again
Lua function parameter: Pilot p Pilot to set invincibility status of (only affects player). Lua function parameter:[opt=true] boolean state State to set invincibility.
| L | Lua State |
Lua function: setInvincPlayer
Definition at line 3318 of file nlua_pilot.c.
|
static |
Sets the pilot's invisibility status.
An invisible pilot is not shown on the radar nor targettable, however, it renders and updates just like normal.
Lua function parameter: Pilot p Pilot to set invisibility status of. Lua function parameter: boolean state State to set invisibility.
| L | Lua State |
Lua function: setInvisible
Definition at line 3352 of file nlua_pilot.c.
|
static |
Set a pilots leader.
If leader has a leader itself, the leader will instead be set to that pilot's leader. The leader can not be set for deployed fighters or members of the player's fleet.
Lua function parameter: Pilot p Pilot to set the leader of. Lua function parameter: Pilot|nil leader Pilot to set as leader.
| L | Lua State |
Lua function: setLeader
Definition at line 6204 of file nlua_pilot.c.
|
static |
Sets the ability to board the pilot.
No parameter is equivalent to true.
Lua usage parameter: p:setNoBoard( true ) – Pilot can not be boarded by anyone
Lua function parameter: Pilot p Pilot to set disable boarding. Lua function parameter:[opt=true] number noboard If true it disallows boarding of the pilot, otherwise it allows boarding which is the default.
| L | Lua State |
Lua function: setNoBoard
Definition at line 4557 of file nlua_pilot.c.
|
static |
Enables or disables making the the pilot exempt from pilot.clear().
Lua usage parameter: p:setNoClear( true )
Lua function parameter: Pilot p Pilot to modify. Lua function parameter:[opt] boolean state true or false
| L | Lua State |
Lua function: setNoClear
Definition at line 3591 of file nlua_pilot.c.
|
static |
Makes it so the pilot never dies, stays at 1. armour.
Lua usage parameter: p:setNoDeath( true ) – Pilot will never die
Lua function parameter: Pilot p Pilot to set never die state of. Lua function parameter:[opt=true] boolean state Whether or not to set never die state.
| L | Lua State |
Lua function: setNoDeath
Definition at line 3457 of file nlua_pilot.c.
|
static |
Sets the ability of the pilot to be disabled.
No parameter is equivalent to true.
Lua usage parameter: p:setNoDisable( true ) – Pilot can not be disabled anymore.
Lua function parameter: Pilot p Pilot to set disable disabling. Lua function parameter:[opt=true] boolean disable If true it disallows disabled of the pilot, otherwise it allows disabling which is the default.
| L | Lua State |
Lua function: setNoDisable
Definition at line 4587 of file nlua_pilot.c.
|
static |
Enables or disables a pilot's hyperspace engine.
Lua usage parameter: p:setNoJump( true )
Lua function parameter: Pilot p Pilot to modify. Lua function parameter:[opt=true] boolean state true or false
| L | Lua State |
Lua function: setNoJump
Definition at line 3563 of file nlua_pilot.c.
|
static |
Enables or disables landing for a pilot.
Lua usage parameter: p:setNoLand( true )
Lua function parameter: Pilot p Pilot to modify. Lua function parameter:[opt] boolean state true or false
| L | Lua State |
Lua function: setNoLand
Definition at line 3577 of file nlua_pilot.c.
|
static |
Sets the pilot's norender status.
The pilot still acts normally but is just not visible and can still take damage. Meant to be used in conjunction with other flags like "invisible".
Lua function parameter: Pilot p Pilot to set norender status of. Lua function parameter: boolean state State to set norender.
| L | Lua State |
Lua function: setInvisible
Definition at line 3367 of file nlua_pilot.c.
|
static |
Sets the pilot's position.
Lua usage parameter: p:setPos( vec2.new( 300, 200 ) )
Lua function parameter: Pilot p Pilot to set the position of. Lua function parameter: Vec2 pos Position to set.
| L | Lua State |
Lua function: setPos
Definition at line 3016 of file nlua_pilot.c.
|
static |
Limits the speed of a pilot.
Lua usage parameter: p:setSpeedLimit( 100 ) – Sets maximumspeed to 100px/s. Lua usage parameter: p:setSpeedLimit( 0 ) removes speed limit. Lua function parameter: pilot p Pilot to set speed of. Lua function parameter: number speed Value to set speed to.
| L | Lua State |
Lua function: setSpeedLimit
Definition at line 4617 of file nlua_pilot.c.
|
static |
Sets the pilot target of the pilot.
Lua function parameter: Pilot p Pilot to get target of. Lua function parameter: Pilot|nil t Pilot to set the target to or nil to set no target.
| L | Lua State |
Lua function: setTarget
Definition at line 1473 of file nlua_pilot.c.
|
static |
Sets the pilot's asteroid target.
Lua function parameter: Pilot p Pilot to set asteroid target of. Lua function parameter: Asteroid a Asteroid to set pilot's target to.
| L | Lua State |
Lua function: setTargetAsteroid
Definition at line 1517 of file nlua_pilot.c.
|
static |
Sets the temperature of a pilot.
All temperatures are in Kelvins. Note that temperatures cannot go below the base temperature of the Naev galaxy, which is 250K.
Lua usage parameter: p:setTemp( 300, true ) – Sets ship temperature to 300K, as well as all outfits. Lua usage parameter: p:setTemp( 500, false ) – Sets ship temperature to 500K, but leaves outfits alone. Lua usage parameter: p:setTemp( 0 ) – Sets ship temperature to the base temperature, as well as all outfits.
Lua function parameter: Pilot p Pilot to set health of. Lua function parameter: number temp Value to set temperature to. Values below base temperature will be clamped. Lua function parameter:[opt=false] boolean noslots Whether slots should also be set to this temperature.
| L | Lua State |
Lua function: setTemp
Definition at line 4337 of file nlua_pilot.c.
|
static |
Sets the pilot's velocity.
Lua usage parameter: p:setVel( vec2.new( 300, 200 ) )
Lua function parameter: Pilot p Pilot to set the velocity of. Lua function parameter: Vec2 vel Velocity to set.
| L | Lua State |
Lua function: setVel
Definition at line 3044 of file nlua_pilot.c.
|
static |
Marks the pilot as always visible for other pilots.
This cancels out ewarfare visibility ranges and affects every pilot.
Lua usage parameter: p:setVisible( true )
Lua function parameter: Pilot p Pilot to set visibility status of. Lua function parameter:[opt=true] boolean state State to set visibility.
| L | Lua State |
Lua function: setVisible
Definition at line 3399 of file nlua_pilot.c.
|
static |
Marks the pilot as always visible for the player.
This cancels out ewarfare visibility ranges and only affects the visibility of the player.
Lua usage parameter: p:setVisplayer( true )
Lua function parameter: Pilot p Pilot to set player visibility status of. Lua function parameter:[opt=true] boolean state State to set player visibility.
| L | Lua State |
Lua function: setVisplayer
Definition at line 3383 of file nlua_pilot.c.
|
static |
Gets the pilot's ship.
Lua usage parameter: s = p:ship()
Lua function parameter: Pilot p Pilot to get ship of. Lua return parameter: Ship The ship of the pilot.
| L | Lua State |
Lua function: ship
Definition at line 5247 of file nlua_pilot.c.
|
static |
Gets a pilots ship memory table.
The resulting table is indexable and mutable.
Lua function parameter: Pilot p Pilot to get ship memory of.
| L | Lua State |
Lua function: memory
Definition at line 5391 of file nlua_pilot.c.
|
static |
Allows getting an ship property stats of a pilot, or gets all of them if name is not specified.
Lua function parameter: Pilot p Pilot to get stat of. Lua function parameter:[opt=nil] string name Name of the stat to get. It is the same as in the xml. Lua function parameter:[opt=false] boolean internal Whether or not to use the internal representation. Lua function parameter: Value of the stat or a table containing all the stats if name is not specified.
| L | Lua State |
Lua function: shippropGet
Definition at line 4146 of file nlua_pilot.c.
|
static |
Resets the ship property stats of a pilot.
| L | Lua State |
Lua function: shippropReset
Definition at line 4087 of file nlua_pilot.c.
|
static |
Allows setting ship property stats of a pilot.
Lua usage parameter: p:shippropSet( "turn", -50 ) – Lowers p's turn by 50%
Lua function parameter: Pilot p Pilot to set stat of. Lua function parameter: string name Name of the stat to set. It is the same as in the xml. Lua function parameter: number value Value to set the stat to.
| L | Lua State |
Lua function: shippropSet
Definition at line 4106 of file nlua_pilot.c.
|
static |
Peeks at a ship variable.
Lua usage parameter: local exp = p:shipvarPeek( "exp" ) – Checks the value of the "exp" ship var on the player's current ship
Lua function parameter: Pilot p Pilot whose ship variable is being manipulated. 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 pilot's current ship.
| L | Lua State |
Lua function: shipvarPeek
Definition at line 6565 of file nlua_pilot.c.
|
static |
Pops a ship variable.
Lua function parameter: Pilot p Pilot whose ship variable is being manipulated. Lua function parameter: string varname Name of the variable to pop.
| L | Lua State |
Lua function: shipvarPop
Definition at line 6601 of file nlua_pilot.c.
|
static |
Pushes a ship variable.
Lua function parameter: Pilot p Pilot whose ship variable is being manipulated. Lua function parameter: string varname Name of the variable to set value of. Lua function parameter: val Value to push.
| L | Lua State |
Lua function: shipvarPush
Definition at line 6583 of file nlua_pilot.c.
|
static |
Toggles the emitter marker.
Lua usage parameter: pilot.showEmitters() – Trail emitters are marked with crosses. Lua usage parameter: pilot.showEmitters(false) – Remove the markers.
Lua function parameter:[opt=true] boolean state Whether to set or unset markers.
| L | Lua State |
Lua function: showEmitters
Definition at line 6531 of file nlua_pilot.c.
|
static |
Gets the pilot's signature.
Lua usage parameter: d = p:signature()
Lua function parameter: Pilot p Pilot to get the signature of. Lua return parameter: number The pilot's current signature value.
| L | Lua State |
Lua function: signature
Definition at line 2825 of file nlua_pilot.c.
|
static |
Checks the pilot's spaceworthiness.
Message can be non-null even if spaceworthy.
Lua usage parameter: spaceworthy = p:spaceworthy()
Lua function parameter: Pilot p Pilot to get the spaceworthy status of. Lua return parameter: boolean Whether the pilot's ship is spaceworthy. Lua return parameter: string Reason why the pilot is not spaceworthy.
| L | Lua State |
Lua function: spaceworthy
Definition at line 2997 of file nlua_pilot.c.
|
static |
Gets the speed of a pilot.
Lua function parameter: Pilot p Pilot to get speed of. Lua return parameter: number The pilot's current speed.
| L | Lua State |
Lua function: speed
Definition at line 2901 of file nlua_pilot.c.
|
static |
Gets the maximum speed of a pilot.
Lua function parameter: Pilot p Pilot to get maximum speed of. Lua return parameter: number The pilot's current maximum speed.
| L | Lua State |
Lua function: speedMax
Definition at line 2916 of file nlua_pilot.c.
|
static |
Tells the pilot to try to stealth.
Pilot must be under manual control for this to work.
Lua function parameter: Pilot p Pilot to tell to try to stealth. See also: control
| L | Lua State |
Lua function: stealth
Definition at line 5990 of file nlua_pilot.c.
|
static |
Gets the pilot target of the pilot.
Lua usage parameter: target = p:target()
Lua function parameter: Pilot p Pilot to get target of. Lua return parameter: Pilot|nil nil if no target is selected, otherwise the target of the pilot.
| L | Lua State |
Lua function: target
Definition at line 1455 of file nlua_pilot.c.
|
static |
Gets the asteroid target of the pilot.
Lua usage parameter: target = p:targetAsteroid()
Lua function parameter: Pilot p Pilot to get asteroid target of. Lua return parameter: table|nil nil if no asteroid is selected, otherwise a table with information about the selected asteroid.
| L | Lua State |
Lua function: targetAsteroid
Definition at line 1497 of file nlua_pilot.c.
|
static |
Gets the name and data of a pilot's current task.
Lua function parameter: Pilot p Pilot to get task data of. Lua return parameter: string Name of the task. Lua return parameter: Data of the task.
| L | Lua State |
Lua function: task
Definition at line 5427 of file nlua_pilot.c.
|
static |
Clears all the tasks of the pilot.
Lua usage parameter: p:taskClear()
Lua function parameter: Pilot p Pilot to clear tasks of.
| L | Lua State |
Lua function: taskClear
Definition at line 5514 of file nlua_pilot.c.
|
static |
Gets the data of the task the pilot is currently doing.
Lua function parameter: Pilot p Pilot to get task data of. Lua return parameter: Data of the task.
| L | Lua State |
Lua function: taskdata
Definition at line 5495 of file nlua_pilot.c.
|
static |
Gets the name of the task the pilot is currently doing.
Lua function parameter: Pilot p Pilot to get task name of. Lua return parameter: string Name of the task. Lua return parameter: string|nil Name of the subtask if applicable, or nil otherwise.
| L | Lua State |
Lua function: taskname
Definition at line 5450 of file nlua_pilot.c.
|
static |
Gets the name of all the pilot's current tasks (not subtasks).
Lua function parameter: Pilot p Pilot to get task stack of.
| L | Lua State |
Lua function: taskstack
Definition at line 5471 of file nlua_pilot.c.
|
static |
Gets the temperature of a pilot.
Lua usage parameter: t = p:temp()
Lua function parameter: Pilot p Pilot to get temperature of. Lua return parameter: number The pilot's current temperature (in kelvin).
| L | Lua State |
Lua function: temp
Definition at line 2857 of file nlua_pilot.c.
|
static |
Disables or enables pilot spawning in the current system.
If player jumps the spawn is enabled again automatically. Global spawning takes priority over faction spawning.
Lua usage parameter: pilot.toggleSpawn() – Defaults to disabling global spawning Lua usage parameter: pilot.toggleSpawn( false ) – Disables global spawning Lua usage parameter: pilot.toggleSpawn( "Pirate" ) – Defaults to disabling pirate spawning Lua usage parameter: pilot.toggleSpawn( "Pirate", true ) – Turns on pirate spawning
Lua function parameter:[opt] Faction|table fac Faction or table of factions to enable or disable spawning off. If ommited it works on global spawning. Lua function parameter:[opt=false] boolean enable true enables spawn, false disables it. Lua return parameter: boolean The current spawn state.
| L | Lua State |
Lua function: toggleSpawn
Definition at line 969 of file nlua_pilot.c.
|
static |
Gets the pilot's current (translated) name or notes it is inexistent.
Lua usage parameter: tostring(p)
Lua function parameter: Pilot p Pilot to convert to string. Lua return parameter: string The current name of the pilot or "(inexistent pilot)" if not existent.
| L | Lua State |
Lua function: __tostring
Definition at line 1374 of file nlua_pilot.c.
|
static |
Tries to make the pilot stealth.
Lua function parameter: Pilot p Pilot to try to make stealth. Lua return parameter: boolean Whether or not the pilot was able to stealth.
| L | Lua State |
Lua function: tryStealth
Definition at line 6006 of file nlua_pilot.c.
|
static |
Gets the turn of a pilot.
Lua function parameter: Pilot p Pilot to get turn of. Lua return parameter: number The pilot's current turn (in degrees per second).
| L | Lua State |
Lua function: turn
Definition at line 2930 of file nlua_pilot.c.
|
static |
Gets the pilot's velocity.
Lua usage parameter: vel = p:vel()
Lua function parameter: Pilot p Pilot to get the velocity of. Lua return parameter: Vec2 The pilot's current velocity.
| L | Lua State |
Lua function: vel
Definition at line 2793 of file nlua_pilot.c.
|
static |
Gets the weapset weapon of the pilot.
The weapon sets have the following structure:
An example would be:
Lua usage parameter: set_name, slots = p:weapset( true ) – Gets info for all active weapons Lua usage parameter: set_name, slots = p:weapset() – Get info about the current set Lua usage parameter: set_name, slots = p:weapset( 5 ) – Get info about the set number 5
Lua function parameter: Pilot p Pilot to get weapset weapon of. Lua function parameter:[opt=pilot.weapsetActive()] number id ID of the set to get information of. Defaults to currently active set. Lua return parameter: string The name of the set. Lua return parameter: table A table with each slot's information.
| L | Lua State |
Lua function: weapset
Definition at line 1961 of file nlua_pilot.c.
|
static |
Gets the ID (number from 1 to 10) of the current active weapset.
Lua usage parameter: set_id = p:weapsetActive() – A number from 1 to 10
Lua function parameter: Pilot p Pilot to get active weapset ID of. Lua return parameter: number current active weapset ID.
| L | Lua State |
Lua function: weapsetActive
Definition at line 1732 of file nlua_pilot.c.
|
static |
Adds an outfit to a pilot's weapon set.
Lua function parameter: Pilot p Pilot to remove weapon from weapon set. Lua function parameter: integer id ID of the weapon set as shown in game (from 0 to 9). Lua function parameter: string|integer slot Slot to add to weapon set. Can be passed by either id or name.
| L | Lua State |
Lua function: weapsetAdd
Definition at line 2095 of file nlua_pilot.c.
|
static |
Adds an outfit to a pilot's weapon set.
Lua function parameter: Pilot p Pilot to remove weapon from weapon set. Lua function parameter: integer id ID of the weapon set as shown in game (from 0 to 9). Lua function parameter: string|integer slot Slot to add to weapon set. Can be passed by either id or name.
| L | Lua State |
Lua function: weapsetAdd
Definition at line 2113 of file nlua_pilot.c.
|
static |
Gets the ammo left of a weapon set.
Lua function parameter: Pilot p Pilot to get weapon set ammo for. Lua function parameter:[opt] number id Optional parameter indicating id of weapon set to get ammo of, defaults to selected one. Lua function parameter:[opt=-1] number level Level of weapon set to get range of. Lua return parameter: number The range of the weapon set.
| L | Lua State |
Lua function: weapsetAmmo
Definition at line 2297 of file nlua_pilot.c.
|
static |
Cleans up a weapon set. This removes all properties of the weapon set and resets it.
Lua function parameter: Pilot p Pilot to remove weapon from weapon set. Lua function parameter:[opt] integer id ID of the weapon set as shown in game (from 0 to 9). Cleans them all up if set to nil or not set.
| L | Lua State |
Lua function: weapsetCleanup
Definition at line 2155 of file nlua_pilot.c.
|
static |
Gets heat information for a weapon set.
Heat is a 0-2 value that corresponds to three separate ranges:
Lua usage parameter: hmean, hpeak = p:weapsetHeat( true ) – Gets info for all active weapons Lua usage parameter: hmean, hpeak = p:weapsetHeat() – Get info about the current set Lua usage parameter: hmean, hpeak = p:weapsetHeat( 5 ) – Get info about the set number 5
Lua function parameter: Pilot p Pilot to get weapset weapon of. Lua function parameter:[opt] number id ID of the set to get information of. Defaults to currently active set. Lua return parameter: number Mean heat. Lua return parameter: number Peak heat.
| L | Lua State |
Lua function: weapsetHeat
Definition at line 2190 of file nlua_pilot.c.
|
static |
Get a list of all the outfits in a weapon set.
Lua function parameter: Pilot p Pilot to set weapon set outfit list of. Lua function parameter: integer id ID of the weapon set as shown in game (from 0 to 9). Lua return parameter: table Table containing the slot ids of all outfits in the weapon set for use with functions such as pilot.outfitGet.
| L | Lua State |
Lua function: weapsetList
Definition at line 2047 of file nlua_pilot.c.
|
static |
Removes an outfit from a pilot's weapon set.
Lua function parameter: Pilot p Pilot to remove weapon from weapon set. Lua function parameter: integer id ID of the weapon set as shown in game (from 0 to 9). Lua function parameter: string|integer slot Slot to remove from weapon set. Can be passed by either id or name.
| L | Lua State |
Lua function: weapsetRm
Definition at line 2139 of file nlua_pilot.c.
|
static |
Sets the ID (number from 1 to 10) of the current active weapset.
Lua usage parameter: set_id = p:weapsetActive() – A number from 1 to 10
Lua function parameter: Pilot p Pilot to get active weapset ID of. Lua function parameter: number Weapon set to make active.
| L | Lua State |
Lua function: weapsetSetActive
Definition at line 1749 of file nlua_pilot.c.
|
static |
Sets whether a pilot's weapon set does inrange checks.
Lua function parameter: Pilot p Pilot to get weapset weapon of. Lua function parameter:[opt=nil] number id ID of the weapon set to set inrange check status, or nil for all. Lua function parameter: boolean docheck Whether or not to do inrange checks.
| L | Lua State |
Lua function: weapsetSetInrange
Definition at line 2273 of file nlua_pilot.c.
|
static |
Sets the type of a weapon set for a pilot.
Lua function parameter: Pilot p Pilot to set weapon set type of. Lua function parameter: integer id ID of the weapon set as shown in game (from 0 to 9). Lua function parameter: string type Type of the weapon set. Can be either "switch", "toggle", or "hold".
| L | Lua State |
Lua function: weapsetType
Definition at line 2069 of file nlua_pilot.c.
|
static |
Checks to see if pilot is with player.
Lua function parameter: Pilot p Pilot to check to see if is with player. Lua return parameter: boolean true if pilot is with player.
| L | Lua State |
Lua function: withPlayer
Definition at line 1605 of file nlua_pilot.c.
|
static |
Gets the worth of a pilot (total value of ship and outfits).
Lua function parameter: Pilot p Pilot to get worth of. Lua function parameter:[opt=false] boolean count_unique Whether or not to count unique outfits too. Lua return parameter: number The credit worth of the pilot.
| L | Lua State |
Lua function: worth
Definition at line 5068 of file nlua_pilot.c.
| void toggleSpawn | ( | int | f, |
| int | b ) |
Definition at line 944 of file nlua_pilot.c.
|
static |
Sets up an item in a weapon set.
TODO move this to an object in its own module or something.
Definition at line 1763 of file nlua_pilot.c.
|
static |
Pilot metatable methods.
Definition at line 258 of file nlua_pilot.c.
|
static |
Flags to get.
Definition at line 5132 of file nlua_pilot.c.