16#include "pilot_heat.h"
36 mass_kg = 1000. * p->base_mass;
38 p->heat_cond = STEEL_HEAT_CONDUCTIVITY;
39 p->heat_C = STEEL_HEAT_CAPACITY * mass_kg;
56 p->heat_area = 4.*M_PI*pow( 3./4.*mass_kg/STEEL_DENSITY/M_PI, 2./3. ) * p->stats.heat_dissipation;
65 return STEEL_HEAT_CAPACITY *
MAX( 1000. * o->
mass, 1. );
75 double mass_kg =
MAX( 1000. * o->
mass, 1. );
77 return 2.*M_PI*pow( 3./4.*mass_kg/STEEL_DENSITY/M_PI, 2./3. );
85 o->
heat_T = CONST_SPACE_STAR_TEMP;
103 p->heat_T = CONST_SPACE_STAR_TEMP;
105 p->outfits[i]->heat_T = CONST_SPACE_STAR_TEMP;
114 case OUTFIT_TYPE_BOLT:
115 case OUTFIT_TYPE_BEAM:
116 return p->stats.fwd_heat;
118 case OUTFIT_TYPE_TURRET_BOLT:
119 case OUTFIT_TYPE_TURRET_BEAM:
120 return p->stats.tur_heat;
183 double Q = -p->heat_cond * (o->
heat_T - p->heat_T) * o->
heat_area * dt;
218 Q_rad = CONST_STEFAN_BOLTZMANN * p->heat_area * p->heat_emis *
219 (CONST_SPACE_STAR_TEMP_4 - pow(p->heat_T,4.)) * dt;
225 p->heat_T += Q / p->heat_C;
237 return CLAMP( 0., 1., 1. - (T - Tb) / Tc );
247 double t =
pow2( 1. - p->ctimer / p->cdelay );
248 p->heat_T = p->heat_start - CONST_SPACE_STAR_TEMP - (p->heat_start -
249 CONST_SPACE_STAR_TEMP) * t + CONST_SPACE_STAR_TEMP;
251 for (
int i=0; i<
array_size(p->outfits); i++) {
255 CONST_SPACE_STAR_TEMP) * t + CONST_SPACE_STAR_TEMP;
279 return CLAMP( 0., 1., (T-500.)/600. );
287 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.