![]() |
naev 0.11.5
|
Handles pilot weapon sets. More...
#include "array.h"#include "escort.h"#include "log.h"#include "nxml.h"#include "nlua_pilot.h"#include "nlua_pilotoutfit.h"#include "pilot.h"#include "player.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_weapSetFire (Pilot *p, PilotWeaponSet *ws, int level) |
| Fires a weapon set. | |
| static int | pilot_shootWeaponSetOutfit (Pilot *p, PilotWeaponSet *ws, const Outfit *o, int level, 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. | |
| unsigned int | pilot_weaponSetShootStop (Pilot *p, PilotWeaponSet *ws, int level) |
| Have pilot stop shooting a given weaponset. | |
| 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. | |
| void | pilot_weapSetPress (Pilot *p, int id, int type) |
| Handles a weapon set press. | |
| 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, int level) |
| 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_weapSetRange (Pilot *p, int id, int level) |
| Gets the range of the current pilot weapon set. | |
| double | pilot_weapSetSpeed (Pilot *p, int id, int level) |
| Gets the speed of the current pilot weapon set. | |
| double | pilot_weapSetAmmo (Pilot *p, int id, int level) |
| 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. | |
| int | pilot_shoot (Pilot *p, int level) |
| Makes the pilot shoot. | |
| void | pilot_shootStop (Pilot *p, int level) |
| Have pilot stop shooting their weapon. | |
| 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_weaponSetDefault (Pilot *p) |
| Gives the pilot a default weapon set. | |
| void | pilot_weaponSafe (Pilot *p) |
| Sets the weapon set as safe. | |
| int | pilot_outfitOff (Pilot *p, PilotOutfitSlot *o) |
| Disables a given active outfit. | |
| int | pilot_outfitOn (Pilot *p, PilotOutfitSlot *o) |
| Enable a given active outfit. | |
| int | pilot_outfitOffAll (Pilot *p) |
| Disables all active outfits for a pilot. | |
| void | 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.
Cheat sheet: how this works (it's complicated).
KEYPRESS 1) weapSetPress 2) weapSetFire 2.1) Modifications get turned on/off 2.2) Weapons go to shootWeaponSetOutfit
UPDATE 1) weapSetUpdate 2.1) fire set => weapSetFire 2.1.1) Modifications get turned on/off 2.1.2) Weapons go to shootWeaponSetOutfit 2.2) weapsetUpdateOutfits
So to actually modify stuff, chances are you want to go to pilot_weapSetFire.
Definition in file pilot_weapon.c.
| void pilot_afterburn | ( | Pilot * | p | ) |
| void pilot_afterburnOver | ( | Pilot * | p | ) |
Deactivates the afterburner.
Definition at line 1722 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 1367 of file pilot_weapon.c.
| int pilot_outfitOff | ( | Pilot * | p, |
| PilotOutfitSlot * | o ) |
Disables a given active outfit.
Definition at line 1577 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 1654 of file pilot_weapon.c.
| int pilot_outfitOn | ( | Pilot * | p, |
| PilotOutfitSlot * | o ) |
Enable a given active outfit.
Definition at line 1628 of file pilot_weapon.c.
| int pilot_shoot | ( | Pilot * | p, |
| int | level ) |
Makes the pilot shoot.
| p | The pilot which is shooting. |
| level | Level of the shot. |
Definition at line 877 of file pilot_weapon.c.
| void pilot_shootStop | ( | Pilot * | p, |
| int | level ) |
Have pilot stop shooting their weapon.
Only really deals with beam weapons.
| p | Pilot that was shooting. |
| level | Level of the shot. |
Definition at line 903 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 1189 of file pilot_weapon.c.
|
static |
Calculates and shoots the appropriate weapons in a weapon set matching an outfit.
Definition at line 1095 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 967 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 1008 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 1425 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 1405 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 1557 of file pilot_weapon.c.
| void pilot_weaponSetDefault | ( | Pilot * | p | ) |
Gives the pilot a default weapon set.
Definition at line 1516 of file pilot_weapon.c.
| unsigned int pilot_weaponSetShootStop | ( | Pilot * | p, |
| PilotWeaponSet * | ws, | ||
| int | level ) |
Have pilot stop shooting a given weaponset.
Only really deals with beam weapons.
Definition at line 922 of file pilot_weapon.c.
Gets the weapon target of a pilot.
Definition at line 1074 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 57 of file pilot_weapon.c.
| void pilot_weapSetAdd | ( | Pilot * | p, |
| int | id, | ||
| const PilotOutfitSlot * | o, | ||
| int | level ) |
Adds an outfit to a weapon set.
Definition at line 576 of file pilot_weapon.c.
| void pilot_weapSetAIClear | ( | Pilot * | p | ) |
Useful function for AI, clears activeness of all weapon sets.
Definition at line 149 of file pilot_weapon.c.
| double pilot_weapSetAmmo | ( | Pilot * | p, |
| int | id, | ||
| int | level ) |
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. |
| level | Level of the weapons to get the speed of (-1 for all). |
Definition at line 813 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 666 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 631 of file pilot_weapon.c.
|
static |
| 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 428 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 415 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 645 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 454 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 441 of file pilot_weapon.c.
| const char * pilot_weapSetName | ( | Pilot * | p, |
| int | id ) |
Gets the name of a weapon set.
Definition at line 489 of file pilot_weapon.c.
| void 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 164 of file pilot_weapon.c.
| double pilot_weapSetRange | ( | Pilot * | p, |
| int | id, | ||
| int | level ) |
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. |
| level | Level of the weapons to get the range of (-1 for all). |
Definition at line 769 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 612 of file pilot_weapon.c.
| double pilot_weapSetSpeed | ( | Pilot * | p, |
| int | id, | ||
| int | level ) |
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. |
| level | Level of the weapons to get the speed of (-1 for all). |
Definition at line 791 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 400 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 387 of file pilot_weapon.c.
| void pilot_weapSetUpdate | ( | Pilot * | p | ) |
Updates the pilot's weapon sets.
| p | Pilot to update. |
Definition at line 303 of file pilot_weapon.c.
|
static |
Updates the outfits with their current weapon set level.
Definition at line 343 of file pilot_weapon.c.
|
static |
Updates the weapon range for a pilot weapon set.
Definition at line 699 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 687 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 480 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 467 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 1743 of file pilot_weapon.c.
| void ws_free | ( | PilotWeaponSet | ws[PILOT_WEAPON_SETS] | ) |
Frees a weapon set.
Definition at line 1754 of file pilot_weapon.c.