Find and replace strikes again

This commit is contained in:
Bjorn Neergaard
2016-02-06 03:00:20 -06:00
parent 8d3e80be2a
commit 159ca02294
3 changed files with 24 additions and 22 deletions
@@ -11,19 +11,22 @@ var/list/meta_gas_info = meta_gas_list() //see ATMOSPHERICS/gas_types.dm
var/list/gaslist_cache = null
/proc/gaslist(id)
var/list/cached_gas
if(!gaslist_cache)
gaslist_cache = new(meta_gas_info.len)
if(!gaslist_cache[id])
if(!meta_gas_info[id])
CRASH("Gas [id] does not exist!")
cached_gas = new(3)
gaslist_cache[id] = cached_gas
var/list/gas = new(3)
gas[MOLES] = 0
gas[ARCHIVE] = 0
gas[meta_gas_info] = meta_gas_info[id]
gaslist_cache[id] = gas
var/list/cached_gas = gaslist_cache[id]
cached_gas[MOLES] = 0
cached_gas[ARCHIVE] = 0
cached_gas[GAS_META] = meta_gas_info[id]
else
cached_gas = gaslist_cache[id]
return cached_gas.Copy()
/datum/gas_mixture
@@ -34,12 +37,12 @@ var/list/gaslist_cache = null
var/last_share
var/tmp/fuel_burnt
/datum/gas_mixture/New(vol = CELL_VOLUME)
/datum/gas_mixture/New(volume = CELL_VOLUME)
..()
gases = new
temperature = 0
temperature_archived = 0
volume = 0
src.volume = volume
last_share = 0
fuel_burnt = 0
@@ -99,9 +102,9 @@ var/list/gaslist_cache = null
. += cached_gases[id][MOLES]
/datum/gas_mixture/proc/return_pressure()
. = 0
if(volume > 0)
. = total_moles() * R_IDEAL_GAS_EQUATION * temperature / volume
if(volume > 0) // to prevent division by zero
return total_moles() * R_IDEAL_GAS_EQUATION * temperature / volume
return 0
/datum/gas_mixture/proc/return_temperature()
return temperature
@@ -379,9 +382,9 @@ var/list/gaslist_cache = null
/datum/gas_mixture/copy_from_turf(turf/model)
var/list/cached_gases = gases
assert_gases(arglist(hardcoded_gases))
temperature = model.temperature
assert_gases(arglist(hardcoded_gases))
cached_gases["o2"][MOLES] = model.oxygen
cached_gases["n2"][MOLES] = model.nitrogen
cached_gases["plasma"][MOLES] = model.toxins
@@ -1,17 +1,17 @@
var/list/hardcoded_gases = list("o2","n2","co2","plasma") //the main four gases, which were at one time hardcoded
/proc/meta_gas_list()
. = list()
. = new /list
for(var/gas_path in subtypesof(/datum/gas))
var/list/gas_info = new(4)
var/datum/gas/g = gas_path
var/datum/gas/gas = gas_path
gas_info[META_GAS_SPECIFIC_HEAT] = initial(g.specific_heat)
gas_info[META_GAS_NAME] = initial(g.name)
gas_info[META_GAS_MOLES_VISIBLE] = initial(g.moles_visible)
if(gas_info[META_GAS_MOLES_VISIBLE] != null)
gas_info[META_GAS_OVERLAY] = new /obj/effect/overlay/gas(initial(g.gas_overlay))
.[initial(g.id)] = gas_info
gas_info[META_GAS_SPECIFIC_HEAT] = initial(gas.specific_heat)
gas_info[META_GAS_NAME] = initial(gas.name)
gas_info[META_GAS_MOLES_VISIBLE] = initial(gas.moles_visible)
if(initial(gas.moles_visible) != null)
gas_info[META_GAS_OVERLAY] = new /obj/effect/overlay/gas(initial(gas.gas_overlay))
.[initial(gas.id)] = gas_info
/*||||||||||||||/----------\||||||||||||||*\
||||||||||||||||[GAS DATUMS]||||||||||||||||