naev 0.11.5
pilot_outfit.c File Reference

Handles pilot outfits. More...

#include "array.h"
#include "escort.h"
#include "gui.h"
#include "log.h"
#include "difficulty.h"
#include "nstring.h"
#include "nxml.h"
#include "outfit.h"
#include "pause.h"
#include "pilot.h"
#include "player.h"
#include "slots.h"
#include "space.h"
#include "nlua.h"
#include "nlua_pilot.h"
#include "nlua_pilotoutfit.h"
#include "nlua_outfit.h"

Go to the source code of this file.

Data Structures

struct  OnhitData
 
struct  CooldownData
 

Macros

#define SPACEWORTHY_CHECK(cond, msg)
 

Functions

static void pilot_calcStatsSlot (Pilot *pilot, PilotOutfitSlot *slot)
 Computes the stats for a pilot's slot.
 
static const char * outfitkeytostr (OutfitKey key)
 
void pilot_lockUpdateSlot (Pilot *p, PilotOutfitSlot *o, Pilot *t, double *a, double dt)
 Updates the lockons on the pilot's launchers.
 
void pilot_lockClear (Pilot *p)
 Clears pilot's missile lockon timers.
 
int pilot_getMount (const Pilot *p, const PilotOutfitSlot *w, vec2 *v)
 Gets the mount position of a pilot.
 
int pilot_dock (Pilot *p, Pilot *target)
 Docks the pilot on its target pilot.
 
int pilot_hasDeployed (const Pilot *p)
 Checks to see if the pilot has deployed ships.
 
int pilot_addOutfitRaw (Pilot *pilot, const Outfit *outfit, PilotOutfitSlot *s)
 Adds an outfit to the pilot, ignoring CPU or other limits.
 
int pilot_addOutfitTest (Pilot *pilot, const Outfit *outfit, const PilotOutfitSlot *s, int warn)
 Tests to see if an outfit can be added.
 
int pilot_addOutfit (Pilot *pilot, const Outfit *outfit, PilotOutfitSlot *s)
 Adds an outfit to the pilot.
 
int pilot_addOutfitIntrinsicRaw (Pilot *pilot, const Outfit *outfit)
 Adds an outfit as an intrinsic slot.
 
int pilot_addOutfitIntrinsic (Pilot *pilot, const Outfit *outfit)
 Adds an outfit as an intrinsic slot.
 
int pilot_rmOutfitIntrinsic (Pilot *pilot, const Outfit *outfit)
 Removes an outfit from an intrinsic slot.
 
int pilot_hasIntrinsic (const Pilot *pilot, const Outfit *outfit)
 Gets how many copies of an intrinsic a pilot has.
 
int pilot_rmOutfitRaw (Pilot *pilot, PilotOutfitSlot *s)
 Removes an outfit from the pilot without doing any checks.
 
int pilot_rmOutfit (Pilot *pilot, PilotOutfitSlot *s)
 Removes an outfit from the pilot.
 
int pilot_slotsCheckSafety (const Pilot *p)
 Pilot slot safety check - makes sure stats are safe.
 
int pilot_slotsCheckRequired (const Pilot *p)
 Pilot required (core) slot filled check - makes sure they are filled.
 
int pilot_isSpaceworthy (const Pilot *p)
 Pilot safety check - makes sure stats are safe.
 
int pilot_reportSpaceworthy (const Pilot *p, char *buf, int bufSize)
 Pilot safety report - makes sure stats are safe.
 
int pilot_hasOutfitLimit (const Pilot *p, const char *limit)
 Checks to see if a pilot has an outfit with a specific outfit type.
 
const char * pilot_canEquip (const Pilot *p, const PilotOutfitSlot *s, const Outfit *o)
 Checks to see if can equip/remove an outfit from a slot.
 
int pilot_addAmmo (Pilot *pilot, PilotOutfitSlot *s, int quantity)
 Adds some ammo to the pilot stock.
 
int pilot_rmAmmo (Pilot *pilot, PilotOutfitSlot *s, int quantity)
 Removes some ammo from the pilot stock.
 
int pilot_countAmmo (const Pilot *pilot)
 Gets the number of ammo units on the ship.
 
int pilot_maxAmmo (const Pilot *pilot)
 The maximum amount of ammo the pilot's current ship can hold.
 
int pilot_maxAmmoO (const Pilot *p, const Outfit *o)
 Gets the maximum available ammo for a pilot for a specific outfit.
 
void pilot_fillAmmo (Pilot *pilot)
 Fills pilot's ammo completely.
 
double pilot_outfitRange (const Pilot *p, const Outfit *o)
 
void pilot_calcStats (Pilot *pilot)
 Recalculates the pilot's stats based on his outfits.
 
void pilot_healLanded (Pilot *pilot)
 Cures the pilot as if he was landed.
 
PilotOutfitSlotpilot_getSlotByName (Pilot *pilot, const char *name)
 Gets the outfit slot by name.
 
double pilot_massFactor (const Pilot *pilot)
 Gets the factor at which speed gets worse.
 
void pilot_updateMass (Pilot *pilot)
 Updates the pilot stats after mass change.
 
int pilot_slotIsToggleable (const PilotOutfitSlot *o)
 Checks to see if a slot has an active outfit that can be toggleable.
 
static void pilot_outfitLRun (Pilot *p, void(*const func)(const Pilot *p, PilotOutfitSlot *po, const void *data), const void *data)
 Wrapper that does all the work for us.
 
static void outfitLRunWarning (const Pilot *p, const Outfit *o, const char *name, const char *error)
 
static int pilot_outfitLmem (PilotOutfitSlot *po, nlua_env env)
 Sets up the outfit memory for a slot.
 
static void pilot_outfitLunmem (nlua_env env, int oldmem)
 Cleans up the outfit memory for a slot.
 
static const char * pilot_outfitLDescExtra (const Pilot *p, const Outfit *o)
 
const char * pilot_outfitDescription (const Pilot *p, const Outfit *o)
 Gets the description of an outfit for a given pilot.
 
const char * pilot_outfitSummary (const Pilot *p, const Outfit *o, int withname)
 Gets the summary of an outfit for a give pilot.
 
void pilot_outfitLInitAll (Pilot *pilot)
 Runs the pilot's Lua outfits init script.
 
int pilot_outfitLAdd (const Pilot *pilot, PilotOutfitSlot *po)
 Outfit is added to a ship.
 
int pilot_outfitLRemove (const Pilot *pilot, PilotOutfitSlot *po)
 Outfit is removed froma ship.
 
int pilot_outfitLInit (const Pilot *pilot, PilotOutfitSlot *po)
 Runs the pilot's Lua outfits init script for an outfit.
 
static void outfitLUpdate (const Pilot *pilot, PilotOutfitSlot *po, const void *data)
 
void pilot_outfitLUpdate (Pilot *pilot, double dt)
 Runs the pilot's Lua outfits update script.
 
static void outfitLOutofenergy (const Pilot *pilot, PilotOutfitSlot *po, const void *data)
 
void pilot_outfitLOutfofenergy (Pilot *pilot)
 Handles when the pilot runs out of energy.
 
static void outfitLOnhit (const Pilot *pilot, PilotOutfitSlot *po, const void *data)
 
void pilot_outfitLOnhit (Pilot *pilot, double armour, double shield, unsigned int attacker)
 Runs the pilot's Lua outfits onhit script.
 
int pilot_outfitLOntoggle (const Pilot *pilot, PilotOutfitSlot *po, int on)
 Handle the manual toggle of an outfit.
 
int pilot_outfitLOnshoot (const Pilot *pilot, PilotOutfitSlot *po)
 Handle the manual shoot of an outfit.
 
static void outfitLCooldown (const Pilot *pilot, PilotOutfitSlot *po, const void *data)
 
void pilot_outfitLCooldown (Pilot *pilot, int done, int success, double timer)
 Handle cooldown hooks for outfits.
 
static void outfitLOnshootany (const Pilot *pilot, PilotOutfitSlot *po, const void *data)
 
void pilot_outfitLOnshootany (Pilot *pilot)
 Runs the pilot's Lua outfits onshootany script.
 
static void outfitLOnstealth (const Pilot *pilot, PilotOutfitSlot *po, const void *data)
 
int pilot_outfitLOnstealth (Pilot *pilot)
 Runs the pilot's Lua outfits onhit script.
 
static void outfitLOnscan (const Pilot *pilot, PilotOutfitSlot *po, const void *data)
 
void pilot_outfitLOnscan (Pilot *pilot)
 Runs Lua outfits when pilot scanned their target.
 
static void outfitLOnscanned (const Pilot *pilot, PilotOutfitSlot *po, const void *data)
 
void pilot_outfitLOnscanned (Pilot *pilot, const Pilot *scanner)
 Runs Lua outfits when pilot was scanned by scanner.
 
static void outfitLOnland (const Pilot *pilot, PilotOutfitSlot *po, const void *data)
 
void pilot_outfitLOnland (Pilot *pilot)
 Runs Lua outfits when pilot lands on a spob.
 
static void outfitLOntakeoff (const Pilot *pilot, PilotOutfitSlot *po, const void *data)
 
void pilot_outfitLOntakeoff (Pilot *pilot)
 Runs Lua outfits when pilot takes off from a spob.
 
static void outfitLOnjumpin (const Pilot *pilot, PilotOutfitSlot *po, const void *data)
 
void pilot_outfitLOnjumpin (Pilot *pilot)
 Runs Lua outfits when pilot jumps into a system.
 
static void outfitLOnboard (const Pilot *pilot, PilotOutfitSlot *po, const void *data)
 
void pilot_outfitLOnboard (Pilot *pilot, const Pilot *target)
 Runs Lua outfits when pilot boards a target.
 
static void outfitLOnkeydoubletap (const Pilot *pilot, PilotOutfitSlot *po, const void *data)
 
void pilot_outfitLOnkeydoubletap (Pilot *pilot, OutfitKey key)
 
static void outfitLOnkeyrelease (const Pilot *pilot, PilotOutfitSlot *po, const void *data)
 
void pilot_outfitLOnkeyrelease (Pilot *pilot, OutfitKey key)
 
void pilot_outfitLCleanup (Pilot *pilot)
 Handle cleanup hooks for outfits.
 

Variables

static int stealth_break = 0
 

Detailed Description

Handles pilot outfits.

Definition in file pilot_outfit.c.

Macro Definition Documentation

◆ SPACEWORTHY_CHECK

#define SPACEWORTHY_CHECK ( cond,
msg )
Value:
if (cond) { ret++; \
if (buf != NULL) { \
if (pos > 0) \
pos += scnprintf( &buf[pos], bufSize-pos, "\n" ); \
pos += scnprintf( &buf[pos], bufSize-pos, (msg) ); } }
int scnprintf(char *text, size_t maxlen, const char *fmt,...)
Like snprintf(), but returns the number of characters ACTUALLY "printed" into the buffer....
Definition nstring.c:99

Function Documentation

◆ outfitkeytostr()

static const char * outfitkeytostr ( OutfitKey key)
static

Definition at line 1999 of file pilot_outfit.c.

◆ outfitLCooldown()

static void outfitLCooldown ( const Pilot * pilot,
PilotOutfitSlot * po,
const void * data )
static

Definition at line 1685 of file pilot_outfit.c.

◆ outfitLOnboard()

static void outfitLOnboard ( const Pilot * pilot,
PilotOutfitSlot * po,
const void * data )
static

Definition at line 1964 of file pilot_outfit.c.

◆ outfitLOnhit()

static void outfitLOnhit ( const Pilot * pilot,
PilotOutfitSlot * po,
const void * data )
static

Definition at line 1562 of file pilot_outfit.c.

◆ outfitLOnjumpin()

static void outfitLOnjumpin ( const Pilot * pilot,
PilotOutfitSlot * po,
const void * data )
static

Definition at line 1932 of file pilot_outfit.c.

◆ outfitLOnkeydoubletap()

static void outfitLOnkeydoubletap ( const Pilot * pilot,
PilotOutfitSlot * po,
const void * data )
static

Definition at line 2012 of file pilot_outfit.c.

◆ outfitLOnkeyrelease()

static void outfitLOnkeyrelease ( const Pilot * pilot,
PilotOutfitSlot * po,
const void * data )
static

Definition at line 2049 of file pilot_outfit.c.

◆ outfitLOnland()

static void outfitLOnland ( const Pilot * pilot,
PilotOutfitSlot * po,
const void * data )
static

Definition at line 1868 of file pilot_outfit.c.

◆ outfitLOnscan()

static void outfitLOnscan ( const Pilot * pilot,
PilotOutfitSlot * po,
const void * data )
static

Definition at line 1800 of file pilot_outfit.c.

◆ outfitLOnscanned()

static void outfitLOnscanned ( const Pilot * pilot,
PilotOutfitSlot * po,
const void * data )
static

Definition at line 1833 of file pilot_outfit.c.

◆ outfitLOnshootany()

static void outfitLOnshootany ( const Pilot * pilot,
PilotOutfitSlot * po,
const void * data )
static

Definition at line 1733 of file pilot_outfit.c.

◆ outfitLOnstealth()

static void outfitLOnstealth ( const Pilot * pilot,
PilotOutfitSlot * po,
const void * data )
static

Definition at line 1765 of file pilot_outfit.c.

◆ outfitLOntakeoff()

static void outfitLOntakeoff ( const Pilot * pilot,
PilotOutfitSlot * po,
const void * data )
static

Definition at line 1900 of file pilot_outfit.c.

◆ outfitLOutofenergy()

static void outfitLOutofenergy ( const Pilot * pilot,
PilotOutfitSlot * po,
const void * data )
static

Definition at line 1524 of file pilot_outfit.c.

◆ outfitLRunWarning()

static void outfitLRunWarning ( const Pilot * p,
const Outfit * o,
const char * name,
const char * error )
static

Definition at line 1252 of file pilot_outfit.c.

◆ outfitLUpdate()

static void outfitLUpdate ( const Pilot * pilot,
PilotOutfitSlot * po,
const void * data )
static

Definition at line 1485 of file pilot_outfit.c.

◆ pilot_addAmmo()

int pilot_addAmmo ( Pilot * pilot,
PilotOutfitSlot * s,
int quantity )

Adds some ammo to the pilot stock.

Parameters
pilotPilot to add ammo to.
sSlot to add ammo to.
quantityAmount to add.
Returns
Amount actually added.

Definition at line 719 of file pilot_outfit.c.

◆ pilot_addOutfit()

int pilot_addOutfit ( Pilot * pilot,
const Outfit * outfit,
PilotOutfitSlot * s )

Adds an outfit to the pilot.

Parameters
pilotPilot to add the outfit to.
outfitOutfit to add to the pilot.
sSlot to add ammo to.
Returns
0 on success.

Definition at line 366 of file pilot_outfit.c.

◆ pilot_addOutfitIntrinsic()

int pilot_addOutfitIntrinsic ( Pilot * pilot,
const Outfit * outfit )

Adds an outfit as an intrinsic slot.

Definition at line 405 of file pilot_outfit.c.

◆ pilot_addOutfitIntrinsicRaw()

int pilot_addOutfitIntrinsicRaw ( Pilot * pilot,
const Outfit * outfit )

Adds an outfit as an intrinsic slot.

Definition at line 385 of file pilot_outfit.c.

◆ pilot_addOutfitRaw()

int pilot_addOutfitRaw ( Pilot * pilot,
const Outfit * outfit,
PilotOutfitSlot * s )

Adds an outfit to the pilot, ignoring CPU or other limits.

Note
Does not call pilot_calcStats().
Parameters
pilotPilot to add the outfit to.
outfitOutfit to add to the pilot.
sSlot to add ammo to.
Returns
0 on success.

Definition at line 271 of file pilot_outfit.c.

◆ pilot_addOutfitTest()

int pilot_addOutfitTest ( Pilot * pilot,
const Outfit * outfit,
const PilotOutfitSlot * s,
int warn )

Tests to see if an outfit can be added.

Parameters
pilotPilot to add outfit to.
outfitOutfit to add.
sSlot adding outfit to.
warnWhether or not should generate a warning.
Returns
0 if can add, -1 if can't.

Definition at line 331 of file pilot_outfit.c.

◆ pilot_calcStats()

void pilot_calcStats ( Pilot * pilot)

Recalculates the pilot's stats based on his outfits.

Parameters
pilotPilot to recalculate his stats.

Definition at line 965 of file pilot_outfit.c.

◆ pilot_calcStatsSlot()

static void pilot_calcStatsSlot ( Pilot * pilot,
PilotOutfitSlot * slot )
static

Computes the stats for a pilot's slot.

Definition at line 900 of file pilot_outfit.c.

◆ pilot_canEquip()

const char * pilot_canEquip ( const Pilot * p,
const PilotOutfitSlot * s,
const Outfit * o )

Checks to see if can equip/remove an outfit from a slot.

Parameters
pPilot to check if can equip.
sSlot being checked to see if it can equip/remove an outfit.
oOutfit to check (NULL if being removed).
Returns
NULL if can swap, or error message if can't.

Definition at line 685 of file pilot_outfit.c.

◆ pilot_countAmmo()

int pilot_countAmmo ( const Pilot * pilot)

Gets the number of ammo units on the ship.

Parameters
pilotPilot to count the ammo on @return The integer count of ammo units on pilot

Definition at line 779 of file pilot_outfit.c.

◆ pilot_dock()

int pilot_dock ( Pilot * p,
Pilot * target )

Docks the pilot on its target pilot.

Parameters
pPilot that wants to dock.
targetPilot to dock on.
Returns
0 on successful docking.

Definition at line 190 of file pilot_outfit.c.

◆ pilot_fillAmmo()

void pilot_fillAmmo ( Pilot * pilot)

Fills pilot's ammo completely.

Parameters
pilotPilot to add ammo to.

Definition at line 844 of file pilot_outfit.c.

◆ pilot_getMount()

int pilot_getMount ( const Pilot * p,
const PilotOutfitSlot * w,
vec2 * v )

Gets the mount position of a pilot.

Position is relative to the pilot.

Parameters
pPilot to get mount position of.
wSlot of the mount.
[out]vPosition of the mount.
Returns
0 on success.

Definition at line 149 of file pilot_outfit.c.

◆ pilot_getSlotByName()

PilotOutfitSlot * pilot_getSlotByName ( Pilot * pilot,
const char * name )

Gets the outfit slot by name.

Definition at line 1150 of file pilot_outfit.c.

◆ pilot_hasDeployed()

int pilot_hasDeployed ( const Pilot * p)

Checks to see if the pilot has deployed ships.

Parameters
pPilot to see if has deployed ships.
Returns
1 if pilot has deployed ships, 0 otherwise.

Definition at line 249 of file pilot_outfit.c.

◆ pilot_hasIntrinsic()

int pilot_hasIntrinsic ( const Pilot * pilot,
const Outfit * outfit )

Gets how many copies of an intrinsic a pilot has.

Definition at line 450 of file pilot_outfit.c.

◆ pilot_hasOutfitLimit()

int pilot_hasOutfitLimit ( const Pilot * p,
const char * limit )

Checks to see if a pilot has an outfit with a specific outfit type.

Parameters
pPilot to check.
limitOutfit (limiting) type to check.
Returns
the amount of outfits of this type the pilot has.

Definition at line 658 of file pilot_outfit.c.

◆ pilot_healLanded()

void pilot_healLanded ( Pilot * pilot)

Cures the pilot as if he was landed.

Definition at line 1126 of file pilot_outfit.c.

◆ pilot_isSpaceworthy()

int pilot_isSpaceworthy ( const Pilot * p)

Pilot safety check - makes sure stats are safe.

Parameters
pPilot to check.
Returns
The reason why the pilot is not safe (or NULL if safe).

Definition at line 579 of file pilot_outfit.c.

◆ pilot_lockClear()

void pilot_lockClear ( Pilot * p)

Clears pilot's missile lockon timers.

Parameters
pPilot to clear missile lockon timers.

Definition at line 122 of file pilot_outfit.c.

◆ pilot_lockUpdateSlot()

void pilot_lockUpdateSlot ( Pilot * p,
PilotOutfitSlot * o,
Pilot * t,
double * a,
double dt )

Updates the lockons on the pilot's launchers.

Parameters
pPilot being updated.
oSlot being updated.
tPilot that is currently the target of p (or NULL if not applicable).
aAngle to update if necessary. Should be initialized to -1 before the loop.
dtCurrent delta tick.

Definition at line 48 of file pilot_outfit.c.

◆ pilot_massFactor()

double pilot_massFactor ( const Pilot * pilot)

Gets the factor at which speed gets worse.

Definition at line 1163 of file pilot_outfit.c.

◆ pilot_maxAmmo()

int pilot_maxAmmo ( const Pilot * pilot)

The maximum amount of ammo the pilot's current ship can hold.

Parameters
pilotPilot to get the count from @return An integer, the max amount of ammo that can be held.

Definition at line 803 of file pilot_outfit.c.

◆ pilot_maxAmmoO()

int pilot_maxAmmoO ( const Pilot * p,
const Outfit * o )

Gets the maximum available ammo for a pilot for a specific outfit.

Definition at line 825 of file pilot_outfit.c.

◆ pilot_outfitDescription()

const char * pilot_outfitDescription ( const Pilot * p,
const Outfit * o )

Gets the description of an outfit for a given pilot.

Note: the returned string can get overwritten by subsequent calls.

Parameters
pPilot to get the outfit description of (or NULL for no pilot).
oOutfit to get description of.
Returns
The description of the outfit.

Definition at line 1327 of file pilot_outfit.c.

◆ pilot_outfitLAdd()

int pilot_outfitLAdd ( const Pilot * pilot,
PilotOutfitSlot * po )

Outfit is added to a ship.

Definition at line 1387 of file pilot_outfit.c.

◆ pilot_outfitLCleanup()

void pilot_outfitLCleanup ( Pilot * pilot)

Handle cleanup hooks for outfits.

Parameters
pilotPilot being handled.

Definition at line 2083 of file pilot_outfit.c.

◆ pilot_outfitLCooldown()

void pilot_outfitLCooldown ( Pilot * pilot,
int done,
int success,
double timer )

Handle cooldown hooks for outfits.

Parameters
pilotPilot being handled.
doneWhether or not cooldown is starting or done.
successWhether or not it completed successfully.
timerHow much time is necessary to cooldown. Only used if done is false.

Definition at line 1727 of file pilot_outfit.c.

◆ pilot_outfitLDescExtra()

static const char * pilot_outfitLDescExtra ( const Pilot * p,
const Outfit * o )
static

Definition at line 1287 of file pilot_outfit.c.

◆ pilot_outfitLInit()

int pilot_outfitLInit ( const Pilot * pilot,
PilotOutfitSlot * po )

Runs the pilot's Lua outfits init script for an outfit.

Parameters
pilotPilot to run Lua outfits for.
poPilot outfit to check.
Returns
0 if nothing was done, 1 if script was run, and -1 on error.

Definition at line 1449 of file pilot_outfit.c.

◆ pilot_outfitLInitAll()

void pilot_outfitLInitAll ( Pilot * pilot)

Runs the pilot's Lua outfits init script.

Parameters
pilotPilot to run Lua outfits for.

Definition at line 1372 of file pilot_outfit.c.

◆ pilot_outfitLmem()

static int pilot_outfitLmem ( PilotOutfitSlot * po,
nlua_env env )
static

Sets up the outfit memory for a slot.

Definition at line 1260 of file pilot_outfit.c.

◆ pilot_outfitLOnboard()

void pilot_outfitLOnboard ( Pilot * pilot,
const Pilot * target )

Runs Lua outfits when pilot boards a target.

Parameters
pilotPilot being handled.
targetPilot being boarded.

Definition at line 1994 of file pilot_outfit.c.

◆ pilot_outfitLOnhit()

void pilot_outfitLOnhit ( Pilot * pilot,
double armour,
double shield,
unsigned int attacker )

Runs the pilot's Lua outfits onhit script.

Parameters
pilotPilot to run Lua outfits for.
armourArmour amage taken by pilot.
shieldShield amage taken by pilot.
attackerThe attacker that hit the pilot.

Definition at line 1604 of file pilot_outfit.c.

◆ pilot_outfitLOnjumpin()

void pilot_outfitLOnjumpin ( Pilot * pilot)

Runs Lua outfits when pilot jumps into a system.

Parameters
pilotPilot being handled.

Definition at line 1959 of file pilot_outfit.c.

◆ pilot_outfitLOnkeydoubletap()

void pilot_outfitLOnkeydoubletap ( Pilot * pilot,
OutfitKey key )

Definition at line 2041 of file pilot_outfit.c.

◆ pilot_outfitLOnkeyrelease()

void pilot_outfitLOnkeyrelease ( Pilot * pilot,
OutfitKey key )

Definition at line 2073 of file pilot_outfit.c.

◆ pilot_outfitLOnland()

void pilot_outfitLOnland ( Pilot * pilot)

Runs Lua outfits when pilot lands on a spob.

Parameters
pilotPilot being handled.

Definition at line 1895 of file pilot_outfit.c.

◆ pilot_outfitLOnscan()

void pilot_outfitLOnscan ( Pilot * pilot)

Runs Lua outfits when pilot scanned their target.

Parameters
pilotPilot being handled.

Definition at line 1828 of file pilot_outfit.c.

◆ pilot_outfitLOnscanned()

void pilot_outfitLOnscanned ( Pilot * pilot,
const Pilot * scanner )

Runs Lua outfits when pilot was scanned by scanner.

Parameters
pilotPilot being handled.
scannerPilot that scanned the pilot.

Definition at line 1863 of file pilot_outfit.c.

◆ pilot_outfitLOnshoot()

int pilot_outfitLOnshoot ( const Pilot * pilot,
PilotOutfitSlot * po )

Handle the manual shoot of an outfit.

Parameters
pilotPilot to shoot outfit of.
poOutfit to be toggling.
Returns
1 if was able to shoot it, 0 otherwise.

Definition at line 1653 of file pilot_outfit.c.

◆ pilot_outfitLOnshootany()

void pilot_outfitLOnshootany ( Pilot * pilot)

Runs the pilot's Lua outfits onshootany script.

Parameters
pilotPilot to run Lua outfits for.

Definition at line 1760 of file pilot_outfit.c.

◆ pilot_outfitLOnstealth()

int pilot_outfitLOnstealth ( Pilot * pilot)

Runs the pilot's Lua outfits onhit script.

Parameters
pilotPilot to run Lua outfits for.
Returns
1 if ship stats were recalculated.

Definition at line 1794 of file pilot_outfit.c.

◆ pilot_outfitLOntakeoff()

void pilot_outfitLOntakeoff ( Pilot * pilot)

Runs Lua outfits when pilot takes off from a spob.

Parameters
pilotPilot being handled.

Definition at line 1927 of file pilot_outfit.c.

◆ pilot_outfitLOntoggle()

int pilot_outfitLOntoggle ( const Pilot * pilot,
PilotOutfitSlot * po,
int on )

Handle the manual toggle of an outfit.

Parameters
pilotPilot to toggle outfit of.
poOutfit to be toggling.
onWhether to toggle on or off.
Returns
1 if was able to toggle it, 0 otherwise.

Definition at line 1618 of file pilot_outfit.c.

◆ pilot_outfitLOutfofenergy()

void pilot_outfitLOutfofenergy ( Pilot * pilot)

Handles when the pilot runs out of energy.

Parameters
pilotPilot that ran out of energy.

Definition at line 1552 of file pilot_outfit.c.

◆ pilot_outfitLRemove()

int pilot_outfitLRemove ( const Pilot * pilot,
PilotOutfitSlot * po )

Outfit is removed froma ship.

Definition at line 1416 of file pilot_outfit.c.

◆ pilot_outfitLRun()

static void pilot_outfitLRun ( Pilot * p,
void(* func )(const Pilot *p, PilotOutfitSlot *po, const void *data),
const void * data )
static

Wrapper that does all the work for us.

Definition at line 1233 of file pilot_outfit.c.

◆ pilot_outfitLunmem()

static void pilot_outfitLunmem ( nlua_env env,
int oldmem )
static

Cleans up the outfit memory for a slot.

Definition at line 1280 of file pilot_outfit.c.

◆ pilot_outfitLUpdate()

void pilot_outfitLUpdate ( Pilot * pilot,
double dt )

Runs the pilot's Lua outfits update script.

Parameters
pilotPilot to run Lua outfits for.
dtDelta-tick from last time it was run.

Definition at line 1517 of file pilot_outfit.c.

◆ pilot_outfitRange()

double pilot_outfitRange ( const Pilot * p,
const Outfit * o )

Definition at line 867 of file pilot_outfit.c.

◆ pilot_outfitSummary()

const char * pilot_outfitSummary ( const Pilot * p,
const Outfit * o,
int withname )

Gets the summary of an outfit for a give pilot.

Note: the returned string can get overwritten by subsequent calls.

Parameters
pPilot to get the outfit summary of (or NULL for no pilot).
oOutfit to get summary of.
withnameWhether or not to show the name too.
Returns
The summary of the outfit.

Definition at line 1348 of file pilot_outfit.c.

◆ pilot_reportSpaceworthy()

int pilot_reportSpaceworthy ( const Pilot * p,
char * buf,
int bufSize )

Pilot safety report - makes sure stats are safe.

Parameters
pPilot to check.
bufBuffer to fill.
bufSizeSize of the buffer.
Returns
Number of issues encountered.

Definition at line 592 of file pilot_outfit.c.

◆ pilot_rmAmmo()

int pilot_rmAmmo ( Pilot * pilot,
PilotOutfitSlot * s,
int quantity )

Removes some ammo from the pilot stock.

Parameters
pilotPilot to remove ammo from.
sSlot to remove ammo from.
quantityAmount to remove.
Returns
Amount actually removed.

Definition at line 751 of file pilot_outfit.c.

◆ pilot_rmOutfit()

int pilot_rmOutfit ( Pilot * pilot,
PilotOutfitSlot * s )

Removes an outfit from the pilot.

Parameters
pilotPilot to remove the outfit from.
sSlot to remove.
Returns
0 on success.

Definition at line 526 of file pilot_outfit.c.

◆ pilot_rmOutfitIntrinsic()

int pilot_rmOutfitIntrinsic ( Pilot * pilot,
const Outfit * outfit )

Removes an outfit from an intrinsic slot.

Definition at line 430 of file pilot_outfit.c.

◆ pilot_rmOutfitRaw()

int pilot_rmOutfitRaw ( Pilot * pilot,
PilotOutfitSlot * s )

Removes an outfit from the pilot without doing any checks.

Note
Does not run pilot_calcStats().
Parameters
pilotPilot to remove the outfit from.
sSlot to remove.
Returns
0 on success.

Definition at line 471 of file pilot_outfit.c.

◆ pilot_slotIsToggleable()

int pilot_slotIsToggleable ( const PilotOutfitSlot * o)

Checks to see if a slot has an active outfit that can be toggleable.

Parameters
oOutfit slot to check.
Returns
1 if can toggle, 0 otherwise.

Definition at line 1215 of file pilot_outfit.c.

◆ pilot_slotsCheckRequired()

int pilot_slotsCheckRequired ( const Pilot * p)

Pilot required (core) slot filled check - makes sure they are filled.

Parameters
pPilot to check.
Returns
0 if a slot is missing, !0 otherwise.

Definition at line 565 of file pilot_outfit.c.

◆ pilot_slotsCheckSafety()

int pilot_slotsCheckSafety ( const Pilot * p)

Pilot slot safety check - makes sure stats are safe.

Parameters
pPilot to check.
Returns
0 if a slot doesn't fit, !0 otherwise.

Definition at line 550 of file pilot_outfit.c.

◆ pilot_updateMass()

void pilot_updateMass ( Pilot * pilot)

Updates the pilot stats after mass change.

Parameters
pilotPilot to update his mass.

Definition at line 1178 of file pilot_outfit.c.

Variable Documentation

◆ stealth_break

int stealth_break = 0
static

Whether or not to break stealth.

Definition at line 31 of file pilot_outfit.c.