22#include "nlua_pilotoutfit.h"
35 const Target *target,
double time,
48 return &p->weapon_sets[id];
56 for (
int i = 0; i < PILOT_WEAPON_SETS; i++ ) {
70 if ( !( pos->
flags & PILOTOUTFIT_TOGGLEABLE ) )
73 if ( pos->
flags & PILOTOUTFIT_ISON_HOLD )
77 if ( pos->
flags & PILOTOUTFIT_ISON ) {
78 pos->
flags &= ~PILOTOUTFIT_ISON_TOGGLE;
80 pos->
flags |= PILOTOUTFIT_ISON_TOGGLE;
82 pos->
flags |= PILOTOUTFIT_VOLLEY;
84 pos->
flags |= PILOTOUTFIT_INRANGE;
86 pos->
flags |= PILOTOUTFIT_MANUAL;
108 if ( ws->
slots == NULL )
112 if ( ( pilot_isDisabled( p ) ) || ( pilot_isFlag( p, PILOT_COOLDOWN ) ) )
120 t = WEAPSET_TYPE_HOLD;
122 t = WEAPSET_TYPE_DEFAULT;
127 case WEAPSET_TYPE_DEFAULT:
130 ret = ( ws->
active != 0 );
132 }
else if ( type > 1 ) {
133 ret = ( ws->
active != 1 );
136 ret = ( ws->
active != 0 );
138 ret |= pilot_weapSetPressToggle( p, ws );
142 case WEAPSET_TYPE_TOGGLE:
148 ret = pilot_weapSetPressToggle( p, ws );
151 case WEAPSET_TYPE_HOLD:
157 ret = ( ws->
active != 1 );
159 }
else if ( type < 0 ) {
160 ret = ( ws->
active != 0 );
178 for (
int i = 0; i <
array_size( p->outfits ); i++ ) {
180 pos->
flags &= ~PILOTOUTFIT_ISON_HOLD;
184 for (
int i = 0; i < PILOT_WEAPON_SETS; i++ ) {
186 if ( ws->
slots == NULL )
194 if ( p->advweap && ( ws->
type == WEAPSET_TYPE_TOGGLE ) )
200 if ( pos->
outfit == NULL )
203 pos->
flags &= ~PILOTOUTFIT_ISON_TOGGLE;
204 pos->
flags |= PILOTOUTFIT_ISON_HOLD;
206 pos->
flags |= PILOTOUTFIT_VOLLEY;
208 pos->
flags |= PILOTOUTFIT_INRANGE;
210 pos->
flags |= PILOTOUTFIT_MANUAL;
217 pilotoutfit_modified = 0;
218 for (
int i = 0; i <
array_size( p->outfits ); i++ ) {
223 if ( !( pos->
flags & PILOTOUTFIT_TOGGLEABLE ) )
226 if ( pos->
flags & ( PILOTOUTFIT_ISON_TOGGLE | PILOTOUTFIT_ISON_HOLD ) )
227 pos->
flags |= PILOTOUTFIT_ISON;
229 pos->
flags &= ~( PILOTOUTFIT_ISON | PILOTOUTFIT_DYNAMIC_FLAGS );
232 if ( pos->
flags & PILOTOUTFIT_ISON ) {
237 if ( pos->
state == PILOT_OUTFIT_OFF ) {
240 !outfit_isProp( pos->
outfit, OUTFIT_PROP_STEALTH_ON ) )
243 pos->
flags &= ~( PILOTOUTFIT_ISON | PILOTOUTFIT_DYNAMIC_FLAGS );
247 if ( pos->
state == PILOT_OUTFIT_ON )
253 if ( ( non + noff > 0 ) || pilotoutfit_modified ) {
255 if ( pilot_isFlag( p, PILOT_STEALTH ) && breakstealth )
269 int n, shotweap, target_set, breakstealth;
273 if ( pilot_isFlag( p, PILOT_HYP_BEGIN ) )
280 pilotoutfit_modified = 0;
281 for (
int i = 0; i <
array_size( p->outfits ); i++ ) {
288 if ( !( pos->
flags & PILOTOUTFIT_TOGGLEABLE ) )
290 if ( !( pos->
flags & PILOTOUTFIT_ISON ) )
301 for (
int j = 0; j < i; j++ ) {
303 if ( posj->
flags != PILOTOUTFIT_ISON )
306 if ( posj->
outfit == o ) {
334 if ( pilot_outfitRange( p, o ) / o->
u.
blt.
speed < time )
338 p->stats.weapon_range <
344 if ( !
weapon_inArc( o, p, &wt, &p->solid.pos, &p->solid.vel,
345 p->solid.dir, time ) )
352 !( pos->
flags & PILOTOUTFIT_MANUAL ) );
355 p, o, &wt, time, !( pos->
flags & PILOTOUTFIT_MANUAL ) );
359 if ( shot && !outfit_isProp( pos->
outfit, OUTFIT_PROP_STEALTH_ON ) )
364 if ( ( n > 0 ) || pilotoutfit_modified ) {
366 if ( pilot_isFlag( p, PILOT_STEALTH ) && breakstealth )
372 if ( pilot_isFlag( p, PILOT_COOLDOWN ) && ( shotweap > 0 ) )
387 for (
int i = 0; i <
array_size( p->outfits ); i++ ) {
390 for (
int j = 0; j < PILOT_WEAPON_SETS; j++ ) {
517 static char setname[STRMAX_SHORT];
518 const char *base, *type;
522 switch ( ws->
type ) {
523 case WEAPSET_TYPE_DEFAULT:
524 type = p_(
"weapset",
"Default" );
526 case WEAPSET_TYPE_TOGGLE:
527 type = p_(
"weapset",
"Toggle" );
529 case WEAPSET_TYPE_HOLD:
530 type = p_(
"weapset",
"Hold" );
533 type = p_(
"weapset",
"Unknown" );
547 if ( pos->
outfit == NULL )
553 else if ( o != pos->
outfit )
556 case OUTFIT_SLOT_STRUCTURE:
559 case OUTFIT_SLOT_UTILITY:
562 case OUTFIT_SLOT_WEAPON:
571 else if ( not_same == 0 )
573 else if ( has_weap && !has_util && !has_stru )
574 base = p_(
"weapset",
"Weapons" );
575 else if ( !has_weap && has_util && !has_stru )
576 base = p_(
"weapset",
"Utilities" );
577 else if ( !has_weap && !has_util && has_stru )
578 base = p_(
"weapset",
"Structurals" );
580 base = p_(
"weapset",
"Mixed" );
584 snprintf( setname,
sizeof( setname ), p_(
"weapset",
"%s - %s" ), type,
587 snprintf( setname,
sizeof( setname ),
"%s", base );
604 if ( ws->
slots == NULL )
653 ws->
type = WEAPSET_TYPE_TOGGLE;
706 for (
int i = 0; i < PILOT_WEAPON_SETS; i++ )
733 if ( pos->
outfit == NULL )
741 range = pilot_outfitRange( p, pos->
outfit );
744 range_accum += range;
755 speed_accum += speed;
761 if ( range_num == 0 )
764 ws->
range = range_accum / (double)range_num;
767 if ( speed_num == 0 )
770 ws->
speed = speed_accum / (double)speed_num;
829 return ( nammo == 0 ) ? 0. : ammo / (double)nammo;
854 for (
int i = 0; i < PILOT_WEAPON_SETS; i++ )
878 double rate_mod, energy_mod, used;
881 if ( w->u.beamid == 0 )
885 if ( w->outfit == NULL ) {
902 used = w->outfit->u.bem.duration -
905 w->timer = rate_mod *
MAX( w->outfit->u.bem.min_delay,
906 ( used / w->outfit->u.bem.duration ) *
909 w->state = PILOT_OUTFIT_OFF;
923 vec2 approach_vector, relative_location, orthoradial_vector;
924 double speed, radial_speed, orthoradial_speed, dist, t;
926 dist = vec2_dist( &parent->
solid.
pos, pos );
931 if ( o->
type == OUTFIT_TYPE_BEAM )
936 if ( dist <= o->u.bem.range * range_mod )
948 vec2_cset( &approach_vector, -vel->
x, -vel->
y );
950 vec2_cset( &approach_vector, VX( parent->
solid.
vel ) - vel->
x,
958 vec2_cset( &relative_location, pos->
x - VX( parent->
solid.
pos ),
962 vec2_cset( &orthoradial_vector, VY( parent->
solid.
pos ) - pos->
y,
965 radial_speed = vec2_dot( &approach_vector, &relative_location );
966 radial_speed = radial_speed / VMOD( relative_location );
968 orthoradial_speed = vec2_dot( &approach_vector, &orthoradial_vector );
969 orthoradial_speed = orthoradial_speed / VMOD( relative_location );
971 if ( ( ( speed * speed -
972 VMOD( approach_vector ) * VMOD( approach_vector ) ) != 0 ) &&
973 ( speed * speed - orthoradial_speed * orthoradial_speed ) > 0 )
975 ( sqrt( speed * speed - orthoradial_speed * orthoradial_speed ) -
977 ( speed * speed - VMOD( approach_vector ) * VMOD( approach_vector ) );
984 ( sqrt( speed * speed - orthoradial_speed * orthoradial_speed ) +
986 ( speed * speed - VMOD( approach_vector ) * VMOD( approach_vector ) );
1006 wt->type = TARGET_PILOT;
1009 }
else if ( p->nav_asteroid != -1 ) {
1010 wt->type = TARGET_ASTEROID;
1011 wt->u.ast.anchor = p->nav_anchor;
1012 wt->u.ast.asteroid = p->nav_asteroid;
1015 wt->type = TARGET_NONE;
1024 const Target *target,
double time,
1027 int is_launcher, is_bay;
1028 double rate_mod, energy_mod;
1044 for (
int i = 0; i <
array_size( p->outfits ); i++ ) {
1052 if ( !( pos->
flags & PILOTOUTFIT_ISON ) )
1056 if ( ( is_launcher || is_bay ) && ( pos->u.
ammo.
quantity <= 0 ) )
1060 if ( pos->
timer <= 0. ) {
1061 if ( is_launcher ) {
1062 if ( ( minh < 0 ) ||
1063 ( p->outfits[minh]->u.ammo.quantity < pos->u.
ammo.
quantity ) )
1066 if ( ( minh < 0 ) || ( p->outfits[minh]->heat_T > pos->
heat_T ) )
1072 if ( ( maxp < 0 ) || ( pos->
timer > maxt ) ) {
1084 if ( maxt > rate_mod *
outfit_delay( o ) * ( ( q - 1. ) / q ) )
1104 double time,
int aim )
1107 double rate_mod, energy_mod;
1111 if ( w->outfit == NULL )
1115 if ( w->timer > 0. )
1125 vec2_cset( &vv, p->solid.vel.
x - vp.
y * p->solid.dir_vel,
1126 p->solid.vel.y + vp.
x * p->solid.dir_vel );
1129 vp.
x += p->solid.pos.x;
1130 vp.
y += p->solid.pos.y;
1139 if ( ( aim >= 0 ) && ( w->outfit->lua_onshoot != LUA_NOREF ) &&
1144 p->energy -= energy;
1146 if ( !outfit_isProp( w->outfit, OUTFIT_PROP_SHOOT_DRY ) ) {
1147 for (
int i = 0; i < w->outfit->u.blt.shots; i++ ) {
1148 weapon_add( w, NULL, p->solid.dir, &vp, &vv, p, target, time, aim );
1158 if ( w->u.beamid > 0 )
1166 if ( ( aim >= 0 ) && ( w->outfit->lua_onshoot != LUA_NOREF ) &&
1171 w->state = PILOT_OUTFIT_ON;
1172 if ( !outfit_isProp( w->outfit, OUTFIT_PROP_SHOOT_DRY ) ) {
1174 beam_start( w, p->solid.dir, &vp, &p->solid.vel, p, target, aim );
1177 w->timer = w->outfit->u.bem.duration;
1188 if ( w->u.ammo.quantity <= 0 )
1196 if ( target == NULL ) {
1202 if ( ( w->outfit->u.lau.ai != AMMO_AI_UNGUIDED ) &&
1203 ( target->type != TARGET_PILOT ) )
1207 if ( ( aim >= 0 ) && ( w->outfit->lua_onshoot != LUA_NOREF ) &&
1212 p->energy -= energy;
1214 if ( !outfit_isProp( w->outfit, OUTFIT_PROP_SHOOT_DRY ) ) {
1215 for (
int i = 0; i < w->outfit->u.lau.shots; i++ )
1216 weapon_add( w, NULL, p->solid.dir, &vp, &vv, p, target, time, aim );
1223 p->shoot_indicator = 1;
1226 if ( w->u.ammo.quantity <= 0 ) {
1227 for (
int j = 0; j < PILOT_WEAPON_SETS; j++ )
1239 if ( w->u.ammo.quantity <= 0 )
1243 if ( ( aim >= 0 ) && ( w->outfit->lua_onshoot != LUA_NOREF ) &&
1248 for (
int j = 0; j <
array_size( p->outfits ); j++ ) {
1249 if ( p->outfits[j] == w )
1254 if ( !outfit_isProp( w->outfit, OUTFIT_PROP_SHOOT_DRY ) )
1255 escort_create( p, w->outfit->u.bay.ship, &vp, &p->solid.vel,
1256 p->solid.dir, ESCORT_TYPE_BAY, 1, dockslot );
1258 w->u.ammo.quantity -= 1;
1259 p->mass_outfit -= w->outfit->u.bay.ship_mass;
1262 WARN( _(
"Shooting unknown weapon type: %s" ), w->outfit->name );
1286 switch ( o->
type ) {
1287 case OUTFIT_TYPE_BOLT:
1288 case OUTFIT_TYPE_BEAM:
1289 *rate_mod = 1. / ( p->stats.fwd_firerate *
1290 p->stats.weapon_firerate );
1291 *energy_mod = p->stats.fwd_energy * p->stats.weapon_energy;
1293 case OUTFIT_TYPE_TURRET_BOLT:
1294 case OUTFIT_TYPE_TURRET_BEAM:
1295 *rate_mod = 1. / ( p->stats.tur_firerate *
1296 p->stats.weapon_firerate );
1297 *energy_mod = p->stats.tur_energy * p->stats.weapon_energy;
1300 case OUTFIT_TYPE_LAUNCHER:
1301 case OUTFIT_TYPE_TURRET_LAUNCHER:
1303 1. / ( p->stats.launch_rate * p->stats.weapon_firerate );
1304 *energy_mod = p->stats.launch_energy * p->stats.weapon_energy;
1307 case OUTFIT_TYPE_FIGHTER_BAY:
1308 *rate_mod = 1. / p->stats.fbay_rate;
1326 for (
int i = 0; i < PILOT_WEAPON_SETS; i++ ) {
1350 int isplayer = pilot_isPlayer( p );
1360 for (
int i = 2; i < PILOT_WEAPON_SETS; i++ )
1364 for (
int i = 0; i <
array_size( p->outfits ); i++ ) {
1375 else if ( outfit_isProp( o, OUTFIT_PROP_WEAP_POINTDEFENSE ) )
1385 hasfb = 2 + !!haspd;
1390 for (
int i = 2; i < PILOT_WEAPON_SETS; i++ )
1395 for (
int i = 0; i <
array_size( p->outfits ); i++ ) {
1413 else if ( !outfit_isProp( o, OUTFIT_PROP_WEAP_POINTDEFENSE ) &&
1421 else if ( outfit_isProp( o, OUTFIT_PROP_WEAP_POINTDEFENSE ) )
1430 if (
id >= PILOT_WEAPON_SETS )
1441 else if ( outfit_isProp( o, OUTFIT_PROP_WEAP_POINTDEFENSE ) )
1466 for (
int i = 0; i < PILOT_WEAPON_SETS; i++ ) {
1483 for (
int j = 0; j < PILOT_WEAPON_SETS; j++ ) {
1502 if ( o->
outfit == NULL || ( pilot_isDisabled( p ) ) ||
1503 ( pilot_isFlag( p, PILOT_COOLDOWN ) ) )
1510 o->
flags &= ~PILOTOUTFIT_DYNAMIC_FLAGS;
1517 o->
flags &= ~PILOTOUTFIT_DYNAMIC_FLAGS;
1524 o->
state = PILOT_OUTFIT_OFF;
1525 }
else if ( !( o->
flags & PILOTOUTFIT_TOGGLEABLE ) )
1532 o->
state = PILOT_OUTFIT_OFF;
1533 o->
flags &= ~( PILOTOUTFIT_DYNAMIC_FLAGS | PILOTOUTFIT_ISON );
1539 o->
state = PILOT_OUTFIT_OFF;
1541 o->
state = PILOT_OUTFIT_COOLDOWN;
1542 o->
flags &= ~PILOTOUTFIT_DYNAMIC_FLAGS;
1557 if ( pos->
outfit == NULL )
1562 pos->
state = PILOT_OUTFIT_ON;
1567 pos->
state = PILOT_OUTFIT_ON;
1570 pos->
state = PILOT_OUTFIT_ON;
1586 for (
int i = 0; i <
array_size( p->outfits ); i++ ) {
1589 if ( pos->
outfit == NULL )
1591 if ( pos->
state == PILOT_OUTFIT_ON )
1594 return ( nchg > 0 );
1606 for (
int i = 0; i <
array_size( p->outfits ); i++ ) {
1611 if ( outfit_isProp( o->
outfit, OUTFIT_PROP_STEALTH_ON ) )
1613 if ( o->
state == PILOT_OUTFIT_ON )
1616 return ( nchg > 0 );
1627 if ( pilot_isFlag( p, PILOT_HYP_PREP ) ||
1628 pilot_isFlag( p, PILOT_HYPERSPACE ) ||
1629 pilot_isFlag( p, PILOT_LANDING ) || pilot_isFlag( p, PILOT_TAKEOFF ) ||
1630 pilot_isDisabled( p ) || pilot_isFlag( p, PILOT_COOLDOWN ) )
1634 if ( pilot_isFlag( p, PILOT_MANUAL_CONTROL ) && pilot_isPlayer( p ) )
1638 if ( p->afterburner == NULL )
1642 if ( p->energy < p->afterburner->outfit->u.afb.energy * 0.5 )
1647 p->afterburner->heat_T, p->afterburner->outfit->overheat_min,
1648 p->afterburner->outfit->overheat_max ) < 0.1 ) {
1649 if ( pilot_isPlayer( p ) )
1651 _( p->afterburner->outfit->name ) );
1656 if ( p->afterburner->state == PILOT_OUTFIT_OFF ) {
1657 p->afterburner->state = PILOT_OUTFIT_ON;
1659 pilot_setFlag( p, PILOT_AFTERBURNER );
1660 if ( !outfit_isProp( p->afterburner->outfit, OUTFIT_PROP_STEALTH_ON ) )
1666 sound_playPos( p->afterburner->outfit->u.afb.sound_on, p->solid.pos.x,
1667 p->solid.pos.y, p->solid.vel.x, p->solid.vel.y );
1670 if ( pilot_isPlayer( p ) ) {
1684 if ( p->afterburner == NULL )
1687 if ( p->afterburner->state == PILOT_OUTFIT_ON ) {
1688 p->afterburner->state = PILOT_OUTFIT_OFF;
1689 pilot_rmFlag( p, PILOT_AFTERBURNER );
1694 sound_playPos( p->afterburner->outfit->u.afb.sound_off, p->solid.pos.x,
1695 p->solid.pos.y, p->solid.vel.x, p->solid.vel.y );
1706 memcpy( dest, src,
sizeof(
PilotWeaponSet ) * PILOT_WEAPON_SETS );
1707 for (
int i = 0; i < PILOT_WEAPON_SETS; i++ )
1716 for (
int i = 0; i < PILOT_WEAPON_SETS; i++ ) {
Provides macros to work with dynamic arrays.
#define array_free(ptr_array)
Frees memory allocated and sets array to NULL.
#define array_copy(basic_type, ptr_array)
Returns a shallow copy of the input array.
#define array_end(array)
Returns a pointer to the end of the reserved memory space.
#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_begin(array)
Returns a pointer to the beginning of the reserved memory space.
#define array_create(basic_type)
Creates a new dynamic array of ‘basic_type’.
unsigned int escort_create(Pilot *p, const Ship *ship, const vec2 *pos, const vec2 *vel, double dir, EscortType_t type, int add, int dockslot)
Creates an escort.
void player_message(const char *fmt,...)
Adds a mesg to the queue to be displayed on screen.
Header file with generic functions and naev-specifics.
int outfit_isSecondary(const Outfit *o)
Checks if outfit has the secondary flag set.
double outfit_speed(const Outfit *o)
Gets the outfit's speed.
int outfit_isBeam(const Outfit *o)
Checks if outfit is a beam type weapon.
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_isWeapon(const Outfit *o)
Checks to see if an outfit is a weapon.
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_duration(const Outfit *o)
Gets the outfit's duration.
double outfit_cooldown(const Outfit *o)
Gets the outfit's cooldown.
int outfit_isBolt(const Outfit *o)
Checks if outfit is bolt type weapon.
double outfit_energy(const Outfit *o)
Gets the outfit's energy usage.
double outfit_delay(const Outfit *o)
Gets the outfit's delay.
Pilot * pilot_getTarget(Pilot *p)
Gets the target of a pilot using a fancy caching system.
void pilot_cooldownEnd(Pilot *p, const char *reason)
Terminates active cooldown.
void pilot_destealth(Pilot *p)
Destealths a pilot.
void pilot_heatAddSlot(const Pilot *p, PilotOutfitSlot *o)
Adds heat to an outfit slot.
double pilot_heatEfficiencyMod(double T, double Tb, double Tc)
Returns a 0:1 modifier representing efficiency (1. being normal).
double pilot_heatAccuracyMod(double T)
Returns a 0:1 modifier representing accuracy (0. being normal).
int pilot_getMount(const Pilot *p, const PilotOutfitSlot *w, vec2 *v)
Gets the mount position of a pilot.
void pilot_updateMass(Pilot *pilot)
Updates the pilot stats after mass change.
int pilot_maxAmmoO(const Pilot *p, const Outfit *o)
Gets the maximum available ammo for a pilot for a specific outfit.
int pilot_slotIsToggleable(const PilotOutfitSlot *o)
Checks to see if a slot has an active outfit that can be toggleable.
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.
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.
int pilot_rmAmmo(Pilot *pilot, PilotOutfitSlot *s, int quantity)
Removes some ammo from the pilot stock.
void pilot_outfitLOnshootany(Pilot *pilot)
Runs the pilot's Lua outfits onshootany script.
void pilot_weapSetAdd(Pilot *p, int id, const PilotOutfitSlot *o)
Adds an outfit to a weapon set.
int pilot_weapSetTypeCheck(Pilot *p, int id)
Checks the current weapon set type.
void pilot_getRateMod(double *rate_mod, double *energy_mod, const Pilot *p, const Outfit *o)
Gets applicable fire rate and energy modifications for a pilot's weapon.
void pilot_weapSetInrange(Pilot *p, int id, int inrange)
Changes the weapon set inrange property.
int pilot_afterburn(Pilot *p)
Activate the afterburner.
void pilot_weaponSafe(Pilot *p)
Sets the weapon set as safe.
void pilot_weapSetManual(Pilot *p, int id, int manual)
Changes the weapon set manual property.
void pilot_afterburnOver(Pilot *p)
Deactivates the afterburner.
static int pilot_shootWeaponSetOutfit(Pilot *p, const Outfit *o, const Target *target, double time, int aim)
Calculates and shoots the appropriate weapons in a weapon set matching an outfit.
void pilot_weapSetCleanup(Pilot *p, int id)
Cleans up a weapon set.
void pilot_weapSetVolley(Pilot *p, int id, int volley)
Changes the weapon set volley property.
int pilot_weapSetManualCheck(Pilot *p, int id)
Checks the current weapon set manual property.
void pilot_stopBeam(const Pilot *p, PilotOutfitSlot *w)
Stops a beam outfit and sets delay as appropriate.
static void pilot_weapSetUpdateOutfits(Pilot *p, PilotWeaponSet *ws)
Updates the outfits with their current weapon set level.
void pilot_weapSetRm(Pilot *p, int id, const PilotOutfitSlot *o)
Removes a slot from a weapon set.
void pilot_weaponClear(Pilot *p)
Clears the pilots weapon settings.
void ws_copy(PilotWeaponSet dest[PILOT_WEAPON_SETS], const PilotWeaponSet src[PILOT_WEAPON_SETS])
Copies a weapon set over.
void ws_free(PilotWeaponSet ws[PILOT_WEAPON_SETS])
Frees a weapon set.
double pilot_weapSetRangeMin(Pilot *p, int id)
Gets the minimum range of the current pilot weapon set.
static void pilot_weapSetUpdateRange(const Pilot *p, PilotWeaponSet *ws)
Updates the weapon range for a pilot weapon set.
int pilot_weapSetVolleyCheck(Pilot *p, int id)
Checks the current weapon set volley property.
double pilot_weapFlyTime(const Outfit *o, const Pilot *parent, const vec2 *pos, const vec2 *vel)
Computes an estimation of ammo flying time.
void pilot_weapSetAIClear(Pilot *p)
Useful function for AI, clears activeness of all weapon sets.
PilotWeaponSet * pilot_weapSet(Pilot *p, int id)
Gets a weapon set from id.
Pilot * pilot_weaponTarget(Pilot *p, Target *wt)
Gets the weapon target of a pilot.
void pilot_weapSetUpdate(Pilot *p)
Updates the pilot's weapon sets.
int pilot_weapSetInSet(Pilot *p, int id, const PilotOutfitSlot *o)
Checks to see if a slot is in a weapon set.
int pilot_outfitOffAll(Pilot *p)
Disables all active outfits for a pilot.
double pilot_weapSetSpeed(Pilot *p, int id)
Gets the speed of the current pilot weapon set.
double pilot_weapSetAmmo(Pilot *p, int id)
Gets the ammo of the current pilot weapon set.
int pilot_weapSetCheck(Pilot *p, int id, const PilotOutfitSlot *o)
Checks to see if a slot is in a weapon set and usable.
PilotWeaponSetOutfit * pilot_weapSetList(Pilot *p, int id)
Lists the items in a pilot weapon set.
int pilot_outfitOn(Pilot *p, PilotOutfitSlot *pos)
Enable a given active outfit.
int pilot_outfitOff(Pilot *p, PilotOutfitSlot *o, int natural)
Disables a given active outfit.
void pilot_weapSetUpdateOutfitState(Pilot *p)
Updates the local state of all the pilot's outfits based on the weapon sets.
double pilot_weapSetRange(Pilot *p, int id)
Gets the range of the current pilot weapon set.
int pilot_shootWeapon(Pilot *p, PilotOutfitSlot *w, const Target *target, double time, int aim)
Actually handles the shooting, how often the player.p can shoot and such.
int pilot_outfitOffAllStealth(Pilot *p)
Disables all active outfits for a pilot.
void pilot_weapSetClear(Pilot *p, int id)
Clears a weapon set.
void pilot_weaponAuto(Pilot *p)
Tries to automatically set and create the pilot's weapon set.
int pilot_weapSetInrangeCheck(Pilot *p, int id)
Checks the current weapon set inrange property.
void pilot_weapSetFree(Pilot *p)
Frees a pilot's weapon sets.
int pilot_weapSetPress(Pilot *p, int id, int type)
Handles a weapon set press.
const char * pilot_weapSetName(Pilot *p, int id)
Gets the name of a weapon set.
void pilot_weapSetType(Pilot *p, int id, WeaponSetType type)
Changes the weapon sets mode.
void pilot_weapSetUpdateStats(Pilot *p)
Update the weapon sets given pilot stat changes.
int sound_playPos(int sound, double px, double py, double vx, double vy)
Plays a sound based on position.
void spfx_shake(double mod)
Increases the current rumble level.
A ship outfit, depends radically on the type.
union Outfit::@125206365173064275134261143013340144375262037177 u
Stores an outfit the pilot has.
A pilot Weapon Set Outfit.
A weapon set represents a set of weapons that have an action.
PilotWeaponSetOutfit * slots
The representation of an in-game pilot.
Represents a weapon target.
double weapon_targetFlyTime(const Outfit *o, const Pilot *p, const Target *t)
Gets the fly time for a weapon target.
unsigned int beam_start(PilotOutfitSlot *po, double dir, const vec2 *pos, const vec2 *vel, const Pilot *parent, const Target *target, int aim)
Starts a beam weapon.
Weapon * weapon_add(PilotOutfitSlot *po, const Outfit *ref, double dir, const vec2 *pos, const vec2 *vel, const Pilot *parent, const Target *target, double time, int aim)
Creates a new weapon.
int weapon_inArc(const Outfit *o, const Pilot *parent, const Target *target, const vec2 *pos, const vec2 *vel, double dir, double time)
Gets the aim position of a turret weapon.
void beam_end(unsigned int beam)
Ends a beam weapon.