![]() |
naev 0.12.5
|
Handles pilot weapon sets which server to manage and interface with active outfits.. More...
#include "array.h"#include "escort.h"#include "log.h"#include "nlua_pilotoutfit.h"#include "pilot.h"#include "player.h"#include "sound.h"#include "spfx.h"#include "weapon.h"
Go to the source code of this file.
Functions | |
| static void | pilot_weapSetUpdateOutfits (Pilot *p, PilotWeaponSet *ws) |
| Updates the outfits with their current weapon set level. | |
| 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. | |
| static void | pilot_weapSetUpdateRange (const Pilot *p, PilotWeaponSet *ws) |
| Updates the weapon range for a pilot weapon set. | |
| PilotWeaponSet * | pilot_weapSet (Pilot *p, int id) |
| Gets a weapon set from id. | |
| void | pilot_weapSetAIClear (Pilot *p) |
| Useful function for AI, clears activeness of all weapon sets. | |
| static int | pilot_weapSetPressToggle (Pilot *p, PilotWeaponSet *ws) |
| int | pilot_weapSetPress (Pilot *p, int id, int type) |
| Handles a weapon set press. | |
| void | pilot_weapSetUpdateOutfitState (Pilot *p) |
| Updates the local state of all the pilot's outfits based on the weapon sets. | |
| void | pilot_weapSetUpdate (Pilot *p) |
| Updates the pilot's weapon sets. | |
| int | pilot_weapSetTypeCheck (Pilot *p, int id) |
| Checks the current weapon set type. | |
| void | pilot_weapSetType (Pilot *p, int id, WeaponSetType type) |
| Changes the weapon sets mode. | |
| int | pilot_weapSetInrangeCheck (Pilot *p, int id) |
| Checks the current weapon set inrange property. | |
| void | pilot_weapSetInrange (Pilot *p, int id, int inrange) |
| Changes the weapon set inrange property. | |
| int | pilot_weapSetManualCheck (Pilot *p, int id) |
| Checks the current weapon set manual property. | |
| void | pilot_weapSetManual (Pilot *p, int id, int manual) |
| Changes the weapon set manual property. | |
| int | pilot_weapSetVolleyCheck (Pilot *p, int id) |
| Checks the current weapon set volley property. | |
| void | pilot_weapSetVolley (Pilot *p, int id, int volley) |
| Changes the weapon set volley property. | |
| const char * | pilot_weapSetName (Pilot *p, int id) |
| Gets the name of a weapon set. | |
| void | pilot_weapSetAdd (Pilot *p, int id, const PilotOutfitSlot *o) |
| Adds an outfit to a weapon set. | |
| void | pilot_weapSetRm (Pilot *p, int id, const PilotOutfitSlot *o) |
| Removes a slot from a weapon set. | |
| void | pilot_weapSetClear (Pilot *p, int id) |
| Clears a weapon set. | |
| int | pilot_weapSetInSet (Pilot *p, int id, const PilotOutfitSlot *o) |
| Checks to see if a slot is in a 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. | |
| void | pilot_weapSetUpdateStats (Pilot *p) |
| Update the weapon sets given pilot stat changes. | |
| double | pilot_weapSetRangeMin (Pilot *p, int id) |
| Gets the minimum range of the current pilot weapon set. | |
| double | pilot_weapSetRange (Pilot *p, int id) |
| Gets the range of the current pilot weapon set. | |
| 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. | |
| void | pilot_weapSetCleanup (Pilot *p, int id) |
| Cleans up a weapon set. | |
| void | pilot_weapSetFree (Pilot *p) |
| Frees a pilot's weapon sets. | |
| PilotWeaponSetOutfit * | pilot_weapSetList (Pilot *p, int id) |
| Lists the items in a pilot weapon set. | |
| void | pilot_stopBeam (const Pilot *p, PilotOutfitSlot *w) |
| Stops a beam outfit and sets delay as appropriate. | |
| double | pilot_weapFlyTime (const Outfit *o, const Pilot *parent, const vec2 *pos, const vec2 *vel) |
| Computes an estimation of ammo flying time. | |
| Pilot * | pilot_weaponTarget (Pilot *p, Target *wt) |
| Gets the weapon target of a pilot. | |
| 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. | |
| 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_weaponClear (Pilot *p) |
| Clears the pilots weapon settings. | |
| void | pilot_weaponAuto (Pilot *p) |
| Tries to automatically set and create the pilot's weapon set. | |
| void | pilot_weaponSafe (Pilot *p) |
| Sets the weapon set as safe. | |
| int | pilot_outfitOff (Pilot *p, PilotOutfitSlot *o, int natural) |
| Disables a given active outfit. | |
| int | pilot_outfitOn (Pilot *p, PilotOutfitSlot *pos) |
| Enable a given active outfit. | |
| int | pilot_outfitOffAll (Pilot *p) |
| Disables all active outfits for a pilot. | |
| int | pilot_outfitOffAllStealth (Pilot *p) |
| Disables all active outfits for a pilot. | |
| int | pilot_afterburn (Pilot *p) |
| Activate the afterburner. | |
| void | pilot_afterburnOver (Pilot *p) |
| Deactivates the afterburner. | |
| 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. | |
Handles pilot weapon sets which server to manage and interface with active outfits..
The basic approach is a flag and sweep operation. Outfits are flagged based on what weapon sets they belong to when weapon sets change or weapons are fired. Afterwards, the weapons will be updated every iteration to fire or change states as necessary.
Definition in file pilot_weapon.c.
| int pilot_afterburn | ( | Pilot * | p | ) |
| void pilot_afterburnOver | ( | Pilot * | p | ) |
Deactivates the afterburner.
Definition at line 1680 of file pilot_weapon.c.
Gets applicable fire rate and energy modifications for a pilot's weapon.
| [out] | rate_mod | Fire rate multiplier. |
| [out] | energy_mod | Energy use multiplier. |
| p | Pilot who owns the outfit. | |
| o | Pilot's outfit. |
Definition at line 1283 of file pilot_weapon.c.
| int pilot_outfitOff | ( | Pilot * | p, |
| PilotOutfitSlot * | o, | ||
| int | natural ) |
Disables a given active outfit.
| p | Pilot whose outfit we are disabling. |
| o | Outfit to disable. |
| natural | Whether a result of natural behaviour, or something automatic. |
Definition at line 1499 of file pilot_weapon.c.
| int pilot_outfitOffAll | ( | Pilot * | p | ) |
Disables all active outfits for a pilot.
| p | Pilot whose outfits we are disabling. |
Definition at line 1583 of file pilot_weapon.c.
| int pilot_outfitOffAllStealth | ( | Pilot * | p | ) |
Disables all active outfits for a pilot.
| p | Pilot whose outfits we are disabling. |
Definition at line 1603 of file pilot_weapon.c.
| int pilot_outfitOn | ( | Pilot * | p, |
| PilotOutfitSlot * | pos ) |
Enable a given active outfit.
Definition at line 1555 of file pilot_weapon.c.
| 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.
| p | Pilot that is shooting. |
| w | Pilot's outfit to shoot. |
| target | Target shooting at. |
| time | Expected flight time. |
| aim | Whether or not to aim, if negative, indicates that it is automatically shot. |
Definition at line 1103 of file pilot_weapon.c.
|
static |
Calculates and shoots the appropriate weapons in a weapon set matching an outfit.
Definition at line 1023 of file pilot_weapon.c.
| void pilot_stopBeam | ( | const Pilot * | p, |
| PilotOutfitSlot * | w ) |
Stops a beam outfit and sets delay as appropriate.
Definition at line 876 of file pilot_weapon.c.
| double pilot_weapFlyTime | ( | const Outfit * | o, |
| const Pilot * | parent, | ||
| const vec2 * | pos, | ||
| const vec2 * | vel ) |
Computes an estimation of ammo flying time.
| o | the weapon to shoot. |
| parent | Parent of the weapon. |
| pos | Target's position. |
| vel | Target's velocity. |
Definition at line 920 of file pilot_weapon.c.
| void pilot_weaponAuto | ( | Pilot * | p | ) |
Tries to automatically set and create the pilot's weapon set.
Weapon set 0 is for all weapons.
Weapon set 1 is for forward weapons. Ammo using weapons are secondaries.
Weapon set 2 is for turret weapons. Ammo using weapons are secondaries.
Weapon set 3 is for all weapons. Forwards are primaries and turrets are secondaries.
Weapon set 4 is for seeking weapons. High payload variants are secondaries.
Weapon set 5 is for fighter bays.
| p | Pilot to automagically generate weapon lists. |
Definition at line 1345 of file pilot_weapon.c.
| void pilot_weaponClear | ( | Pilot * | p | ) |
Clears the pilots weapon settings.
| p | Pilot whose weapons we're clearing. |
Definition at line 1324 of file pilot_weapon.c.
| void pilot_weaponSafe | ( | Pilot * | p | ) |
Sets the weapon set as safe.
| p | Pilot to set weapons as safe. |
Definition at line 1481 of file pilot_weapon.c.
Gets the weapon target of a pilot.
Definition at line 1002 of file pilot_weapon.c.
| PilotWeaponSet * pilot_weapSet | ( | Pilot * | p, |
| int | id ) |
Gets a weapon set from id.
| p | Pilot to get weapon set from. |
| id | ID of the weapon set. |
Definition at line 46 of file pilot_weapon.c.
| void pilot_weapSetAdd | ( | Pilot * | p, |
| int | id, | ||
| const PilotOutfitSlot * | o ) |
Adds an outfit to a weapon set.
Definition at line 598 of file pilot_weapon.c.
| void pilot_weapSetAIClear | ( | Pilot * | p | ) |
Useful function for AI, clears activeness of all weapon sets.
Definition at line 54 of file pilot_weapon.c.
| double pilot_weapSetAmmo | ( | Pilot * | p, |
| int | id ) |
Gets the ammo of the current pilot weapon set.
| p | Pilot to get the speed of. |
| id | ID of weapon set to get the speed of. |
Definition at line 815 of file pilot_weapon.c.
| int pilot_weapSetCheck | ( | Pilot * | p, |
| int | id, | ||
| const PilotOutfitSlot * | o ) |
Checks to see if a slot is in a weapon set and usable.
Definition at line 686 of file pilot_weapon.c.
| void pilot_weapSetCleanup | ( | Pilot * | p, |
| int | id ) |
Cleans up a weapon set.
| p | Pilot who owns the weapon set. |
| id | ID of the weapon set to clean up. |
Definition at line 838 of file pilot_weapon.c.
| void pilot_weapSetClear | ( | Pilot * | p, |
| int | id ) |
Clears a weapon set.
Definition at line 650 of file pilot_weapon.c.
| void pilot_weapSetFree | ( | Pilot * | p | ) |
Frees a pilot's weapon sets.
Definition at line 852 of file pilot_weapon.c.
| void pilot_weapSetInrange | ( | Pilot * | p, |
| int | id, | ||
| int | inrange ) |
Changes the weapon set inrange property.
| p | Pilot to manipulate. |
| id | ID of the weapon set. |
| inrange | Whether or not to only fire at stuff in range. |
Definition at line 451 of file pilot_weapon.c.
| int pilot_weapSetInrangeCheck | ( | Pilot * | p, |
| int | id ) |
Checks the current weapon set inrange property.
| p | Pilot to manipulate. |
| id | ID of the weapon set to check. |
Definition at line 438 of file pilot_weapon.c.
| int pilot_weapSetInSet | ( | Pilot * | p, |
| int | id, | ||
| const PilotOutfitSlot * | o ) |
Checks to see if a slot is in a weapon set.
Definition at line 665 of file pilot_weapon.c.
| PilotWeaponSetOutfit * pilot_weapSetList | ( | Pilot * | p, |
| int | id ) |
Lists the items in a pilot weapon set.
| p | Pilot who owns the weapon set. |
| id | ID of the weapon set. |
Definition at line 865 of file pilot_weapon.c.
| void pilot_weapSetManual | ( | Pilot * | p, |
| int | id, | ||
| int | manual ) |
Changes the weapon set manual property.
| p | Pilot to manipulate. |
| id | ID of the weapon set. |
| manual | Whether or not to have manual aiming. |
Definition at line 478 of file pilot_weapon.c.
| int pilot_weapSetManualCheck | ( | Pilot * | p, |
| int | id ) |
Checks the current weapon set manual property.
| p | Pilot to manipulate. |
| id | ID of the weapon set to check. |
Definition at line 465 of file pilot_weapon.c.
| const char * pilot_weapSetName | ( | Pilot * | p, |
| int | id ) |
Gets the name of a weapon set.
Definition at line 515 of file pilot_weapon.c.
| int pilot_weapSetPress | ( | Pilot * | p, |
| int | id, | ||
| int | type ) |
Handles a weapon set press.
| p | Pilot the weapon set belongs to. |
| id | ID of the weapon set. |
| type | Is +1 if it's a press or -1 if it's a release. |
Definition at line 101 of file pilot_weapon.c.
|
static |
Definition at line 62 of file pilot_weapon.c.
| double pilot_weapSetRange | ( | Pilot * | p, |
| int | id ) |
Gets the range of the current pilot weapon set.
| p | Pilot to get the range of. |
| id | ID of weapon set to get the range of. |
Definition at line 791 of file pilot_weapon.c.
| double pilot_weapSetRangeMin | ( | Pilot * | p, |
| int | id ) |
Gets the minimum range of the current pilot weapon set.
| p | Pilot to get the minimum range of. |
| id | ID of weapon set to get the minimun range of. |
Definition at line 779 of file pilot_weapon.c.
| void pilot_weapSetRm | ( | Pilot * | p, |
| int | id, | ||
| const PilotOutfitSlot * | o ) |
Removes a slot from a weapon set.
Definition at line 631 of file pilot_weapon.c.
| double pilot_weapSetSpeed | ( | Pilot * | p, |
| int | id ) |
Gets the speed of the current pilot weapon set.
| p | Pilot to get the speed of. |
| id | ID of weapon set to get the speed of. |
Definition at line 803 of file pilot_weapon.c.
| void pilot_weapSetType | ( | Pilot * | p, |
| int | id, | ||
| WeaponSetType | type ) |
Changes the weapon sets mode.
| p | Pilot to manipulate. |
| id | ID of the weapon set. |
| type | The mode (a WEAPSET_TYPE constant). |
Definition at line 422 of file pilot_weapon.c.
| int pilot_weapSetTypeCheck | ( | Pilot * | p, |
| int | id ) |
Checks the current weapon set type.
| p | Pilot to manipulate. |
| id | ID of the weapon set to check. |
Definition at line 409 of file pilot_weapon.c.
| void pilot_weapSetUpdate | ( | Pilot * | p | ) |
Updates the pilot's weapon sets.
| p | Pilot to update. |
Definition at line 267 of file pilot_weapon.c.
|
static |
Updates the outfits with their current weapon set level.
Definition at line 384 of file pilot_weapon.c.
| void pilot_weapSetUpdateOutfitState | ( | Pilot * | p | ) |
Updates the local state of all the pilot's outfits based on the weapon sets.
Definition at line 172 of file pilot_weapon.c.
|
static |
Updates the weapon range for a pilot weapon set.
Definition at line 716 of file pilot_weapon.c.
| void pilot_weapSetUpdateStats | ( | Pilot * | p | ) |
Update the weapon sets given pilot stat changes.
| p | Pilot to update. |
Definition at line 704 of file pilot_weapon.c.
| void pilot_weapSetVolley | ( | Pilot * | p, |
| int | id, | ||
| int | volley ) |
Changes the weapon set volley property.
| p | Pilot to manipulate. |
| id | ID of the weapon set. |
| volley | Whether or not to have volley aiming. |
Definition at line 505 of file pilot_weapon.c.
| int pilot_weapSetVolleyCheck | ( | Pilot * | p, |
| int | id ) |
Checks the current weapon set volley property.
| p | Pilot to manipulate. |
| id | ID of the weapon set to check. |
Definition at line 492 of file pilot_weapon.c.
| void ws_copy | ( | PilotWeaponSet | dest[PILOT_WEAPON_SETS], |
| const PilotWeaponSet | src[PILOT_WEAPON_SETS] ) |
Copies a weapon set over.
Definition at line 1702 of file pilot_weapon.c.
| void ws_free | ( | PilotWeaponSet | ws[PILOT_WEAPON_SETS] | ) |
Frees a weapon set.
Definition at line 1714 of file pilot_weapon.c.