17#include "difficulty.h"
27#include "nlua_pilot.h"
28#include "nlua_pilotoutfit.h"
29#include "nlua_outfit.h"
37static const char *outfitkeytostr( OutfitKey key );
71 *a =
FABS( angle_diff( ang, p->solid.dir ) );
124 for (
int i=0; i<
array_size(p->outfits); i++) {
156 a = (double)(p->tsy * p->ship->gfx_space->sx + p->tsx);
157 a *= p->ship->mangle;
165 m = &w->sslot->mount;
168 x = m->
x * cm + m->
y * sm;
169 y = m->
x *-sm + m->
y * cm;
178 vec2_cset( v, x, y );
196 if (p->dockpilot != target->
id)
201 if (dockslot == NULL)
205 if (vec2_dist(&p->solid.pos, &target->
solid.
pos) >
210 if (vec2_dist2( &p->solid.vel, &target->
solid.
vel ) >
pow2(MAX_HYPERSPACE_VEL))
223 WARN(_(
"Unable to add ammo to '%s' from docking pilot '%s'!"),target->
name,p->name);
227 if ((target->
escorts[i].
type == ESCORT_TYPE_BAY) &&
233 WARN(_(
"Docking pilot '%s' not found in pilot '%s's escort list!"),target->
name,p->name);
251 for (
int i=0; i<
array_size(p->outfits); i++) {
252 if (p->outfits[i]->outfit == NULL)
255 if (p->outfits[i]->u.ammo.deployed > 0)
276 s->
state = PILOT_OUTFIT_OFF;
338 WARN( _(
"Pilot '%s': trying to add outfit '%s' to slot that already has an outfit"),
345 WARN( _(
"Pilot '%s': Not enough CPU to add outfit '%s'"),
351 WARN( _(
"Pilot '%s': Trying to add outfit but %s"),
390 WARN(_(
"Instrinsic outfits must be modifiers!"));
411 WARN(_(
"Instrinsic outfits must be modifiers!"));
476 if (s->
state==PILOT_OUTFIT_ON)
507 luaL_unref( naevL, LUA_REGISTRYINDEX, s->
lua_mem );
531 WARN(_(
"Pilot '%s': Trying to remove outfit but %s"),
553 if ((p->outfits[i]->outfit != NULL) &&
554 !
outfit_fitsSlot( p->outfits[i]->outfit, &p->outfits[i]->sslot->slot ))
568 if (p->outfits[i]->sslot->required && p->outfits[i]->outfit == NULL)
594#define SPACEWORTHY_CHECK(cond,msg) \
598 pos += scnprintf( &buf[pos], bufSize-pos, "\n" ); \
599 pos += scnprintf( &buf[pos], bufSize-pos, (msg) ); } }
606 SPACEWORTHY_CHECK( p->cpu < 0, _(
"!! Insufficient CPU") );
609 SPACEWORTHY_CHECK( p->accel < 0, _(
"!! Insufficient Accel") );
610 SPACEWORTHY_CHECK( p->speed < 0, _(
"!! Insufficient Speed") );
611 SPACEWORTHY_CHECK( p->turn < 0, _(
"!! Insufficient Turn") );
614 SPACEWORTHY_CHECK( p->armour < 0., _(
"!! Insufficient Armour") );
615 SPACEWORTHY_CHECK( p->armour_regen < 0., _(
"!! Insufficient Armour Regeneration") );
616 SPACEWORTHY_CHECK( p->shield < 0., _(
"!! Insufficient Shield") );
617 SPACEWORTHY_CHECK( p->shield_regen < 0., _(
"!! Insufficient Shield Regeneration") );
618 SPACEWORTHY_CHECK( p->energy_max < 0., _(
"!! Insufficient Energy") );
619 SPACEWORTHY_CHECK( (p->energy_regen <= 0.) && (p->energy_max > 0.), _(
"!! Insufficient Energy Regeneration") );
622 SPACEWORTHY_CHECK( p->fuel_max < 0, _(
"!! Insufficient Fuel Maximum") );
623 SPACEWORTHY_CHECK( p->fuel_consumption < 0, _(
"!! Insufficient Fuel Consumption") );
624 SPACEWORTHY_CHECK( p->cargo_free < 0, _(
"!! Insufficient Free Cargo Space") );
625 SPACEWORTHY_CHECK( p->crew < 0, _(
"!! Insufficient Crew") );
632 if (pos > bufSize-1) {
640 pos +=
scnprintf( buf, bufSize, _(
"Spaceworthy"));
641 if (ship_isFlag(p->ship, SHIP_NOPLAYER))
642 pos +=
scnprintf( &buf[pos], bufSize-pos,
"\n#o%s#0", _(
"Escort only") );
643 if (ship_isFlag(p->ship, SHIP_NOESCORT))
644 scnprintf( &buf[pos], bufSize-pos,
"\n#o%s#0", _(
"Lead ship only") );
649#undef SPACEWORTHY_CHECK
662 for (
int i = 0; i<
array_size(p->outfits); i++) {
663 const Outfit *o = p->outfits[i]->outfit;
666 if ((o->
limit != NULL) && (strcmp(o->
limit,limit)==0))
669 for (
int i=0; i<
array_size(p->outfit_intrinsic); i++) {
670 const Outfit *o = p->outfit_intrinsic[i].outfit;
671 if ((o->
limit != NULL) && (strcmp(o->
limit,limit)==0))
688 if ((p==NULL) || (s==NULL))
689 return _(
"Nothing selected.");
694 return _(
"Does not fit slot.");
697 return _(
"Already have an outfit of this type installed");
700 return _(
"Can only install unique outfit once.");
705 return _(
"Recall the fighters first");
725 WARN(_(
"Pilot '%s': Trying to add ammo to unequipped slot."), pilot->
name );
758 else if (s->
outfit == NULL) {
759 WARN(_(
"Pilot '%s': Trying to remove ammo from unequipped slot."), pilot->
name );
831 max = round( (
double)o->
u.
lau.
amount * p->stats.ammo_capacity );
833 max = round( (
double)o->
u.
bay.
amount * p->stats.fbay_capacity );
867double pilot_outfitRange(
const Pilot *p,
const Outfit *o )
876 duration *= p->stats.launch_range;
885 return speedinc * (duration - at / 2.) + o->
u.
lau.
speed * duration;
929 if (slot->
lua_mem != LUA_NOREF)
939 if (slot->
active && !(slot->
state==PILOT_OUTFIT_ON))
947 if (slot->
active && !(slot->
state==PILOT_OUTFIT_ON))
951 pilot_setFlag( pilot, PILOT_AFTERBURNER );
967 double ac, sc, ec, tm;
1011 if (pilot_isPlayer(pilot))
1012 difficulty_apply( s );
1032 if (pilot_isFlag(pilot, PILOT_STEALTH)) {
1119 if (pilot_isPlayer(pilot) && (tm != s->
time_mod))
1168 return 1./(1.+f+f+4.*pow(f,3.));
1192 if (pilot_isFlag(pilot, PILOT_HASSPEEDLIMIT)) {
1195 if (pilot->
speed < 0.) {
1205 if (pilot_isPlayer(pilot))
1235 pilotoutfit_modified = 0;
1236 for (
int i=0; i<
array_size(p->outfits); i++) {
1240 func( p, po, data );
1242 for (
int i=0; i<
array_size(p->outfit_intrinsic); i++) {
1246 func( p, po, data );
1249 if (pilotoutfit_modified)
1252static void outfitLRunWarning(
const Pilot *p,
const Outfit *o,
const char *name,
const char *error )
1254 WARN( _(
"Pilot '%s''s outfit '%s' -> '%s':\n%s"), p->name, o->
name, name, error );
1264 if (po->
lua_mem == LUA_NOREF) {
1265 lua_newtable(naevL);
1266 po->
lua_mem = luaL_ref(naevL,LUA_REGISTRYINDEX);
1269 nlua_getenv( naevL, env,
"mem" );
1270 oldmem = luaL_ref( naevL, LUA_REGISTRYINDEX );
1272 lua_rawgeti(naevL, LUA_REGISTRYINDEX, po->
lua_mem);
1273 nlua_setenv( naevL, env,
"mem" );
1282 lua_rawgeti( naevL, LUA_REGISTRYINDEX, oldmem );
1283 nlua_setenv( naevL, env,
"mem");
1284 luaL_unref( naevL, LUA_REGISTRYINDEX, oldmem );
1287static const char* pilot_outfitLDescExtra(
const Pilot *p,
const Outfit *o )
1289 static char descextra[STRMAX];
1296 if ((p != NULL) && (p->id > 0))
1299 lua_pushnil( naevL );
1301 if (nlua_pcall( o->
lua_env, 2, 1 )) {
1302 outfitLRunWarning( p, o,
"descextra", lua_tostring(naevL,-1) );
1304 descextra[0] =
'\0';
1308 if (lua_isnoneornil( naevL, -1 )) {
1309 lua_pop( naevL, 1 );
1312 de = luaL_checkstring( naevL, -1 );
1313 strncpy( descextra, de,
sizeof(descextra)-1 );
1314 lua_pop( naevL, 1 );
1329 static char o_description[STRMAX];
1330 const char *de = pilot_outfitLDescExtra( p, o );
1333 snprintf( o_description,
sizeof(o_description),
"%s\n%s", _(o->
desc_raw), de );
1334 return o_description;
1350 static char o_summary[STRMAX];
1351 const char *de = pilot_outfitLDescExtra( p, o );
1354 snprintf( o_summary,
sizeof(o_summary),
"%s\n%s", _(o->
name), o->
summary_raw );
1356 snprintf( o_summary,
sizeof(o_summary),
"%s", o->
summary_raw );
1360 snprintf( o_summary,
sizeof(o_summary),
"%s\n%s\n%s", _(o->
name), o->
summary_raw, de );
1362 snprintf( o_summary,
sizeof(o_summary),
"%s\n%s", o->
summary_raw, de );
1374 pilotoutfit_modified = 0;
1380 if (pilotoutfit_modified)
1404 outfitLRunWarning( pilot, po->
outfit,
"onadd", lua_tostring(naevL,-1) );
1433 outfitLRunWarning( pilot, po->
outfit,
"onremove", lua_tostring(naevL,-1) );
1451 int lua_oinit, oldmem;
1466 if (lua_oinit == LUA_NOREF) {
1472 lua_rawgeti(naevL, LUA_REGISTRYINDEX, lua_oinit);
1475 if (nlua_pcall( lua_env, 2, 0 )) {
1476 outfitLRunWarning( pilot, po->
outfit,
"init", lua_tostring(naevL,-1) );
1495 dt = *(
double*)data;
1504 lua_pushnumber(naevL, dt);
1505 if (nlua_pcall( env, 3, 0 )) {
1506 outfitLRunWarning( pilot, po->
outfit,
"update", lua_tostring(naevL,-1) );
1541 if (nlua_pcall( env, 2, 0 )) {
1542 outfitLRunWarning( pilot, po->
outfit,
"outofenergy", lua_tostring(naevL,-1) );
1560 unsigned int attacker;
1564 double armour, shield;
1565 unsigned int attacker;
1576 armour = odat->armour;
1577 shield = odat->shield;
1578 attacker = odat->attacker;
1587 lua_pushnumber(naevL, armour );
1588 lua_pushnumber(naevL, shield );
1590 if (nlua_pcall( env, 5, 0 )) {
1591 outfitLRunWarning( pilot, po->
outfit,
"onhit", lua_tostring(naevL,-1) );
1606 const struct OnhitData data = { .armour = armour, .shield = shield, .attacker = attacker };
1622 pilotoutfit_modified = 0;
1631 lua_pushboolean(naevL, on);
1632 if (nlua_pcall( env, 3, 1 )) {
1633 outfitLRunWarning( pilot, po->
outfit,
"ontoggle", lua_tostring(naevL,-1) );
1640 ret = lua_toboolean(naevL, -1);
1643 return ret || pilotoutfit_modified;
1657 pilotoutfit_modified = 0;
1666 if (nlua_pcall( env, 2, 1 )) {
1667 outfitLRunWarning( pilot, po->
outfit,
"onshoot", lua_tostring(naevL,-1) );
1674 ret = lua_toboolean(naevL, -1);
1677 return ret || pilotoutfit_modified;
1687 int done, success, oldmem;
1698 success = cdat->success;
1699 timer = cdat->timer;
1708 lua_pushboolean(naevL, done);
1710 lua_pushboolean(naevL, success);
1712 lua_pushnumber(naevL, timer);
1713 if (nlua_pcall( env, 4, 0 )) {
1714 outfitLRunWarning( pilot, po->
outfit,
"cooldown", lua_tostring(naevL,-1) );
1729 const struct CooldownData data = { .done = done, .success = success, .timer = timer };
1749 if (nlua_pcall( env, 2, 0 )) {
1750 outfitLRunWarning( pilot, po->
outfit,
"onshootany", lua_tostring(naevL,-1) );
1781 lua_pushboolean(naevL, pilot_isFlag(pilot,PILOT_STEALTH) );
1782 if (nlua_pcall( env, 3, 0 )) {
1783 outfitLRunWarning( pilot, po->
outfit,
"onstealth", lua_tostring(naevL,-1) );
1797 return pilotoutfit_modified;
1817 if (nlua_pcall( env, 3, 0 )) {
1818 outfitLRunWarning( pilot, po->
outfit,
"onscan", lua_tostring(naevL,-1) );
1835 const Pilot *scanner;
1841 scanner = (
const Pilot*) data;
1851 if (nlua_pcall( env, 3, 0 )) {
1852 outfitLRunWarning( pilot, po->
outfit,
"onscanned", lua_tostring(naevL,-1) );
1884 if (nlua_pcall( env, 2, 0 )) {
1885 outfitLRunWarning( pilot, po->
outfit,
"land", lua_tostring(naevL,-1) );
1916 if (nlua_pcall( env, 2, 0 )) {
1917 outfitLRunWarning( pilot, po->
outfit,
"takeoff", lua_tostring(naevL,-1) );
1948 if (nlua_pcall( env, 2, 0 )) {
1949 outfitLRunWarning( pilot, po->
outfit,
"jumpin", lua_tostring(naevL,-1) );
1966 const Pilot *target;
1972 target = (
const Pilot*) data;
1982 if (nlua_pcall( env, 3, 0 )) {
1983 outfitLRunWarning( pilot, po->
outfit,
"board", lua_tostring(naevL,-1) );
1999static const char *outfitkeytostr( OutfitKey key )
2002 case OUTFIT_KEY_ACCEL:
2004 case OUTFIT_KEY_LEFT:
2006 case OUTFIT_KEY_RIGHT:
2018 key = *((
const OutfitKey*) data);
2029 lua_pushstring(naevL, outfitkeytostr(key) );
2030 if (nlua_pcall( env, 3, 1 )) {
2031 outfitLRunWarning( pilot, po->
outfit,
"keydoubletap", lua_tostring(naevL,-1) );
2037 if ((po->
state==PILOT_OUTFIT_ON) || lua_toboolean(naevL,-1))
2039 lua_pop( naevL, 1 );
2041void pilot_outfitLOnkeydoubletap(
Pilot *pilot, OutfitKey key )
2055 key = *((
const OutfitKey*) data);
2066 lua_pushstring(naevL, outfitkeytostr(key) );
2067 if (nlua_pcall( env, 3, 0 )) {
2068 outfitLRunWarning( pilot, po->
outfit,
"keyrelease", lua_tostring(naevL,-1) );
2073void pilot_outfitLOnkeyrelease(
Pilot *pilot, OutfitKey key )
2086 pilotoutfit_modified = 0;
2108 if (nlua_pcall( env, 2, 0 )) {
2109 outfitLRunWarning( pilot, po->
outfit,
"cleanup", lua_tostring(naevL,-1) );
Provides macros to work with dynamic arrays.
#define array_erase(ptr_array, first, last)
Erases elements in interval [first, last).
static ALWAYS_INLINE int array_size(const void *array)
Returns number of elements in the array.
#define array_grow(ptr_array)
Increases the number of elements by one and returns the last element.
#define array_create(basic_type)
Creates a new dynamic array of ‘basic_type’.
void effect_compute(ShipStats *s, const Effect *efxlist)
Updates shipstats from effect list.
void escort_rmListIndex(Pilot *p, int i)
Remove from escorts list.
void gui_setShip(void)
Player just upgraded their ship or modified it.
void gui_setGeneric(const Pilot *pilot)
Calls trigger functions depending on who the pilot is.
Header file with generic functions and naev-specifics.
const Outfit ** lua_pushoutfit(lua_State *L, const Outfit *outfit)
Pushes a outfit on the stack.
LuaPilot * lua_pushpilot(lua_State *L, LuaPilot pilot)
Pushes a pilot on the stack.
PilotOutfitSlot ** lua_pushpilotoutfit(lua_State *L, PilotOutfitSlot *po)
Pushes a pilot outfit on the stack.
int scnprintf(char *text, size_t maxlen, const char *fmt,...)
Like snprintf(), but returns the number of characters ACTUALLY "printed" into the buffer....
int outfit_isBeam(const Outfit *o)
Checks if outfit is a beam type weapon.
double outfit_cpu(const Outfit *o)
Gets the outfit's cpu usage.
int outfit_isActive(const Outfit *o)
Checks if outfit is an active outfit.
int outfit_isLauncher(const Outfit *o)
Checks if outfit is a weapon launcher.
int outfit_isSeeker(const Outfit *o)
Checks if outfit is a seeking weapon.
int outfit_isToggleable(const Outfit *o)
Checks if outfit can be toggled.
int outfit_fitsSlot(const Outfit *o, const OutfitSlot *s)
Checks to see if an outfit fits a slot.
int outfit_isFighterBay(const Outfit *o)
Checks if outfit is a fighter bay.
int outfit_isAfterburner(const Outfit *o)
Checks if outfit is an afterburner.
int outfit_isTurret(const Outfit *o)
Checks if outfit is a turret class weapon.
double outfit_ammoMass(const Outfit *o)
Gets the outfit's ammunition mass.
int outfit_isMod(const Outfit *o)
Checks if outfit is a ship modification.
int outfit_isBolt(const Outfit *o)
Checks if outfit is bolt type weapon.
PilotOutfitSlot * pilot_getDockSlot(Pilot *p)
Gets the dock slot of the pilot.
Pilot * pilot_get(unsigned int id)
Pulls a pilot out of the pilot_stack based on ID.
void pilot_delete(Pilot *p)
Deletes a pilot.
int pilot_numOutfit(const Pilot *p, const Outfit *o)
Checks to see how many of an outfit a pilot has.
void pilot_cargoCalc(Pilot *pilot)
Calculates how much cargo ship has left and such.
void pilot_destealth(Pilot *p)
Destealths a pilot.
double pilot_ewWeaponTrack(const Pilot *p, const Pilot *t, double trackmin, double trackmax)
Calculates the weapon lead (1. is 100%, 0. is 0%)..
void pilot_ewUpdateStatic(Pilot *p)
Updates the pilot's static electronic warfare properties.
void pilot_heatCalcSlot(PilotOutfitSlot *o)
Calculates the heat parameters for a pilot's slot.
void pilot_heatCalc(Pilot *p)
Calculates the heat parameters for a pilot.
int pilot_runHook(Pilot *p, int hook_type)
Tries to run a pilot hook if he has it.
int pilot_getMount(const Pilot *p, const PilotOutfitSlot *w, vec2 *v)
Gets the mount position of a pilot.
int pilot_rmOutfit(Pilot *pilot, PilotOutfitSlot *s)
Removes an outfit from the pilot.
void pilot_updateMass(Pilot *pilot)
Updates the pilot stats after mass change.
int pilot_addOutfitIntrinsicRaw(Pilot *pilot, const Outfit *outfit)
Adds an outfit as an intrinsic slot.
void pilot_outfitLCooldown(Pilot *pilot, int done, int success, double timer)
Handle cooldown hooks for outfits.
int pilot_hasOutfitLimit(const Pilot *p, const char *limit)
Checks to see if a pilot has an outfit with a specific outfit type.
void pilot_outfitLOutfofenergy(Pilot *pilot)
Handles when the pilot runs out of energy.
const char * pilot_outfitDescription(const Pilot *p, const Outfit *o)
Gets the description of an outfit for a given pilot.
void pilot_healLanded(Pilot *pilot)
Cures the pilot as if he was landed.
int pilot_slotsCheckRequired(const Pilot *p)
Pilot required (core) slot filled check - makes sure they are filled.
int pilot_slotsCheckSafety(const Pilot *p)
Pilot slot safety check - makes sure stats are safe.
int pilot_outfitLAdd(const Pilot *pilot, PilotOutfitSlot *po)
Outfit is added to a ship.
int pilot_maxAmmoO(const Pilot *p, const Outfit *o)
Gets the maximum available ammo for a pilot for a specific outfit.
int pilot_hasDeployed(const Pilot *p)
Checks to see if the pilot has deployed ships.
static void pilot_outfitLunmem(nlua_env env, int oldmem)
Cleans up the outfit memory for a slot.
int pilot_addOutfit(Pilot *pilot, const Outfit *outfit, PilotOutfitSlot *s)
Adds an outfit to the pilot.
void pilot_outfitLOnjumpin(Pilot *pilot)
Runs Lua outfits when pilot jumps into a system.
int pilot_slotIsToggleable(const PilotOutfitSlot *o)
Checks to see if a slot has an active outfit that can be toggleable.
void pilot_outfitLOntakeoff(Pilot *pilot)
Runs Lua outfits when pilot takes off from a spob.
int pilot_outfitLOntoggle(const Pilot *pilot, PilotOutfitSlot *po, int on)
Handle the manual toggle of an outfit.
void pilot_calcStats(Pilot *pilot)
Recalculates the pilot's stats based on his outfits.
double pilot_massFactor(const Pilot *pilot)
Gets the factor at which speed gets worse.
void pilot_fillAmmo(Pilot *pilot)
Fills pilot's ammo completely.
int pilot_addAmmo(Pilot *pilot, PilotOutfitSlot *s, int quantity)
Adds some ammo to the pilot stock.
int pilot_hasIntrinsic(const Pilot *pilot, const Outfit *outfit)
Gets how many copies of an intrinsic a pilot has.
const char * pilot_outfitSummary(const Pilot *p, const Outfit *o, int withname)
Gets the summary of an outfit for a give pilot.
int pilot_rmOutfitRaw(Pilot *pilot, PilotOutfitSlot *s)
Removes an outfit from the pilot without doing any checks.
static void pilot_calcStatsSlot(Pilot *pilot, PilotOutfitSlot *slot)
Computes the stats for a pilot's slot.
int pilot_outfitLInit(const Pilot *pilot, PilotOutfitSlot *po)
Runs the pilot's Lua outfits init script for an outfit.
int pilot_countAmmo(const Pilot *pilot)
Gets the number of ammo units on the ship.
void pilot_lockClear(Pilot *p)
Clears pilot's missile lockon timers.
int pilot_outfitLOnstealth(Pilot *pilot)
Runs the pilot's Lua outfits onhit script.
void pilot_outfitLCleanup(Pilot *pilot)
Handle cleanup hooks for outfits.
PilotOutfitSlot * pilot_getSlotByName(Pilot *pilot, const char *name)
Gets the outfit slot by name.
static int pilot_outfitLmem(PilotOutfitSlot *po, nlua_env env)
Sets up the outfit memory for a slot.
int pilot_maxAmmo(const Pilot *pilot)
The maximum amount of ammo the pilot's current ship can hold.
void pilot_outfitLOnscan(Pilot *pilot)
Runs Lua outfits when pilot scanned their target.
int pilot_reportSpaceworthy(const Pilot *p, char *buf, int bufSize)
Pilot safety report - makes sure stats are safe.
int pilot_addOutfitTest(Pilot *pilot, const Outfit *outfit, const PilotOutfitSlot *s, int warn)
Tests to see if an outfit can be added.
int pilot_outfitLOnshoot(const Pilot *pilot, PilotOutfitSlot *po)
Handle the manual shoot of an outfit.
void pilot_outfitLOnboard(Pilot *pilot, const Pilot *target)
Runs Lua outfits when pilot boards a target.
int pilot_outfitLRemove(const Pilot *pilot, PilotOutfitSlot *po)
Outfit is removed froma ship.
int pilot_rmAmmo(Pilot *pilot, PilotOutfitSlot *s, int quantity)
Removes some ammo from the pilot stock.
void pilot_outfitLOnland(Pilot *pilot)
Runs Lua outfits when pilot lands on a spob.
int pilot_dock(Pilot *p, Pilot *target)
Docks the pilot on its target pilot.
void pilot_outfitLOnscanned(Pilot *pilot, const Pilot *scanner)
Runs Lua outfits when pilot was scanned by scanner.
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.
void pilot_lockUpdateSlot(Pilot *p, PilotOutfitSlot *o, Pilot *t, double *a, double dt)
Updates the lockons on the pilot's launchers.
void pilot_outfitLOnshootany(Pilot *pilot)
Runs the pilot's Lua outfits onshootany script.
void pilot_outfitLUpdate(Pilot *pilot, double dt)
Runs the pilot's Lua outfits update script.
int pilot_addOutfitRaw(Pilot *pilot, const Outfit *outfit, PilotOutfitSlot *s)
Adds an outfit to the pilot, ignoring CPU or other limits.
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.
int pilot_rmOutfitIntrinsic(Pilot *pilot, const Outfit *outfit)
Removes an outfit from an intrinsic slot.
int pilot_isSpaceworthy(const Pilot *p)
Pilot safety check - makes sure stats are safe.
int pilot_addOutfitIntrinsic(Pilot *pilot, const Outfit *outfit)
Adds an outfit as an intrinsic slot.
void pilot_outfitLOnhit(Pilot *pilot, double armour, double shield, unsigned int attacker)
Runs the pilot's Lua outfits onhit script.
void pilot_outfitLInitAll(Pilot *pilot)
Runs the pilot's Lua outfits init script.
int pilot_outfitOff(Pilot *p, PilotOutfitSlot *o)
Disables a given active outfit.
void pilot_weapSetUpdateStats(Pilot *p)
Update the weapon sets given pilot stat changes.
void player_resetSpeed(void)
Resets the player speed stuff.
void ss_free(ShipStatList *ll)
Frees a list of ship stats.
int ss_statsMergeFromList(ShipStats *stats, const ShipStatList *list)
Updates a stat structure from a stat list.
int sp_required(unsigned int spid)
Gets whether or not a slot property is required.
A ship outfit, depends radically on the type.
OutfitAfterburnerData afb
Stores an outfit the pilot has.
The representation of an in-game pilot.
ShipStatList * ship_stats
PilotOutfitSlot ** outfits
PilotOutfitSlot * outfit_intrinsic
ShipStatList * intrinsic_stats
PilotOutfitSlot * afterburner
Represents a ship weapon mount point.
Represents ship statistics, properties ship can use.
double shield_regen_malus
double energy_regen_malus
double armour_regen_malus