naev 0.12.5
pilot_outfit.c File Reference

Handles pilot outfits. More...

#include "array.h"
#include "difficulty.h"
#include "escort.h"
#include "gui.h"
#include "log.h"
#include "nlua.h"
#include "nlua_outfit.h"
#include "nlua_pilot.h"
#include "nlua_pilotoutfit.h"
#include "nstring.h"
#include "ntracing.h"
#include "outfit.h"
#include "pilot.h"
#include "player.h"
#include "slots.h"
#include "space.h"
Include dependency graph for pilot_outfit.c:

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, Target *wt, 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.
double pilot_outfitSpeed (const Pilot *p, const Outfit *o)
 Gets the speed of an outfit given a 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, int natural)
 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:102

Function Documentation

◆ outfitkeytostr()

const char * outfitkeytostr ( OutfitKey key)
static

Definition at line 2153 of file pilot_outfit.c.

◆ outfitLCooldown()

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

Definition at line 1819 of file pilot_outfit.c.

◆ outfitLOnboard()

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

Definition at line 2116 of file pilot_outfit.c.

◆ outfitLOnhit()

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

Definition at line 1685 of file pilot_outfit.c.

◆ outfitLOnjumpin()

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

Definition at line 2082 of file pilot_outfit.c.

◆ outfitLOnkeydoubletap()

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

Definition at line 2166 of file pilot_outfit.c.

◆ outfitLOnkeyrelease()

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

Definition at line 2208 of file pilot_outfit.c.

◆ outfitLOnland()

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

Definition at line 2015 of file pilot_outfit.c.

◆ outfitLOnscan()

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

Definition at line 1943 of file pilot_outfit.c.

◆ outfitLOnscanned()

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

Definition at line 1978 of file pilot_outfit.c.

◆ outfitLOnshootany()

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

Definition at line 1871 of file pilot_outfit.c.

◆ outfitLOnstealth()

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

Definition at line 1905 of file pilot_outfit.c.

◆ outfitLOntakeoff()

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

Definition at line 2048 of file pilot_outfit.c.

◆ outfitLOutofenergy()

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

Definition at line 1645 of file pilot_outfit.c.

◆ outfitLRunWarning()

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

Definition at line 1317 of file pilot_outfit.c.

◆ outfitLUpdate()

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

Definition at line 1601 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 746 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 384 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 423 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 403 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 283 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 349 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 1019 of file pilot_outfit.c.

◆ pilot_calcStatsSlot()

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

Computes the stats for a pilot's slot.

Definition at line 951 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 715 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 808 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 199 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 873 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 167 of file pilot_outfit.c.

◆ pilot_getSlotByName()

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

Gets the outfit slot by name.

Definition at line 1212 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 261 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 468 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 688 of file pilot_outfit.c.

◆ pilot_healLanded()

void pilot_healLanded ( Pilot * pilot)

Cures the pilot as if he was landed.

Definition at line 1188 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 598 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 140 of file pilot_outfit.c.

◆ pilot_lockUpdateSlot()

void pilot_lockUpdateSlot ( Pilot * p,
PilotOutfitSlot * o,
Pilot * t,
Target * wt,
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).
wtPilot's target.
aAngle to update if necessary. Should be initialized to -1 before the loop.
dtCurrent delta tick.

Definition at line 50 of file pilot_outfit.c.

◆ pilot_massFactor()

double pilot_massFactor ( const Pilot * pilot)

Gets the factor at which speed gets worse.

Definition at line 1226 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 832 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 854 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 1394 of file pilot_outfit.c.

◆ pilot_outfitLAdd()

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

Outfit is added to a ship.

Definition at line 1501 of file pilot_outfit.c.

◆ pilot_outfitLCleanup()

void pilot_outfitLCleanup ( Pilot * pilot)

Handle cleanup hooks for outfits.

Parameters
pilotPilot being handled.

Definition at line 2244 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 1864 of file pilot_outfit.c.

◆ pilot_outfitLDescExtra()

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

Definition at line 1354 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 1565 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 1483 of file pilot_outfit.c.

◆ pilot_outfitLmem()

int pilot_outfitLmem ( PilotOutfitSlot * po,
nlua_env env )
static

Sets up the outfit memory for a slot.

Definition at line 1327 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 2148 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 1729 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 2111 of file pilot_outfit.c.

◆ pilot_outfitLOnkeydoubletap()

void pilot_outfitLOnkeydoubletap ( Pilot * pilot,
OutfitKey key )

Definition at line 2198 of file pilot_outfit.c.

◆ pilot_outfitLOnkeyrelease()

void pilot_outfitLOnkeyrelease ( Pilot * pilot,
OutfitKey key )

Definition at line 2234 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 2043 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 1973 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 2010 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 1785 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 1900 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 1937 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 2077 of file pilot_outfit.c.

◆ pilot_outfitLOntoggle()

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

Handle the manual toggle of an outfit.

Parameters
pilotPilot to toggle outfit of.
poOutfit to be toggling.
onWhether to toggle on or off.
naturalWhether it's a result of the pilot input, or something automatic (such as turning off outfits when landing or hyperspace).
Returns
1 if was able to toggle it, 0 otherwise.

Definition at line 1747 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 1675 of file pilot_outfit.c.

◆ pilot_outfitLRemove()

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

Outfit is removed froma ship.

Definition at line 1531 of file pilot_outfit.c.

◆ pilot_outfitLRun()

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 1291 of file pilot_outfit.c.

◆ pilot_outfitLunmem()

void pilot_outfitLunmem ( nlua_env env,
int oldmem )
static

Cleans up the outfit memory for a slot.

Definition at line 1347 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 1635 of file pilot_outfit.c.

◆ pilot_outfitRange()

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

Definition at line 896 of file pilot_outfit.c.

◆ pilot_outfitSpeed()

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

Gets the speed of an outfit given a pilot.

Definition at line 1439 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 1415 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 611 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 779 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 544 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 448 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 489 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 1283 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 584 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 568 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 1243 of file pilot_outfit.c.

Variable Documentation

◆ stealth_break

int stealth_break = 0
static

Whether or not to break stealth.

Definition at line 30 of file pilot_outfit.c.