16#include "pilot_heat.h"
35 mass_kg = 1000. * p->base_mass;
37 p->heat_cond = STEEL_HEAT_CONDUCTIVITY;
38 p->heat_C = STEEL_HEAT_CAPACITY * mass_kg;
55 p->heat_area = 4. * M_PI *
56 pow( 3. / 4. * mass_kg / STEEL_DENSITY / M_PI, 2. / 3. ) *
57 p->stats.heat_dissipation;
67 return STEEL_HEAT_CAPACITY *
MAX( 1000. * o->
mass, 1. );
77 double mass_kg =
MAX( 1000. * o->
mass, 1. );
79 return 2. * M_PI * pow( 3. / 4. * mass_kg / STEEL_DENSITY / M_PI, 2. / 3. );
87 o->
heat_T = CONST_SPACE_STAR_TEMP;
105 p->heat_T = CONST_SPACE_STAR_TEMP;
106 for (
int i = 0; i <
array_size( p->outfits ); i++ )
107 p->outfits[i]->heat_T = CONST_SPACE_STAR_TEMP;
116 case OUTFIT_TYPE_BOLT:
117 case OUTFIT_TYPE_BEAM:
118 return p->stats.fwd_heat;
120 case OUTFIT_TYPE_TURRET_BOLT:
121 case OUTFIT_TYPE_TURRET_BEAM:
122 return p->stats.tur_heat;
185 double Q = -p->heat_cond * ( o->
heat_T - p->heat_T ) * o->
heat_area * dt;
220 Q_rad = CONST_STEFAN_BOLTZMANN * p->heat_area * p->heat_emis *
221 ( CONST_SPACE_STAR_TEMP_4 - pow( p->heat_T, 4. ) ) * dt;
227 p->heat_T += Q / p->heat_C;
239 return CLAMP( 0., 1., 1. - ( T - Tb ) / Tc );
249 double t =
pow2( 1. - p->ctimer / p->cdelay );
250 p->heat_T = p->heat_start - CONST_SPACE_STAR_TEMP -
251 ( p->heat_start - CONST_SPACE_STAR_TEMP ) * t +
252 CONST_SPACE_STAR_TEMP;
254 for (
int i = 0; i <
array_size( p->outfits ); i++ ) {
258 ( o->
heat_start - CONST_SPACE_STAR_TEMP ) * t +
259 CONST_SPACE_STAR_TEMP;
283 return CLAMP( 0., 1., ( T - 500. ) / 600. );
291 return CLAMP( 0., 1., ( 1100. - T ) / 300. );
Provides macros to work with dynamic arrays.
static ALWAYS_INLINE int array_size(const void *array)
Returns number of elements in the array.
Header file with generic functions and naev-specifics.
int outfit_isFighterBay(const Outfit *o)
Checks if outfit is a fighter bay.
double outfit_heat(const Outfit *o)
Gets the outfit's heat generation.
void pilot_heatAddSlot(const Pilot *p, PilotOutfitSlot *o)
Adds heat to an outfit slot.
double pilot_heatEfficiencyMod(double T, double Tb, double Tc)
Returns a 0:1 modifier representing efficiency (1. being normal).
void pilot_heatUpdateCooldown(Pilot *p)
Overrides the usual heat model during active cooldown.
double pilot_heatFireRateMod(double T)
Returns a 0:1 modifier representing fire rate (1. being normal).
void pilot_heatCalcSlot(PilotOutfitSlot *o)
Calculates the heat parameters for a pilot's slot.
static double pilot_heatOutfitMod(const Pilot *p, const Outfit *o)
Gets the heat mod for an outfit.
void pilot_heatReset(Pilot *p)
Resets a pilot's heat.
double pilot_heatAccuracyMod(double T)
Returns a 0:1 modifier representing accuracy (0. being normal).
void pilot_heatUpdateShip(Pilot *p, double Q_cond, double dt)
Heats the pilot's ship.
double pilot_heatCalcOutfitC(const Outfit *o)
Calculates the thermal mass of an outfit.
void pilot_heatCalc(Pilot *p)
Calculates the heat parameters for a pilot.
double pilot_heatCalcOutfitArea(const Outfit *o)
Calculates the effective transfer area of an outfit.
double pilot_heatUpdateSlot(const Pilot *p, PilotOutfitSlot *o, double dt)
Heats the pilot's slot.
double pilot_heatFirePercent(double T)
Returns a 0:2 level of fire, 0:1 is the accuracy point, 1:2 is fire rate point.
void pilot_heatAddSlotTime(const Pilot *p, PilotOutfitSlot *o, double dt)
Adds heat to an outfit slot over a period of time.
int pilot_maxAmmoO(const Pilot *p, const Outfit *o)
Gets the maximum available ammo for a pilot for a specific outfit.
int pilot_addAmmo(Pilot *pilot, PilotOutfitSlot *s, int quantity)
Adds some ammo to the pilot stock.
A ship outfit, depends radically on the type.
Stores an outfit the pilot has.
The representation of an in-game pilot.