fuck atmos - attempts to optimize atmos by removing GAS_META from the gas mixture meta list and removing the usage of gas archive

This commit is contained in:
deathride58
2019-04-11 17:07:11 -04:00
parent 67e26a8ad3
commit 8b75240d89
57 changed files with 347 additions and 383 deletions

View File

@@ -243,8 +243,7 @@
//HELPERS //HELPERS
#define THERMAL_ENERGY(gas) (gas.temperature * gas.heat_capacity()) #define THERMAL_ENERGY(gas) (gas.temperature * gas.heat_capacity())
#define ADD_GAS(gas_id, out_list)\ #define ADD_GAS(gas_id, out_list) out_list[gas_id] = 0;
var/list/tmp_gaslist = GLOB.gaslist_cache[gas_id]; out_list[gas_id] = tmp_gaslist.Copy();
#define ASSERT_GAS(gas_id, gas_mixture) if (!gas_mixture.gases[gas_id]) { ADD_GAS(gas_id, gas_mixture.gases) }; #define ASSERT_GAS(gas_id, gas_mixture) if (!gas_mixture.gases[gas_id]) { ADD_GAS(gas_id, gas_mixture.gases) };
@@ -253,9 +252,10 @@
#define TOTAL_MOLES(cached_gases, out_var)\ #define TOTAL_MOLES(cached_gases, out_var)\
out_var = 0;\ out_var = 0;\
for(var/total_moles_id in cached_gases){\ for(var/total_moles_id in cached_gases){\
out_var += cached_gases[total_moles_id][MOLES];\ out_var += cached_gases[total_moles_id];\
} }
#define ARCHIVE_TEMPERATURE(gas) gas.temperature_archived = gas.temperature
GLOBAL_LIST_INIT(pipe_paint_colors, list( GLOBAL_LIST_INIT(pipe_paint_colors, list(
"amethyst" = rgb(130,43,255), //supplymain "amethyst" = rgb(130,43,255), //supplymain

View File

@@ -364,15 +364,15 @@
/datum/symptom/heal/plasma/CanHeal(datum/disease/advance/A) /datum/symptom/heal/plasma/CanHeal(datum/disease/advance/A)
var/mob/living/M = A.affected_mob var/mob/living/M = A.affected_mob
var/datum/gas_mixture/environment var/datum/gas_mixture/environment
var/list/gases var/plasmamount
. = 0 . = 0
if(M.loc) if(M.loc)
environment = M.loc.return_air() environment = M.loc.return_air()
if(environment) if(environment)
gases = environment.gases plasmamount = environment.gases["plasma"]
if(gases["plasma"] && gases["plasma"][MOLES] > gases["plasma"][GAS_META][META_GAS_MOLES_VISIBLE]) //if there's enough plasma in the air to see if(plasmamount && plasmamount > GLOB.meta_gas_info[/datum/gas/plasma][META_GAS_MOLES_VISIBLE]) //if there's enough plasma in the air to see
. += power * 0.5 . += power * 0.5
if(M.reagents.has_reagent("plasma")) if(M.reagents.has_reagent("plasma"))
. += power * 0.75 . += power * 0.75

View File

@@ -103,11 +103,11 @@
// Can most things breathe? // Can most things breathe?
if(trace_gases) if(trace_gases)
continue continue
if(!(A_gases[/datum/gas/oxygen] && A_gases[/datum/gas/oxygen][MOLES] >= 16)) if(A_gases[/datum/gas/oxygen] >= 16)
continue continue
if(A_gases[/datum/gas/plasma]) if(A_gases[/datum/gas/plasma])
continue continue
if(A_gases[/datum/gas/carbon_dioxide] && A_gases[/datum/gas/carbon_dioxide][MOLES] >= 10) if(A_gases[/datum/gas/carbon_dioxide] >= 10)
continue continue
// Aim for goldilocks temperatures and pressure // Aim for goldilocks temperatures and pressure

View File

@@ -124,7 +124,7 @@
/datum/objective_item/steal/plasma/check_special_completion(obj/item/tank/T) /datum/objective_item/steal/plasma/check_special_completion(obj/item/tank/T)
var/target_amount = text2num(name) var/target_amount = text2num(name)
var/found_amount = 0 var/found_amount = 0
found_amount += T.air_contents.gases[/datum/gas/plasma] ? T.air_contents.gases[/datum/gas/plasma][MOLES] : 0 found_amount += T.air_contents.gases[/datum/gas/plasma]
return found_amount>=target_amount return found_amount>=target_amount

View File

@@ -59,8 +59,8 @@
var/total_moles = air_sample.total_moles() var/total_moles = air_sample.total_moles()
if(total_moles) if(total_moles)
for(var/gas_id in air_sample.gases) for(var/gas_id in air_sample.gases)
var/gas_name = air_sample.gases[gas_id][GAS_META][META_GAS_NAME] var/gas_name = GLOB.meta_gas_info[gas_id][META_GAS_NAME]
signal.data["gases"][gas_name] = air_sample.gases[gas_id][MOLES] / total_moles * 100 signal.data["gases"][gas_name] = air_sample.gases[gas_id] / total_moles * 100
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA) radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)

View File

@@ -423,12 +423,12 @@
var/datum/gas_mixture/GM = new var/datum/gas_mixture/GM = new
GM.add_gas(/datum/gas/plasma) GM.add_gas(/datum/gas/plasma)
if(prob(10)) if(prob(10))
GM.gases[/datum/gas/plasma][MOLES] += 100 GM.gases[/datum/gas/plasma] += 100
GM.temperature = 1500+T0C //should be enough to start a fire GM.temperature = 1500+T0C //should be enough to start a fire
T.visible_message("[src] suddenly disgorges a cloud of heated plasma.") T.visible_message("[src] suddenly disgorges a cloud of heated plasma.")
qdel(src) qdel(src)
else else
GM.gases[/datum/gas/plasma][MOLES] += 5 GM.gases[/datum/gas/plasma] += 5
GM.temperature = istype(T) ? T.air.return_temperature() : T20C GM.temperature = istype(T) ? T.air.return_temperature() : T20C
T.visible_message("[src] suddenly disgorges a cloud of plasma.") T.visible_message("[src] suddenly disgorges a cloud of plasma.")
T.assume_air(GM) T.assume_air(GM)

View File

@@ -238,8 +238,8 @@
cabin_air.temperature = T20C cabin_air.temperature = T20C
cabin_air.volume = 200 cabin_air.volume = 200
cabin_air.add_gases(/datum/gas/oxygen, /datum/gas/nitrogen) cabin_air.add_gases(/datum/gas/oxygen, /datum/gas/nitrogen)
cabin_air.gases[/datum/gas/oxygen][MOLES] = O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature) cabin_air.gases[/datum/gas/oxygen] = O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
cabin_air.gases[/datum/gas/nitrogen][MOLES] = N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature) cabin_air.gases[/datum/gas/nitrogen] = N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
return cabin_air return cabin_air
/obj/mecha/proc/add_radio() /obj/mecha/proc/add_radio()

View File

@@ -40,8 +40,8 @@
if(hotspot && istype(T) && T.air) if(hotspot && istype(T) && T.air)
qdel(hotspot) qdel(hotspot)
var/datum/gas_mixture/G = T.air var/datum/gas_mixture/G = T.air
var/plas_amt = min(30,G.gases[/datum/gas/plasma][MOLES]) //Absorb some plasma var/plas_amt = min(30,G.gases[/datum/gas/plasma]) //Absorb some plasma
G.gases[/datum/gas/plasma][MOLES] -= plas_amt G.gases[/datum/gas/plasma] -= plas_amt
absorbed_plasma += plas_amt absorbed_plasma += plas_amt
if(G.temperature > T20C) if(G.temperature > T20C)
G.temperature = max(G.temperature/2,T20C) G.temperature = max(G.temperature/2,T20C)
@@ -324,7 +324,7 @@
for(var/I in G_gases) for(var/I in G_gases)
if(I == /datum/gas/oxygen || I == /datum/gas/nitrogen) if(I == /datum/gas/oxygen || I == /datum/gas/nitrogen)
continue continue
G_gases[I][MOLES] = 0 G_gases[I] = 0
G.garbage_collect() G.garbage_collect()
O.air_update_turf() O.air_update_turf()
for(var/obj/machinery/atmospherics/components/unary/U in O) for(var/obj/machinery/atmospherics/components/unary/U in O)

View File

@@ -173,8 +173,8 @@
var/list/G_gases = G.gases var/list/G_gases = G.gases
if(G_gases[/datum/gas/plasma]) if(G_gases[/datum/gas/plasma])
G.assert_gas(/datum/gas/nitrogen) G.assert_gas(/datum/gas/nitrogen)
G_gases[/datum/gas/nitrogen][MOLES] += (G_gases[/datum/gas/plasma][MOLES]) G_gases[/datum/gas/nitrogen] += (G_gases[/datum/gas/plasma])
G_gases[/datum/gas/plasma][MOLES] = 0 G_gases[/datum/gas/plasma] = 0
G.garbage_collect() G.garbage_collect()
if (weldvents) if (weldvents)
for(var/obj/machinery/atmospherics/components/unary/U in T) for(var/obj/machinery/atmospherics/components/unary/U in T)

View File

@@ -20,11 +20,11 @@
var/obj/item/tank/internals/oxygen/OT = new(V) var/obj/item/tank/internals/oxygen/OT = new(V)
PT.air_contents.assert_gas(/datum/gas/plasma) PT.air_contents.assert_gas(/datum/gas/plasma)
PT.air_contents.gases[/datum/gas/plasma][MOLES] = pressure_p*PT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_p)) PT.air_contents.gases[/datum/gas/plasma] = pressure_p*PT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_p))
PT.air_contents.temperature = CELSIUS_TO_KELVIN(temp_p) PT.air_contents.temperature = CELSIUS_TO_KELVIN(temp_p)
OT.air_contents.assert_gas(/datum/gas/oxygen) OT.air_contents.assert_gas(/datum/gas/oxygen)
OT.air_contents.gases[/datum/gas/oxygen][MOLES] = pressure_o*OT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o)) OT.air_contents.gases[/datum/gas/oxygen] = pressure_o*OT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o))
OT.air_contents.temperature = CELSIUS_TO_KELVIN(temp_o) OT.air_contents.temperature = CELSIUS_TO_KELVIN(temp_o)
V.tank_one = PT V.tank_one = PT

View File

@@ -249,8 +249,8 @@
/obj/effect/chrono_field/return_air() //we always have nominal air and temperature /obj/effect/chrono_field/return_air() //we always have nominal air and temperature
var/datum/gas_mixture/GM = new var/datum/gas_mixture/GM = new
GM.add_gases(/datum/gas/oxygen, /datum/gas/nitrogen) GM.add_gases(/datum/gas/oxygen, /datum/gas/nitrogen)
GM.gases[/datum/gas/oxygen][MOLES] = MOLES_O2STANDARD GM.gases[/datum/gas/oxygen] = MOLES_O2STANDARD
GM.gases[/datum/gas/nitrogen][MOLES] = MOLES_N2STANDARD GM.gases[/datum/gas/nitrogen] = MOLES_N2STANDARD
GM.temperature = T20C GM.temperature = T20C
return GM return GM

View File

@@ -358,9 +358,9 @@ GLOBAL_LIST_EMPTY(PDAs)
if (total_moles) if (total_moles)
for(var/id in env_gases) for(var/id in env_gases)
var/gas_level = env_gases[id][MOLES]/total_moles var/gas_level = env_gases[id]/total_moles
if(gas_level > 0) if(gas_level > 0)
dat += "[env_gases[id][GAS_META][META_GAS_NAME]]: [round(gas_level*100, 0.01)]%<br>" dat += "[GLOB.meta_gas_info[id][META_GAS_NAME]]: [round(gas_level*100, 0.01)]%<br>"
dat += "Temperature: [round(environment.temperature-T0C)]&deg;C<br>" dat += "Temperature: [round(environment.temperature-T0C)]&deg;C<br>"
dat += "<br>" dat += "<br>"

View File

@@ -420,38 +420,38 @@ SLIME SCANNER
var/list/env_gases = environment.gases var/list/env_gases = environment.gases
environment.assert_gases(arglist(GLOB.hardcoded_gases)) environment.assert_gases(arglist(GLOB.hardcoded_gases))
var/o2_concentration = env_gases[/datum/gas/oxygen][MOLES]/total_moles var/o2_concentration = env_gases[/datum/gas/oxygen]/total_moles
var/n2_concentration = env_gases[/datum/gas/nitrogen][MOLES]/total_moles var/n2_concentration = env_gases[/datum/gas/nitrogen]/total_moles
var/co2_concentration = env_gases[/datum/gas/carbon_dioxide][MOLES]/total_moles var/co2_concentration = env_gases[/datum/gas/carbon_dioxide]/total_moles
var/plasma_concentration = env_gases[/datum/gas/plasma][MOLES]/total_moles var/plasma_concentration = env_gases[/datum/gas/plasma]/total_moles
if(abs(n2_concentration - N2STANDARD) < 20) if(abs(n2_concentration - N2STANDARD) < 20)
to_chat(user, "<span class='info'>Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(env_gases[/datum/gas/nitrogen][MOLES], 0.01)] mol)</span>") to_chat(user, "<span class='info'>Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(env_gases[/datum/gas/nitrogen], 0.01)] mol)</span>")
else else
to_chat(user, "<span class='alert'>Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(env_gases[/datum/gas/nitrogen][MOLES], 0.01)] mol)</span>") to_chat(user, "<span class='alert'>Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(env_gases[/datum/gas/nitrogen], 0.01)] mol)</span>")
if(abs(o2_concentration - O2STANDARD) < 2) if(abs(o2_concentration - O2STANDARD) < 2)
to_chat(user, "<span class='info'>Oxygen: [round(o2_concentration*100, 0.01)] % ([round(env_gases[/datum/gas/oxygen][MOLES], 0.01)] mol)</span>") to_chat(user, "<span class='info'>Oxygen: [round(o2_concentration*100, 0.01)] % ([round(env_gases[/datum/gas/oxygen], 0.01)] mol)</span>")
else else
to_chat(user, "<span class='alert'>Oxygen: [round(o2_concentration*100, 0.01)] % ([round(env_gases[/datum/gas/oxygen][MOLES], 0.01)] mol)</span>") to_chat(user, "<span class='alert'>Oxygen: [round(o2_concentration*100, 0.01)] % ([round(env_gases[/datum/gas/oxygen], 0.01)] mol)</span>")
if(co2_concentration > 0.01) if(co2_concentration > 0.01)
to_chat(user, "<span class='alert'>CO2: [round(co2_concentration*100, 0.01)] % ([round(env_gases[/datum/gas/carbon_dioxide][MOLES], 0.01)] mol)</span>") to_chat(user, "<span class='alert'>CO2: [round(co2_concentration*100, 0.01)] % ([round(env_gases[/datum/gas/carbon_dioxide], 0.01)] mol)</span>")
else else
to_chat(user, "<span class='info'>CO2: [round(co2_concentration*100, 0.01)] % ([round(env_gases[/datum/gas/carbon_dioxide][MOLES], 0.01)] mol)</span>") to_chat(user, "<span class='info'>CO2: [round(co2_concentration*100, 0.01)] % ([round(env_gases[/datum/gas/carbon_dioxide], 0.01)] mol)</span>")
if(plasma_concentration > 0.005) if(plasma_concentration > 0.005)
to_chat(user, "<span class='alert'>Plasma: [round(plasma_concentration*100, 0.01)] % ([round(env_gases[/datum/gas/plasma][MOLES], 0.01)] mol)</span>") to_chat(user, "<span class='alert'>Plasma: [round(plasma_concentration*100, 0.01)] % ([round(env_gases[/datum/gas/plasma], 0.01)] mol)</span>")
else else
to_chat(user, "<span class='info'>Plasma: [round(plasma_concentration*100, 0.01)] % ([round(env_gases[/datum/gas/plasma][MOLES], 0.01)] mol)</span>") to_chat(user, "<span class='info'>Plasma: [round(plasma_concentration*100, 0.01)] % ([round(env_gases[/datum/gas/plasma], 0.01)] mol)</span>")
environment.garbage_collect() environment.garbage_collect()
for(var/id in env_gases) for(var/id in env_gases)
if(id in GLOB.hardcoded_gases) if(id in GLOB.hardcoded_gases)
continue continue
var/gas_concentration = env_gases[id][MOLES]/total_moles var/gas_concentration = env_gases[id]/total_moles
to_chat(user, "<span class='alert'>[env_gases[id][GAS_META][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] % ([round(env_gases[id][MOLES], 0.01)] mol)</span>") to_chat(user, "<span class='alert'>[GLOB.meta_gas_info[id][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] % ([round(env_gases[id], 0.01)] mol)</span>")
to_chat(user, "<span class='info'>Temperature: [round(environment.temperature-T0C, 0.01)] &deg;C ([round(environment.temperature, 0.01)] K)</span>") to_chat(user, "<span class='info'>Temperature: [round(environment.temperature-T0C, 0.01)] &deg;C ([round(environment.temperature, 0.01)] K)</span>")
/obj/item/analyzer/AltClick(mob/user) //Barometer output for measuring when the next storm happens /obj/item/analyzer/AltClick(mob/user) //Barometer output for measuring when the next storm happens
@@ -541,8 +541,8 @@ SLIME SCANNER
var/list/cached_gases = air_contents.gases var/list/cached_gases = air_contents.gases
for(var/id in cached_gases) for(var/id in cached_gases)
var/gas_concentration = cached_gases[id][MOLES]/total_moles var/gas_concentration = cached_gases[id]/total_moles
to_chat(user, "<span class='notice'>[cached_gases[id][GAS_META][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] % ([round(cached_gases[id][MOLES], 0.01)] mol)</span>") to_chat(user, "<span class='notice'>[GLOB.meta_gas_info[id][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] % ([round(cached_gases[id], 0.01)] mol)</span>")
to_chat(user, "<span class='notice'>Temperature: [round(temperature - T0C,0.01)] &deg;C ([round(temperature, 0.01)] K)</span>") to_chat(user, "<span class='notice'>Temperature: [round(temperature - T0C,0.01)] &deg;C ([round(temperature, 0.01)] K)</span>")
else else

View File

@@ -205,7 +205,7 @@
//Transfer 5% of current tank air contents to turf //Transfer 5% of current tank air contents to turf
var/datum/gas_mixture/air_transfer = ptank.air_contents.remove_ratio(release_amount) var/datum/gas_mixture/air_transfer = ptank.air_contents.remove_ratio(release_amount)
if(air_transfer.gases[/datum/gas/plasma]) if(air_transfer.gases[/datum/gas/plasma])
air_transfer.gases[/datum/gas/plasma][MOLES] *= 5 air_transfer.gases[/datum/gas/plasma] *= 5
target.assume_air(air_transfer) target.assume_air(air_transfer)
//Burn it based on transfered gas //Burn it based on transfered gas
target.hotspot_expose((ptank.air_contents.temperature*2) + 380,500) target.hotspot_expose((ptank.air_contents.temperature*2) + 380,500)

View File

@@ -18,7 +18,7 @@
..() ..()
if(gas_type) if(gas_type)
air_contents.assert_gas(gas_type) air_contents.assert_gas(gas_type)
air_contents.gases[gas_type][MOLES] = (6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C) air_contents.gases[gas_type] = (6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C)
ion_trail = new ion_trail = new
ion_trail.set_up(src) ion_trail.set_up(src)

View File

@@ -22,7 +22,7 @@
/obj/item/tank/internals/oxygen/New() /obj/item/tank/internals/oxygen/New()
..() ..()
air_contents.assert_gas(/datum/gas/oxygen) air_contents.assert_gas(/datum/gas/oxygen)
air_contents.gases[/datum/gas/oxygen][MOLES] = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) air_contents.gases[/datum/gas/oxygen] = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return return
@@ -50,8 +50,8 @@
/obj/item/tank/internals/anesthetic/New() /obj/item/tank/internals/anesthetic/New()
..() ..()
air_contents.assert_gases(/datum/gas/oxygen, /datum/gas/nitrous_oxide) air_contents.assert_gases(/datum/gas/oxygen, /datum/gas/nitrous_oxide)
air_contents.gases[/datum/gas/oxygen][MOLES] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD air_contents.gases[/datum/gas/oxygen] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD
air_contents.gases[/datum/gas/nitrous_oxide][MOLES] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD air_contents.gases[/datum/gas/nitrous_oxide] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD
return return
/* /*
@@ -68,8 +68,8 @@
/obj/item/tank/internals/air/New() /obj/item/tank/internals/air/New()
..() ..()
air_contents.assert_gases(/datum/gas/oxygen, /datum/gas/nitrogen) air_contents.assert_gases(/datum/gas/oxygen, /datum/gas/nitrogen)
air_contents.gases[/datum/gas/oxygen][MOLES] = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD air_contents.gases[/datum/gas/oxygen] = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD
air_contents.gases[/datum/gas/nitrogen][MOLES] = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD air_contents.gases[/datum/gas/nitrogen] = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD
return return
@@ -88,7 +88,7 @@
/obj/item/tank/internals/plasma/New() /obj/item/tank/internals/plasma/New()
..() ..()
air_contents.assert_gas(/datum/gas/plasma) air_contents.assert_gas(/datum/gas/plasma)
air_contents.gases[/datum/gas/plasma][MOLES] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) air_contents.gases[/datum/gas/plasma] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return return
/obj/item/tank/internals/plasma/attackby(obj/item/W, mob/user, params) /obj/item/tank/internals/plasma/attackby(obj/item/W, mob/user, params)
@@ -106,7 +106,7 @@
/obj/item/tank/internals/plasma/full/New() /obj/item/tank/internals/plasma/full/New()
..() // Plasma asserted in parent ..() // Plasma asserted in parent
air_contents.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) air_contents.gases[/datum/gas/plasma] = (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return return
@@ -125,12 +125,12 @@
/obj/item/tank/internals/plasmaman/New() /obj/item/tank/internals/plasmaman/New()
..() ..()
air_contents.assert_gas(/datum/gas/plasma) air_contents.assert_gas(/datum/gas/plasma)
air_contents.gases[/datum/gas/plasma][MOLES] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) air_contents.gases[/datum/gas/plasma] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return return
/obj/item/tank/internals/plasmaman/full/New() /obj/item/tank/internals/plasmaman/full/New()
..() // Plasma asserted in parent ..() // Plasma asserted in parent
air_contents.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) air_contents.gases[/datum/gas/plasma] = (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return return
@@ -144,7 +144,7 @@
/obj/item/tank/internals/plasmaman/belt/full/New() /obj/item/tank/internals/plasmaman/belt/full/New()
..() // Plasma asserted in parent ..() // Plasma asserted in parent
air_contents.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) air_contents.gases[/datum/gas/plasma] = (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return return
@@ -167,7 +167,7 @@
/obj/item/tank/internals/emergency_oxygen/New() /obj/item/tank/internals/emergency_oxygen/New()
..() ..()
air_contents.assert_gas(/datum/gas/oxygen) air_contents.assert_gas(/datum/gas/oxygen)
air_contents.gases[/datum/gas/oxygen][MOLES] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) air_contents.gases[/datum/gas/oxygen] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return return
/obj/item/tank/internals/emergency_oxygen/engi /obj/item/tank/internals/emergency_oxygen/engi

View File

@@ -152,8 +152,8 @@
pod_moving = 0 pod_moving = 0
if(!QDELETED(pod)) if(!QDELETED(pod))
var/datum/gas_mixture/floor_mixture = loc.return_air() var/datum/gas_mixture/floor_mixture = loc.return_air()
floor_mixture.archive() ARCHIVE_TEMPERATURE(floor_mixture)
pod.air_contents.archive() ARCHIVE_TEMPERATURE(pod.air_contents)
pod.air_contents.share(floor_mixture, 1) //mix the pod's gas mixture with the tile it's on pod.air_contents.share(floor_mixture, 1) //mix the pod's gas mixture with the tile it's on
air_update_turf() air_update_turf()

View File

@@ -12,8 +12,8 @@
/obj/structure/transit_tube_pod/Initialize() /obj/structure/transit_tube_pod/Initialize()
. = ..() . = ..()
air_contents.add_gases(/datum/gas/oxygen, /datum/gas/nitrogen) air_contents.add_gases(/datum/gas/oxygen, /datum/gas/nitrogen)
air_contents.gases[/datum/gas/oxygen][MOLES] = MOLES_O2STANDARD air_contents.gases[/datum/gas/oxygen] = MOLES_O2STANDARD
air_contents.gases[/datum/gas/nitrogen][MOLES] = MOLES_N2STANDARD air_contents.gases[/datum/gas/nitrogen] = MOLES_N2STANDARD
air_contents.temperature = T20C air_contents.temperature = T20C

View File

@@ -298,14 +298,14 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
var/list/S_gases = S.air.gases var/list/S_gases = S.air.gases
for(var/id in S_gases) for(var/id in S_gases)
ASSERT_GAS(id, total) ASSERT_GAS(id, total)
total_gases[id][MOLES] += S_gases[id][MOLES] total_gases[id] += S_gases[id]
total.temperature += S.air.temperature total.temperature += S.air.temperature
air.copy_from(total) air.copy_from(total)
var/list/air_gases = air.gases var/list/air_gases = air.gases
for(var/id in air_gases) for(var/id in air_gases)
air_gases[id][MOLES] /= turf_count //Averages contents of the turfs, ignoring walls and the like air_gases[id] /= turf_count //Averages contents of the turfs, ignoring walls and the like
air.temperature /= turf_count air.temperature /= turf_count
SSair.add_to_active(src) SSair.add_to_active(src)

View File

@@ -289,9 +289,9 @@
/turf/open/rad_act(pulse_strength) /turf/open/rad_act(pulse_strength)
. = ..() . = ..()
if (air.gases[/datum/gas/carbon_dioxide] && air.gases[/datum/gas/oxygen]) if (air.gases[/datum/gas/carbon_dioxide] && air.gases[/datum/gas/oxygen])
pulse_strength = min(pulse_strength,air.gases[/datum/gas/carbon_dioxide][MOLES]*1000,air.gases[/datum/gas/oxygen][MOLES]*2000) //Ensures matter is conserved properly pulse_strength = min(pulse_strength,air.gases[/datum/gas/carbon_dioxide]*1000,air.gases[/datum/gas/oxygen]*2000) //Ensures matter is conserved properly
air.gases[/datum/gas/carbon_dioxide][MOLES]=max(air.gases[/datum/gas/carbon_dioxide][MOLES]-(pulse_strength/1000),0) air.gases[/datum/gas/carbon_dioxide]=max(air.gases[/datum/gas/carbon_dioxide]-(pulse_strength/1000),0)
air.gases[/datum/gas/oxygen][MOLES]=max(air.gases[/datum/gas/oxygen][MOLES]-(pulse_strength/2000),0) air.gases[/datum/gas/oxygen]=max(air.gases[/datum/gas/oxygen]-(pulse_strength/2000),0)
air.assert_gas(/datum/gas/pluoxium) air.assert_gas(/datum/gas/pluoxium)
air.gases[/datum/gas/pluoxium][MOLES]+=(pulse_strength/4000) air.gases[/datum/gas/pluoxium]+=(pulse_strength/4000)
air.garbage_collect() air.garbage_collect()

View File

@@ -842,7 +842,7 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention)
if(!Rad.loaded_tank) if(!Rad.loaded_tank)
var/obj/item/tank/internals/plasma/Plasma = new/obj/item/tank/internals/plasma(Rad) var/obj/item/tank/internals/plasma/Plasma = new/obj/item/tank/internals/plasma(Rad)
Plasma.air_contents.assert_gas(/datum/gas/plasma) Plasma.air_contents.assert_gas(/datum/gas/plasma)
Plasma.air_contents.gases[/datum/gas/plasma][MOLES] = 70 Plasma.air_contents.gases[/datum/gas/plasma] = 70
Rad.drainratio = 0 Rad.drainratio = 0
Rad.loaded_tank = Plasma Rad.loaded_tank = Plasma
Plasma.forceMove(Rad) Plasma.forceMove(Rad)

View File

@@ -9,10 +9,9 @@
var/list/lines = list("<span class='adminnotice'>[AREACOORD(target)]: [env.temperature] K ([env.temperature - T0C] C), [env.return_pressure()] kPa[(burning)?(", <font color='red'>burning</font>"):(null)]</span>") var/list/lines = list("<span class='adminnotice'>[AREACOORD(target)]: [env.temperature] K ([env.temperature - T0C] C), [env.return_pressure()] kPa[(burning)?(", <font color='red'>burning</font>"):(null)]</span>")
for(var/id in env_gases) for(var/id in env_gases)
var/gas = env_gases[id] var/moles = env_gases[id]
var/moles = gas[MOLES]
if (moles >= 0.00001) if (moles >= 0.00001)
lines += "[gas[GAS_META][META_GAS_NAME]]: [moles] mol" lines += "[GLOB.meta_gas_info[id][META_GAS_NAME]]: [moles] mol"
to_chat(usr, lines.Join("\n")) to_chat(usr, lines.Join("\n"))
/client/proc/air_status(turf/target) /client/proc/air_status(turf/target)

View File

@@ -144,7 +144,7 @@
/obj/item/tank/proc/ignite() //This happens when a bomb is told to explode /obj/item/tank/proc/ignite() //This happens when a bomb is told to explode
air_contents.assert_gases(/datum/gas/plasma, /datum/gas/oxygen) air_contents.assert_gases(/datum/gas/plasma, /datum/gas/oxygen)
var/fuel_moles = air_contents.gases[/datum/gas/plasma][MOLES] + air_contents.gases[/datum/gas/oxygen][MOLES]/6 var/fuel_moles = air_contents.gases[/datum/gas/plasma] + air_contents.gases[/datum/gas/oxygen]/6
air_contents.garbage_collect() air_contents.garbage_collect()
var/datum/gas_mixture/bomb_mixture = air_contents.copy() var/datum/gas_mixture/bomb_mixture = air_contents.copy()
var/strength = 1 var/strength = 1

View File

@@ -14,9 +14,9 @@
if(!air_contents) if(!air_contents)
return 0 return 0
var/oxy = air_contents.gases[/datum/gas/oxygen] ? air_contents.gases[/datum/gas/oxygen][MOLES] : 0 var/oxy = air_contents.gases[/datum/gas/oxygen]
var/tox = air_contents.gases[/datum/gas/plasma] ? air_contents.gases[/datum/gas/plasma][MOLES] : 0 var/tox = air_contents.gases[/datum/gas/plasma]
var/trit = air_contents.gases[/datum/gas/tritium] ? air_contents.gases[/datum/gas/tritium][MOLES] : 0 var/trit = air_contents.gases[/datum/gas/tritium]
if(active_hotspot) if(active_hotspot)
if(soh) if(soh)
if((tox > 0.5 || trit > 0.5) && oxy > 0.5) if((tox > 0.5 || trit > 0.5) && oxy > 0.5)
@@ -162,7 +162,7 @@
color = list(LERP(0.3, 1, 1-greyscale_fire) * heat_r,0.3 * heat_g * greyscale_fire,0.3 * heat_b * greyscale_fire, 0.59 * heat_r * greyscale_fire,LERP(0.59, 1, 1-greyscale_fire) * heat_g,0.59 * heat_b * greyscale_fire, 0.11 * heat_r * greyscale_fire,0.11 * heat_g * greyscale_fire,LERP(0.11, 1, 1-greyscale_fire) * heat_b, 0,0,0) color = list(LERP(0.3, 1, 1-greyscale_fire) * heat_r,0.3 * heat_g * greyscale_fire,0.3 * heat_b * greyscale_fire, 0.59 * heat_r * greyscale_fire,LERP(0.59, 1, 1-greyscale_fire) * heat_g,0.59 * heat_b * greyscale_fire, 0.11 * heat_r * greyscale_fire,0.11 * heat_g * greyscale_fire,LERP(0.11, 1, 1-greyscale_fire) * heat_b, 0,0,0)
alpha = heat_a alpha = heat_a
#define INSUFFICIENT(path) (!location.air.gases[path] || location.air.gases[path][MOLES] < 0.5) #define INSUFFICIENT(path) (location.air.gases[path] < 0.5)
/obj/effect/hotspot/process() /obj/effect/hotspot/process()
if(just_spawned) if(just_spawned)
just_spawned = FALSE just_spawned = FALSE
@@ -184,7 +184,7 @@
return return
//Not enough to burn //Not enough to burn
if(((!location.air.gases[/datum/gas/plasma] || location.air.gases[/datum/gas/plasma][MOLES] < 0.5) && (!location.air.gases[/datum/gas/tritium] || location.air.gases[/datum/gas/tritium][MOLES] < 0.5)) || location.air.gases[/datum/gas/oxygen][MOLES] < 0.5) if((location.air.gases[/datum/gas/plasma] < 0.5 && location.air.gases[/datum/gas/tritium] < 0.5) || location.air.gases[/datum/gas/oxygen] < 0.5)
qdel(src) qdel(src)
return return

View File

@@ -88,7 +88,7 @@
temperature_archived = temperature temperature_archived = temperature
/turf/open/archive() /turf/open/archive()
air.archive() ARCHIVE_TEMPERATURE(air)
archived_cycle = SSair.times_fired archived_cycle = SSair.times_fired
temperature_archived = temperature temperature_archived = temperature
@@ -121,10 +121,10 @@
if (nonoverlaying_gases[id]) if (nonoverlaying_gases[id])
continue continue
var/gas = gases[id] var/gas = gases[id]
var/gas_meta = gas[GAS_META] var/gas_meta = GLOB.meta_gas_info[id]
var/gas_overlay = gas_meta[META_GAS_OVERLAY] var/gas_overlay = gas_meta[META_GAS_OVERLAY]
if(gas_overlay && gas[MOLES] > gas_meta[META_GAS_MOLES_VISIBLE]) if(gas_overlay && gas > gas_meta[META_GAS_MOLES_VISIBLE])
. += gas_overlay[min(FACTOR_GAS_VISIBLE_MAX, CEILING(gas[MOLES] / MOLES_GAS_VISIBLE_STEP, 1))] . += gas_overlay[min(FACTOR_GAS_VISIBLE_MAX, CEILING(gas / MOLES_GAS_VISIBLE_STEP, 1))]
/proc/typecache_of_gases_with_no_overlays() /proc/typecache_of_gases_with_no_overlays()
. = list() . = list()
@@ -215,7 +215,7 @@
if (planet_atmos) //share our air with the "atmosphere" "above" the turf if (planet_atmos) //share our air with the "atmosphere" "above" the turf
var/datum/gas_mixture/G = new var/datum/gas_mixture/G = new
G.copy_from_turf(src) G.copy_from_turf(src)
G.archive() ARCHIVE_TEMPERATURE(G)
if(our_air.compare(G)) if(our_air.compare(G))
if(!our_excited_group) if(!our_excited_group)
var/datum/excited_group/EG = new var/datum/excited_group/EG = new
@@ -327,7 +327,7 @@
A.merge(T.air) A.merge(T.air)
for(var/id in A_gases) for(var/id in A_gases)
A_gases[id][MOLES] /= turflen A_gases[id] /= turflen
for(var/t in turf_list) for(var/t in turf_list)
var/turf/open/T = t var/turf/open/T = t

View File

@@ -8,19 +8,6 @@ What are the archived variables for?
#define QUANTIZE(variable) (round(variable,0.0000001))/*I feel the need to document what happens here. Basically this is used to catch most rounding errors, however it's previous value made it so that #define QUANTIZE(variable) (round(variable,0.0000001))/*I feel the need to document what happens here. Basically this is used to catch most rounding errors, however it's previous value made it so that
once gases got hot enough, most procedures wouldnt occur due to the fact that the mole counts would get rounded away. Thus, we lowered it a few orders of magnititude */ once gases got hot enough, most procedures wouldnt occur due to the fact that the mole counts would get rounded away. Thus, we lowered it a few orders of magnititude */
GLOBAL_LIST_INIT(meta_gas_info, meta_gas_list()) //see ATMOSPHERICS/gas_types.dm GLOBAL_LIST_INIT(meta_gas_info, meta_gas_list()) //see ATMOSPHERICS/gas_types.dm
GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
/proc/init_gaslist_cache()
. = list()
for(var/id in GLOB.meta_gas_info)
var/list/cached_gas = new(3)
.[id] = cached_gas
cached_gas[MOLES] = 0
cached_gas[ARCHIVE] = 0
cached_gas[GAS_META] = GLOB.meta_gas_info[id]
/datum/gas_mixture /datum/gas_mixture
var/list/gases var/list/gases
var/temperature = 0 //kelvins var/temperature = 0 //kelvins
@@ -70,7 +57,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
/datum/gas_mixture/proc/garbage_collect(list/tocheck) /datum/gas_mixture/proc/garbage_collect(list/tocheck)
var/list/cached_gases = gases var/list/cached_gases = gases
for(var/id in (tocheck || cached_gases)) for(var/id in (tocheck || cached_gases))
if(QUANTIZE(cached_gases[id][MOLES]) <= 0 && QUANTIZE(cached_gases[id][ARCHIVE]) <= 0) if(QUANTIZE(cached_gases[id]) <= 0)
cached_gases -= id cached_gases -= id
//PV = nRT //PV = nRT
@@ -79,8 +66,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
var/list/cached_gases = gases var/list/cached_gases = gases
. = 0 . = 0
for(var/id in cached_gases) for(var/id in cached_gases)
var/gas_data = cached_gases[id] . += cached_gases[id] * GLOB.meta_gas_info[id][META_GAS_SPECIFIC_HEAT]
. += gas_data[data] * gas_data[GAS_META][META_GAS_SPECIFIC_HEAT]
/datum/gas_mixture/turf/heat_capacity() /datum/gas_mixture/turf/heat_capacity()
. = ..() . = ..()
@@ -108,10 +94,6 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
/datum/gas_mixture/proc/thermal_energy() //joules /datum/gas_mixture/proc/thermal_energy() //joules
return THERMAL_ENERGY(src) //see code/__DEFINES/atmospherics.dm; use the define in performance critical areas return THERMAL_ENERGY(src) //see code/__DEFINES/atmospherics.dm; use the define in performance critical areas
/datum/gas_mixture/proc/archive()
//Update archived versions of variables
//Returns: 1 in all cases
/datum/gas_mixture/proc/merge(datum/gas_mixture/giver) /datum/gas_mixture/proc/merge(datum/gas_mixture/giver)
//Merges all air from giver into self. Deletes giver. //Merges all air from giver into self. Deletes giver.
//Returns: 1 if we are mutable, 0 otherwise //Returns: 1 if we are mutable, 0 otherwise
@@ -156,14 +138,6 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
//Performs various reactions such as combustion or fusion (LOL) //Performs various reactions such as combustion or fusion (LOL)
//Returns: 1 if any reaction took place; 0 otherwise //Returns: 1 if any reaction took place; 0 otherwise
/datum/gas_mixture/archive()
var/list/cached_gases = gases
temperature_archived = temperature
for(var/id in cached_gases)
cached_gases[id][ARCHIVE] = cached_gases[id][MOLES]
return 1
/datum/gas_mixture/merge(datum/gas_mixture/giver) /datum/gas_mixture/merge(datum/gas_mixture/giver)
if(!giver) if(!giver)
@@ -182,7 +156,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
//gas transfer //gas transfer
for(var/giver_id in giver_gases) for(var/giver_id in giver_gases)
ASSERT_GAS(giver_id, src) ASSERT_GAS(giver_id, src)
cached_gases[giver_id][MOLES] += giver_gases[giver_id][MOLES] cached_gases[giver_id] += giver_gases[giver_id]
return 1 return 1
@@ -199,8 +173,8 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
removed.temperature = temperature removed.temperature = temperature
for(var/id in cached_gases) for(var/id in cached_gases)
ADD_GAS(id, removed.gases) ADD_GAS(id, removed.gases)
removed_gases[id][MOLES] = QUANTIZE((cached_gases[id][MOLES] / sum) * amount) removed_gases[id] = QUANTIZE((cached_gases[id] / sum) * amount)
cached_gases[id][MOLES] -= removed_gases[id][MOLES] cached_gases[id] -= removed_gases[id]
garbage_collect() garbage_collect()
return removed return removed
@@ -217,8 +191,8 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
removed.temperature = temperature removed.temperature = temperature
for(var/id in cached_gases) for(var/id in cached_gases)
ADD_GAS(id, removed.gases) ADD_GAS(id, removed.gases)
removed_gases[id][MOLES] = QUANTIZE(cached_gases[id][MOLES] * ratio) removed_gases[id] = QUANTIZE(cached_gases[id] * ratio)
cached_gases[id][MOLES] -= removed_gases[id][MOLES] cached_gases[id] -= removed_gases[id]
garbage_collect() garbage_collect()
@@ -232,7 +206,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
copy.temperature = temperature copy.temperature = temperature
for(var/id in cached_gases) for(var/id in cached_gases)
ADD_GAS(id, copy.gases) ADD_GAS(id, copy.gases)
copy_gases[id][MOLES] = cached_gases[id][MOLES] copy_gases[id] = cached_gases[id]
return copy return copy
@@ -244,7 +218,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
temperature = sample.temperature temperature = sample.temperature
for(var/id in sample_gases) for(var/id in sample_gases)
ASSERT_GAS(id,src) ASSERT_GAS(id,src)
cached_gases[id][MOLES] = sample_gases[id][MOLES] cached_gases[id] = sample_gases[id]
//remove all gases not in the sample //remove all gases not in the sample
cached_gases &= sample_gases cached_gases &= sample_gases
@@ -273,7 +247,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
if(!ispath(path)) if(!ispath(path))
path = gas_id2path(path) //a lot of these strings can't have embedded expressions (especially for mappers), so support for IDs needs to stick around path = gas_id2path(path) //a lot of these strings can't have embedded expressions (especially for mappers), so support for IDs needs to stick around
ADD_GAS(path, gases) ADD_GAS(path, gases)
gases[path][MOLES] = text2num(gas[id]) gases[path] = text2num(gas[id])
return 1 return 1
/datum/gas_mixture/share(datum/gas_mixture/sharer, atmos_adjacent_turfs = 4) /datum/gas_mixture/share(datum/gas_mixture/sharer, atmos_adjacent_turfs = 4)
@@ -302,20 +276,17 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
for(var/id in cached_gases) // transfer gases for(var/id in cached_gases) // transfer gases
ASSERT_GAS(id, sharer) ASSERT_GAS(id, sharer)
var/gas = cached_gases[id] var/delta = QUANTIZE(cached_gases[id] - sharer_gases[id])/(atmos_adjacent_turfs+1) //the amount of gas that gets moved between the mixtures
var/sharergas = sharer_gases[id]
var/delta = QUANTIZE(gas[ARCHIVE] - sharergas[ARCHIVE])/(atmos_adjacent_turfs+1) //the amount of gas that gets moved between the mixtures
if(delta && abs_temperature_delta > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) if(delta && abs_temperature_delta > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
var/gas_heat_capacity = delta * gas[GAS_META][META_GAS_SPECIFIC_HEAT] var/gas_heat_capacity = delta * GLOB.meta_gas_info[id][META_GAS_SPECIFIC_HEAT]
if(delta > 0) if(delta > 0)
heat_capacity_self_to_sharer += gas_heat_capacity heat_capacity_self_to_sharer += gas_heat_capacity
else else
heat_capacity_sharer_to_self -= gas_heat_capacity //subtract here instead of adding the absolute value because we know that delta is negative. heat_capacity_sharer_to_self -= gas_heat_capacity //subtract here instead of adding the absolute value because we know that delta is negative.
gas[MOLES] -= delta cached_gases[id] -= delta
sharergas[MOLES] += delta sharer_gases[id] += delta
moved_moles += delta moved_moles += delta
abs_moved_moles += abs(delta) abs_moved_moles += abs(delta)
@@ -356,8 +327,8 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
sharer_temperature = sharer.temperature_archived sharer_temperature = sharer.temperature_archived
var/temperature_delta = temperature_archived - sharer_temperature var/temperature_delta = temperature_archived - sharer_temperature
if(abs(temperature_delta) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER) if(abs(temperature_delta) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
var/self_heat_capacity = heat_capacity(ARCHIVE) var/self_heat_capacity = heat_capacity()
sharer_heat_capacity = sharer_heat_capacity || sharer.heat_capacity(ARCHIVE) sharer_heat_capacity = sharer_heat_capacity || sharer.heat_capacity()
if((sharer_heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY)) if((sharer_heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY))
var/heat = conduction_coefficient*temperature_delta* \ var/heat = conduction_coefficient*temperature_delta* \
@@ -376,9 +347,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
for(var/id in cached_gases | sample_gases) // compare gases from either mixture for(var/id in cached_gases | sample_gases) // compare gases from either mixture
var/gas_moles = cached_gases[id] var/gas_moles = cached_gases[id]
gas_moles = gas_moles ? gas_moles[MOLES] : 0
var/sample_moles = sample_gases[id] var/sample_moles = sample_gases[id]
sample_moles = sample_moles ? sample_moles[MOLES] : 0
var/delta = abs(gas_moles - sample_moles) var/delta = abs(gas_moles - sample_moles)
if(delta > MINIMUM_MOLES_DELTA_TO_MOVE && \ if(delta > MINIMUM_MOLES_DELTA_TO_MOVE && \
delta > gas_moles * MINIMUM_AIR_RATIO_TO_MOVE) delta > gas_moles * MINIMUM_AIR_RATIO_TO_MOVE)
@@ -425,7 +394,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
for(var/id in min_reqs) for(var/id in min_reqs)
if (id == "TEMP" || id == "ENER") if (id == "TEMP" || id == "ENER")
continue continue
if(!cached_gases[id] || cached_gases[id][MOLES] < min_reqs[id]) if(cached_gases[id] < min_reqs[id])
continue reaction_loop continue reaction_loop
//at this point, all minimum requirements for the reaction are satisfied. //at this point, all minimum requirements for the reaction are satisfied.

View File

@@ -14,9 +14,6 @@
temperature_archived = initial_temperature temperature_archived = initial_temperature
gases.Cut() gases.Cut()
/datum/gas_mixture/immutable/archive()
return 1 //nothing changes, so we do nothing and the archive is successful
/datum/gas_mixture/immutable/merge() /datum/gas_mixture/immutable/merge()
return 0 //we're immutable. return 0 //we're immutable.
@@ -65,7 +62,7 @@
/datum/gas_mixture/immutable/cloner/garbage_collect() /datum/gas_mixture/immutable/cloner/garbage_collect()
..() ..()
ADD_GAS(/datum/gas/nitrogen, gases) ADD_GAS(/datum/gas/nitrogen, gases)
gases[/datum/gas/nitrogen][MOLES] = MOLES_O2STANDARD + MOLES_N2STANDARD gases[/datum/gas/nitrogen] = MOLES_O2STANDARD + MOLES_N2STANDARD
/datum/gas_mixture/immutable/cloner/heat_capacity() /datum/gas_mixture/immutable/cloner/heat_capacity()
return (MOLES_O2STANDARD + MOLES_N2STANDARD)*20 //specific heat of nitrogen is 20 return (MOLES_O2STANDARD + MOLES_N2STANDARD)*20 //specific heat of nitrogen is 20

View File

@@ -60,7 +60,7 @@
if(location && location.freon_gas_act()) if(location && location.freon_gas_act())
. = REACTING . = REACTING
else if(location && location.water_vapor_gas_act()) else if(location && location.water_vapor_gas_act())
air.gases[/datum/gas/water_vapor][MOLES] -= MOLES_GAS_VISIBLE air.gases[/datum/gas/water_vapor] -= MOLES_GAS_VISIBLE
. = REACTING . = REACTING
//tritium combustion: combustion of oxygen and tritium (treated as hydrocarbons). creates hotspots. exothermic //tritium combustion: combustion of oxygen and tritium (treated as hydrocarbons). creates hotspots. exothermic
@@ -86,13 +86,13 @@
var/turf/open/location = isturf(holder) ? holder : null var/turf/open/location = isturf(holder) ? holder : null
var/burned_fuel = 0 var/burned_fuel = 0
if(cached_gases[/datum/gas/oxygen][MOLES] < cached_gases[/datum/gas/tritium][MOLES]) if(cached_gases[/datum/gas/oxygen] < cached_gases[/datum/gas/tritium])
burned_fuel = cached_gases[/datum/gas/oxygen][MOLES]/TRITIUM_BURN_OXY_FACTOR burned_fuel = cached_gases[/datum/gas/oxygen]/TRITIUM_BURN_OXY_FACTOR
cached_gases[/datum/gas/tritium][MOLES] -= burned_fuel cached_gases[/datum/gas/tritium] -= burned_fuel
else else
burned_fuel = cached_gases[/datum/gas/tritium][MOLES]*TRITIUM_BURN_TRIT_FACTOR burned_fuel = cached_gases[/datum/gas/tritium]*TRITIUM_BURN_TRIT_FACTOR
cached_gases[/datum/gas/tritium][MOLES] -= cached_gases[/datum/gas/tritium][MOLES]/TRITIUM_BURN_TRIT_FACTOR cached_gases[/datum/gas/tritium] -= cached_gases[/datum/gas/tritium]/TRITIUM_BURN_TRIT_FACTOR
cached_gases[/datum/gas/oxygen][MOLES] -= cached_gases[/datum/gas/tritium][MOLES] cached_gases[/datum/gas/oxygen] -= cached_gases[/datum/gas/tritium]
if(burned_fuel) if(burned_fuel)
energy_released += FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel energy_released += FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel
@@ -100,7 +100,7 @@
radiation_pulse(location, energy_released/TRITIUM_BURN_RADIOACTIVITY_FACTOR) radiation_pulse(location, energy_released/TRITIUM_BURN_RADIOACTIVITY_FACTOR)
ASSERT_GAS(/datum/gas/water_vapor, air) //oxygen+more-or-less hydrogen=H2O ASSERT_GAS(/datum/gas/water_vapor, air) //oxygen+more-or-less hydrogen=H2O
cached_gases[/datum/gas/water_vapor][MOLES] += burned_fuel/TRITIUM_BURN_OXY_FACTOR cached_gases[/datum/gas/water_vapor] += burned_fuel/TRITIUM_BURN_OXY_FACTOR
cached_results["fire"] += burned_fuel cached_results["fire"] += burned_fuel
@@ -157,23 +157,23 @@
temperature_scale = (temperature-PLASMA_MINIMUM_BURN_TEMPERATURE)/(PLASMA_UPPER_TEMPERATURE-PLASMA_MINIMUM_BURN_TEMPERATURE) temperature_scale = (temperature-PLASMA_MINIMUM_BURN_TEMPERATURE)/(PLASMA_UPPER_TEMPERATURE-PLASMA_MINIMUM_BURN_TEMPERATURE)
if(temperature_scale > 0) if(temperature_scale > 0)
oxygen_burn_rate = OXYGEN_BURN_RATE_BASE - temperature_scale oxygen_burn_rate = OXYGEN_BURN_RATE_BASE - temperature_scale
if(cached_gases[/datum/gas/oxygen][MOLES] / cached_gases[/datum/gas/plasma][MOLES] > SUPER_SATURATION_THRESHOLD) //supersaturation. Form Tritium. if(cached_gases[/datum/gas/oxygen] / cached_gases[/datum/gas/plasma] > SUPER_SATURATION_THRESHOLD) //supersaturation. Form Tritium.
super_saturation = TRUE super_saturation = TRUE
if(cached_gases[/datum/gas/oxygen][MOLES] > cached_gases[/datum/gas/plasma][MOLES]*PLASMA_OXYGEN_FULLBURN) if(cached_gases[/datum/gas/oxygen] > cached_gases[/datum/gas/plasma]*PLASMA_OXYGEN_FULLBURN)
plasma_burn_rate = (cached_gases[/datum/gas/plasma][MOLES]*temperature_scale)/PLASMA_BURN_RATE_DELTA plasma_burn_rate = (cached_gases[/datum/gas/plasma]*temperature_scale)/PLASMA_BURN_RATE_DELTA
else else
plasma_burn_rate = (temperature_scale*(cached_gases[/datum/gas/oxygen][MOLES]/PLASMA_OXYGEN_FULLBURN))/PLASMA_BURN_RATE_DELTA plasma_burn_rate = (temperature_scale*(cached_gases[/datum/gas/oxygen]/PLASMA_OXYGEN_FULLBURN))/PLASMA_BURN_RATE_DELTA
if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY) if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY)
plasma_burn_rate = min(plasma_burn_rate,cached_gases[/datum/gas/plasma][MOLES],cached_gases[/datum/gas/oxygen][MOLES]/oxygen_burn_rate) //Ensures matter is conserved properly plasma_burn_rate = min(plasma_burn_rate,cached_gases[/datum/gas/plasma],cached_gases[/datum/gas/oxygen]/oxygen_burn_rate) //Ensures matter is conserved properly
cached_gases[/datum/gas/plasma][MOLES] = QUANTIZE(cached_gases[/datum/gas/plasma][MOLES] - plasma_burn_rate) cached_gases[/datum/gas/plasma] = QUANTIZE(cached_gases[/datum/gas/plasma] - plasma_burn_rate)
cached_gases[/datum/gas/oxygen][MOLES] = QUANTIZE(cached_gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate)) cached_gases[/datum/gas/oxygen] = QUANTIZE(cached_gases[/datum/gas/oxygen] - (plasma_burn_rate * oxygen_burn_rate))
if (super_saturation) if (super_saturation)
ASSERT_GAS(/datum/gas/tritium,air) ASSERT_GAS(/datum/gas/tritium,air)
cached_gases[/datum/gas/tritium][MOLES] += plasma_burn_rate cached_gases[/datum/gas/tritium] += plasma_burn_rate
else else
ASSERT_GAS(/datum/gas/carbon_dioxide,air) ASSERT_GAS(/datum/gas/carbon_dioxide,air)
cached_gases[/datum/gas/carbon_dioxide][MOLES] += plasma_burn_rate cached_gases[/datum/gas/carbon_dioxide] += plasma_burn_rate
energy_released += FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate) energy_released += FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate)
@@ -231,21 +231,21 @@
var/old_heat_capacity = air.heat_capacity() var/old_heat_capacity = air.heat_capacity()
var/reaction_energy = 0 var/reaction_energy = 0
var/mediation = FUSION_MEDIATION_FACTOR*(air.heat_capacity()-(cached_gases[/datum/gas/plasma][MOLES]*cached_gases[/datum/gas/plasma][GAS_META][META_GAS_SPECIFIC_HEAT]))/(air.total_moles()-cached_gases[/datum/gas/plasma][MOLES]) //This is the average specific heat of the mixture,not including plasma. var/mediation = FUSION_MEDIATION_FACTOR*(air.heat_capacity()-(cached_gases[/datum/gas/plasma]*GLOB.meta_gas_info[/datum/gas/plasma][META_GAS_SPECIFIC_HEAT]))/(air.total_moles()-cached_gases[/datum/gas/plasma]) //This is the average specific heat of the mixture,not including plasma.
var/gases_fused = air.total_moles() - cached_gases[/datum/gas/plasma][MOLES] var/gases_fused = air.total_moles() - cached_gases[/datum/gas/plasma]
var/plasma_differential = (cached_gases[/datum/gas/plasma][MOLES] - gases_fused) / air.total_moles() var/plasma_differential = (cached_gases[/datum/gas/plasma] - gases_fused) / air.total_moles()
var/reaction_efficiency = FUSION_EFFICIENCY_BASE ** -((plasma_differential ** 2) / FUSION_EFFICIENCY_DIVISOR) //https://www.desmos.com/calculator/6jjx3vdrvx var/reaction_efficiency = FUSION_EFFICIENCY_BASE ** -((plasma_differential ** 2) / FUSION_EFFICIENCY_DIVISOR) //https://www.desmos.com/calculator/6jjx3vdrvx
var/gas_power = 0 var/gas_power = 0
for (var/gas_id in cached_gases) for (var/gas_id in cached_gases)
gas_power += reaction_efficiency * (cached_gases[gas_id][GAS_META][META_GAS_FUSION_POWER]*cached_gases[gas_id][MOLES]) gas_power += reaction_efficiency * (GLOB.meta_gas_info[gas_id][META_GAS_FUSION_POWER]*cached_gases[gas_id])
var/power_ratio = gas_power/mediation var/power_ratio = gas_power/mediation
cached_scan_results[id] = power_ratio //used for analyzer feedback cached_scan_results[id] = power_ratio //used for analyzer feedback
for (var/gas_id in cached_gases) //and now we fuse for (var/gas_id in cached_gases) //and now we fuse
cached_gases[gas_id][MOLES] = 0 cached_gases[gas_id] = 0
var/radiation_power = (FUSION_RADIATION_FACTOR * power_ratio) / (power_ratio + FUSION_RADIATION_CONSTANT) //https://www.desmos.com/calculator/4i1f296phl var/radiation_power = (FUSION_RADIATION_FACTOR * power_ratio) / (power_ratio + FUSION_RADIATION_CONSTANT) //https://www.desmos.com/calculator/4i1f296phl
var/zap_power = ((FUSION_ZAP_POWER_ASYMPTOTE * power_ratio) / (power_ratio + FUSION_ZAP_POWER_CONSTANT)) + FUSION_ZAP_POWER_BASE //https://www.desmos.com/calculator/n0zkdpxnrr var/zap_power = ((FUSION_ZAP_POWER_ASYMPTOTE * power_ratio) / (power_ratio + FUSION_ZAP_POWER_CONSTANT)) + FUSION_ZAP_POWER_BASE //https://www.desmos.com/calculator/n0zkdpxnrr
@@ -255,7 +255,7 @@
if (power_ratio > FUSION_SUPER_TIER_THRESHOLD) //power ratio 50+: SUPER TIER. The gases become so energized that they fuse into a ton of tritium, which is pretty nice! Until you consider the fact that everything just exploded, the canister is probably going to break and you're irradiated. if (power_ratio > FUSION_SUPER_TIER_THRESHOLD) //power ratio 50+: SUPER TIER. The gases become so energized that they fuse into a ton of tritium, which is pretty nice! Until you consider the fact that everything just exploded, the canister is probably going to break and you're irradiated.
reaction_energy += gases_fused * FUSION_RELEASE_ENERGY_SUPER * (power_ratio / FUSION_ENERGY_DIVISOR_SUPER) reaction_energy += gases_fused * FUSION_RELEASE_ENERGY_SUPER * (power_ratio / FUSION_ENERGY_DIVISOR_SUPER)
cached_gases[/datum/gas/tritium][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_TRITIUM //60% of the gas is converted to energy, 40% to trit cached_gases[/datum/gas/tritium] += gases_fused * FUSION_GAS_CREATION_FACTOR_TRITIUM //60% of the gas is converted to energy, 40% to trit
fusion_prepare_to_die_edition_rng = 100 //Wait a minute.. fusion_prepare_to_die_edition_rng = 100 //Wait a minute..
do_explosion = TRUE do_explosion = TRUE
zap_range = FUSION_ZAP_RANGE_SUPER zap_range = FUSION_ZAP_RANGE_SUPER
@@ -263,8 +263,8 @@
else if (power_ratio > FUSION_HIGH_TIER_THRESHOLD) //power ratio 20-50; High tier. The reaction is so energized that it fuses into a small amount of stimulum, and some pluoxium. Very dangerous, but super cool and super useful. else if (power_ratio > FUSION_HIGH_TIER_THRESHOLD) //power ratio 20-50; High tier. The reaction is so energized that it fuses into a small amount of stimulum, and some pluoxium. Very dangerous, but super cool and super useful.
reaction_energy += gases_fused * FUSION_RELEASE_ENERGY_HIGH * (power_ratio / FUSION_ENERGY_DIVISOR_HIGH) reaction_energy += gases_fused * FUSION_RELEASE_ENERGY_HIGH * (power_ratio / FUSION_ENERGY_DIVISOR_HIGH)
air.assert_gases(/datum/gas/stimulum, /datum/gas/pluoxium) air.assert_gases(/datum/gas/stimulum, /datum/gas/pluoxium)
cached_gases[/datum/gas/stimulum][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_STIM //40% of the gas is converted to energy, 60% to stim and pluox cached_gases[/datum/gas/stimulum] += gases_fused * FUSION_GAS_CREATION_FACTOR_STIM //40% of the gas is converted to energy, 60% to stim and pluox
cached_gases[/datum/gas/pluoxium][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_PLUOX cached_gases[/datum/gas/pluoxium] += gases_fused * FUSION_GAS_CREATION_FACTOR_PLUOX
fusion_prepare_to_die_edition_rng = power_ratio //Now we're getting into dangerous territory fusion_prepare_to_die_edition_rng = power_ratio //Now we're getting into dangerous territory
do_explosion = TRUE do_explosion = TRUE
zap_range = FUSION_ZAP_RANGE_HIGH zap_range = FUSION_ZAP_RANGE_HIGH
@@ -272,16 +272,16 @@
else if (power_ratio > FUSION_MID_TIER_THRESHOLD) //power_ratio 5 to 20; Mediation is overpowered, fusion reaction starts to break down. else if (power_ratio > FUSION_MID_TIER_THRESHOLD) //power_ratio 5 to 20; Mediation is overpowered, fusion reaction starts to break down.
reaction_energy += gases_fused * FUSION_RELEASE_ENERGY_MID * (power_ratio / FUSION_ENERGY_DIVISOR_MID) reaction_energy += gases_fused * FUSION_RELEASE_ENERGY_MID * (power_ratio / FUSION_ENERGY_DIVISOR_MID)
air.assert_gases(/datum/gas/nitryl,/datum/gas/nitrous_oxide) air.assert_gases(/datum/gas/nitryl,/datum/gas/nitrous_oxide)
cached_gases[/datum/gas/nitryl][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_NITRYL //20% of the gas is converted to energy, 80% to nitryl and N2O cached_gases[/datum/gas/nitryl] += gases_fused * FUSION_GAS_CREATION_FACTOR_NITRYL //20% of the gas is converted to energy, 80% to nitryl and N2O
cached_gases[/datum/gas/nitrous_oxide][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_N2O cached_gases[/datum/gas/nitrous_oxide] += gases_fused * FUSION_GAS_CREATION_FACTOR_N2O
fusion_prepare_to_die_edition_rng = power_ratio * FUSION_MID_TIER_RAD_PROB_FACTOR //Still unlikely, but don't stand next to the reaction unprotected fusion_prepare_to_die_edition_rng = power_ratio * FUSION_MID_TIER_RAD_PROB_FACTOR //Still unlikely, but don't stand next to the reaction unprotected
zap_range = FUSION_ZAP_RANGE_MID zap_range = FUSION_ZAP_RANGE_MID
else //power ratio 0 to 5; Gas power is overpowered. Fusion isn't nearly as powerful. else //power ratio 0 to 5; Gas power is overpowered. Fusion isn't nearly as powerful.
reaction_energy += gases_fused * FUSION_RELEASE_ENERGY_LOW * (power_ratio / FUSION_ENERGY_DIVISOR_LOW) reaction_energy += gases_fused * FUSION_RELEASE_ENERGY_LOW * (power_ratio / FUSION_ENERGY_DIVISOR_LOW)
air.assert_gases(/datum/gas/bz, /datum/gas/carbon_dioxide) air.assert_gases(/datum/gas/bz, /datum/gas/carbon_dioxide)
cached_gases[/datum/gas/bz][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_BZ //10% of the gas is converted to energy, 90% to BZ and CO2 cached_gases[/datum/gas/bz] += gases_fused * FUSION_GAS_CREATION_FACTOR_BZ //10% of the gas is converted to energy, 90% to BZ and CO2
cached_gases[/datum/gas/carbon_dioxide][MOLES] += gases_fused * FUSION_GAS_CREATION_FACTOR_CO2 cached_gases[/datum/gas/carbon_dioxide] += gases_fused * FUSION_GAS_CREATION_FACTOR_CO2
fusion_prepare_to_die_edition_rng = power_ratio * FUSION_LOW_TIER_RAD_PROB_FACTOR //Low, but still something to look out for fusion_prepare_to_die_edition_rng = power_ratio * FUSION_LOW_TIER_RAD_PROB_FACTOR //Low, but still something to look out for
zap_range = FUSION_ZAP_RANGE_LOW zap_range = FUSION_ZAP_RANGE_LOW
@@ -322,14 +322,14 @@
var/temperature = air.temperature var/temperature = air.temperature
var/old_heat_capacity = air.heat_capacity() var/old_heat_capacity = air.heat_capacity()
var/heat_efficency = min(temperature/(FIRE_MINIMUM_TEMPERATURE_TO_EXIST*100),cached_gases[/datum/gas/oxygen][MOLES],cached_gases[/datum/gas/nitrogen][MOLES]) var/heat_efficency = min(temperature/(FIRE_MINIMUM_TEMPERATURE_TO_EXIST*100),cached_gases[/datum/gas/oxygen],cached_gases[/datum/gas/nitrogen])
var/energy_used = heat_efficency*NITRYL_FORMATION_ENERGY var/energy_used = heat_efficency*NITRYL_FORMATION_ENERGY
ASSERT_GAS(/datum/gas/nitryl,air) ASSERT_GAS(/datum/gas/nitryl,air)
if ((cached_gases[/datum/gas/oxygen][MOLES] - heat_efficency < 0 )|| (cached_gases[/datum/gas/nitrogen][MOLES] - heat_efficency < 0)) //Shouldn't produce gas from nothing. if ((cached_gases[/datum/gas/oxygen] - heat_efficency < 0 )|| (cached_gases[/datum/gas/nitrogen] - heat_efficency < 0)) //Shouldn't produce gas from nothing.
return NO_REACTION return NO_REACTION
cached_gases[/datum/gas/oxygen][MOLES] -= heat_efficency cached_gases[/datum/gas/oxygen] -= heat_efficency
cached_gases[/datum/gas/nitrogen][MOLES] -= heat_efficency cached_gases[/datum/gas/nitrogen] -= heat_efficency
cached_gases[/datum/gas/nitryl][MOLES] += heat_efficency*2 cached_gases[/datum/gas/nitryl] += heat_efficency*2
if(energy_used > 0) if(energy_used > 0)
var/new_heat_capacity = air.heat_capacity() var/new_heat_capacity = air.heat_capacity()
@@ -355,14 +355,14 @@
var/pressure = air.return_pressure() var/pressure = air.return_pressure()
var/old_heat_capacity = air.heat_capacity() var/old_heat_capacity = air.heat_capacity()
var/reaction_efficency = min(1/((pressure/(0.1*ONE_ATMOSPHERE))*(max(cached_gases[/datum/gas/plasma][MOLES]/cached_gases[/datum/gas/nitrous_oxide][MOLES],1))),cached_gases[/datum/gas/nitrous_oxide][MOLES],cached_gases[/datum/gas/plasma][MOLES]/2) var/reaction_efficency = min(1/((pressure/(0.1*ONE_ATMOSPHERE))*(max(cached_gases[/datum/gas/plasma]/cached_gases[/datum/gas/nitrous_oxide],1))),cached_gases[/datum/gas/nitrous_oxide],cached_gases[/datum/gas/plasma]/2)
var/energy_released = 2*reaction_efficency*FIRE_CARBON_ENERGY_RELEASED var/energy_released = 2*reaction_efficency*FIRE_CARBON_ENERGY_RELEASED
if ((cached_gases[/datum/gas/nitrous_oxide][MOLES] - reaction_efficency < 0 )|| (cached_gases[/datum/gas/plasma][MOLES] - (2*reaction_efficency) < 0)) //Shouldn't produce gas from nothing. if ((cached_gases[/datum/gas/nitrous_oxide] - reaction_efficency < 0 )|| (cached_gases[/datum/gas/plasma] - (2*reaction_efficency) < 0)) //Shouldn't produce gas from nothing.
return NO_REACTION return NO_REACTION
ASSERT_GAS(/datum/gas/bz,air) ASSERT_GAS(/datum/gas/bz,air)
cached_gases[/datum/gas/bz][MOLES] += reaction_efficency cached_gases[/datum/gas/bz] += reaction_efficency
cached_gases[/datum/gas/nitrous_oxide][MOLES] -= reaction_efficency cached_gases[/datum/gas/nitrous_oxide] -= reaction_efficency
cached_gases[/datum/gas/plasma][MOLES] -= 2*reaction_efficency cached_gases[/datum/gas/plasma] -= 2*reaction_efficency
if(energy_released > 0) if(energy_released > 0)
@@ -388,16 +388,16 @@
var/list/cached_gases = air.gases var/list/cached_gases = air.gases
var/old_heat_capacity = air.heat_capacity() var/old_heat_capacity = air.heat_capacity()
var/heat_scale = min(air.temperature/STIMULUM_HEAT_SCALE,cached_gases[/datum/gas/tritium][MOLES],cached_gases[/datum/gas/plasma][MOLES],cached_gases[/datum/gas/nitryl][MOLES]) var/heat_scale = min(air.temperature/STIMULUM_HEAT_SCALE,cached_gases[/datum/gas/tritium],cached_gases[/datum/gas/plasma],cached_gases[/datum/gas/nitryl])
var/stim_energy_change = heat_scale + STIMULUM_FIRST_RISE*(heat_scale**2) - STIMULUM_FIRST_DROP*(heat_scale**3) + STIMULUM_SECOND_RISE*(heat_scale**4) - STIMULUM_ABSOLUTE_DROP*(heat_scale**5) var/stim_energy_change = heat_scale + STIMULUM_FIRST_RISE*(heat_scale**2) - STIMULUM_FIRST_DROP*(heat_scale**3) + STIMULUM_SECOND_RISE*(heat_scale**4) - STIMULUM_ABSOLUTE_DROP*(heat_scale**5)
ASSERT_GAS(/datum/gas/stimulum,air) ASSERT_GAS(/datum/gas/stimulum,air)
if ((cached_gases[/datum/gas/tritium][MOLES] - heat_scale < 0 )|| (cached_gases[/datum/gas/plasma][MOLES] - heat_scale < 0) || (cached_gases[/datum/gas/nitryl][MOLES] - heat_scale < 0)) //Shouldn't produce gas from nothing. if ((cached_gases[/datum/gas/tritium] - heat_scale < 0 )|| (cached_gases[/datum/gas/plasma] - heat_scale < 0) || (cached_gases[/datum/gas/nitryl] - heat_scale < 0)) //Shouldn't produce gas from nothing.
return NO_REACTION return NO_REACTION
cached_gases[/datum/gas/stimulum][MOLES]+= heat_scale/10 cached_gases[/datum/gas/stimulum]+= heat_scale/10
cached_gases[/datum/gas/tritium][MOLES] -= heat_scale cached_gases[/datum/gas/tritium] -= heat_scale
cached_gases[/datum/gas/plasma][MOLES] -= heat_scale cached_gases[/datum/gas/plasma] -= heat_scale
cached_gases[/datum/gas/nitryl][MOLES] -= heat_scale cached_gases[/datum/gas/nitryl] -= heat_scale
if(stim_energy_change) if(stim_energy_change)
var/new_heat_capacity = air.heat_capacity() var/new_heat_capacity = air.heat_capacity()
@@ -420,13 +420,13 @@
var/list/cached_gases = air.gases var/list/cached_gases = air.gases
air.assert_gases(/datum/gas/hypernoblium,/datum/gas/bz) air.assert_gases(/datum/gas/hypernoblium,/datum/gas/bz)
var/old_heat_capacity = air.heat_capacity() var/old_heat_capacity = air.heat_capacity()
var/nob_formed = min((cached_gases[/datum/gas/nitrogen][MOLES]+cached_gases[/datum/gas/tritium][MOLES])/100,cached_gases[/datum/gas/tritium][MOLES]/10,cached_gases[/datum/gas/nitrogen][MOLES]/20) var/nob_formed = min((cached_gases[/datum/gas/nitrogen]+cached_gases[/datum/gas/tritium])/100,cached_gases[/datum/gas/tritium]/10,cached_gases[/datum/gas/nitrogen]/20)
var/energy_taken = nob_formed*(NOBLIUM_FORMATION_ENERGY/(max(cached_gases[/datum/gas/bz][MOLES],1))) var/energy_taken = nob_formed*(NOBLIUM_FORMATION_ENERGY/(max(cached_gases[/datum/gas/bz],1)))
if ((cached_gases[/datum/gas/tritium][MOLES] - 10*nob_formed < 0) || (cached_gases[/datum/gas/nitrogen][MOLES] - 20*nob_formed < 0)) if ((cached_gases[/datum/gas/tritium] - 10*nob_formed < 0) || (cached_gases[/datum/gas/nitrogen] - 20*nob_formed < 0))
return NO_REACTION return NO_REACTION
cached_gases[/datum/gas/tritium][MOLES] -= 10*nob_formed cached_gases[/datum/gas/tritium] -= 10*nob_formed
cached_gases[/datum/gas/nitrogen][MOLES] -= 20*nob_formed cached_gases[/datum/gas/nitrogen] -= 20*nob_formed
cached_gases[/datum/gas/hypernoblium][MOLES]+= nob_formed cached_gases[/datum/gas/hypernoblium]+= nob_formed
if (nob_formed) if (nob_formed)
@@ -449,14 +449,14 @@
/datum/gas_reaction/miaster/react(datum/gas_mixture/air, datum/holder) /datum/gas_reaction/miaster/react(datum/gas_mixture/air, datum/holder)
var/list/cached_gases = air.gases var/list/cached_gases = air.gases
// As the name says it, it needs to be dry // As the name says it, it needs to be dry
if(cached_gases[/datum/gas/water_vapor] && cached_gases[/datum/gas/water_vapor][MOLES]/air.total_moles() > 0.1) if(cached_gases[/datum/gas/water_vapor] && cached_gases[/datum/gas/water_vapor]/air.total_moles() > 0.1)
return return
//Replace miasma with oxygen //Replace miasma with oxygen
var/cleaned_air = min(cached_gases[/datum/gas/miasma][MOLES], 20 + (air.temperature - FIRE_MINIMUM_TEMPERATURE_TO_EXIST - 70) / 20) var/cleaned_air = min(cached_gases[/datum/gas/miasma], 20 + (air.temperature - FIRE_MINIMUM_TEMPERATURE_TO_EXIST - 70) / 20)
cached_gases[/datum/gas/miasma][MOLES] -= cleaned_air cached_gases[/datum/gas/miasma] -= cleaned_air
ASSERT_GAS(/datum/gas/oxygen,air) ASSERT_GAS(/datum/gas/oxygen,air)
cached_gases[/datum/gas/oxygen][MOLES] += cleaned_air cached_gases[/datum/gas/oxygen] += cleaned_air
//Possibly burning a bit of organic matter through maillard reaction, so a *tiny* bit more heat would be understandable //Possibly burning a bit of organic matter through maillard reaction, so a *tiny* bit more heat would be understandable
air.temperature += cleaned_air * 0.002 air.temperature += cleaned_air * 0.002

View File

@@ -282,10 +282,10 @@
continue continue
cur_tlv = TLV[gas_id] cur_tlv = TLV[gas_id]
data["environment_data"] += list(list( data["environment_data"] += list(list(
"name" = environment.gases[gas_id][GAS_META][META_GAS_NAME], "name" = GLOB.meta_gas_info[gas_id][META_GAS_NAME],
"value" = environment.gases[gas_id][MOLES] / total_moles * 100, "value" = environment.gases[gas_id] / total_moles * 100,
"unit" = "%", "unit" = "%",
"danger_level" = cur_tlv.get_danger_level(environment.gases[gas_id][MOLES] * partial_pressure) "danger_level" = cur_tlv.get_danger_level(environment.gases[gas_id] * partial_pressure)
)) ))
if(!locked || user.has_unlimited_silicon_privilege) if(!locked || user.has_unlimited_silicon_privilege)
@@ -692,7 +692,7 @@
if(!(gas_id in TLV)) // We're not interested in this gas, it seems. if(!(gas_id in TLV)) // We're not interested in this gas, it seems.
continue continue
cur_tlv = TLV[gas_id] cur_tlv = TLV[gas_id]
gas_dangerlevel = max(gas_dangerlevel, cur_tlv.get_danger_level(env_gases[gas_id][MOLES] * partial_pressure)) gas_dangerlevel = max(gas_dangerlevel, cur_tlv.get_danger_level(env_gases[gas_id] * partial_pressure))
environment.garbage_collect() environment.garbage_collect()

View File

@@ -160,9 +160,9 @@
filtered_out.temperature = removed.temperature filtered_out.temperature = removed.temperature
filtered_out.add_gas(filter_type) filtered_out.add_gas(filter_type)
filtered_out.gases[filter_type][MOLES] = removed.gases[filter_type][MOLES] filtered_out.gases[filter_type] = removed.gases[filter_type]
removed.gases[filter_type][MOLES] = 0 removed.gases[filter_type] = 0
removed.garbage_collect() removed.garbage_collect()
var/datum/gas_mixture/target = (air2.return_pressure() < target_pressure ? air2 : air1) //if there's no room for the filtered gas; just leave it in air1 var/datum/gas_mixture/target = (air2.return_pressure() < target_pressure ? air2 : air1) //if there's no room for the filtered gas; just leave it in air1

View File

@@ -183,7 +183,7 @@
if(reagent_transfer == 0) // Magically transfer reagents. Because cryo magic. if(reagent_transfer == 0) // Magically transfer reagents. Because cryo magic.
beaker.reagents.trans_to(occupant, 1, efficiency * 0.25) // Transfer reagents. beaker.reagents.trans_to(occupant, 1, efficiency * 0.25) // Transfer reagents.
beaker.reagents.reaction(occupant, VAPOR) beaker.reagents.reaction(occupant, VAPOR)
air1.gases[/datum/gas/oxygen][MOLES] -= max(0,air1.gases[/datum/gas/oxygen][MOLES] - 2 / efficiency) //Let's use gas for this air1.gases[/datum/gas/oxygen] -= max(0,air1.gases[/datum/gas/oxygen] - 2 / efficiency) //Let's use gas for this
air1.garbage_collect() air1.garbage_collect()
if(++reagent_transfer >= 10 * efficiency) // Throttle reagent transfer (higher efficiency will transfer the same amount but consume less from the beaker). if(++reagent_transfer >= 10 * efficiency) // Throttle reagent transfer (higher efficiency will transfer the same amount but consume less from the beaker).
reagent_transfer = 0 reagent_transfer = 0
@@ -198,7 +198,7 @@
var/datum/gas_mixture/air1 = airs[1] var/datum/gas_mixture/air1 = airs[1]
if(!nodes[1] || !airs[1] || !air1.gases.len || air1.gases[/datum/gas/oxygen][MOLES] < 5) // Turn off if the machine won't work. if(!nodes[1] || !airs[1] || !air1.gases.len || air1.gases[/datum/gas/oxygen] < 5) // Turn off if the machine won't work.
on = FALSE on = FALSE
update_icon() update_icon()
return return
@@ -220,7 +220,7 @@
air1.temperature = max(air1.temperature - heat / air_heat_capacity, TCMB) air1.temperature = max(air1.temperature - heat / air_heat_capacity, TCMB)
mob_occupant.adjust_bodytemperature(heat / heat_capacity, TCMB) mob_occupant.adjust_bodytemperature(heat / heat_capacity, TCMB)
air1.gases[/datum/gas/oxygen][MOLES] = max(0,air1.gases[/datum/gas/oxygen][MOLES] - 0.5 / efficiency) // Magically consume gas? Why not, we run on cryo magic. air1.gases[/datum/gas/oxygen] = max(0,air1.gases[/datum/gas/oxygen] - 0.5 / efficiency) // Magically consume gas? Why not, we run on cryo magic.
air1.garbage_collect() air1.garbage_collect()
/obj/machinery/atmospherics/components/unary/cryo_cell/power_change() /obj/machinery/atmospherics/components/unary/cryo_cell/power_change()

View File

@@ -18,8 +18,8 @@
air_contents.temperature = T20C air_contents.temperature = T20C
if(gas_type) if(gas_type)
air_contents.assert_gas(gas_type) air_contents.assert_gas(gas_type)
air_contents.gases[gas_type][MOLES] = AIR_CONTENTS air_contents.gases[gas_type] = AIR_CONTENTS
name = "[name] ([air_contents.gases[gas_type][GAS_META][META_GAS_NAME]])" name = "[name] ([GLOB.meta_gas_info[gas_type][META_GAS_NAME]])"
/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide /obj/machinery/atmospherics/components/unary/tank/carbon_dioxide
gas_type = /datum/gas/carbon_dioxide gas_type = /datum/gas/carbon_dioxide
@@ -45,5 +45,5 @@
..() ..()
var/datum/gas_mixture/air_contents = airs[1] var/datum/gas_mixture/air_contents = airs[1]
air_contents.assert_gases(/datum/gas/oxygen, /datum/gas/nitrogen) air_contents.assert_gases(/datum/gas/oxygen, /datum/gas/nitrogen)
air_contents.gases[/datum/gas/oxygen][MOLES] = AIR_CONTENTS * 0.2 air_contents.gases[/datum/gas/oxygen] = AIR_CONTENTS * 0.2
air_contents.gases[/datum/gas/nitrogen][MOLES] = AIR_CONTENTS * 0.8 air_contents.gases[/datum/gas/nitrogen] = AIR_CONTENTS * 0.8

View File

@@ -198,8 +198,8 @@
for(var/gas in filter_types & removed_gases) for(var/gas in filter_types & removed_gases)
filtered_out.add_gas(gas) filtered_out.add_gas(gas)
filtered_gases[gas][MOLES] = removed_gases[gas][MOLES] filtered_gases[gas] = removed_gases[gas]
removed_gases[gas][MOLES] = 0 removed_gases[gas] = 0
removed.garbage_collect() removed.garbage_collect()

View File

@@ -145,7 +145,7 @@
var/member_gases = member.air_temporary.gases var/member_gases = member.air_temporary.gases
for(var/id in member_gases) for(var/id in member_gases)
member_gases[id][MOLES] *= member.volume/air.volume member_gases[id] *= member.volume/air.volume
member.air_temporary.temperature = air.temperature member.air_temporary.temperature = air.temperature
@@ -254,4 +254,4 @@
G.copy_from(total_gas_mixture) G.copy_from(total_gas_mixture)
var/list/G_gases = G.gases var/list/G_gases = G.gases
for(var/id in G_gases) for(var/id in G_gases)
G_gases[id][MOLES] *= G.volume/total_gas_mixture.volume G_gases[id] *= G.volume/total_gas_mixture.volume

View File

@@ -132,7 +132,7 @@
return FALSE return FALSE
var/datum/gas_mixture/merger = new var/datum/gas_mixture/merger = new
merger.assert_gas(spawn_id) merger.assert_gas(spawn_id)
merger.gases[spawn_id][MOLES] = (spawn_mol) merger.gases[spawn_id] = (spawn_mol)
merger.temperature = spawn_temp merger.temperature = spawn_temp
O.assume_air(merger) O.assume_air(merger)
O.air_update_turf(TRUE) O.air_update_turf(TRUE)

View File

@@ -207,13 +207,13 @@
air_contents.add_gas(gas_type) air_contents.add_gas(gas_type)
if(starter_temp) if(starter_temp)
air_contents.temperature = starter_temp air_contents.temperature = starter_temp
air_contents.gases[gas_type][MOLES] = (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature) air_contents.gases[gas_type] = (maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
if(starter_temp) if(starter_temp)
air_contents.temperature = starter_temp air_contents.temperature = starter_temp
/obj/machinery/portable_atmospherics/canister/air/create_gas() /obj/machinery/portable_atmospherics/canister/air/create_gas()
air_contents.add_gases(/datum/gas/oxygen, /datum/gas/nitrogen) air_contents.add_gases(/datum/gas/oxygen, /datum/gas/nitrogen)
air_contents.gases[/datum/gas/oxygen][MOLES] = (O2STANDARD * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature) air_contents.gases[/datum/gas/oxygen] = (O2STANDARD * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
air_contents.gases[/datum/gas/nitrogen][MOLES] = (N2STANDARD * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature) air_contents.gases[/datum/gas/nitrogen] = (N2STANDARD * maximum_pressure * filled) * air_contents.volume / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
#define HOLDING (1<<0) #define HOLDING (1<<0)
#define CONNECTED (1<<1) #define CONNECTED (1<<1)
@@ -439,10 +439,10 @@
var/list/danger = list() var/list/danger = list()
for(var/id in air_contents.gases) for(var/id in air_contents.gases)
var/gas = air_contents.gases[id] var/gas = air_contents.gases[id]
if(!gas[GAS_META][META_GAS_DANGER]) if(!GLOB.meta_gas_info[id][META_GAS_DANGER])
continue continue
if(gas[MOLES] > (gas[GAS_META][META_GAS_MOLES_VISIBLE] || MOLES_GAS_VISIBLE)) //if moles_visible is undefined, default to default visibility if(gas > (GLOB.meta_gas_info[id][META_GAS_MOLES_VISIBLE] || MOLES_GAS_VISIBLE)) //if moles_visible is undefined, default to default visibility
danger[gas[GAS_META][META_GAS_NAME]] = gas[MOLES] //ex. "plasma" = 20 danger[GLOB.meta_gas_info[id][META_GAS_NAME]] = gas //ex. "plasma" = 20
if(danger.len) if(danger.len)
message_admins("[ADMIN_LOOKUPFLW(usr)] opened a canister that contains the following at [ADMIN_VERBOSEJMP(src)]:") message_admins("[ADMIN_LOOKUPFLW(usr)] opened a canister that contains the following at [ADMIN_VERBOSEJMP(src)]:")

View File

@@ -46,8 +46,8 @@
filtered.temperature = filtering.temperature filtered.temperature = filtering.temperature
for(var/gas in filtering.gases & scrubbing) for(var/gas in filtering.gases & scrubbing)
filtered.add_gas(gas) filtered.add_gas(gas)
filtered.gases[gas][MOLES] = filtering.gases[gas][MOLES] // Shuffle the "bad" gasses to the filtered mixture. filtered.gases[gas] = filtering.gases[gas] // Shuffle the "bad" gasses to the filtered mixture.
filtering.gases[gas][MOLES] = 0 filtering.gases[gas] = 0
filtering.garbage_collect() // Now that the gasses are set to 0, clean up the mixture. filtering.garbage_collect() // Now that the gasses are set to 0, clean up the mixture.
air_contents.merge(filtered) // Store filtered out gasses. air_contents.merge(filtered) // Store filtered out gasses.

View File

@@ -12,7 +12,7 @@
var/obj/item/tank/T = O var/obj/item/tank/T = O
if(!T.air_contents.gases[gas_type]) if(!T.air_contents.gases[gas_type])
return FALSE return FALSE
return T.air_contents.gases[gas_type][MOLES] >= moles_required return T.air_contents.gases[gas_type] >= moles_required
/datum/bounty/item/engineering/gas/nitryl_tank /datum/bounty/item/engineering/gas/nitryl_tank
name = "Full Tank of Nitryl" name = "Full Tank of Nitryl"

View File

@@ -172,7 +172,7 @@
var/datum/gas_mixture/GM = T.air var/datum/gas_mixture/GM = T.air
if(!GM.gases[/datum/gas/oxygen]) if(!GM.gases[/datum/gas/oxygen])
return return
GM.gases[/datum/gas/oxygen][MOLES] = max(GM.gases[/datum/gas/oxygen][MOLES] - severity * holder.energy, 0) GM.gases[/datum/gas/oxygen] = max(GM.gases[/datum/gas/oxygen] - severity * holder.energy, 0)
GM.garbage_collect() GM.garbage_collect()
/datum/spacevine_mutation/nitro_eater /datum/spacevine_mutation/nitro_eater
@@ -187,7 +187,7 @@
var/datum/gas_mixture/GM = T.air var/datum/gas_mixture/GM = T.air
if(!GM.gases[/datum/gas/nitrogen]) if(!GM.gases[/datum/gas/nitrogen])
return return
GM.gases[/datum/gas/nitrogen][MOLES] = max(GM.gases[/datum/gas/nitrogen][MOLES] - severity * holder.energy, 0) GM.gases[/datum/gas/nitrogen] = max(GM.gases[/datum/gas/nitrogen] - severity * holder.energy, 0)
GM.garbage_collect() GM.garbage_collect()
/datum/spacevine_mutation/carbondioxide_eater /datum/spacevine_mutation/carbondioxide_eater
@@ -202,7 +202,7 @@
var/datum/gas_mixture/GM = T.air var/datum/gas_mixture/GM = T.air
if(!GM.gases[/datum/gas/carbon_dioxide]) if(!GM.gases[/datum/gas/carbon_dioxide])
return return
GM.gases[/datum/gas/carbon_dioxide][MOLES] = max(GM.gases[/datum/gas/carbon_dioxide][MOLES] - severity * holder.energy, 0) GM.gases[/datum/gas/carbon_dioxide] = max(GM.gases[/datum/gas/carbon_dioxide] - severity * holder.energy, 0)
GM.garbage_collect() GM.garbage_collect()
/datum/spacevine_mutation/plasma_eater /datum/spacevine_mutation/plasma_eater
@@ -217,7 +217,7 @@
var/datum/gas_mixture/GM = T.air var/datum/gas_mixture/GM = T.air
if(!GM.gases[/datum/gas/plasma]) if(!GM.gases[/datum/gas/plasma])
return return
GM.gases[/datum/gas/plasma][MOLES] = max(GM.gases[/datum/gas/plasma][MOLES] - severity * holder.energy, 0) GM.gases[/datum/gas/plasma] = max(GM.gases[/datum/gas/plasma] - severity * holder.energy, 0)
GM.garbage_collect() GM.garbage_collect()
/datum/spacevine_mutation/thorns /datum/spacevine_mutation/thorns

View File

@@ -187,7 +187,7 @@
var/turf/open/O = loc var/turf/open/O = loc
if(O.air) if(O.air)
var/loc_gases = O.air.gases var/loc_gases = O.air.gases
if(loc_gases[/datum/gas/oxygen][MOLES] > 13) if(loc_gases[/datum/gas/oxygen] > 13)
return TRUE return TRUE
return FALSE return FALSE

View File

@@ -371,14 +371,14 @@ obj/item/integrated_circuit/atmospherics/connector/portableConnectorReturnAir()
for(var/filtered_gas in removed.gases) for(var/filtered_gas in removed.gases)
//Get the name of the gas and see if it is in the list //Get the name of the gas and see if it is in the list
if(removed.gases[filtered_gas][GAS_META][META_GAS_NAME] in wanted) if(GLOB.meta_gas_info[filtered_gas][META_GAS_NAME] in wanted)
//The gas that is put in all the filtered out gases //The gas that is put in all the filtered out gases
filtered_out.temperature = removed.temperature filtered_out.temperature = removed.temperature
filtered_out.add_gas(filtered_gas) filtered_out.add_gas(filtered_gas)
filtered_out.gases[filtered_gas][MOLES] = removed.gases[filtered_gas][MOLES] filtered_out.gases[filtered_gas] = removed.gases[filtered_gas]
//The filtered out gas is entirely removed from the currently filtered gases //The filtered out gas is entirely removed from the currently filtered gases
removed.gases[filtered_gas][MOLES] = 0 removed.gases[filtered_gas] = 0
removed.garbage_collect() removed.garbage_collect()
//Check if the pressure is high enough to put stuff in filtered, or else just put it back in the source //Check if the pressure is high enough to put stuff in filtered, or else just put it back in the source

View File

@@ -1165,8 +1165,8 @@
var/list/gas_names = list() var/list/gas_names = list()
var/list/gas_amounts = list() var/list/gas_amounts = list()
for(var/id in gases) for(var/id in gases)
var/name = gases[id][GAS_META][META_GAS_NAME] var/name = GLOB.meta_gas_info[id][META_GAS_NAME]
var/amt = round(gases[id][MOLES], 0.001) var/amt = round(gases[id], 0.001)
gas_names.Add(name) gas_names.Add(name)
gas_amounts.Add(amt) gas_amounts.Add(amt)

View File

@@ -18,20 +18,20 @@
breath.assert_gases(/datum/gas/plasma, /datum/gas/oxygen) breath.assert_gases(/datum/gas/plasma, /datum/gas/oxygen)
//Partial pressure of the toxins in our breath //Partial pressure of the toxins in our breath
var/Toxins_pp = (breath_gases[/datum/gas/plasma][MOLES]/breath.total_moles())*breath_pressure var/Toxins_pp = (breath_gases[/datum/gas/plasma]/breath.total_moles())*breath_pressure
if(Toxins_pp > tox_detect_threshold) // Detect toxins in air if(Toxins_pp > tox_detect_threshold) // Detect toxins in air
adjustPlasma(breath_gases[/datum/gas/plasma][MOLES]*250) adjustPlasma(breath_gases[/datum/gas/plasma]*250)
throw_alert("alien_tox", /obj/screen/alert/alien_tox) throw_alert("alien_tox", /obj/screen/alert/alien_tox)
toxins_used = breath_gases[/datum/gas/plasma][MOLES] toxins_used = breath_gases[/datum/gas/plasma]
else else
clear_alert("alien_tox") clear_alert("alien_tox")
//Breathe in toxins and out oxygen //Breathe in toxins and out oxygen
breath_gases[/datum/gas/plasma][MOLES] -= toxins_used breath_gases[/datum/gas/plasma] -= toxins_used
breath_gases[/datum/gas/oxygen][MOLES] += toxins_used breath_gases[/datum/gas/oxygen] += toxins_used
breath.garbage_collect() breath.garbage_collect()

View File

@@ -33,7 +33,7 @@
if((!istype(H.w_uniform, /obj/item/clothing/under/plasmaman) || !istype(H.head, /obj/item/clothing/head/helmet/space/plasmaman)) && !atmos_sealed) if((!istype(H.w_uniform, /obj/item/clothing/under/plasmaman) || !istype(H.head, /obj/item/clothing/head/helmet/space/plasmaman)) && !atmos_sealed)
if(environment) if(environment)
if(environment.total_moles()) if(environment.total_moles())
if(environment.gases[/datum/gas/oxygen] && (environment.gases[/datum/gas/oxygen][MOLES]) >= 1) //Same threshhold that extinguishes fire if(environment.gases[/datum/gas/oxygen] && (environment.gases[/datum/gas/oxygen]) >= 1) //Same threshhold that extinguishes fire
H.adjust_fire_stacks(0.5) H.adjust_fire_stacks(0.5)
if(!H.on_fire && H.fire_stacks > 0) if(!H.on_fire && H.fire_stacks > 0)
H.visible_message("<span class='danger'>[H]'s body reacts with the atmosphere and bursts into flames!</span>","<span class='userdanger'>Your body reacts with the atmosphere and bursts into flame!</span>") H.visible_message("<span class='danger'>[H]'s body reacts with the atmosphere and bursts into flames!</span>","<span class='userdanger'>Your body reacts with the atmosphere and bursts into flame!</span>")

View File

@@ -151,9 +151,9 @@
var/list/breath_gases = breath.gases var/list/breath_gases = breath.gases
breath.assert_gases(/datum/gas/oxygen, /datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz) breath.assert_gases(/datum/gas/oxygen, /datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz)
var/O2_partialpressure = (breath_gases[/datum/gas/oxygen][MOLES]/breath.total_moles())*breath_pressure var/O2_partialpressure = (breath_gases[/datum/gas/oxygen]/breath.total_moles())*breath_pressure
var/Toxins_partialpressure = (breath_gases[/datum/gas/plasma][MOLES]/breath.total_moles())*breath_pressure var/Toxins_partialpressure = (breath_gases[/datum/gas/plasma]/breath.total_moles())*breath_pressure
var/CO2_partialpressure = (breath_gases[/datum/gas/carbon_dioxide][MOLES]/breath.total_moles())*breath_pressure var/CO2_partialpressure = (breath_gases[/datum/gas/carbon_dioxide]/breath.total_moles())*breath_pressure
//OXYGEN //OXYGEN
@@ -177,7 +177,7 @@
var/ratio = 1 - O2_partialpressure/safe_oxy_min var/ratio = 1 - O2_partialpressure/safe_oxy_min
adjustOxyLoss(min(5*ratio, 3)) adjustOxyLoss(min(5*ratio, 3))
failed_last_breath = 1 failed_last_breath = 1
oxygen_used = breath_gases[/datum/gas/oxygen][MOLES]*ratio oxygen_used = breath_gases[/datum/gas/oxygen]*ratio
else else
adjustOxyLoss(3) adjustOxyLoss(3)
failed_last_breath = 1 failed_last_breath = 1
@@ -189,12 +189,12 @@
o2overloadtime = 0 //reset our counter for this too o2overloadtime = 0 //reset our counter for this too
if(health >= crit_threshold) if(health >= crit_threshold)
adjustOxyLoss(-5) adjustOxyLoss(-5)
oxygen_used = breath_gases[/datum/gas/oxygen][MOLES] oxygen_used = breath_gases[/datum/gas/oxygen]
clear_alert("not_enough_oxy") clear_alert("not_enough_oxy")
SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "suffocation") SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "suffocation")
breath_gases[/datum/gas/oxygen][MOLES] -= oxygen_used breath_gases[/datum/gas/oxygen] -= oxygen_used
breath_gases[/datum/gas/carbon_dioxide][MOLES] += oxygen_used breath_gases[/datum/gas/carbon_dioxide] += oxygen_used
//CARBON DIOXIDE //CARBON DIOXIDE
if(CO2_partialpressure > safe_co2_max) if(CO2_partialpressure > safe_co2_max)
@@ -213,7 +213,7 @@
//TOXINS/PLASMA //TOXINS/PLASMA
if(Toxins_partialpressure > safe_tox_max) if(Toxins_partialpressure > safe_tox_max)
var/ratio = (breath_gases[/datum/gas/plasma][MOLES]/safe_tox_max) * 10 var/ratio = (breath_gases[/datum/gas/plasma]/safe_tox_max) * 10
adjustToxLoss(CLAMP(ratio, MIN_TOXIC_GAS_DAMAGE, MAX_TOXIC_GAS_DAMAGE)) adjustToxLoss(CLAMP(ratio, MIN_TOXIC_GAS_DAMAGE, MAX_TOXIC_GAS_DAMAGE))
throw_alert("too_much_tox", /obj/screen/alert/too_much_tox) throw_alert("too_much_tox", /obj/screen/alert/too_much_tox)
else else
@@ -221,7 +221,7 @@
//NITROUS OXIDE //NITROUS OXIDE
if(breath_gases[/datum/gas/nitrous_oxide]) if(breath_gases[/datum/gas/nitrous_oxide])
var/SA_partialpressure = (breath_gases[/datum/gas/nitrous_oxide][MOLES]/breath.total_moles())*breath_pressure var/SA_partialpressure = (breath_gases[/datum/gas/nitrous_oxide]/breath.total_moles())*breath_pressure
if(SA_partialpressure > SA_para_min) if(SA_partialpressure > SA_para_min)
Unconscious(60) Unconscious(60)
if(SA_partialpressure > SA_sleep_min) if(SA_partialpressure > SA_sleep_min)
@@ -232,7 +232,7 @@
//BZ (Facepunch port of their Agent B) //BZ (Facepunch port of their Agent B)
if(breath_gases[/datum/gas/bz]) if(breath_gases[/datum/gas/bz])
var/bz_partialpressure = (breath_gases[/datum/gas/bz][MOLES]/breath.total_moles())*breath_pressure var/bz_partialpressure = (breath_gases[/datum/gas/bz]/breath.total_moles())*breath_pressure
if(bz_partialpressure > 1) if(bz_partialpressure > 1)
hallucination += 10 hallucination += 10
else if(bz_partialpressure > 0.01) else if(bz_partialpressure > 0.01)
@@ -240,17 +240,17 @@
//TRITIUM //TRITIUM
if(breath_gases[/datum/gas/tritium]) if(breath_gases[/datum/gas/tritium])
var/tritium_partialpressure = (breath_gases[/datum/gas/tritium][MOLES]/breath.total_moles())*breath_pressure var/tritium_partialpressure = (breath_gases[/datum/gas/tritium]/breath.total_moles())*breath_pressure
radiation += tritium_partialpressure/10 radiation += tritium_partialpressure/10
//NITRYL //NITRYL
if(breath_gases[/datum/gas/nitryl]) if(breath_gases[/datum/gas/nitryl])
var/nitryl_partialpressure = (breath_gases[/datum/gas/nitryl][MOLES]/breath.total_moles())*breath_pressure var/nitryl_partialpressure = (breath_gases[/datum/gas/nitryl]/breath.total_moles())*breath_pressure
adjustFireLoss(nitryl_partialpressure/4) adjustFireLoss(nitryl_partialpressure/4)
//MIASMA //MIASMA
if(breath_gases[/datum/gas/miasma]) if(breath_gases[/datum/gas/miasma])
var/miasma_partialpressure = (breath_gases[/datum/gas/miasma][MOLES]/breath.total_moles())*breath_pressure var/miasma_partialpressure = (breath_gases[/datum/gas/miasma]/breath.total_moles())*breath_pressure
if(prob(1 * miasma_partialpressure)) if(prob(1 * miasma_partialpressure))
var/datum/disease/advance/miasma_disease = new /datum/disease/advance/random(2,3) var/datum/disease/advance/miasma_disease = new /datum/disease/advance/random(2,3)
@@ -346,7 +346,7 @@
var/list/cached_gases = miasma_turf.air.gases var/list/cached_gases = miasma_turf.air.gases
ASSERT_GAS(/datum/gas/miasma, miasma_turf.air) ASSERT_GAS(/datum/gas/miasma, miasma_turf.air)
cached_gases[/datum/gas/miasma][MOLES] += 0.02 cached_gases[/datum/gas/miasma] += 0.02
/mob/living/carbon/proc/handle_blood() /mob/living/carbon/proc/handle_blood()
return return

View File

@@ -109,7 +109,7 @@
ExtinguishMob() ExtinguishMob()
return return
var/datum/gas_mixture/G = loc.return_air() // Check if we're standing in an oxygenless environment var/datum/gas_mixture/G = loc.return_air() // Check if we're standing in an oxygenless environment
if(!G.gases[/datum/gas/oxygen] || G.gases[/datum/gas/oxygen][MOLES] < 1) if(G.gases[/datum/gas/oxygen] < 1)
ExtinguishMob() //If there's no oxygen in the tile we're on, put out the fire ExtinguishMob() //If there's no oxygen in the tile we're on, put out the fire
return return
var/turf/location = get_turf(src) var/turf/location = get_turf(src)

View File

@@ -544,9 +544,9 @@
if (total_moles) if (total_moles)
for(var/id in env_gases) for(var/id in env_gases)
var/gas_level = env_gases[id][MOLES]/total_moles var/gas_level = env_gases[id]/total_moles
if(gas_level > 0.01) if(gas_level > 0.01)
dat += "[env_gases[id][GAS_META][META_GAS_NAME]]: [round(gas_level*100)]%<br>" dat += "[GLOB.meta_gas_info[id][META_GAS_NAME]]: [round(gas_level*100)]%<br>"
dat += "Temperature: [round(environment.temperature-T0C)]&deg;C<br>" dat += "Temperature: [round(environment.temperature-T0C)]&deg;C<br>"
dat += "<a href='byond://?src=[REF(src)];software=atmosensor;sub=0'>Refresh Reading</a> <br>" dat += "<a href='byond://?src=[REF(src)];software=atmosensor;sub=0'>Refresh Reading</a> <br>"
dat += "<br>" dat += "<br>"

View File

@@ -1,71 +1,71 @@
/mob/living/simple_animal/hostile/tree /mob/living/simple_animal/hostile/tree
name = "pine tree" name = "pine tree"
desc = "A pissed off tree-like alien. It seems annoyed with the festivities..." desc = "A pissed off tree-like alien. It seems annoyed with the festivities..."
icon = 'icons/obj/flora/pinetrees.dmi' icon = 'icons/obj/flora/pinetrees.dmi'
icon_state = "pine_1" icon_state = "pine_1"
icon_living = "pine_1" icon_living = "pine_1"
icon_dead = "pine_1" icon_dead = "pine_1"
icon_gib = "pine_1" icon_gib = "pine_1"
gender = NEUTER gender = NEUTER
speak_chance = 0 speak_chance = 0
turns_per_move = 5 turns_per_move = 5
response_help = "brushes" response_help = "brushes"
response_disarm = "pushes" response_disarm = "pushes"
response_harm = "hits" response_harm = "hits"
speed = 1 speed = 1
maxHealth = 250 maxHealth = 250
health = 250 health = 250
mob_size = MOB_SIZE_LARGE mob_size = MOB_SIZE_LARGE
pixel_x = -16 pixel_x = -16
harm_intent_damage = 5 harm_intent_damage = 5
melee_damage_lower = 8 melee_damage_lower = 8
melee_damage_upper = 12 melee_damage_upper = 12
attacktext = "bites" attacktext = "bites"
attack_sound = 'sound/weapons/bite.ogg' attack_sound = 'sound/weapons/bite.ogg'
speak_emote = list("pines") speak_emote = list("pines")
emote_taunt = list("growls") emote_taunt = list("growls")
taunt_chance = 20 taunt_chance = 20
atmos_requirements = list("min_oxy" = 2, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0) atmos_requirements = list("min_oxy" = 2, "max_oxy" = 0, "min_tox" = 0, "max_tox" = 0, "min_co2" = 0, "max_co2" = 0, "min_n2" = 0, "max_n2" = 0)
unsuitable_atmos_damage = 5 unsuitable_atmos_damage = 5
minbodytemp = 0 minbodytemp = 0
maxbodytemp = 1200 maxbodytemp = 1200
faction = list("hostile") faction = list("hostile")
deathmessage = "is hacked into pieces!" deathmessage = "is hacked into pieces!"
loot = list(/obj/item/stack/sheet/mineral/wood) loot = list(/obj/item/stack/sheet/mineral/wood)
gold_core_spawnable = HOSTILE_SPAWN gold_core_spawnable = HOSTILE_SPAWN
del_on_death = 1 del_on_death = 1
/mob/living/simple_animal/hostile/tree/Life() /mob/living/simple_animal/hostile/tree/Life()
..() ..()
if(isopenturf(loc)) if(isopenturf(loc))
var/turf/open/T = src.loc var/turf/open/T = src.loc
if(T.air && T.air.gases[/datum/gas/carbon_dioxide]) if(T.air && T.air.gases[/datum/gas/carbon_dioxide])
var/co2 = T.air.gases[/datum/gas/carbon_dioxide][MOLES] var/co2 = T.air.gases[/datum/gas/carbon_dioxide]
if(co2 > 0) if(co2 > 0)
if(prob(25)) if(prob(25))
var/amt = min(co2, 9) var/amt = min(co2, 9)
T.air.gases[/datum/gas/carbon_dioxide][MOLES] -= amt T.air.gases[/datum/gas/carbon_dioxide] -= amt
T.atmos_spawn_air("o2=[amt]") T.atmos_spawn_air("o2=[amt]")
/mob/living/simple_animal/hostile/tree/AttackingTarget() /mob/living/simple_animal/hostile/tree/AttackingTarget()
. = ..() . = ..()
if(iscarbon(target)) if(iscarbon(target))
var/mob/living/carbon/C = target var/mob/living/carbon/C = target
if(prob(15)) if(prob(15))
C.Knockdown(60) C.Knockdown(60)
C.visible_message("<span class='danger'>\The [src] knocks down \the [C]!</span>", \ C.visible_message("<span class='danger'>\The [src] knocks down \the [C]!</span>", \
"<span class='userdanger'>\The [src] knocks you down!</span>") "<span class='userdanger'>\The [src] knocks you down!</span>")
/mob/living/simple_animal/hostile/tree/festivus /mob/living/simple_animal/hostile/tree/festivus
name = "festivus pole" name = "festivus pole"
desc = "Serenity now... SERENITY NOW!" desc = "Serenity now... SERENITY NOW!"
icon_state = "festivus_pole" icon_state = "festivus_pole"
icon_living = "festivus_pole" icon_living = "festivus_pole"
icon_dead = "festivus_pole" icon_dead = "festivus_pole"
icon_gib = "festivus_pole" icon_gib = "festivus_pole"
loot = list(/obj/item/stack/rods) loot = list(/obj/item/stack/rods)
speak_emote = list("polls") speak_emote = list("polls")

View File

@@ -209,10 +209,10 @@
var/ST_gases = ST.air.gases var/ST_gases = ST.air.gases
ST.air.assert_gases(arglist(GLOB.hardcoded_gases)) ST.air.assert_gases(arglist(GLOB.hardcoded_gases))
var/tox = ST_gases[/datum/gas/plasma][MOLES] var/tox = ST_gases[/datum/gas/plasma]
var/oxy = ST_gases[/datum/gas/oxygen][MOLES] var/oxy = ST_gases[/datum/gas/oxygen]
var/n2 = ST_gases[/datum/gas/nitrogen][MOLES] var/n2 = ST_gases[/datum/gas/nitrogen]
var/co2 = ST_gases[/datum/gas/carbon_dioxide][MOLES] var/co2 = ST_gases[/datum/gas/carbon_dioxide]
ST.air.garbage_collect() ST.air.garbage_collect()

View File

@@ -132,7 +132,7 @@
if(stat != DEAD) if(stat != DEAD)
var/bz_percentage =0 var/bz_percentage =0
if(environment.gases[/datum/gas/bz]) if(environment.gases[/datum/gas/bz])
bz_percentage = environment.gases[/datum/gas/bz][MOLES] / environment.total_moles() bz_percentage = environment.gases[/datum/gas/bz] / environment.total_moles()
var/stasis = (bz_percentage >= 0.05 && bodytemperature < (T0C + 100)) || force_stasis var/stasis = (bz_percentage >= 0.05 && bodytemperature < (T0C + 100)) || force_stasis
if(stat == CONSCIOUS && stasis) if(stat == CONSCIOUS && stasis)

View File

@@ -67,8 +67,8 @@
t += "<span class='danger'>Temperature: [environment.temperature] \n</span>" t += "<span class='danger'>Temperature: [environment.temperature] \n</span>"
for(var/id in environment.gases) for(var/id in environment.gases)
var/gas = environment.gases[id] var/gas = environment.gases[id]
if(gas[MOLES]) if(gas)
t+="<span class='notice'>[gas[GAS_META][META_GAS_NAME]]: [gas[MOLES]] \n</span>" t+="<span class='notice'>[GLOB.meta_gas_info[id][META_GAS_NAME]]: [gas] \n</span>"
to_chat(usr, t) to_chat(usr, t)

View File

@@ -81,13 +81,13 @@
if(air.total_moles()) if(air.total_moles())
for(var/gasid in air.gases) for(var/gasid in air.gases)
gasdata.Add(list(list( gasdata.Add(list(list(
"name"= air.gases[gasid][GAS_META][META_GAS_NAME], "name"= GLOB.meta_gas_info[gasid][META_GAS_NAME],
"amount" = round(100*air.gases[gasid][MOLES]/air.total_moles(),0.01)))) "amount" = round(100*air.gases[gasid]/air.total_moles(),0.01))))
else else
for(var/gasid in air.gases) for(var/gasid in air.gases)
gasdata.Add(list(list( gasdata.Add(list(list(
"name"= air.gases[gasid][GAS_META][META_GAS_NAME], "name"= GLOB.meta_gas_info[gasid][META_GAS_NAME],
"amount" = 0))) "amount" = 0)))
data["gases"] = gasdata data["gases"] = gasdata

View File

@@ -43,10 +43,10 @@
playsound(src, 'sound/machines/ding.ogg', 50, 1) playsound(src, 'sound/machines/ding.ogg', 50, 1)
eject() eject()
else else
var/gasdrained = min(powerproduction_drain*drainratio,loaded_tank.air_contents.gases[/datum/gas/plasma][MOLES]) var/gasdrained = min(powerproduction_drain*drainratio,loaded_tank.air_contents.gases[/datum/gas/plasma])
loaded_tank.air_contents.gases[/datum/gas/plasma][MOLES] -= gasdrained loaded_tank.air_contents.gases[/datum/gas/plasma] -= gasdrained
loaded_tank.air_contents.assert_gas(/datum/gas/tritium) loaded_tank.air_contents.assert_gas(/datum/gas/tritium)
loaded_tank.air_contents.gases[/datum/gas/tritium][MOLES] += gasdrained loaded_tank.air_contents.gases[/datum/gas/tritium] += gasdrained
loaded_tank.air_contents.garbage_collect() loaded_tank.air_contents.garbage_collect()
var/power_produced = RAD_COLLECTOR_OUTPUT var/power_produced = RAD_COLLECTOR_OUTPUT
@@ -58,10 +58,10 @@
eject() eject()
else else
var/gasdrained = bitcoinproduction_drain*drainratio var/gasdrained = bitcoinproduction_drain*drainratio
loaded_tank.air_contents.gases[/datum/gas/tritium][MOLES] -= gasdrained loaded_tank.air_contents.gases[/datum/gas/tritium] -= gasdrained
loaded_tank.air_contents.gases[/datum/gas/oxygen][MOLES] -= gasdrained loaded_tank.air_contents.gases[/datum/gas/oxygen] -= gasdrained
loaded_tank.air_contents.assert_gas(/datum/gas/carbon_dioxide) loaded_tank.air_contents.assert_gas(/datum/gas/carbon_dioxide)
loaded_tank.air_contents.gases[/datum/gas/carbon_dioxide][MOLES] += gasdrained*2 loaded_tank.air_contents.gases[/datum/gas/carbon_dioxide] += gasdrained*2
loaded_tank.air_contents.garbage_collect() loaded_tank.air_contents.garbage_collect()
var/bitcoins_mined = RAD_COLLECTOR_OUTPUT var/bitcoins_mined = RAD_COLLECTOR_OUTPUT
SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, bitcoins_mined*RAD_COLLECTOR_MINING_CONVERSION_RATE) SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, bitcoins_mined*RAD_COLLECTOR_MINING_CONVERSION_RATE)
@@ -76,7 +76,6 @@
var/fuel var/fuel
if(loaded_tank) if(loaded_tank)
fuel = loaded_tank.air_contents.gases[/datum/gas/plasma] fuel = loaded_tank.air_contents.gases[/datum/gas/plasma]
fuel = fuel ? fuel[MOLES] : 0
investigate_log("turned [active?"<font color='green'>on</font>":"<font color='red'>off</font>"] by [key_name(user)]. [loaded_tank?"Fuel: [round(fuel/0.29)]%":"<font color='red'>It is empty</font>"].", INVESTIGATE_SINGULO) investigate_log("turned [active?"<font color='green'>on</font>":"<font color='red'>off</font>"] by [key_name(user)]. [loaded_tank?"Fuel: [round(fuel/0.29)]%":"<font color='red'>It is empty</font>"].", INVESTIGATE_SINGULO)
return return
else else

View File

@@ -343,12 +343,12 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
//calculating gas related values //calculating gas related values
combined_gas = max(removed.total_moles(), 0) combined_gas = max(removed.total_moles(), 0)
plasmacomp = max(removed.gases[/datum/gas/plasma][MOLES]/combined_gas, 0) plasmacomp = max(removed.gases[/datum/gas/plasma]/combined_gas, 0)
o2comp = max(removed.gases[/datum/gas/oxygen][MOLES]/combined_gas, 0) o2comp = max(removed.gases[/datum/gas/oxygen]/combined_gas, 0)
co2comp = max(removed.gases[/datum/gas/carbon_dioxide][MOLES]/combined_gas, 0) co2comp = max(removed.gases[/datum/gas/carbon_dioxide]/combined_gas, 0)
n2ocomp = max(removed.gases[/datum/gas/nitrous_oxide][MOLES]/combined_gas, 0) n2ocomp = max(removed.gases[/datum/gas/nitrous_oxide]/combined_gas, 0)
n2comp = max(removed.gases[/datum/gas/nitrogen][MOLES]/combined_gas, 0) n2comp = max(removed.gases[/datum/gas/nitrogen]/combined_gas, 0)
gasmix_power_ratio = min(max(plasmacomp + o2comp + co2comp - n2comp, 0), 1) gasmix_power_ratio = min(max(plasmacomp + o2comp + co2comp - n2comp, 0), 1)
@@ -400,9 +400,9 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
removed.temperature = max(0, min(removed.temperature, 2500 * dynamic_heat_modifier)) removed.temperature = max(0, min(removed.temperature, 2500 * dynamic_heat_modifier))
//Calculate how much gas to release //Calculate how much gas to release
removed.gases[/datum/gas/plasma][MOLES] += max((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER, 0) removed.gases[/datum/gas/plasma] += max((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER, 0)
removed.gases[/datum/gas/oxygen][MOLES] += max(((device_energy + removed.temperature * dynamic_heat_modifier) - T0C) / OXYGEN_RELEASE_MODIFIER, 0) removed.gases[/datum/gas/oxygen] += max(((device_energy + removed.temperature * dynamic_heat_modifier) - T0C) / OXYGEN_RELEASE_MODIFIER, 0)
if(produces_gas) if(produces_gas)
env.merge(removed) env.merge(removed)

View File

@@ -102,7 +102,7 @@ Chilling extracts:
var/datum/gas_mixture/G = T.air var/datum/gas_mixture/G = T.air
if(istype(G)) if(istype(G))
G.assert_gas(/datum/gas/plasma) G.assert_gas(/datum/gas/plasma)
G.gases[/datum/gas/plasma][MOLES] = 0 G.gases[/datum/gas/plasma] = 0
filtered = TRUE filtered = TRUE
G.garbage_collect() G.garbage_collect()
T.air_update_turf() T.air_update_turf()

View File

@@ -87,10 +87,10 @@
breath.assert_gases(/datum/gas/oxygen, /datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz, /datum/gas/nitrogen, /datum/gas/tritium, /datum/gas/nitryl, /datum/gas/pluoxium, /datum/gas/stimulum) breath.assert_gases(/datum/gas/oxygen, /datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz, /datum/gas/nitrogen, /datum/gas/tritium, /datum/gas/nitryl, /datum/gas/pluoxium, /datum/gas/stimulum)
//Partial pressures in our breath //Partial pressures in our breath
var/O2_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/oxygen][MOLES])+(8*breath.get_breath_partial_pressure(breath_gases[/datum/gas/pluoxium][MOLES])) var/O2_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/oxygen])+(8*breath.get_breath_partial_pressure(breath_gases[/datum/gas/pluoxium]))
var/N2_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/nitrogen][MOLES]) var/N2_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/nitrogen])
var/Toxins_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/plasma][MOLES]) var/Toxins_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/plasma])
var/CO2_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/carbon_dioxide][MOLES]) var/CO2_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/carbon_dioxide])
//-- OXY --// //-- OXY --//
@@ -98,7 +98,7 @@
//Too much oxygen! //Yes, some species may not like it. //Too much oxygen! //Yes, some species may not like it.
if(safe_oxygen_max) if(safe_oxygen_max)
if((O2_pp > safe_oxygen_max) && safe_oxygen_max == 0) //I guess plasma men technically need to have a check. if((O2_pp > safe_oxygen_max) && safe_oxygen_max == 0) //I guess plasma men technically need to have a check.
var/ratio = (breath_gases[/datum/gas/oxygen][MOLES]/safe_oxygen_max) * 10 var/ratio = (breath_gases[/datum/gas/oxygen]/safe_oxygen_max) * 10
H.apply_damage_type(CLAMP(ratio, oxy_breath_dam_min, oxy_breath_dam_max), oxy_damage_type) H.apply_damage_type(CLAMP(ratio, oxy_breath_dam_min, oxy_breath_dam_max), oxy_damage_type)
H.throw_alert("too_much_oxy", /obj/screen/alert/too_much_oxy) H.throw_alert("too_much_oxy", /obj/screen/alert/too_much_oxy)
@@ -121,18 +121,18 @@
//Too little oxygen! //Too little oxygen!
if(safe_oxygen_min) if(safe_oxygen_min)
if(O2_pp < safe_oxygen_min) if(O2_pp < safe_oxygen_min)
gas_breathed = handle_too_little_breath(H, O2_pp, safe_oxygen_min, breath_gases[/datum/gas/oxygen][MOLES]) gas_breathed = handle_too_little_breath(H, O2_pp, safe_oxygen_min, breath_gases[/datum/gas/oxygen])
H.throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy) H.throw_alert("not_enough_oxy", /obj/screen/alert/not_enough_oxy)
else else
H.failed_last_breath = FALSE H.failed_last_breath = FALSE
if(H.health >= H.crit_threshold) if(H.health >= H.crit_threshold)
H.adjustOxyLoss(-5) H.adjustOxyLoss(-5)
gas_breathed = breath_gases[/datum/gas/oxygen][MOLES] gas_breathed = breath_gases[/datum/gas/oxygen]
H.clear_alert("not_enough_oxy") H.clear_alert("not_enough_oxy")
//Exhale //Exhale
breath_gases[/datum/gas/oxygen][MOLES] -= gas_breathed breath_gases[/datum/gas/oxygen] -= gas_breathed
breath_gases[/datum/gas/carbon_dioxide][MOLES] += gas_breathed breath_gases[/datum/gas/carbon_dioxide] += gas_breathed
gas_breathed = 0 gas_breathed = 0
//-- Nitrogen --// //-- Nitrogen --//
@@ -140,7 +140,7 @@
//Too much nitrogen! //Too much nitrogen!
if(safe_nitro_max) if(safe_nitro_max)
if(N2_pp > safe_nitro_max) if(N2_pp > safe_nitro_max)
var/ratio = (breath_gases[/datum/gas/nitrogen][MOLES]/safe_nitro_max) * 10 var/ratio = (breath_gases[/datum/gas/nitrogen]/safe_nitro_max) * 10
H.apply_damage_type(CLAMP(ratio, nitro_breath_dam_min, nitro_breath_dam_max), nitro_damage_type) H.apply_damage_type(CLAMP(ratio, nitro_breath_dam_min, nitro_breath_dam_max), nitro_damage_type)
H.throw_alert("too_much_nitro", /obj/screen/alert/too_much_nitro) H.throw_alert("too_much_nitro", /obj/screen/alert/too_much_nitro)
H.losebreath += 2 H.losebreath += 2
@@ -150,18 +150,18 @@
//Too little nitrogen! //Too little nitrogen!
if(safe_nitro_min) if(safe_nitro_min)
if(N2_pp < safe_nitro_min) if(N2_pp < safe_nitro_min)
gas_breathed = handle_too_little_breath(H, N2_pp, safe_nitro_min, breath_gases[/datum/gas/nitrogen][MOLES]) gas_breathed = handle_too_little_breath(H, N2_pp, safe_nitro_min, breath_gases[/datum/gas/nitrogen])
H.throw_alert("nitro", /obj/screen/alert/not_enough_nitro) H.throw_alert("nitro", /obj/screen/alert/not_enough_nitro)
else else
H.failed_last_breath = FALSE H.failed_last_breath = FALSE
if(H.health >= H.crit_threshold) if(H.health >= H.crit_threshold)
H.adjustOxyLoss(-5) H.adjustOxyLoss(-5)
gas_breathed = breath_gases[/datum/gas/nitrogen][MOLES] gas_breathed = breath_gases[/datum/gas/nitrogen]
H.clear_alert("nitro") H.clear_alert("nitro")
//Exhale //Exhale
breath_gases[/datum/gas/nitrogen][MOLES] -= gas_breathed breath_gases[/datum/gas/nitrogen] -= gas_breathed
breath_gases[/datum/gas/carbon_dioxide][MOLES] += gas_breathed breath_gases[/datum/gas/carbon_dioxide] += gas_breathed
gas_breathed = 0 gas_breathed = 0
//-- CO2 --// //-- CO2 --//
@@ -187,18 +187,18 @@
//Too little CO2! //Too little CO2!
if(safe_co2_min) if(safe_co2_min)
if(CO2_pp < safe_co2_min) if(CO2_pp < safe_co2_min)
gas_breathed = handle_too_little_breath(H, CO2_pp, safe_co2_min, breath_gases[/datum/gas/carbon_dioxide][MOLES]) gas_breathed = handle_too_little_breath(H, CO2_pp, safe_co2_min, breath_gases[/datum/gas/carbon_dioxide])
H.throw_alert("not_enough_co2", /obj/screen/alert/not_enough_co2) H.throw_alert("not_enough_co2", /obj/screen/alert/not_enough_co2)
else else
H.failed_last_breath = FALSE H.failed_last_breath = FALSE
if(H.health >= H.crit_threshold) if(H.health >= H.crit_threshold)
H.adjustOxyLoss(-5) H.adjustOxyLoss(-5)
gas_breathed = breath_gases[/datum/gas/carbon_dioxide][MOLES] gas_breathed = breath_gases[/datum/gas/carbon_dioxide]
H.clear_alert("not_enough_co2") H.clear_alert("not_enough_co2")
//Exhale //Exhale
breath_gases[/datum/gas/carbon_dioxide][MOLES] -= gas_breathed breath_gases[/datum/gas/carbon_dioxide] -= gas_breathed
breath_gases[/datum/gas/oxygen][MOLES] += gas_breathed breath_gases[/datum/gas/oxygen] += gas_breathed
gas_breathed = 0 gas_breathed = 0
@@ -207,7 +207,7 @@
//Too much toxins! //Too much toxins!
if(safe_toxins_max) if(safe_toxins_max)
if(Toxins_pp > safe_toxins_max) if(Toxins_pp > safe_toxins_max)
var/ratio = (breath_gases[/datum/gas/plasma][MOLES]/safe_toxins_max) * 10 var/ratio = (breath_gases[/datum/gas/plasma]/safe_toxins_max) * 10
H.apply_damage_type(CLAMP(ratio, tox_breath_dam_min, tox_breath_dam_max), tox_damage_type) H.apply_damage_type(CLAMP(ratio, tox_breath_dam_min, tox_breath_dam_max), tox_damage_type)
H.throw_alert("too_much_tox", /obj/screen/alert/too_much_tox) H.throw_alert("too_much_tox", /obj/screen/alert/too_much_tox)
else else
@@ -217,18 +217,18 @@
//Too little toxins! //Too little toxins!
if(safe_toxins_min) if(safe_toxins_min)
if(Toxins_pp < safe_toxins_min) if(Toxins_pp < safe_toxins_min)
gas_breathed = handle_too_little_breath(H, Toxins_pp, safe_toxins_min, breath_gases[/datum/gas/plasma][MOLES]) gas_breathed = handle_too_little_breath(H, Toxins_pp, safe_toxins_min, breath_gases[/datum/gas/plasma])
H.throw_alert("not_enough_tox", /obj/screen/alert/not_enough_tox) H.throw_alert("not_enough_tox", /obj/screen/alert/not_enough_tox)
else else
H.failed_last_breath = FALSE H.failed_last_breath = FALSE
if(H.health >= H.crit_threshold) if(H.health >= H.crit_threshold)
H.adjustOxyLoss(-5) H.adjustOxyLoss(-5)
gas_breathed = breath_gases[/datum/gas/plasma][MOLES] gas_breathed = breath_gases[/datum/gas/plasma]
H.clear_alert("not_enough_tox") H.clear_alert("not_enough_tox")
//Exhale //Exhale
breath_gases[/datum/gas/plasma][MOLES] -= gas_breathed breath_gases[/datum/gas/plasma] -= gas_breathed
breath_gases[/datum/gas/carbon_dioxide][MOLES] += gas_breathed breath_gases[/datum/gas/carbon_dioxide] += gas_breathed
gas_breathed = 0 gas_breathed = 0
@@ -238,7 +238,7 @@
// N2O // N2O
var/SA_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/nitrous_oxide][MOLES]) var/SA_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/nitrous_oxide])
if(SA_pp > SA_para_min) // Enough to make us stunned for a bit if(SA_pp > SA_para_min) // Enough to make us stunned for a bit
H.Unconscious(60) // 60 gives them one second to wake up and run away a bit! H.Unconscious(60) // 60 gives them one second to wake up and run away a bit!
if(SA_pp > SA_sleep_min) // Enough to make us sleep as well if(SA_pp > SA_sleep_min) // Enough to make us sleep as well
@@ -249,7 +249,7 @@
// BZ // BZ
var/bz_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/bz][MOLES]) var/bz_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/bz])
if(bz_pp > BZ_trip_balls_min) if(bz_pp > BZ_trip_balls_min)
H.hallucination += 10 H.hallucination += 10
H.reagents.add_reagent("bz_metabolites",5) H.reagents.add_reagent("bz_metabolites",5)
@@ -262,14 +262,14 @@
// Tritium // Tritium
var/trit_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/tritium][MOLES]) var/trit_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/tritium])
if (trit_pp > 50) if (trit_pp > 50)
H.radiation += trit_pp/2 //If you're breathing in half an atmosphere of radioactive gas, you fucked up. H.radiation += trit_pp/2 //If you're breathing in half an atmosphere of radioactive gas, you fucked up.
else else
H.radiation += trit_pp/10 H.radiation += trit_pp/10
// Nitryl // Nitryl
var/nitryl_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/nitryl][MOLES]) var/nitryl_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/nitryl])
if (prob(nitryl_pp)) if (prob(nitryl_pp))
to_chat(H, "<span class='alert'>Your mouth feels like it's burning!</span>") to_chat(H, "<span class='alert'>Your mouth feels like it's burning!</span>")
if (nitryl_pp >40) if (nitryl_pp >40)
@@ -280,22 +280,22 @@
H.silent = max(H.silent, 3) H.silent = max(H.silent, 3)
else else
H.adjustFireLoss(nitryl_pp/4) H.adjustFireLoss(nitryl_pp/4)
gas_breathed = breath_gases[/datum/gas/nitryl][MOLES] gas_breathed = breath_gases[/datum/gas/nitryl]
if (gas_breathed > gas_stimulation_min) if (gas_breathed > gas_stimulation_min)
H.reagents.add_reagent("no2",1) H.reagents.add_reagent("no2",1)
breath_gases[/datum/gas/nitryl][MOLES]-=gas_breathed breath_gases[/datum/gas/nitryl]-=gas_breathed
// Stimulum // Stimulum
gas_breathed = breath_gases[/datum/gas/stimulum][MOLES] gas_breathed = breath_gases[/datum/gas/stimulum]
if (gas_breathed > gas_stimulation_min) if (gas_breathed > gas_stimulation_min)
var/existing = H.reagents.get_reagent_amount("stimulum") var/existing = H.reagents.get_reagent_amount("stimulum")
H.reagents.add_reagent("stimulum",max(0, 1 - existing)) H.reagents.add_reagent("stimulum",max(0, 1 - existing))
breath_gases[/datum/gas/stimulum][MOLES]-=gas_breathed breath_gases[/datum/gas/stimulum]-=gas_breathed
// Miasma // Miasma
if (breath_gases[/datum/gas/miasma]) if (breath_gases[/datum/gas/miasma])
var/miasma_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/miasma][MOLES]) var/miasma_pp = breath.get_breath_partial_pressure(breath_gases[/datum/gas/miasma])
//Miasma sickness //Miasma sickness
if(prob(0.5 * miasma_pp)) if(prob(0.5 * miasma_pp))
@@ -334,7 +334,7 @@
// Then again, this is a purely hypothetical scenario and hardly reachable // Then again, this is a purely hypothetical scenario and hardly reachable
owner.adjust_disgust(0.1 * miasma_pp) owner.adjust_disgust(0.1 * miasma_pp)
breath_gases[/datum/gas/miasma][MOLES]-=gas_breathed breath_gases[/datum/gas/miasma]-=gas_breathed
// Clear out moods when no miasma at all // Clear out moods when no miasma at all
else else

View File

@@ -90,10 +90,10 @@ SLEEPER CODE IS IN game/objects/items/devices/dogborg_sleeper.dm !
var/list/env_gases = environment.gases var/list/env_gases = environment.gases
environment.assert_gases(arglist(GLOB.hardcoded_gases)) environment.assert_gases(arglist(GLOB.hardcoded_gases))
var/o2_concentration = env_gases[/datum/gas/oxygen][MOLES]/total_moles var/o2_concentration = env_gases[/datum/gas/oxygen]/total_moles
var/n2_concentration = env_gases[/datum/gas/nitrogen][MOLES]/total_moles var/n2_concentration = env_gases[/datum/gas/nitrogen]/total_moles
var/co2_concentration = env_gases[/datum/gas/carbon_dioxide][MOLES]/total_moles var/co2_concentration = env_gases[/datum/gas/carbon_dioxide]/total_moles
var/plasma_concentration = env_gases[/datum/gas/plasma][MOLES]/total_moles var/plasma_concentration = env_gases[/datum/gas/plasma]/total_moles
environment.garbage_collect() environment.garbage_collect()
if(abs(n2_concentration - N2STANDARD) < 20) if(abs(n2_concentration - N2STANDARD) < 20)
@@ -120,8 +120,8 @@ SLEEPER CODE IS IN game/objects/items/devices/dogborg_sleeper.dm !
for(var/id in env_gases) for(var/id in env_gases)
if(id in GLOB.hardcoded_gases) if(id in GLOB.hardcoded_gases)
continue continue
var/gas_concentration = env_gases[id][MOLES]/total_moles var/gas_concentration = env_gases[id]/total_moles
to_chat(user, "<span class='alert'>[env_gases[id][GAS_META][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] %</span>") to_chat(user, "<span class='alert'>[GLOB.meta_gas_info[id][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] %</span>")
to_chat(user, "<span class='info'>Temperature: [round(environment.temperature-T0C)] &deg;C</span>") to_chat(user, "<span class='info'>Temperature: [round(environment.temperature-T0C)] &deg;C</span>")
/obj/item/analyzer/nose/AltClick(mob/user) //Barometer output for measuring when the next storm happens /obj/item/analyzer/nose/AltClick(mob/user) //Barometer output for measuring when the next storm happens