naev 0.10.4
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
10/* Augmentations of normal pilot API. */
11const char* pilot_outfitDescription( const Pilot *pilot, const Outfit *o );
12const char* pilot_outfitSummary( const Pilot *p, const Outfit *o, int withname );
13
14/* Raw changes. */
15int pilot_addOutfitRaw( Pilot* pilot, const Outfit* outfit, PilotOutfitSlot *s );
16int pilot_addOutfitTest( Pilot* pilot, const Outfit* outfit, PilotOutfitSlot *s, int warn );
18
19/* Changes with checks. */
20int pilot_addOutfit( Pilot* pilot, const Outfit* outfit, PilotOutfitSlot *s );
21int pilot_rmOutfit( Pilot* pilot, PilotOutfitSlot *s );
22
23/* Intrinsic outfits. */
24int pilot_addOutfitIntrinsic( Pilot *pilot, const Outfit *outfit );
26
27/* Ammo. */
28int pilot_addAmmo( Pilot* pilot, PilotOutfitSlot *s, int quantity );
29int pilot_rmAmmo( Pilot* pilot, PilotOutfitSlot *s, int quantity );
30int pilot_countAmmo( const Pilot* pilot );
31int pilot_maxAmmo( const Pilot* pilot );
32int pilot_maxAmmoO( const Pilot* p, const Outfit *o );
33void pilot_fillAmmo( Pilot* pilot );
34
35/* Checks. */
36int pilot_slotsCheckSafety( const Pilot *p );
37int pilot_slotsCheckRequired( const Pilot *p );
38int pilot_isSpaceworthy( const Pilot *p );
39int pilot_reportSpaceworthy( const Pilot *p, char *buf, int buffSize );
40const char* pilot_canEquip( const Pilot *p, const PilotOutfitSlot *s, const Outfit *o );
41
42/* Lock-ons. */
43void pilot_lockUpdateSlot( Pilot *p, PilotOutfitSlot *o, Pilot *t, double *a, double dt );
44void pilot_lockClear( Pilot *p );
45
46/* Other. */
47void pilot_calcStats( Pilot *pilot );
48void pilot_updateMass( Pilot *pilot );
49void pilot_healLanded( Pilot *pilot );
50PilotOutfitSlot *pilot_getSlotByName( Pilot *pilot, const char *name );
51
52/* Special outfit stuff. */
53int pilot_getMount( const Pilot *p, const PilotOutfitSlot *w, vec2 *v );
54
55/* Lua outfit stuff. */
58int pilot_outfitLAdd( Pilot *pilot, PilotOutfitSlot *po );
60void pilot_outfitLInitAll( Pilot *pilot );
61int pilot_outfitLInit( Pilot *pilot, PilotOutfitSlot *po );
62void pilot_outfitLUpdate( Pilot *pilot, double dt );
63void pilot_outfitLOutfofenergy( Pilot *pilot );
64void pilot_outfitLOnhit( Pilot *pilot, double armour, double shield, unsigned int attacker );
65int pilot_outfitLOntoggle( Pilot *pilot, PilotOutfitSlot *po, int on );
66void pilot_outfitLCooldown( Pilot *pilot, int done, int success, double timer );
67void pilot_outfitLOnshoot( Pilot *pilot );
68int pilot_outfitLOnstealth( Pilot *pilot );
69void pilot_outfitLOnscan( Pilot *pilot );
70void pilot_outfitLOnscanned( Pilot *pilot, const Pilot *scanner );
71void pilot_outfitLOnland( Pilot *pilot );
72void pilot_outfitLOntakeoff( Pilot *pilot );
73void pilot_outfitLOnjumpin( Pilot *pilot );
74void pilot_outfitLCleanup( Pilot *pilot );
int pilot_getMount(const Pilot *p, const PilotOutfitSlot *w, vec2 *v)
Gets the mount position of a pilot.
Definition: pilot_outfit.c:148
int pilot_rmOutfit(Pilot *pilot, PilotOutfitSlot *s)
Removes an outfit from the pilot.
Definition: pilot_outfit.c:475
int pilot_outfitLInit(Pilot *pilot, PilotOutfitSlot *po)
Runs the pilot's Lua outfits init script for an outfit.
void pilot_updateMass(Pilot *pilot)
Updates the pilot stats after mass change.
void pilot_outfitLCooldown(Pilot *pilot, int done, int success, double timer)
Handle cooldown hooks for outfits.
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.
Definition: pilot_outfit.c:514
int pilot_slotsCheckSafety(const Pilot *p)
Pilot slot safety check - makes sure stats are safe.
Definition: pilot_outfit.c:499
void pilot_outfitLOnshoot(Pilot *pilot)
Runs the pilot's Lua outfits onshoot script.
int pilot_maxAmmoO(const Pilot *p, const Outfit *o)
Gets the maximum available ammo for a pilot for a specific outfit.
Definition: pilot_outfit.c:767
int pilot_addOutfit(Pilot *pilot, const Outfit *outfit, PilotOutfitSlot *s)
Adds an outfit to the pilot.
Definition: pilot_outfit.c:366
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.
void pilot_calcStats(Pilot *pilot)
Recalculates the pilot's stats based on his outfits.
Definition: pilot_outfit.c:877
void pilot_fillAmmo(Pilot *pilot)
Fills pilot's ammo completely.
Definition: pilot_outfit.c:786
int pilot_addAmmo(Pilot *pilot, PilotOutfitSlot *s, int quantity)
Adds some ammo to the pilot stock.
Definition: pilot_outfit.c:661
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.
Definition: pilot_outfit.c:424
int pilot_outfitLRemove(Pilot *pilot, PilotOutfitSlot *po)
Outfit is removed froma ship.
int pilot_countAmmo(const Pilot *pilot)
Gets the number of ammo units on the ship.
Definition: pilot_outfit.c:721
void pilot_lockClear(Pilot *p)
Clears pilot's missile lockon timers.
Definition: pilot_outfit.c:121
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.
Definition: pilot_outfit.c:745
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.
Definition: pilot_outfit.c:541
int pilot_outfitLAdd(Pilot *pilot, PilotOutfitSlot *po)
Outfit is added to a ship.
int pilot_outfitLOntoggle(Pilot *pilot, PilotOutfitSlot *po, int on)
Handle the manual toggle of an outfit.
int pilot_rmAmmo(Pilot *pilot, PilotOutfitSlot *s, int quantity)
Removes some ammo from the pilot stock.
Definition: pilot_outfit.c:693
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.
Definition: pilot_outfit.c:627
void pilot_lockUpdateSlot(Pilot *p, PilotOutfitSlot *o, Pilot *t, double *a, double dt)
Updates the lockons on the pilot's launchers.
Definition: pilot_outfit.c:46
int pilot_addOutfitTest(Pilot *pilot, const Outfit *outfit, PilotOutfitSlot *s, int warn)
Tests to see if an outfit can be added.
Definition: pilot_outfit.c:331
void pilot_outfitLUpdate(Pilot *pilot, double dt)
Runs the pilot's Lua outfits update script.
int pilot_rmOutfitIntrinsic(Pilot *pilot, PilotOutfitSlot *s)
Removes an outfit from an intrinsic slot.
Definition: pilot_outfit.c:408
int pilot_addOutfitRaw(Pilot *pilot, const Outfit *outfit, PilotOutfitSlot *s)
Adds an outfit to the pilot, ignoring CPU or other limits.
Definition: pilot_outfit.c:273
int pilot_isSpaceworthy(const Pilot *p)
Pilot safety check - makes sure stats are safe.
Definition: pilot_outfit.c:528
int pilot_addOutfitIntrinsic(Pilot *pilot, const Outfit *outfit)
Adds an outfit as an intrinsic slot.
Definition: pilot_outfit.c:385
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:304
Stores an outfit the pilot has.
Definition: pilot.h:108
The representation of an in-game pilot.
Definition: pilot.h:210
Represents a 2d vector.
Definition: vec2.h:32