naev 0.11.5
pilot_outfit.h
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
4#pragma once
5
6#include "pilot.h"
7
8#define PILOT_OUTFIT_LUA_UPDATE_DT (1.0/10.0) /* How often the Lua outfits run their update script (in seconds). */
9
10typedef enum OutfitKey_ {
11 OUTFIT_KEY_ACCEL,
12 OUTFIT_KEY_LEFT,
13 OUTFIT_KEY_RIGHT,
14} OutfitKey;
15
16/* Augmentations of normal pilot API. */
17const char* pilot_outfitDescription( const Pilot *pilot, const Outfit *o );
18const char* pilot_outfitSummary( const Pilot *p, const Outfit *o, int withname );
19
20/* Raw changes. */
21int pilot_addOutfitRaw( Pilot* pilot, const Outfit* outfit, PilotOutfitSlot *s );
22int pilot_addOutfitTest( Pilot* pilot, const Outfit* outfit, const PilotOutfitSlot *s, int warn );
24
25/* Changes with checks. */
26int pilot_addOutfit( Pilot* pilot, const Outfit* outfit, PilotOutfitSlot *s );
27int pilot_rmOutfit( Pilot* pilot, PilotOutfitSlot *s );
28
29/* Intrinsic outfits. */
30int pilot_addOutfitIntrinsicRaw( Pilot *pilot, const Outfit *outfit );
31int pilot_addOutfitIntrinsic( Pilot *pilot, const Outfit *outfit );
32int pilot_rmOutfitIntrinsic( Pilot *pilot, const Outfit *outfit );
33int pilot_hasIntrinsic( const Pilot *pilot, const Outfit *outfit );
34
35/* Ammo. */
36int pilot_addAmmo( Pilot* pilot, PilotOutfitSlot *s, int quantity );
37int pilot_rmAmmo( Pilot* pilot, PilotOutfitSlot *s, int quantity );
38int pilot_countAmmo( const Pilot* pilot );
39int pilot_maxAmmo( const Pilot* pilot );
40int pilot_maxAmmoO( const Pilot* p, const Outfit *o );
41void pilot_fillAmmo( Pilot* pilot );
42double pilot_outfitRange( const Pilot *p, const Outfit *o );
43
44/* Checks. */
45int pilot_hasOutfitLimit( const Pilot *p, const char *limit );
46int pilot_slotsCheckSafety( const Pilot *p );
47int pilot_slotsCheckRequired( const Pilot *p );
48int pilot_isSpaceworthy( const Pilot *p );
49int pilot_reportSpaceworthy( const Pilot *p, char *buf, int buffSize );
50const char* pilot_canEquip( const Pilot *p, const PilotOutfitSlot *s, const Outfit *o );
51
52/* Lock-ons. */
53void pilot_lockUpdateSlot( Pilot *p, PilotOutfitSlot *o, Pilot *t, double *a, double dt );
54void pilot_lockClear( Pilot *p );
55
56/* Other. */
57void pilot_calcStats( Pilot *pilot );
58double pilot_massFactor( const Pilot *pilot );
59void pilot_updateMass( Pilot *pilot );
60void pilot_healLanded( Pilot *pilot );
61PilotOutfitSlot *pilot_getSlotByName( Pilot *pilot, const char *name );
62
63/* Special outfit stuff. */
64int pilot_getMount( const Pilot *p, const PilotOutfitSlot *w, vec2 *v );
65
66/* Lua outfit stuff. */
68int pilot_outfitLAdd( const Pilot *pilot, PilotOutfitSlot *po );
69int pilot_outfitLRemove( const Pilot *pilot, PilotOutfitSlot *po );
70void pilot_outfitLInitAll( Pilot *pilot );
71int pilot_outfitLInit( const Pilot *pilot, PilotOutfitSlot *po );
72void pilot_outfitLUpdate( Pilot *pilot, double dt );
73void pilot_outfitLOutfofenergy( Pilot *pilot );
74void pilot_outfitLOnhit( Pilot *pilot, double armour, double shield, unsigned int attacker );
75int pilot_outfitLOntoggle( const Pilot *pilot, PilotOutfitSlot *po, int on );
76int pilot_outfitLOnshoot( const Pilot *pilot, PilotOutfitSlot *po );
77void pilot_outfitLCooldown( Pilot *pilot, int done, int success, double timer );
78void pilot_outfitLOnshootany( Pilot *pilot );
79int pilot_outfitLOnstealth( Pilot *pilot );
80void pilot_outfitLOnscan( Pilot *pilot );
81void pilot_outfitLOnscanned( Pilot *pilot, const Pilot *scanner );
82void pilot_outfitLOnland( Pilot *pilot );
83void pilot_outfitLOntakeoff( Pilot *pilot );
84void pilot_outfitLOnjumpin( Pilot *pilot );
85void pilot_outfitLOnboard( Pilot *pilot, const Pilot *target );
86void pilot_outfitLOnkeydoubletap( Pilot *pilot, OutfitKey key );
87void pilot_outfitLOnkeyrelease( Pilot *pilot, OutfitKey key );
88void pilot_outfitLCleanup( Pilot *pilot );
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_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.
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.
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.
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.
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.
A ship outfit, depends radically on the type.
Definition outfit.h:328
Stores an outfit the pilot has.
Definition pilot.h:108
The representation of an in-game pilot.
Definition pilot.h:217
Represents a 2d vector.
Definition vec2.h:32