Merge pull request #3168 from Citadel-Station-13/upstream-merge-31321

[MIRROR] Makes a couple of atmos procs a tiny bit faster, removes /datum/gas_mixture/thermal_energy()
This commit is contained in:
LetterJay
2017-10-06 02:14:03 -04:00
committed by GitHub
4 changed files with 6 additions and 7 deletions

View File

@@ -174,3 +174,5 @@
#define LAVALAND_EQUIPMENT_EFFECT_PRESSURE 50 //what pressure you have to be under to increase the effect of equipment meant for lavaland
#define LAVALAND_DEFAULT_ATMOS "o2=14;n2=23;TEMP=300"
#define THERMAL_ENERGY(gas) (gas.temperature * gas.heat_capacity())

View File

@@ -119,9 +119,6 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
/datum/gas_mixture/proc/return_volume() //liters
return max(0, volume)
/datum/gas_mixture/proc/thermal_energy() //joules
return temperature * heat_capacity()
/datum/gas_mixture/proc/archive()
//Update archived versions of variables
//Returns: 1 in all cases
@@ -424,7 +421,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
var/list/cached_gases = gases
var/temp = temperature
var/ener = thermal_energy()
var/ener = THERMAL_ENERGY(src)
reaction_loop:
for(var/r in SSair.gas_reactions)

View File

@@ -199,13 +199,13 @@
var/old_heat_capacity = air.heat_capacity()
var/carbon_efficency = min(cached_gases["plasma"][MOLES]/cached_gases["co2"][MOLES],MAX_CARBON_EFFICENCY)
var/reaction_energy = air.thermal_energy()
var/reaction_energy = THERMAL_ENERGY(air)
var/moles_impurities = air.total_moles()-(cached_gases["plasma"][MOLES]+cached_gases["co2"][MOLES])
var/plasma_fused = (PLASMA_FUSED_COEFFICENT*carbon_efficency)*(temperature/PLASMA_BINDING_ENERGY)
var/carbon_catalyzed = (CARBON_CATALYST_COEFFICENT*carbon_efficency)*(temperature/PLASMA_BINDING_ENERGY)
var/oxygen_added = carbon_catalyzed
var/nitrogen_added = (plasma_fused-oxygen_added)-(air.thermal_energy()/PLASMA_BINDING_ENERGY)
var/nitrogen_added = (plasma_fused-oxygen_added)-(THERMAL_ENERGY(air)/PLASMA_BINDING_ENERGY)
reaction_energy = max(reaction_energy+((carbon_efficency*cached_gases["plasma"][MOLES])/((moles_impurities/carbon_efficency)+2)*10)+((plasma_fused/(moles_impurities/carbon_efficency))*PLASMA_BINDING_ENERGY),0)

View File

@@ -232,7 +232,7 @@
total_gas_mixture.merge(G)
total_thermal_energy += G.thermal_energy()
total_thermal_energy += THERMAL_ENERGY(G)
total_heat_capacity += G.heat_capacity()
total_gas_mixture.temperature = total_heat_capacity ? total_thermal_energy/total_heat_capacity : 0