naev 0.12.6
pilot.h
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
4#pragma once
5
6#include "pilot_flags.h"
7
8#include "ai.h"
9#include "commodity.h"
10#include "effect.h"
11#include "faction.h"
12#include "intlist.h"
13#include "lvar.h"
14#include "ntime.h"
15#include "outfit.h"
16#include "physics.h"
17#include "ship.h"
18#include "space.h"
19#include "spfx.h"
20
21#define PLAYER_ID 1
22
23/* Hyperspace parameters. */
24#define HYPERSPACE_ENGINE_DELAY 3.
25#define HYPERSPACE_FLY_DELAY 5.
26#define HYPERSPACE_DUST_BLUR \
27 3.
28#define HYPERSPACE_DUST_LENGTH \
29 250
30#define HYPERSPACE_FADEOUT 1.
31#define HYPERSPACE_FADEIN 1.
32#define HYPERSPACE_ACCEL \
33 2000.
35#define HYPERSPACE_VEL \
36 ( 2. * HYPERSPACE_ACCEL * \
37 HYPERSPACE_FLY_DELAY )
38#define HYPERSPACE_ENTER_MIN \
39 ( HYPERSPACE_VEL * 0.3 )
40#define HYPERSPACE_ENTER_MAX \
41 ( HYPERSPACE_VEL * 0.4 )
42#define HYPERSPACE_EXIT_MIN 1500.
43/* Land/takeoff. */
44#define PILOT_LANDING_DELAY 1.
45#define PILOT_TAKEOFF_DELAY 1.
46/* Refueling. */
47#define PILOT_REFUEL_TIME 3.
48/* Misc. */
49#define PILOT_SIZE_APPROX 0.8
50#define PILOT_WEAPON_SETS 12
51#define PILOT_REVERSE_THRUST \
52 0.4
53#define PILOT_PLAYER_NONTARGETABLE_TAKEOFF_DELAY \
54 5.
55#define PILOT_PLAYER_NONTARGETABLE_JUMPIN_DELAY \
56 5.
57
58/* Pilot-related hooks. */
59typedef enum PilotHookType_ {
60 PILOT_HOOK_NONE,
61 PILOT_HOOK_CREATION,
62 PILOT_HOOK_DEATH,
63 PILOT_HOOK_BOARDING,
64 PILOT_HOOK_BOARD,
65 PILOT_HOOK_BOARD_ALL,
66 PILOT_HOOK_DISABLE,
67 PILOT_HOOK_UNDISABLE,
68 PILOT_HOOK_JUMP,
69 PILOT_HOOK_HAIL,
70 PILOT_HOOK_LAND,
71 PILOT_HOOK_ATTACKED,
73 PILOT_HOOK_DISCOVERED,
74 PILOT_HOOK_SCAN,
75 PILOT_HOOK_SCANNED,
76 PILOT_HOOK_IDLE,
78 PILOT_HOOK_EXPLODED,
79 PILOT_HOOK_LOCKON,
80 PILOT_HOOK_STEALTH,
81} PilotHookType;
82
83/* Damage */
84#define PILOT_HOSTILE_THRESHOLD \
85 0.09
86#define PILOT_HOSTILE_DECAY 0.005
87
88/* Makes life easier */
89#define pilot_isPlayer( p ) \
90 pilot_isFlag( p, PILOT_PLAYER )
91#define pilot_isDisabled( p ) \
92 pilot_isFlag( p, PILOT_DISABLED )
93#define pilot_isStopped( p ) ( VMOD( p->solid.vel ) <= MIN_VEL_ERR )
94/* We would really have to recursively go up all the parents to check, but we're
95 * being cheap. */
96#define pilot_isWithPlayer( p ) \
97 ( ( p )->faction == FACTION_PLAYER || ( ( p )->parent == PLAYER_ID ) )
98
104typedef enum PilotOutfitState_ {
105 PILOT_OUTFIT_OFF,
106 PILOT_OUTFIT_WARMUP,
107 PILOT_OUTFIT_ON,
108 PILOT_OUTFIT_COOLDOWN
109} PilotOutfitState;
110
114typedef struct PilotOutfitAmmo_ {
118 int in_arc;
120
121#define PILOTOUTFIT_ACTIVE \
122 ( 1 << 0 )
124#define PILOTOUTFIT_TOGGLEABLE \
125 ( 1 << 1 )
126#define PILOTOUTFIT_ISON ( 1 << 2 )
127#define PILOTOUTFIT_VOLLEY \
128 ( 1 << 3 )
129#define PILOTOUTFIT_INRANGE \
130 ( 1 << 4 )
132#define PILOTOUTFIT_MANUAL \
133 ( 1 << 5 )
134#define PILOTOUTFIT_ISON_TOGGLE \
135 ( 1 << 7 )
137#define PILOTOUTFIT_ISON_HOLD ( 1 << 8 )
138#define PILOTOUTFIT_DYNAMIC_FLAGS \
139 ( PILOTOUTFIT_VOLLEY | PILOTOUTFIT_INRANGE | PILOTOUTFIT_MANUAL | \
140 PILOTOUTFIT_ISON_TOGGLE | PILOTOUTFIT_ISON_HOLD )
141
145typedef struct PilotOutfitSlot_ {
146 int id;
147
148 /* Outfit slot properties. */
149 const Outfit *outfit;
150 int flags;
152
153 /* Heat. */
154 double heat_T;
155 double heat_C;
156 double heat_area;
157 double heat_start;
158
159 /* Current state. */
160 PilotOutfitState state;
161 double stimer;
162 double timer;
163 double rtimer;
164 double
167 unsigned int inrange;
169
170 /* Type-specific data. */
171 union {
172 unsigned int beamid;
175 } u;
176
177 /* In the case of Lua stuff. */
178 int
183
187typedef struct PilotWeaponSetOutfit_ {
188 double range2;
189 int slotid;
191
195typedef enum WeaponSetType_ {
196 WEAPSET_TYPE_DEFAULT = 0,
197 WEAPSET_TYPE_HOLD = 1,
198 WEAPSET_TYPE_TOGGLE = 2,
199} WeaponSetType;
200
207typedef struct PilotWeaponSet_ {
208 WeaponSetType type;
209 int active;
211 /* Only applicable to weapon type. */
213 int manual;
214 int volley;
215 double range_min;
216 double range;
217 double speed;
219
223typedef struct PilotCommodity_ {
226 unsigned int id;
228
232typedef struct PilotHook_ {
233 int type;
234 unsigned int id;
235} PilotHook;
236
240typedef enum EscortType_e {
241 ESCORT_TYPE_NULL,
242 ESCORT_TYPE_BAY,
244 ESCORT_TYPE_MERCENARY,
246 ESCORT_TYPE_FLEET,
247} EscortType_t;
248
252typedef struct Escort_s {
253 const Ship *ship;
254 EscortType_t type;
255 unsigned int id;
256 /* TODO: something better than this */
258} Escort_t;
259
263typedef struct Pilot_ {
264 unsigned int id;
265 char *name;
266 double r;
267
268 /* Fleet/faction management. */
272
273 /* Object characteristics */
274 const Ship *ship;
276 double base_mass;
277 double mass_cargo;
278 double mass_outfit;
279 int tsx;
280 int tsy;
282
283 /* Properties. */
284 int cpu;
286 double crew;
288 double cap_cargo;
289
290 /* Movement */
291 double accel;
292 double accel_base;
293 double speed;
294 double speed_base;
295 double
297 double turn;
298 double turn_base;
299
300 /* Current health */
301 double armour;
302 double stress;
303 double shield;
304 double armour_max;
305 double shield_max;
308 double dmg_absorb;
309 double fuel_max;
310 double fuel;
312
313 /* Energy is handled a bit differently. */
314 double energy;
315 double energy_max;
317
318 /* Defensive Electronic Warfare. */
319 double
323 double ew_stealth;
324 /* Defensive Electronic Warfare. */
325 double ew_mass;
326 double ew_asteroid;
328 /* misc. */
330
331 /* Heat. */
332 double heat_T;
333 double heat_C;
334 double
336 double heat_cond;
337 double heat_area;
338 double cdelay;
339 double ctimer;
340 double heat_start;
341
342 /* Ship statistics. */
349
350 /* Ship effects. */
352
353 /* Outfit management */
361
362 /* Primarily for AI usage. */
365 int nbeams;
370
371 /* For easier usage. */
373
374 /* Weapon sets. */
376 weapon_sets[PILOT_WEAPON_SETS];
380
381 /* Cargo */
382 credits_t credits;
385
386 /* Hook attached to the pilot */
388
389 /* Escort stuff. */
390 unsigned int parent;
392 unsigned int dockpilot;
398
399 /* Targeting. */
400 unsigned int target;
401 void *ptarget;
406
407 /* AI */
410 double tcontrol;
411 double timer[MAX_AI_TIMERS];
413 unsigned int shoot_indicator;
415
416 /* Ship Lua. */
419
420 /* Misc */
423 char *comm_msg;
424 PilotFlags flags;
426 double pdata;
427 double ptimer;
428 double itimer;
429 double htimer;
430 double stimer;
431 double sbonus;
432 double dtimer;
434 double otimer;
435 double scantimer;
439 int *mounted;
442 double engine_glow;
443 double tilt;
446} Pilot;
447
448/* These depend on Pilot being defined first. */
449#include "pilot_cargo.h" // IWYU pragma: export
450#include "pilot_ew.h" // IWYU pragma: export
451#include "pilot_heat.h" // IWYU pragma: export
452#include "pilot_hook.h" // IWYU pragma: export
453#include "pilot_outfit.h" // IWYU pragma: export
454#include "pilot_weapon.h" // IWYU pragma: export
455
456/* Getting pilot stuff. */
457Pilot *const *pilot_getAll( void );
458Pilot *pilot_get( unsigned int id );
460unsigned int pilot_getNextID( unsigned int id, int mode );
461unsigned int pilot_getPrevID( unsigned int id, int mode );
462unsigned int pilot_getNearestEnemy( const Pilot *p );
463unsigned int pilot_getNearestEnemy_size( const Pilot *p, double target_mass_LB,
464 double target_mass_UB );
465unsigned int pilot_getNearestEnemy_heuristic( const Pilot *p,
466 double mass_factor,
467 double health_factor,
468 double damage_factor,
469 double range_factor );
470unsigned int pilot_getNearestHostile( void ); /* only for the player */
471unsigned int pilot_getNearestPilot( const Pilot *p );
472unsigned int pilot_getBoss( const Pilot *p );
473double pilot_getNearestPosPilot( const Pilot *p, Pilot **tp, double x, double y,
474 int disabled );
475double pilot_getNearestPos( const Pilot *p, unsigned int *tp, double x,
476 double y, int disabled );
477double pilot_getNearestAng( const Pilot *p, unsigned int *tp, double ang,
478 int disabled );
479int pilot_getJumps( const Pilot *p );
480const glColour *pilot_getColour( const Pilot *p );
481int pilot_validTarget( const Pilot *p, const Pilot *target );
482int pilot_validTargetRange( const Pilot *p, const Pilot *target, int *inrange );
483int pilot_canTarget( const Pilot *p );
484
485/* non-lua wrappers */
486double pilot_relsize( const Pilot *cur_pilot, const Pilot *p );
487double pilot_reldps( const Pilot *cur_pilot, const Pilot *p );
488double pilot_relhp( const Pilot *cur_pilot, const Pilot *p );
489
490/* Combat. */
491void pilot_setTarget( Pilot *p, unsigned int id );
492double pilot_hit( Pilot *p, const Solid *w, const Pilot *pshooter,
493 const Damage *dmg, const Outfit *outfit, int lua_mem,
494 int reset );
495void pilot_updateDisable( Pilot *p, unsigned int shooter );
496void pilot_explode( double x, double y, double radius, const Damage *dmg,
497 const Pilot *parent );
498double pilot_face( Pilot *p, double dir, double dt );
500double pilot_minbrakedist( const Pilot *p, double dt, double *flytime );
501int pilot_brake( Pilot *p, double dt );
502void pilot_cooldown( Pilot *p, int dochecks );
503void pilot_cooldownEnd( Pilot *p, const char *reason );
504double pilot_aimAngle( Pilot *p, const vec2 *pos, const vec2 *vel );
505
506/* Outfits */
507int pilot_numOutfit( const Pilot *p, const Outfit *o );
508void pilot_dpseps( const Pilot *p, double *pdps, double *peps );
509
510/* Money. */
511credits_t pilot_worth( const Pilot *p, int count_unique );
512int pilot_hasCredits( const Pilot *p, credits_t amount );
513credits_t pilot_modCredits( Pilot *p, credits_t amount );
514
515/* Creation. */
516Pilot *pilot_create( const Ship *ship, const char *name, int faction,
517 const char *ai, double dir, const vec2 *pos,
518 const vec2 *vel, const PilotFlags flags,
519 unsigned int dockpilot, int dockslot );
520Pilot *pilot_createEmpty( const Ship *ship, const char *name, int faction,
521 PilotFlags flags );
522unsigned int pilot_clone( const Pilot *p );
523unsigned int pilot_addStack( Pilot *p );
524void pilot_reset( Pilot *pilot );
525Pilot *pilot_setPlayer( Pilot *after );
526void pilot_choosePoint( vec2 *vp, Spob **spob, JumpPoint **jump, int lf,
527 int ignore_rules, int guerilla );
528void pilot_delete( Pilot *p );
529void pilot_dead( Pilot *p, unsigned int killer );
530
531/* Init and cleanup. */
532void pilot_stackRemove( Pilot *p );
533void pilots_init( void );
534void pilots_free( void );
535void pilots_clean( int persist );
536void pilots_newSystem( void );
537void pilots_clear( void );
538void pilots_cleanAll( void );
539void pilot_free( Pilot *p );
540
541/* Movement. */
542void pilot_setAccel( Pilot *p, double accel );
543void pilot_setTurn( Pilot *p, double turn );
544
545/* Update. */
546void pilot_update( Pilot *pilot, double dt );
547void pilots_updatePurge( void );
548void pilots_update( double dt );
549void pilot_renderFramebuffer( Pilot *p, GLuint fbo, double fw, double fh,
550 const Lighting *L );
551void pilots_render( void );
552void pilots_renderOverlay( void );
553void pilot_render( Pilot *pilot );
554void pilot_renderOverlay( Pilot *p );
555
556/* Communication. */
557void pilot_broadcast( Pilot *p, const char *msg, int ignore_int );
558void pilot_distress( Pilot *p, Pilot *attacker, const char *msg );
559void pilot_setCommMsg( Pilot *p, const char *s );
560
561/* Faction stuff. */
562int pilot_validEnemy( const Pilot *p, const Pilot *target );
563int pilot_areAllies( const Pilot *p, const Pilot *target );
564int pilot_areEnemies( const Pilot *p, const Pilot *target );
565void pilot_setHostile( Pilot *p );
566void pilot_rmHostile( Pilot *p );
567void pilot_setFriendly( Pilot *p );
568void pilot_rmFriendly( Pilot *p );
569int pilot_isHostile( const Pilot *p );
570int pilot_isNeutral( const Pilot *p );
571int pilot_isFriendly( const Pilot *p );
572char pilot_getFactionColourChar( const Pilot *p );
573
574/* Misc details. */
576void pilot_msg( const Pilot *p, const Pilot *receiver, const char *type,
577 unsigned int index );
578void pilot_clearTrails( Pilot *p );
579void pilot_sample_trails( Pilot *p, int none );
580int pilot_hasIllegal( const Pilot *p, int faction );
581int pilot_refuelStart( Pilot *p );
583void pilot_clearTimers( Pilot *pilot );
584int pilot_hasDeployed( const Pilot *p );
585int pilot_dock( Pilot *p, Pilot *target );
586ntime_t pilot_hyperspaceDelay( const Pilot *p );
587void pilot_untargetAsteroid( int anchor, int asteroid );
589const IntList *pilot_collideQuery( int x1, int y1, int x2, int y2 );
590void pilot_collideQueryIL( IntList *il, int x1, int y1, int x2, int y2 );
591void pilot_quadtreeParams( int max_elem, int depth );
Pilot * cur_pilot
Definition ai.c:340
char pilot_getFactionColourChar(const Pilot *p)
Gets the faction colour char, works like faction_reputationColourChar but for a pilot.
Definition pilot.c:1121
void pilot_free(Pilot *p)
Frees and cleans up a pilot.
Definition pilot.c:3902
void pilot_stackRemove(Pilot *p)
Tries to remove a pilot from the stack.
Definition pilot.c:3992
unsigned int pilot_getNearestEnemy_size(const Pilot *p, double target_mass_LB, double target_mass_UB)
Gets the nearest enemy to the pilot closest to the pilot whose mass is between LB and UB.
Definition pilot.c:361
void pilot_choosePoint(vec2 *vp, Spob **spob, JumpPoint **jump, int lf, int ignore_rules, int guerilla)
Finds a spawn point for a pilot.
Definition pilot.c:3784
int pilot_isHostile(const Pilot *p)
Checks to see if pilot is hostile to the player.
Definition pilot.c:699
void pilot_updateDisable(Pilot *p, unsigned int shooter)
Handles pilot disabling. Set or unset the disable status depending on health and stress values.
Definition pilot.c:1605
void pilot_cooldown(Pilot *p, int dochecks)
Begins active cooldown, reducing hull and outfit temperatures.
Definition pilot.c:918
int pilot_brakeCheckReverseThrusters(const Pilot *p)
See if the pilot wants to use their reverse thrusters to brake.
Definition pilot.c:838
void pilot_renderFramebuffer(Pilot *p, GLuint fbo, double fw, double fh, const Lighting *L)
Renders a pilot to a framebuffer.
Definition pilot.c:1849
void pilot_rmHostile(Pilot *p)
Unmarks a pilot as hostile to player.
Definition pilot.c:1277
unsigned int pilot_addStack(Pilot *p)
Adds a pilot to the stack.
Definition pilot.c:3690
void pilots_updatePurge(void)
Purges pilots set for deletion.
Definition pilot.c:4176
void pilot_quadtreeParams(int max_elem, int depth)
Sets the quad tree parameters. Can have significant impact on performance.
Definition pilot.c:4592
double pilot_relhp(const Pilot *cur_pilot, const Pilot *p)
Gets the relative hp(combined shields and armour) between the current pilot and the specified target.
Definition pilot.c:4468
int pilot_validEnemy(const Pilot *p, const Pilot *target)
Checks to see if a pilot is a valid enemy for another pilot.
Definition pilot.c:291
double pilot_relsize(const Pilot *cur_pilot, const Pilot *p)
Gets the relative size(shipmass) between the current pilot and the specified target.
Definition pilot.c:4364
int pilot_areEnemies(const Pilot *p, const Pilot *target)
Like areEnemies but for pilots.
Definition pilot.c:763
void pilots_clear(void)
Clears all the pilots except the player and clear-exempt pilots.
Definition pilot.c:4137
unsigned int pilot_getNearestPilot(const Pilot *p)
Get the nearest pilot to a pilot.
Definition pilot.c:437
void pilots_clean(int persist)
Cleans up the pilot stack - leaves the player.
Definition pilot.c:4052
Pilot * pilot_getTarget(Pilot *p)
Gets the target of a pilot using a fancy caching system.
Definition pilot.c:655
Pilot * pilot_createEmpty(const Ship *ship, const char *name, int faction, PilotFlags flags)
Creates a pilot without adding it to the stack.
Definition pilot.c:3627
double pilot_face(Pilot *p, double dir, double dt)
Tries to turn the pilot to face dir.
Definition pilot.c:827
mat4 pilot_local_transform(const Pilot *p)
Gets the local transformation matrix of a pilot.
Definition pilot.c:4507
double pilot_getNearestPos(const Pilot *p, unsigned int *tp, double x, double y, int disabled)
Get the nearest pilot to a pilot from a certain position.
Definition pilot.c:564
void pilot_clearTimers(Pilot *pilot)
Clears the pilot's timers.
Definition pilot.c:4337
double pilot_reldps(const Pilot *cur_pilot, const Pilot *p)
Gets the relative damage output(total DPS) between the current pilot and the specified target.
Definition pilot.c:4445
void pilot_msg(const Pilot *p, const Pilot *receiver, const char *type, unsigned int idx)
Sends a message.
Definition pilot.c:4531
void pilot_dead(Pilot *p, unsigned int killer)
Pilot is dead, now will slowly explode.
Definition pilot.c:1687
Pilot * pilot_setPlayer(Pilot *after)
Replaces the player's pilot with an alternate ship with the same ID.
Definition pilot.c:3735
void pilot_renderOverlay(Pilot *p)
Renders the pilot overlay.
Definition pilot.c:2235
void pilot_setAccel(Pilot *p, double accel)
Sets the pilot's accel.
Definition pilot.c:680
void pilot_cooldownEnd(Pilot *p, const char *reason)
Terminates active cooldown.
Definition pilot.c:986
credits_t pilot_modCredits(Pilot *p, credits_t amount)
Modifies the amount of credits the pilot has.
Definition pilot.c:3300
unsigned int pilot_getNearestEnemy(const Pilot *p)
Gets the nearest enemy to the pilot.
Definition pilot.c:331
void pilot_setFriendly(Pilot *p)
Marks pilot as friendly to player.
Definition pilot.c:1295
void pilot_hyperspaceAbort(Pilot *p)
Stops the pilot from hyperspacing.
Definition pilot.c:3140
void pilot_setTurn(Pilot *p, double turn)
Sets the pilot's turn.
Definition pilot.c:688
int pilot_validTarget(const Pilot *p, const Pilot *target)
Checks to see if a pilot is a valid target for another pilot.
Definition pilot.c:235
void pilot_explode(double x, double y, double radius, const Damage *dmg, const Pilot *parent)
Makes the pilot explosion.
Definition pilot.c:1767
void pilot_reset(Pilot *pilot)
Resets a pilot.
Definition pilot.c:3491
int pilot_isFriendly(const Pilot *p)
Checks to see if pilot is friendly to the player.
Definition pilot.c:728
int pilot_refuelStart(Pilot *p)
Attempts to start refueling the pilot's target.
Definition pilot.c:3170
void pilots_renderOverlay(void)
Renders all the pilots overlays.
Definition pilot.c:4314
int pilot_isNeutral(const Pilot *p)
Checks to see if pilot is neutral to the player.
Definition pilot.c:715
PilotOutfitSlot * pilot_getDockSlot(Pilot *p)
Gets the dock slot of the pilot.
Definition pilot.c:793
void pilots_init(void)
Initializes pilot stuff.
Definition pilot.c:4010
int pilot_hasIllegal(const Pilot *p, int faction)
Checks to see if the pilot has illegal stuf to a faction.
Definition pilot.c:4567
void pilot_setCommMsg(Pilot *p, const char *s)
Sets the overhead communication message of the pilot.
Definition pilot.c:1137
Pilot * pilot_get(unsigned int id)
Pulls a pilot out of the pilot_stack based on ID.
Definition pilot.c:640
ntime_t pilot_hyperspaceDelay(const Pilot *p)
Calculates the hyperspace delay for a pilot.
Definition pilot.c:3243
void pilot_broadcast(Pilot *p, const char *msg, int ignore_int)
Has the pilot broadcast a message.
Definition pilot.c:1152
double pilot_minbrakedist(const Pilot *p, double dt, double *flytime)
Gets the minimum braking distance for the pilot.
Definition pilot.c:862
void pilot_setHostile(Pilot *p)
Marks pilot as hostile to player.
Definition pilot.c:1105
double pilot_getNearestPosPilot(const Pilot *p, Pilot **tp, double x, double y, int disabled)
Get the nearest pilot to a pilot from a certain position.
Definition pilot.c:518
void pilot_dpseps(const Pilot *p, double *pdps, double *peps)
Calculates the dps and eps of a pilot.
Definition pilot.c:4377
const glColour * pilot_getColour(const Pilot *p)
Gets a pilot's colour.
Definition pilot.c:1328
void pilot_distress(Pilot *p, Pilot *attacker, const char *msg)
Has the pilot broadcast a distress signal.
Definition pilot.c:1180
void pilot_render(Pilot *p)
Renders the pilot.
Definition pilot.c:1958
Pilot *const * pilot_getAll(void)
Gets the pilot stack.
Definition pilot.c:93
int pilot_canTarget(const Pilot *p)
Same as pilot_validTarget but without the range check.
Definition pilot.c:270
credits_t pilot_worth(const Pilot *p, int count_unique)
Gets the price or worth of a pilot in credits.
Definition pilot.c:4482
unsigned int pilot_getNearestEnemy_heuristic(const Pilot *p, double mass_factor, double health_factor, double damage_factor, double range_factor)
Gets the nearest enemy to the pilot closest to the pilot whose mass is between LB and UB.
Definition pilot.c:400
double pilot_aimAngle(Pilot *p, const vec2 *pos, const vec2 *vel)
Returns the angle for a pilot to aim at another pilot.
Definition pilot.c:1025
void pilots_newSystem(void)
Updates pilot state which depends on the system (sensor range, nebula trails...)
Definition pilot.c:4116
unsigned int pilot_getNextID(unsigned int id, int mode)
Gets the next pilot based on id.
Definition pilot.c:135
void pilot_rmFriendly(Pilot *p)
Unmarks a pilot as friendly to player.
Definition pilot.c:1306
void pilots_render(void)
Renders all the pilots.
Definition pilot.c:4293
int pilot_areAllies(const Pilot *p, const Pilot *target)
Like areAllies but for pilots.
Definition pilot.c:741
int pilot_validTargetRange(const Pilot *p, const Pilot *target, int *inrange)
Checks to see if a pilot is a valid target for another pilot while storing the result of pilot_inRang...
Definition pilot.c:250
double pilot_getNearestAng(const Pilot *p, unsigned int *tp, double ang, int disabled)
Get the pilot closest to an angle extending from another pilot.
Definition pilot.c:585
void pilot_untargetAsteroid(int anchor, int asteroid)
Loops over pilot stack to remove an asteroid as target.
Definition pilot.c:3255
int pilot_getJumps(const Pilot *p)
Gets the amount of jumps the pilot has left.
Definition pilot.c:1317
void pilot_delete(Pilot *p)
Deletes a pilot.
Definition pilot.c:2965
void pilots_update(double dt)
Updates all the pilots.
Definition pilot.c:4216
void pilots_cleanAll(void)
Even cleans up the player.
Definition pilot.c:4148
void pilot_clearTrails(Pilot *p)
Resets the trails for a pilot.
Definition pilot.c:3722
unsigned int pilot_getBoss(const Pilot *p)
Get the strongest ally in a given range.
Definition pilot.c:450
void pilots_free(void)
Frees the pilot stack.
Definition pilot.c:4019
double pilot_hit(Pilot *p, const Solid *w, const Pilot *pshooter, const Damage *dmg, const Outfit *outfit, int lua_mem, int reset)
Damages the pilot.
Definition pilot.c:1383
void pilot_update(Pilot *pilot, double dt)
Updates the pilot.
Definition pilot.c:2328
Pilot * pilot_create(const Ship *ship, const char *name, int faction, const char *ai, const double dir, const vec2 *pos, const vec2 *vel, const PilotFlags flags, unsigned int dockpilot, int dockslot)
Creates a new pilot.
Definition pilot.c:3557
unsigned int pilot_getPrevID(unsigned int id, int mode)
Gets the previous pilot based on ID.
Definition pilot.c:183
int pilot_numOutfit(const Pilot *p, const Outfit *o)
Checks to see how many of an outfit a pilot has.
Definition pilot.c:3269
void pilot_sample_trails(Pilot *p, int none)
Updates the given pilot's trail emissions.
Definition pilot.c:2846
int pilot_hasCredits(const Pilot *p, credits_t amount)
Checks to see if the pilot has at least a certain amount of credits.
Definition pilot.c:3286
int pilot_brake(Pilot *p, double dt)
Causes the pilot to turn around and brake.
Definition pilot.c:886
void pilot_setTarget(Pilot *p, unsigned int id)
Sets the target of the pilot.
Definition pilot.c:1352
unsigned int pilot_clone(const Pilot *ref)
Clones an existing pilot.
Definition pilot.c:3646
Basic AI profile.
Definition ai.h:39
Represents a commodity.
Definition commodity.h:57
Core damage that an outfit does.
Definition outfit.h:168
Pilot ship effect.
Definition effect.h:49
Stores an escort.
Definition pilot.h:252
unsigned int id
Definition pilot.h:255
int persist
Definition pilot.h:257
EscortType_t type
Definition pilot.h:254
const Ship * ship
Definition pilot.h:253
A ship outfit, depends radically on the type.
Definition outfit.h:372
Stores a pilot commodity.
Definition pilot.h:223
const Commodity * commodity
Definition pilot.h:224
unsigned int id
Definition pilot.h:226
A wrapper for pilot hooks.
Definition pilot.h:232
unsigned int id
Definition pilot.h:234
int type
Definition pilot.h:233
Stores outfit ammo.
Definition pilot.h:114
double lockon_timer
Definition pilot.h:117
Stores an outfit the pilot has.
Definition pilot.h:145
unsigned int beamid
Definition pilot.h:172
PilotOutfitAmmo ammo
Definition pilot.h:174
double heat_C
Definition pilot.h:155
double stimer
Definition pilot.h:161
double rtimer
Definition pilot.h:163
double heat_start
Definition pilot.h:157
double heat_T
Definition pilot.h:154
double progress
Definition pilot.h:165
double heat_area
Definition pilot.h:156
PilotOutfitState state
Definition pilot.h:160
ShipStatList * lua_stats
Definition pilot.h:180
double timer
Definition pilot.h:162
unsigned int inrange
Definition pilot.h:167
ShipOutfitSlot * sslot
Definition pilot.h:151
const Outfit * outfit
Definition pilot.h:149
A pilot Weapon Set Outfit.
Definition pilot.h:187
A weapon set represents a set of weapons that have an action.
Definition pilot.h:207
double range
Definition pilot.h:216
double range_min
Definition pilot.h:215
PilotWeaponSetOutfit * slots
Definition pilot.h:210
double speed
Definition pilot.h:217
WeaponSetType type
Definition pilot.h:208
The representation of an in-game pilot.
Definition pilot.h:263
double tilt
Definition pilot.h:443
int advweap
Definition pilot.h:378
double engine_glow
Definition pilot.h:442
double ew_stealth_timer
Definition pilot.h:329
int nturrets
Definition pilot.h:364
double dtimer
Definition pilot.h:432
double dtimer_accum
Definition pilot.h:433
ShipStatList * ship_stats
Definition pilot.h:343
double itimer
Definition pilot.h:428
ShipStats stats
Definition pilot.h:348
double accel
Definition pilot.h:291
double shield
Definition pilot.h:303
double otimer
Definition pilot.h:434
double speed_limit
Definition pilot.h:296
AI_Profile * ai
Definition pilot.h:408
int presence
Definition pilot.h:271
unsigned int id
Definition pilot.h:264
lvar * shipvar
Definition pilot.h:445
double comm_msgWidth
Definition pilot.h:422
PilotWeaponSet weapon_sets[PILOT_WEAPON_SETS]
Definition pilot.h:376
PilotCommodity * commodities
Definition pilot.h:383
int aimLines
Definition pilot.h:379
double turn_base
Definition pilot.h:298
int cpu_max
Definition pilot.h:285
double crew
Definition pilot.h:286
double ew_stealth
Definition pilot.h:323
PilotOutfitSlot * outfit_structure
Definition pilot.h:356
unsigned int parent
Definition pilot.h:390
credits_t credits
Definition pilot.h:382
int nav_hyperspace
Definition pilot.h:403
int projectiles
Definition pilot.h:438
double scantimer
Definition pilot.h:435
double refuel_amount
Definition pilot.h:369
double energy_regen
Definition pilot.h:316
PilotOutfitSlot ** outfits
Definition pilot.h:354
PilotOutfitSlot * outfit_utility
Definition pilot.h:357
PilotOutfitSlot * outfit_intrinsic
Definition pilot.h:360
int outfitlupdate
Definition pilot.h:368
int messages
Definition pilot.h:444
double lua_ship_timer
Definition pilot.h:418
double armour_max
Definition pilot.h:304
double speed
Definition pilot.h:293
int tsy
Definition pilot.h:280
int tsx
Definition pilot.h:279
double speed_base
Definition pilot.h:294
double ew_asteroid
Definition pilot.h:326
double timer[MAX_AI_TIMERS]
Definition pilot.h:411
double heat_start
Definition pilot.h:340
double htimer
Definition pilot.h:429
double ew_mass
Definition pilot.h:325
const Ship * ship
Definition pilot.h:274
double sbonus
Definition pilot.h:431
int lockons
Definition pilot.h:437
double fuel_max
Definition pilot.h:309
ShipStatList * intrinsic_stats
Definition pilot.h:345
int ncannons
Definition pilot.h:363
double energy
Definition pilot.h:314
double ew_detection
Definition pilot.h:320
int nav_anchor
Definition pilot.h:404
double stress
Definition pilot.h:302
int hail_pos
Definition pilot.h:436
double mass_cargo
Definition pilot.h:277
double ptimer
Definition pilot.h:427
int faction
Definition pilot.h:269
PilotHook * hooks
Definition pilot.h:387
int faction_spawn
Definition pilot.h:270
int autoweap
Definition pilot.h:377
double comm_msgTimer
Definition pilot.h:421
double stimer
Definition pilot.h:430
double energy_max
Definition pilot.h:315
double landing_delay
Definition pilot.h:425
unsigned int shoot_indicator
Definition pilot.h:413
Solid solid
Definition pilot.h:275
double fuel
Definition pilot.h:310
PilotOutfitSlot * afterburner
Definition pilot.h:372
double cdelay
Definition pilot.h:338
double accel_base
Definition pilot.h:292
double pdata
Definition pilot.h:426
char * name
Definition pilot.h:265
void * ptarget
Definition pilot.h:401
double tcontrol
Definition pilot.h:410
double r
Definition pilot.h:266
PilotFlags flags
Definition pilot.h:424
int nbeams
Definition pilot.h:365
double mass_outfit
Definition pilot.h:278
Escort_t * escorts
Definition pilot.h:391
unsigned int dockpilot
Definition pilot.h:392
int cpu
Definition pilot.h:284
Trail_spfx ** trail
Definition pilot.h:281
double fuel_consumption
Definition pilot.h:311
int lua_ship_mem
Definition pilot.h:417
double ctimer
Definition pilot.h:339
double heat_cond
Definition pilot.h:336
double base_mass
Definition pilot.h:276
double heat_T
Definition pilot.h:332
double heat_emis
Definition pilot.h:335
Task * task
Definition pilot.h:412
double heat_C
Definition pilot.h:333
int nfighterbays
Definition pilot.h:366
double shield_regen
Definition pilot.h:307
int cargo_free
Definition pilot.h:384
double ew_jumppoint
Definition pilot.h:327
unsigned int target
Definition pilot.h:400
int nafterburners
Definition pilot.h:367
int nav_spob
Definition pilot.h:402
int dockslot
Definition pilot.h:396
int lua_mem
Definition pilot.h:409
double player_damage
Definition pilot.h:440
Effect * effects
Definition pilot.h:351
double cap_cargo
Definition pilot.h:288
double turn
Definition pilot.h:297
char * comm_msg
Definition pilot.h:423
PilotOutfitSlot * outfit_weapon
Definition pilot.h:358
double armour
Definition pilot.h:301
double shield_max
Definition pilot.h:305
double dmg_absorb
Definition pilot.h:308
int * mounted
Definition pilot.h:439
int nav_asteroid
Definition pilot.h:405
double heat_area
Definition pilot.h:337
double ew_signature
Definition pilot.h:321
double armour_regen
Definition pilot.h:306
Ship outfit slot.
Definition ship.h:71
Represents relative ship statistics as a linked list.
Definition shipstats.h:198
Represents ship statistics, properties ship can use.
Definition shipstats.h:229
Represents a space ship.
Definition ship.h:97
Represents a solid in the game.
Definition physics.h:44
Represents a Space Object (SPOB), including and not limited to planets, stations, wormholes,...
Definition space.h:102
Basic AI task.
Definition ai.h:23
A trail generated by a ship or an ammo.
Definition spfx.h:93
Contains a mission variable.
Definition lvar.h:24
Definition mat4.h:12
Represents a 2d vector.
Definition vec2.h:45