Moderators: MisterPerson, Code Maintainers
if(air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
hotspot_expose(air.temperature, CELL_VOLUME)
for(var/atom/movable/item in src)
item.temperature_expose(air, air.temperature, CELL_VOLUME)
temperature_expose(air, air.temperature, CELL_VOLUME)
if((air.temperature > MINIMUM_TEMPERATURE_START_REACTION) && (air.temperature <= FIRE_MINIMUM_TEMPERATURE_TO_EXIST))
for(var/atom/movable/item in src)
if (istype(item, /obj/item/weapon/reagent_containers)) item.temperature_expose(air, air.temperature, CELL_VOLUME)
/obj/item/weapon/reagent_containers/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
// OPTIMIZATION - Why the hell would you check for every 0.1 change. DELTATEMPKICKIN is to lower the amount of calls to handle_reactions()
// So that in the scope of +/-DELTATEMPKICKIN change there won't be a call
if (( oldtemp-DELTATEMPKICKIN > exposed_temperature ) || ( oldtemp+DELTATEMPKICKIN < exposed_temperature ))
// When it kicks in, write down what was the old temperature
oldtemp = exposed_temperature
// WHAM!
src.reagents.handle_reactions()
Cv*T = Q (per mole)
#define HEAT_CAPACITY_CALCULATION(oxygen,carbon_dioxide,nitrogen,toxins) \
(carbon_dioxide*SPECIFIC_HEAT_CDO + (oxygen+nitrogen)*SPECIFIC_HEAT_AIR + toxins*SPECIFIC_HEAT_TOXIN)
if((air1.total_moles() > 0) && (air1.temperature > 0))
// Energy of the gas at start
var/start_energy=air1.thermal_energy()
// Efficency to reduce the number of calculations at the cost of memory
var/convertedmoles=round(air1.carbon_dioxide*conversionrate)
// This is how much end energy will there be
var/end_energy = start_energy-convertedmoles*REACTION_ENERGY
// Do reaction
air1.carbon_dioxide -= convertedmoles
air1.oxygen += convertedmoles
// Calculate the output temperature
air1.temperature = end_energy / air1.heat_capacity()
// Transfer the gas into the second node and merge
var/datum/gas_mixture/removed = air1.remove_ratio(1)
air2.merge(removed)
if(network1)
network1.update = 1
if(network2)
network2.update = 1
//Calculate necessary moles to transfer using PV = nRT
if((air1.total_moles() > 0) && (air1.temperature > 0))
if(((air1.temperature > MINTEMPERATUREFORCO2CONV ) && (air1.temperature < MAXTEMPERATUREFORCO2CONV)) && ((input_starting_pressure > MINPRESSUREFORCO2CONV) && (input_starting_pressure < MAXPRESSUREFORCO2CONV)))
// efficency calculations
if input_starting_pressure <> GOLDENPOINTPRESSURE
var/conversionratep = min(1,GOLDENPOINTPRESSURE*PRESSUREPLATEAUFRAC/sqrt(abs(GOLDENPOINTPRESSURE^2-air1.input_starting_pressure^2)))
else
var/conversionratep = 1
if air1.temperature <> GOLDENPOINTTEMPERATURE
var/conversionratet = min(1,GOLDENPOINTTEMPERATURE*TEMPERATUREPLATEAUFRAC/sqrt(abs(GOLDENPOINTTEMPERATURE^2-air1.temperature^2)))
else
var/conversionratet = 1
var/conversionrate = (conversionratet+conversionratep)/2
// Energy of the gas at start
var/start_energy=air1.thermal_energy()
// Efficency to reduce the number of calculations at the cost of memory
var/convertedmoles=round(air1.carbon_dioxide*conversionrate)
// This is how much end energy will there be
var/end_energy = start_energy-convertedmoles*REACTION_ENERGY
// Do reaction
air1.carbon_dioxide -= convertedmoles
air1.oxygen += convertedmoles
// Calculate the output temperature
air1.temperature = end_energy / air1.heat_capacity()
// Transfer the gas into the second node and merge
var/datum/gas_mixture/removed = air1.remove_ratio(transfer_ratio)
air2.merge(removed)
if(network1)
network1.update = 1
if(network2)
network2.update = 1
Users browsing this forum: No registered users