Gas math stripping

Removed update_values(). RIP, shine on you CPU diamond.
Removed get_moles_by_id and get_archived_moles_by_id, all moles are now accessed directly to reduce call cost.
Added set_temperature and set_volume procs which recalc pressure when temperature or pressure change.
Heat_capacity is now a var updated when gases update.
Modified adjust_gas to use set_gas, modified set_gas to alter heat_capacity, total_moles, and pressure as needed.
This commit is contained in:
ComicIronic
2015-05-06 20:50:27 +01:00
parent 9d5911b404
commit c1a58dc3c3
95 changed files with 509 additions and 618 deletions

View File

@@ -55,14 +55,14 @@ Thus, the two variables affect pump operation are set in New():
if((stat & (NOPOWER|BROKEN)) || !on)
return
var/output_starting_pressure = air2.return_pressure()
var/output_starting_pressure = air2.pressure
if( (target_pressure - output_starting_pressure) < 0.01)
//No need to pump gas if target is already reached!
return
//Calculate necessary moles to transfer using PV=nRT
if((air1.total_moles() > 0) && (air1.temperature>0))
if((air1.total_moles > 0) && (air1.temperature>0))
var/pressure_delta = target_pressure - output_starting_pressure
var/transfer_moles = pressure_delta*air2.volume/(air1.temperature * R_IDEAL_GAS_EQUATION)