REVERT GAS DATUMS UNTIL COMIC FIXES THE PERFORMANCE ISSUES: PLEASE WORK ON THE GASDATUMS BRANCH https://github.com/d3athrow/vgstation13/tree/gasdatums in the mean time.

This commit is contained in:
D3athrow
2015-05-10 22:09:18 -05:00
parent 4a7106215c
commit 9c21244617
173 changed files with 3439 additions and 2786 deletions

View File

@@ -135,24 +135,25 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
//add plasma from the surrounding environment
var/datum/gas_mixture/environment = loc.return_air()
var/held_plasma_moles = held_plasma.gases[PLASMA]
//hack in some stuff to remove plasma from the air because SCIENCE
//the amount of plasma pulled in each update is relative to the field strength, with 50T (max field strength) = 100% of area covered by the field
//at minimum strength, 0.25% of the field volume is pulled in per update (?)
//have a max of 1000 moles suspended
if(held_plasma_moles < transfer_ratio * 1000)
var/moles_covered = environment.pressure*volume_covered/(environment.temperature * R_IDEAL_GAS_EQUATION)
if(held_plasma.toxins < transfer_ratio * 1000)
var/moles_covered = environment.return_pressure()*volume_covered/(environment.temperature * R_IDEAL_GAS_EQUATION)
//world << "<span class='notice'>moles_covered: [moles_covered]</span>"
//
var/datum/gas_mixture/gas_covered = environment.remove(moles_covered)
var/datum/gas_mixture/plasma_captured = new /datum/gas_mixture()
//
plasma_captured.set_gas(PLASMA, round(gas_covered.gases[PLASMA] * transfer_ratio))
plasma_captured.toxins = round(gas_covered.toxins * transfer_ratio)
//world << "<span class='warning'>[plasma_captured.toxins] moles of plasma captured</span>"
plasma_captured.set_temperature(gas_covered.temperature)
plasma_captured.temperature = gas_covered.temperature
plasma_captured.update_values()
//
gas_covered.adjust_gas(PLASMA, -plasma_captured.gases[PLASMA])
gas_covered.toxins -= plasma_captured.toxins
gas_covered.update_values()
//
held_plasma.merge(plasma_captured)
//
@@ -170,32 +171,32 @@ Deuterium-tritium fusion: 4.5 x 10^7 K
//change held plasma temp according to energy levels
//SPECIFIC_HEAT_TOXIN
if(mega_energy > 0 && held_plasma_moles)
var/heat_capacity = held_plasma.heat_capacity//200 * number of plasma moles
if(mega_energy > 0 && held_plasma.toxins)
var/heat_capacity = held_plasma.heat_capacity()//200 * number of plasma moles
if(heat_capacity > 0.0003) //formerly MINIMUM_HEAT_CAPACITY
held_plasma.set_temperature((heat_capacity + mega_energy * 35000)/heat_capacity)
held_plasma.temperature = (heat_capacity + mega_energy * 35000)/heat_capacity
//if there is too much plasma in the field, lose some
/*if( held_plasma.toxins > (MOLES_CELLSTANDARD * 7) * (50 / field_strength) )
LosePlasma()*/
if(held_plasma_moles > 1)
if(held_plasma.toxins > 1)
//lose a random amount of plasma back into the air, increased by the field strength (want to switch this over to frequency eventually)
var/loss_ratio = rand() * (0.05 + (0.05 * 50 / field_strength))
//world << "lost [loss_ratio*100]% of held plasma"
//
var/datum/gas_mixture/plasma_lost = new
plasma_lost.set_temperature(held_plasma.temperature)
plasma_lost.temperature = held_plasma.temperature
//
plasma_lost.set_gas(PLASMA, held_plasma_moles * loss_ratio)
plasma_lost.toxins = held_plasma.toxins * loss_ratio
//plasma_lost.update_values()
held_plasma.adjust_gas(PLASMA, -held_plasma_moles * loss_ratio)
held_plasma.toxins -= held_plasma.toxins * loss_ratio
//held_plasma.update_values()
//
environment.merge(plasma_lost)
radiation += loss_ratio * mega_energy * 0.1
mega_energy -= loss_ratio * mega_energy * 0.1
else
held_plasma.set_gas(PLASMA, 0)
held_plasma.toxins = 0
//held_plasma.update_values()
//handle some reactants formatting