naev 0.10.4
Macros | Functions | Variables
pilot_ew.c File Reference

Pilot electronic warfare information. More...

#include "array.h"
#include "hook.h"
#include "log.h"
#include "pilot.h"
#include "player.h"
#include "player_autonav.h"
#include "space.h"

Go to the source code of this file.

Macros

#define EW_ASTEROID_DIST   7.5e3
 
#define EW_JUMPDETECT_DIST   7.5e3
 
#define EW_SPOBDETECT_DIST   20e3 /* TODO something better than this. */
 

Functions

static void pilot_ewUpdate (Pilot *p)
 Updates all the internal values. More...
 
static double pilot_ewMass (double mass)
 Gets the electronic warfare mass modifier for a given mass. More...
 
static double pilot_ewAsteroid (const Pilot *p)
 Gets the electronic warfare asteroid modifier. More...
 
static double pilot_ewJumpPoint (const Pilot *p)
 Gets the electronic warfare jump point modifier. More...
 
static int pilot_ewStealthGetNearby (const Pilot *p, double *mod, int *close, int *isplayer)
 Checks to see if there are pilots nearby to a stealthed pilot that could break stealth. More...
 
double pilot_ewScanTime (const Pilot *p)
 Gets the time it takes to scan a pilot. More...
 
void pilot_ewScanStart (Pilot *p)
 Initializes the scan timer for a pilot. More...
 
int pilot_ewScanCheck (const Pilot *p)
 Checks to see if a scan is done. More...
 
void pilot_ewUpdateStatic (Pilot *p)
 Updates the pilot's static electronic warfare properties. More...
 
void pilot_ewUpdateDynamic (Pilot *p, double dt)
 Updates the pilot's dynamic electronic warfare properties. More...
 
void pilot_updateSensorRange (void)
 Updates the system's base sensor range. More...
 
double pilot_sensorRange (void)
 Returns the default sensor range for the current system. More...
 
int pilot_inRange (const Pilot *p, double x, double y)
 Check to see if a position is in range of the pilot. More...
 
int pilot_inRangePilot (const Pilot *p, const Pilot *target, double *dist2)
 Check to see if a pilot is in sensor range of another. More...
 
int pilot_inRangeSpob (const Pilot *p, int target)
 Check to see if a spob is in sensor range of the pilot. More...
 
int pilot_inRangeAsteroid (const Pilot *p, int ast, int fie)
 Check to see if an asteroid is in sensor range of the pilot. More...
 
int pilot_inRangeJump (const Pilot *p, int i)
 Check to see if a jump point is in sensor range of the pilot. More...
 
double pilot_ewWeaponTrack (const Pilot *p, const Pilot *t, double trackmin, double trackmax)
 Calculates the weapon lead (1. is 100%, 0. is 0%).. More...
 
void pilot_ewUpdateStealth (Pilot *p, double dt)
 Updates the stealth mode and checks to see if it is getting broken. More...
 
int pilot_stealth (Pilot *p)
 Stealths a pilot. More...
 
void pilot_destealth (Pilot *p)
 Destealths a pilot. More...
 

Variables

static double ew_interference = 1.
 

Detailed Description

Pilot electronic warfare information.

Definition in file pilot_ew.c.

Macro Definition Documentation

◆ EW_ASTEROID_DIST

#define EW_ASTEROID_DIST   7.5e3

Definition at line 23 of file pilot_ew.c.

◆ EW_JUMPDETECT_DIST

#define EW_JUMPDETECT_DIST   7.5e3

Definition at line 24 of file pilot_ew.c.

◆ EW_SPOBDETECT_DIST

#define EW_SPOBDETECT_DIST   20e3 /* TODO something better than this. */

Definition at line 25 of file pilot_ew.c.

Function Documentation

◆ pilot_destealth()

void pilot_destealth ( Pilot p)

Destealths a pilot.

Definition at line 549 of file pilot_ew.c.

◆ pilot_ewAsteroid()

static double pilot_ewAsteroid ( const Pilot p)
static

Gets the electronic warfare asteroid modifier.

Parameters
pPilot.
Returns
The electronic warfare asteroid modifier.

Definition at line 167 of file pilot_ew.c.

◆ pilot_ewJumpPoint()

static double pilot_ewJumpPoint ( const Pilot p)
static

Gets the electronic warfare jump point modifier.

Parameters
pPilot.
Returns
The electronic warfare jump point modifier.

Definition at line 181 of file pilot_ew.c.

◆ pilot_ewMass()

static double pilot_ewMass ( double  mass)
static

Gets the electronic warfare mass modifier for a given mass.

Parameters
massMass to get the electronic warfare mass modifier of.
Returns
The electronic warfare mass modifier.

Definition at line 156 of file pilot_ew.c.

◆ pilot_ewScanCheck()

int pilot_ewScanCheck ( const Pilot p)

Checks to see if a scan is done.

Parameters
pPilot to check.
Returns
1 if scan is done, 0 otherwise.

Definition at line 75 of file pilot_ew.c.

◆ pilot_ewScanStart()

void pilot_ewScanStart ( Pilot p)

Initializes the scan timer for a pilot.

Parameters
pPilot to set scan timer for.

Definition at line 55 of file pilot_ew.c.

◆ pilot_ewScanTime()

double pilot_ewScanTime ( const Pilot p)

Gets the time it takes to scan a pilot.

Parameters
pPilot to scan.
Returns
Time it takes to scan the pilot.

Definition at line 44 of file pilot_ew.c.

◆ pilot_ewStealthGetNearby()

static int pilot_ewStealthGetNearby ( const Pilot p,
double *  mod,
int *  close,
int *  isplayer 
)
static

Checks to see if there are pilots nearby to a stealthed pilot that could break stealth.

Parameters
pPilot to check.
modDistance-dependent trength modifier.
closeNumber of pilots nearby.
isplayerWhether or not the player is the pilot breaking stealth.
Returns
Number of stealth-breaking pilots nearby.

Definition at line 402 of file pilot_ew.c.

◆ pilot_ewUpdate()

static void pilot_ewUpdate ( Pilot p)
static

Updates all the internal values.

Definition at line 85 of file pilot_ew.c.

◆ pilot_ewUpdateDynamic()

void pilot_ewUpdateDynamic ( Pilot p,
double  dt 
)

Updates the pilot's dynamic electronic warfare properties.

Parameters
pPilot to update.
dtDelta time increment (seconds).

Definition at line 110 of file pilot_ew.c.

◆ pilot_ewUpdateStatic()

void pilot_ewUpdateStatic ( Pilot p)

Updates the pilot's static electronic warfare properties.

Parameters
pPilot to update.

Definition at line 98 of file pilot_ew.c.

◆ pilot_ewUpdateStealth()

void pilot_ewUpdateStealth ( Pilot p,
double  dt 
)

Updates the stealth mode and checks to see if it is getting broken.

Parameters
pPilot to update.
dtCurrent delta-tick.

Definition at line 468 of file pilot_ew.c.

◆ pilot_ewWeaponTrack()

double pilot_ewWeaponTrack ( const Pilot p,
const Pilot t,
double  trackmin,
double  trackmax 
)

Calculates the weapon lead (1. is 100%, 0. is 0%)..

Parameters
pPilot tracking.
tPilot being tracked.
trackminMinimum track limit of the weapon.
trackmaxMaximum track limit of the weapon.
Returns
The lead angle of the weapon.

Definition at line 387 of file pilot_ew.c.

◆ pilot_inRange()

int pilot_inRange ( const Pilot p,
double  x,
double  y 
)

Check to see if a position is in range of the pilot.

Parameters
pPilot to check to see if position is in their sensor range.
xX position to check.
yY position to check.
Returns
1 if the position is in range, 0 if it isn't.

Definition at line 225 of file pilot_ew.c.

◆ pilot_inRangeAsteroid()

int pilot_inRangeAsteroid ( const Pilot p,
int  ast,
int  fie 
)

Check to see if an asteroid is in sensor range of the pilot.

Parameters
pPilot who is trying to check to see if the asteroid is in sensor range.
astAsteroid to see if is in sensor range.
fieField the Asteroid belongs to to see if is in sensor range.
Returns
1 if they are in range, 0 if they aren't.

Definition at line 307 of file pilot_ew.c.

◆ pilot_inRangeJump()

int pilot_inRangeJump ( const Pilot p,
int  i 
)

Check to see if a jump point is in sensor range of the pilot.

Parameters
pPilot who is trying to check to see if the jump point is in sensor range.
itarget Jump point to see if is in sensor range.
Returns
1 if they are in range, 0 if they aren't.

Definition at line 342 of file pilot_ew.c.

◆ pilot_inRangePilot()

int pilot_inRangePilot ( const Pilot p,
const Pilot target,
double *  dist2 
)

Check to see if a pilot is in sensor range of another.

Parameters
pPilot who is trying to check to see if other is in sensor range.
targetTarget of p to check to see if is in sensor range.
[out]dist2Distance squared of the two pilots. Set to NULL if you're not interested.
Returns
1 if they are in range, 0 if they aren't and -1 if they are detected fuzzily.

Definition at line 242 of file pilot_ew.c.

◆ pilot_inRangeSpob()

int pilot_inRangeSpob ( const Pilot p,
int  target 
)

Check to see if a spob is in sensor range of the pilot.

Parameters
pPilot who is trying to check to see if the spob is in sensor range.
targetSpob to see if is in sensor range.
Returns
1 if they are in range, 0 if they aren't.

Definition at line 277 of file pilot_ew.c.

◆ pilot_sensorRange()

double pilot_sensorRange ( void  )

Returns the default sensor range for the current system.

Returns
Sensor range.

Definition at line 212 of file pilot_ew.c.

◆ pilot_stealth()

int pilot_stealth ( Pilot p)

Stealths a pilot.

Definition at line 513 of file pilot_ew.c.

◆ pilot_updateSensorRange()

void pilot_updateSensorRange ( void  )

Updates the system's base sensor range.

Definition at line 202 of file pilot_ew.c.

Variable Documentation

◆ ew_interference

double ew_interference = 1.
static

Interference factor.

Definition at line 27 of file pilot_ew.c.