diff --git a/code/ATMOSPHERICS/components/trinary_devices/filter.dm b/code/ATMOSPHERICS/components/trinary_devices/filter.dm
index d1c0dafc97b..a3d0214b985 100644
--- a/code/ATMOSPHERICS/components/trinary_devices/filter.dm
+++ b/code/ATMOSPHERICS/components/trinary_devices/filter.dm
@@ -1,9 +1,10 @@
#define FILTER_NOTHING -1
-#define FILTER_PLASMA 0
-#define FILTER_OXYGEN 1
-#define FILTER_NITROGEN 2
-#define FILTER_CARBONDIOXIDE 3
-#define FILTER_NITROUSOXIDE 4
+//very cleverly using the gas index defines so as to simplify a bunch of logic
+#define FILTER_PLASMA GAS_PL
+#define FILTER_OXYGEN GAS_O2
+#define FILTER_NITROGEN GAS_N2
+#define FILTER_CARBONDIOXIDE GAS_CO2
+#define FILTER_NITROUSOXIDE GAS_N2O
/obj/machinery/atmospherics/components/trinary/filter
icon_state = "filter_off"
@@ -108,39 +109,14 @@ Filter types:
var/datum/gas_mixture/filtered_out = new
filtered_out.temperature = removed.temperature
- switch(filter_type)
- if(FILTER_PLASMA)
- filtered_out.toxins = removed.toxins
- removed.toxins = 0
-
- if(removed.trace_gases.len>0)
- for(var/datum/gas/trace_gas in removed.trace_gases)
- if(istype(trace_gas, /datum/gas/oxygen_agent_b))
- removed.trace_gases -= trace_gas
- filtered_out.trace_gases += trace_gas
-
- if(FILTER_OXYGEN)
- filtered_out.oxygen = removed.oxygen
- removed.oxygen = 0
-
- if(FILTER_NITROGEN)
- filtered_out.nitrogen = removed.nitrogen
- removed.nitrogen = 0
-
- if(FILTER_CARBONDIOXIDE)
- filtered_out.carbon_dioxide = removed.carbon_dioxide
- removed.carbon_dioxide = 0
-
- if(FILTER_NITROUSOXIDE)
- if(removed.trace_gases.len>0)
- for(var/datum/gas/trace_gas in removed.trace_gases)
- if(istype(trace_gas, /datum/gas/sleeping_agent))
- removed.trace_gases -= trace_gas
- filtered_out.trace_gases += trace_gas
-
- else
- filtered_out = null
-
+ if(filter_type > 0)
+ filtered_out.gases[filter_type][MOLES] = removed.gases[filter_type][MOLES]
+ removed.gases[filter_type][MOLES] = 0
+ if(filter_type == FILTER_PLASMA)
+ filtered_out.gases[GAS_AGENT_B][MOLES] = removed.gases[GAS_AGENT_B][MOLES]
+ removed.gases[GAS_AGENT_B][MOLES] = 0
+ else
+ filtered_out = null
air2.merge(filtered_out)
air3.merge(removed)
diff --git a/code/ATMOSPHERICS/components/unary_devices/cryo.dm b/code/ATMOSPHERICS/components/unary_devices/cryo.dm
index 9674aa921e1..6c1361f3433 100644
--- a/code/ATMOSPHERICS/components/unary_devices/cryo.dm
+++ b/code/ATMOSPHERICS/components/unary_devices/cryo.dm
@@ -269,7 +269,7 @@
if(occupant.bodytemperature < T0C)
occupant.sleeping = max(5 / efficiency, (1 / occupant.bodytemperature) * 2000 / efficiency)
occupant.Paralyse(max(5 / efficiency, (1 / occupant.bodytemperature) * 3000 / efficiency))
- if(air_contents.oxygen > 2)
+ if(air_contents.gases[GAS_O2][MOLES] > 2)
if(occupant.getOxyLoss()) occupant.adjustOxyLoss(-1)
else
occupant.adjustOxyLoss(-1)
diff --git a/code/ATMOSPHERICS/components/unary_devices/oxygen_generator.dm b/code/ATMOSPHERICS/components/unary_devices/oxygen_generator.dm
index 0c0bee0b275..f0da2640824 100644
--- a/code/ATMOSPHERICS/components/unary_devices/oxygen_generator.dm
+++ b/code/ATMOSPHERICS/components/unary_devices/oxygen_generator.dm
@@ -46,7 +46,7 @@
var/added_oxygen = oxygen_content - total_moles
air_contents.temperature = (current_heat_capacity*air_contents.temperature + 20*added_oxygen*T0C)/(current_heat_capacity+20*added_oxygen)
- air_contents.oxygen += added_oxygen
+ air_contents.gases[GAS_O2][MOLES] += added_oxygen
update_parents()
diff --git a/code/ATMOSPHERICS/components/unary_devices/tank.dm b/code/ATMOSPHERICS/components/unary_devices/tank.dm
index 44ab5048460..d5ecc65b7e9 100644
--- a/code/ATMOSPHERICS/components/unary_devices/tank.dm
+++ b/code/ATMOSPHERICS/components/unary_devices/tank.dm
@@ -6,58 +6,35 @@
desc = "A large vessel containing pressurized gas."
var/volume = 10000 //in liters, 1 meters by 1 meters by 2 meters
density = 1
+ var/gas_type = 0
/obj/machinery/atmospherics/components/unary/tank/New()
..()
var/datum/gas_mixture/air_contents = AIR1
air_contents.volume = volume
air_contents.temperature = T20C
+ if(gas_type)
+ air_contents.gases[gas_type][MOLES] = AIR_CONTENTS
+ name = "[name] ([air_contents.gases[gas_type][GAS_NAME]])"
/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide
- name = "pressure tank (Carbon Dioxide)"
-
-/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide/New()
- ..()
- var/datum/gas_mixture/air_contents = AIR1
- air_contents.carbon_dioxide = AIR_CONTENTS
+ gas_type = GAS_CO2
/obj/machinery/atmospherics/components/unary/tank/toxins
icon_state = "orange"
- name = "pressure tank (Plasma)"
-
-/obj/machinery/atmospherics/components/unary/tank/toxins/New()
- ..()
- var/datum/gas_mixture/air_contents = AIR1
- air_contents.toxins = AIR_CONTENTS
+ gas_type = GAS_PL
/obj/machinery/atmospherics/components/unary/tank/oxygen_agent_b
icon_state = "orange_2"
- name = "pressure tank (Oxygen + Plasma)"
-
-/obj/machinery/atmospherics/components/unary/tank/oxygen_agent_b/New()
- ..()
- var/datum/gas_mixture/air_contents = AIR1
- var/datum/gas/oxygen_agent_b/trace_gas = new
- trace_gas.moles = AIR_CONTENTS
- air_contents.trace_gases += trace_gas
+ gas_type = GAS_AGENT_B
/obj/machinery/atmospherics/components/unary/tank/oxygen
icon_state = "blue"
- name = "pressure tank (Oxygen)"
-
-/obj/machinery/atmospherics/components/unary/tank/oxygen/New()
- ..()
- var/datum/gas_mixture/air_contents = AIR1
- air_contents.oxygen = AIR_CONTENTS
+ gas_type = GAS_O2
/obj/machinery/atmospherics/components/unary/tank/nitrogen
icon_state = "red"
- name = "pressure tank (Nitrogen)"
-
-/obj/machinery/atmospherics/components/unary/tank/nitrogen/New()
- ..()
- var/datum/gas_mixture/air_contents = AIR1
- air_contents.nitrogen = AIR_CONTENTS
+ gas_type = GAS_N2
/obj/machinery/atmospherics/components/unary/tank/air
icon_state = "grey"
@@ -66,5 +43,5 @@
/obj/machinery/atmospherics/components/unary/tank/air/New()
..()
var/datum/gas_mixture/air_contents = AIR1
- air_contents.oxygen = AIR_CONTENTS * 0.2
- air_contents.nitrogen = AIR_CONTENTS * 0.8
\ No newline at end of file
+ air_contents.gases[GAS_O2][MOLES] = AIR_CONTENTS * 0.2
+ air_contents.gases[GAS_N2][MOLES] = AIR_CONTENTS * 0.8
\ No newline at end of file
diff --git a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm
index 65bdcf2c5e8..74e4d62fe1e 100644
--- a/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm
+++ b/code/ATMOSPHERICS/components/unary_devices/vent_scrubber.dm
@@ -162,14 +162,21 @@
/obj/machinery/atmospherics/components/unary/vent_scrubber/proc/scrub(var/turf/simulated/tile)
- if (!tile || !istype(tile))
+ if (!istype(tile))
return 0
var/datum/gas_mixture/environment = tile.return_air()
var/datum/gas_mixture/air_contents = AIR1
if(scrubbing & SCRUBBING)
- if((environment.toxins>0) || (environment.carbon_dioxide>0) || (environment.trace_gases.len>0))
+ var/should_we_scrub = FALSE
+ for(var/gas in environment.gases)
+ if(gas[GAS_INDEX] <= 2)
+ continue
+ if(gas[MOLES])
+ should_we_scrub = TRUE
+ break
+ if(should_we_scrub)
var/transfer_moles = min(1, volume_rate/environment.volume)*environment.total_moles()
//Take a gas sample
@@ -181,21 +188,17 @@
var/datum/gas_mixture/filtered_out = new
filtered_out.temperature = removed.temperature
if(scrub_Toxins)
- filtered_out.toxins = removed.toxins
- removed.toxins = 0
+ filtered_out.gases[GAS_PL][MOLES] = removed.gases[GAS_PL][MOLES]
+ removed.gases[GAS_PL][MOLES] = 0
if(scrub_CO2)
- filtered_out.carbon_dioxide = removed.carbon_dioxide
- removed.carbon_dioxide = 0
-
- if(removed.trace_gases.len>0)
- for(var/datum/gas/trace_gas in removed.trace_gases)
- if(istype(trace_gas, /datum/gas/oxygen_agent_b))
- removed.trace_gases -= trace_gas
- filtered_out.trace_gases += trace_gas
- else if(istype(trace_gas, /datum/gas/sleeping_agent) && scrub_N2O)
- removed.trace_gases -= trace_gas
- filtered_out.trace_gases += trace_gas
-
+ filtered_out.gases[GAS_CO2][MOLES] = removed.gases[GAS_CO2][MOLES]
+ removed.gases[GAS_CO2][MOLES] = 0
+ if(TRUE) //no var for scrubbing agent b but I wanted the indentation to line up
+ filtered_out.gases[GAS_AGENT_B][MOLES] = removed.gases[GAS_AGENT_B][MOLES]
+ removed.gases[GAS_AGENT_B][MOLES] = 0
+ if(scrub_N2O)
+ filtered_out.gases[GAS_N2O][MOLES] = removed.gases[GAS_N2O][MOLES]
+ removed.gases[GAS_AGENT_B][MOLES] = 0
//Remix the resulting gases
air_contents.merge(filtered_out)
diff --git a/code/ATMOSPHERICS/datum_pipeline.dm b/code/ATMOSPHERICS/datum_pipeline.dm
index b4547824db6..5c34e41914c 100644
--- a/code/ATMOSPHERICS/datum_pipeline.dm
+++ b/code/ATMOSPHERICS/datum_pipeline.dm
@@ -130,21 +130,13 @@ var/pipenetwarnings = 10
for(var/obj/machinery/atmospherics/pipe/member in members)
member.air_temporary = new
member.air_temporary.volume = member.volume
+ member.air_temporary.copy_from(air)
- member.air_temporary.oxygen = air.oxygen*member.volume/air.volume
- member.air_temporary.nitrogen = air.nitrogen*member.volume/air.volume
- member.air_temporary.toxins = air.toxins*member.volume/air.volume
- member.air_temporary.carbon_dioxide = air.carbon_dioxide*member.volume/air.volume
+ for(var/gas in member.air_temporary.gases)
+ gas[MOLES] *= member.volume/air.volume
member.air_temporary.temperature = air.temperature
- if(air.trace_gases.len)
- for(var/datum/gas/trace_gas in air.trace_gases)
- var/datum/gas/corresponding = new trace_gas.type()
- member.air_temporary.trace_gases += corresponding
-
- corresponding.moles = trace_gas.moles*member.volume/air.volume
-
/datum/pipeline/proc/temperature_interact(turf/target, share_volume, thermal_conductivity)
var/total_heat_capacity = air.heat_capacity()
var/partial_heat_capacity = total_heat_capacity*(share_volume/air.volume)
@@ -215,56 +207,24 @@ var/pipenetwarnings = 10
if(C.connected_device)
GL += C.portableConnectorReturnAir()
- var/total_volume = 0
var/total_thermal_energy = 0
var/total_heat_capacity = 0
- var/total_oxygen = 0
- var/total_nitrogen = 0
- var/total_toxins = 0
- var/total_carbon_dioxide = 0
- var/list/total_trace_gases = list()
+ var/datum/gas_mixture/total_gas_mixture = new
for(var/datum/gas_mixture/G in GL)
- total_volume += G.volume
+ total_gas_mixture.volume += G.volume
+ total_gas_mixture.merge(G)
total_thermal_energy += G.thermal_energy()
total_heat_capacity += G.heat_capacity()
- total_oxygen += G.oxygen
- total_nitrogen += G.nitrogen
- total_toxins += G.toxins
- total_carbon_dioxide += G.carbon_dioxide
-
- if(G.trace_gases.len)
- for(var/datum/gas/trace_gas in G.trace_gases)
- var/datum/gas/corresponding = locate(trace_gas.type) in total_trace_gases
- if(!corresponding)
- corresponding = new trace_gas.type()
- total_trace_gases += corresponding
-
- corresponding.moles += trace_gas.moles
-
- if(total_volume > 0)
-
- //Calculate temperature
- var/temperature = 0
-
- if(total_heat_capacity > 0)
- temperature = total_thermal_energy/total_heat_capacity
+ if(total_heat_capacity > 0)
+ total_gas_mixture.temperature = total_thermal_energy/total_heat_capacity
+ else
+ total_gas_mixture.temperature = 0
+ if(total_gas_mixture.volume > 0)
//Update individual gas_mixtures by volume ratio
for(var/datum/gas_mixture/G in GL)
- G.oxygen = total_oxygen*G.volume/total_volume
- G.nitrogen = total_nitrogen*G.volume/total_volume
- G.toxins = total_toxins*G.volume/total_volume
- G.carbon_dioxide = total_carbon_dioxide*G.volume/total_volume
-
- G.temperature = temperature
-
- if(total_trace_gases.len)
- for(var/datum/gas/trace_gas in total_trace_gases)
- var/datum/gas/corresponding = locate(trace_gas.type) in G.trace_gases
- if(!corresponding)
- corresponding = new trace_gas.type()
- G.trace_gases += corresponding
-
- corresponding.moles = trace_gas.moles*G.volume/total_volume
\ No newline at end of file
+ G.copy_from(total_gas_mixture)
+ for(var/gas in G.gases)
+ gas[MOLES] *= G.volume/total_gas_mixture.volume
diff --git a/code/LINDA/LINDA_fire.dm b/code/LINDA/LINDA_fire.dm
index fa7c5902d8e..4215bcc91e7 100644
--- a/code/LINDA/LINDA_fire.dm
+++ b/code/LINDA/LINDA_fire.dm
@@ -13,7 +13,7 @@
return 0
if(active_hotspot)
if(soh)
- if(air_contents.toxins > 0.5 && air_contents.oxygen > 0.5)
+ if(air_contents.gases[GAS_PL][MOLES] > 0.5 && air_contents.gases[GAS_O2][MOLES] > 0.5)
if(active_hotspot.temperature < exposed_temperature)
active_hotspot.temperature = exposed_temperature
if(active_hotspot.volume < exposed_volume)
@@ -22,11 +22,11 @@
var/igniting = 0
- if((exposed_temperature > PLASMA_MINIMUM_BURN_TEMPERATURE) && air_contents.toxins > 0.5)
+ if((exposed_temperature > PLASMA_MINIMUM_BURN_TEMPERATURE) && air_contents.gases[GAS_PL][MOLES] > 0.5)
igniting = 1
if(igniting)
- if(air_contents.oxygen < 0.5 || air_contents.toxins < 0.5)
+ if(air_contents.gases[GAS_O2][MOLES] < 0.5 || air_contents.gases[GAS_PL][MOLES] < 0.5)
return 0
active_hotspot = PoolOrNew(/obj/effect/hotspot, src)
@@ -103,7 +103,7 @@
qdel(src)
return
- if(!(location.air) || location.air.toxins < 0.5 || location.air.oxygen < 0.5)
+ if(!(location.air) || location.air.gases[GAS_PL][MOLES] < 0.5 || location.air.gases[GAS_O2][MOLES] < 0.5)
qdel(src)
return
diff --git a/code/LINDA/LINDA_system.dm b/code/LINDA/LINDA_system.dm
index e1904d8973b..e4d4d3f4cde 100644
--- a/code/LINDA/LINDA_system.dm
+++ b/code/LINDA/LINDA_system.dm
@@ -163,22 +163,20 @@ var/const/SPAWN_AIR = 256
G.temperature += 1000
if(flag & SPAWN_TOXINS)
- G.toxins += amount
+ G.gases[GAS_PL][MOLES] += amount
if(flag & SPAWN_OXYGEN)
- G.oxygen += amount
+ G.gases[GAS_O2][MOLES] += amount
if(flag & SPAWN_CO2)
- G.carbon_dioxide += amount
+ G.gases[GAS_CO2][MOLES] += amount
if(flag & SPAWN_NITROGEN)
- G.nitrogen += amount
+ G.gases[GAS_N2][MOLES] += amount
if(flag & SPAWN_N2O)
- var/datum/gas/sleeping_agent/T = new
- T.moles += amount
- G.trace_gases += T
+ G.gases[GAS_N2O][MOLES] += amount
if(flag & SPAWN_AIR)
- G.oxygen += MOLES_O2STANDARD * amount
- G.nitrogen += MOLES_N2STANDARD * amount
+ G.gases[GAS_O2][MOLES] += MOLES_O2STANDARD * amount
+ G.gases[GAS_N2][MOLES] += MOLES_N2STANDARD * amount
air.merge(G)
SSair.add_to_active(src, 0)
\ No newline at end of file
diff --git a/code/LINDA/LINDA_turf_tile.dm b/code/LINDA/LINDA_turf_tile.dm
index 2ad06711b10..fd4b203ef1a 100644
--- a/code/LINDA/LINDA_turf_tile.dm
+++ b/code/LINDA/LINDA_turf_tile.dm
@@ -15,26 +15,14 @@
//Create gas mixture to hold data for passing
var/datum/gas_mixture/GM = new
- GM.oxygen = oxygen
- GM.carbon_dioxide = carbon_dioxide
- GM.nitrogen = nitrogen
- GM.toxins = toxins
-
- GM.temperature = temperature
+ GM.copy_from(src)
return GM
-/turf/remove_air(amount as num)
- var/datum/gas_mixture/GM = new
+/turf/remove_air(amount)
+ var/datum/gas_mixture/GM = return_air()
- var/sum = oxygen + carbon_dioxide + nitrogen + toxins
- if(sum>0)
- GM.oxygen = (oxygen/sum)*amount
- GM.carbon_dioxide = (carbon_dioxide/sum)*amount
- GM.nitrogen = (nitrogen/sum)*amount
- GM.toxins = (toxins/sum)*amount
-
- GM.temperature = temperature
+ GM.remove(amount)
return GM
@@ -61,11 +49,7 @@
visibilityChanged()
if(!blocks_air)
air = new
- air.oxygen = oxygen
- air.carbon_dioxide = carbon_dioxide
- air.nitrogen = nitrogen
- air.toxins = toxins
- air.temperature = temperature
+ air.copy_from_turf(src)
/turf/simulated/Destroy()
visibilityChanged()
@@ -254,11 +238,10 @@
return null
/turf/simulated/proc/tile_graphic()
- if(air.toxins > MOLES_PLASMA_VISIBLE)
+ if(air.gases[GAS_PL][MOLES] > MOLES_PLASMA_VISIBLE)
return "plasma"
- var/datum/gas/sleeping_agent = locate(/datum/gas/sleeping_agent) in air.trace_gases
- if(sleeping_agent && (sleeping_agent.moles > 1))
+ if(air.gases[GAS_N2O][MOLES] > 1)
return "sleeping_agent"
return null
@@ -331,36 +314,15 @@
/datum/excited_group/proc/self_breakdown()
var/datum/gas_mixture/A = new
- var/datum/gas/sleeping_agent/S = new
- A.trace_gases += S
for(var/turf/simulated/T in turf_list)
- A.oxygen += T.air.oxygen
- A.carbon_dioxide+= T.air.carbon_dioxide
- A.nitrogen += T.air.nitrogen
- A.toxins += T.air.toxins
-
- if(T.air.trace_gases.len)
- for(var/datum/gas/N in T.air.trace_gases)
- S.moles += N.moles
+ A.merge(T.air)
for(var/turf/simulated/T in turf_list)
- T.air.oxygen = A.oxygen/turf_list.len
- T.air.carbon_dioxide= A.carbon_dioxide/turf_list.len
- T.air.nitrogen = A.nitrogen/turf_list.len
- T.air.toxins = A.toxins/turf_list.len
-
- if(S.moles > 0)
- if(T.air.trace_gases.len)
- for(var/datum/gas/G in T.air.trace_gases)
- G.moles = S.moles/turf_list.len
- else
- var/datum/gas/sleeping_agent/G = new
- G.moles = S.moles/turf_list.len
- T.air.trace_gases += G
+ for(var/gas in T.air.gases)
+ gas[MOLES] = A.gases[gas[GAS_INDEX]][MOLES]/turf_list.len
T.update_visuals()
-
/datum/excited_group/proc/dismantle()
for(var/turf/simulated/T in turf_list)
T.excited = 0
diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm
index 9ba07db229b..5b0d2034026 100644
--- a/code/__DEFINES/atmospherics.dm
+++ b/code/__DEFINES/atmospherics.dm
@@ -20,8 +20,9 @@
//indices of values in gas lists. used by listmos.
#define MOLES 1
#define ARCHIVE 2
-#define SPECIFIC_HEAT 3
-#define GAS_INDEX 4
+#define GAS_INDEX 3
+#define SPECIFIC_HEAT 4
+#define GAS_NAME 5
//stuff you should probably leave well alone!
//ATMOS
diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm
index a1b0b22f1dc..227ef3c4f62 100644
--- a/code/__HELPERS/unsorted.dm
+++ b/code/__HELPERS/unsorted.dm
@@ -1046,20 +1046,13 @@ var/list/WALLITEMS_INVERSE = list(
user << "Results of analysis of \icon[icon] [target]."
if(total_moles>0)
- var/o2_concentration = air_contents.oxygen/total_moles
- var/n2_concentration = air_contents.nitrogen/total_moles
- var/co2_concentration = air_contents.carbon_dioxide/total_moles
- var/plasma_concentration = air_contents.toxins/total_moles
-
- var/unknown_concentration = 1-(o2_concentration+n2_concentration+co2_concentration+plasma_concentration)
-
user << "Pressure: [round(pressure,0.1)] kPa"
- user << "Nitrogen: [round(n2_concentration*100)] %"
- user << "Oxygen: [round(o2_concentration*100)] %"
- user << "CO2: [round(co2_concentration*100)] %"
- user << "Plasma: [round(plasma_concentration*100)] %"
- if(unknown_concentration>0.01)
- user << "Unknown: [round(unknown_concentration*100)] %"
+
+ for(var/gas in air_contents.gases)
+ var/gas_concentration = gas[MOLES]/total_moles
+ if(gas[GAS_INDEX] <= 4 || gas_concentration > 0.01) //ensures the four primary gases are always shown.
+ user << "[gas[GAS_NAME]]: [round(gas_concentration*100)] %"
+
user << "Temperature: [round(air_contents.temperature-T0C)] °C"
else
user << "[target] is empty!"
@@ -1217,7 +1210,7 @@ B --><-- A
transform = shift
SpinAnimation(rotation_speed, -1, clockwise, rotation_segments)
-
+
//we stack the orbits up client side, so we can assign this back to normal server side without it breaking the orbit
transform = initial_transform
while(orbiting && orbiting == A && A.loc)
@@ -1227,7 +1220,7 @@ B --><-- A
loc = targetloc
lastloc = loc
sleep(0.6)
-
+
if (orbiting == A) //make sure we haven't started orbiting something else.
orbiting = null
SpinAnimation(0,0)
diff --git a/code/datums/gas_mixture.dm b/code/datums/gas_mixture.dm
index 7c21ed5ef7c..4f0b6ea1a3a 100644
--- a/code/datums/gas_mixture.dm
+++ b/code/datums/gas_mixture.dm
@@ -29,29 +29,29 @@ What are the archived variables for?
/datum/gas/volatile_fuel
specific_heat = 30
-var/list/gas_heats = list( //this is actually the list that decides what gases exist and in what order
- 20, //GAS_O2
- 20, //GAS_N2
- 30, //GAS_C02
- 200,//GAS_PLASMA
- 40, //GAS_N20
- 300,//GAS_AGENT_B
- 30, //GAS_V_FUEL
+var/list/meta_gas_info = list( //this is actually the list that decides what gases exist and in what order
+ list(20, "Oxygen"), //GAS_O2
+ list(20, "Nitrogen"), //GAS_N2
+ list(30, "Carbon Dioxide"), //GAS_C02
+ list(200, "Plasma"), //GAS_PLASMA
+ list(40, "Nitrous Oxide"), //GAS_N20
+ list(300, "Oxygen Agent B"), //GAS_AGENT_B
+ list(30, "Volatile Fuel") //GAS_V_FUEL
)
var/list/cached_gases_list
/proc/gaseslist()
. = new /list
- for(var/i in 1 to gas_heats.len)
- .[i] = gaslist(gas_heats[i], i)
+ for(var/i in 1 to meta_gas_info.len)
+ .[i] = gaslist(meta_gas_info[i], i)
-/proc/gaslist(specific_heat, index)
+/proc/gaslist(gas_info, index)
. = new /list
. += 0 //MOLES
. += 0 //ARCHIVE
- . += specific_heat //SPECIFIC_HEAT
. += index //GAS_INDEX
+ . += gas_info //all the rest
/datum/gas_mixture
/*
@@ -257,6 +257,8 @@ var/list/cached_gases_list
/datum/gas_mixture/proc/temperature_share(datum/gas_mixture/sharer, conduction_coefficient)
+/datum/gas_mixture/proc/temperature_mimic(turf/model, conduction_coefficient)
+
/datum/gas_mixture/proc/temperature_turf_share(turf/simulated/sharer, conduction_coefficient)
/datum/gas_mixture/proc/compare(datum/gas_mixture/sample)
@@ -410,6 +412,17 @@ var/list/cached_gases_list
temperature -= heat/self_heat_capacity
sharer.temperature += heat/sharer_heat_capacity
+/datum/gas_mixture/temperature_mimic(turf/model, conduction_coefficient)
+ var/delta_temperature = (temperature - model.temperature)
+ if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
+ var/self_heat_capacity = heat_capacity()
+
+ if((model.heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY))
+ var/heat = conduction_coefficient*delta_temperature* \
+ (self_heat_capacity*model.heat_capacity/(self_heat_capacity+model.heat_capacity))
+
+ temperature -= heat/self_heat_capacity
+
/datum/gas_mixture/temperature_turf_share(turf/simulated/sharer, conduction_coefficient)
var/delta_temperature = (temperature_archived - sharer.temperature)
if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
diff --git a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm
index da0a9add2ce..a3b1aa4bb0a 100644
--- a/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm
+++ b/code/game/gamemodes/miniantags/bot_swarm/swarmer.dm
@@ -290,7 +290,12 @@
var/turf/simulated/floor/F = random_location
if(F.air)
var/datum/gas_mixture/A = F.air
- if(A.oxygen >= 16 && !A.toxins && A.carbon_dioxide < 10 && !A.trace_gases.len)//Can most things breathe in this location?
+ var/trace_gases
+ for(var/i in 5 to A.gases.len)
+ if(A.gases[i][MOLES])
+ trace_gases = TRUE
+ break
+ if(A.gases[GAS_O2][MOLES] >= 16 && !A.gases[GAS_PL][MOLES] && A.gases[GAS_CO2][MOLES] < 10 && !trace_gases)//Can most things breathe in this location?
if((A.temperature > 270) && (A.temperature < 360))//Not too hot, not too cold
var/pressure = A.return_pressure()
if((pressure > 20) && (pressure < 550))//Account for crushing pressure or vaccuums
diff --git a/code/game/gamemodes/objective_items.dm b/code/game/gamemodes/objective_items.dm
index 9f1c99cea84..4de36883eff 100644
--- a/code/game/gamemodes/objective_items.dm
+++ b/code/game/gamemodes/objective_items.dm
@@ -94,7 +94,7 @@
/datum/objective_item/steal/plasma/check_special_completion(obj/item/weapon/tank/T)
var/target_amount = text2num(name)
var/found_amount = 0
- found_amount += T.air_contents.toxins
+ found_amount += T.air_contents.gases[GAS_PL][MOLES]
return found_amount>=target_amount
diff --git a/code/game/machinery/alarm.dm b/code/game/machinery/alarm.dm
index c27fb9ecb99..d09b18aea4f 100644
--- a/code/game/machinery/alarm.dm
+++ b/code/game/machinery/alarm.dm
@@ -257,7 +257,7 @@
if(!location)
return
var/datum/gas_mixture/environment = location.return_air()
- var/total = environment.oxygen + environment.nitrogen + environment.carbon_dioxide + environment.toxins
+ var/total = environment.total_moles()
var/list/environment_data = list()
data["atmos_alarm"] = alarm_area.atmosalm
@@ -273,25 +273,25 @@
environment_data += list(list("name" = "Pressure", "value" = pressure, "unit" = "kPa", "danger_level" = pressure_danger))
cur_tlv = TLV["oxygen"]
- var/oxygen_danger = cur_tlv.get_danger_level(environment.oxygen*partial_pressure)
- environment_data += list(list("name" = "Oxygen", "value" = environment.oxygen / total * 100, "unit" = "%", "danger_level" = oxygen_danger))
+ var/oxygen_danger = cur_tlv.get_danger_level(environment.gases[GAS_O2][MOLES]*partial_pressure)
+ environment_data += list(list("name" = "Oxygen", "value" = environment.gases[GAS_O2][MOLES] / total * 100, "unit" = "%", "danger_level" = oxygen_danger))
cur_tlv = TLV["nitrogen"]
- var/nitrogen_danger = cur_tlv.get_danger_level(environment.nitrogen*partial_pressure)
- environment_data += list(list("name" = "Nitrogen", "value" = environment.nitrogen / total * 100, "unit" = "%", "danger_level" = nitrogen_danger))
+ var/nitrogen_danger = cur_tlv.get_danger_level(environment.gases[GAS_N2][MOLES]*partial_pressure)
+ environment_data += list(list("name" = "Nitrogen", "value" = environment.gases[GAS_N2][MOLES] / total * 100, "unit" = "%", "danger_level" = nitrogen_danger))
cur_tlv = TLV["carbon dioxide"]
- var/carbon_dioxide_danger = cur_tlv.get_danger_level(environment.carbon_dioxide*partial_pressure)
- environment_data += list(list("name" = "Carbon Dioxide", "value" = environment.carbon_dioxide / total * 100, "unit" = "%", "danger_level" = carbon_dioxide_danger))
+ var/carbon_dioxide_danger = cur_tlv.get_danger_level(environment.gases[GAS_CO2][MOLES]*partial_pressure)
+ environment_data += list(list("name" = "Carbon Dioxide", "value" = environment.gases[GAS_CO2][MOLES] / total * 100, "unit" = "%", "danger_level" = carbon_dioxide_danger))
cur_tlv = TLV["plasma"]
- var/plasma_danger = cur_tlv.get_danger_level(environment.toxins*partial_pressure)
- environment_data += list(list("name" = "Toxins", "value" = environment.toxins / total * 100, "unit" = "%", "danger_level" = plasma_danger))
+ var/plasma_danger = cur_tlv.get_danger_level(environment.gases[GAS_PL][MOLES]*partial_pressure)
+ environment_data += list(list("name" = "Toxins", "value" = environment.gases[GAS_PL][MOLES] / total * 100, "unit" = "%", "danger_level" = plasma_danger))
cur_tlv = TLV["other"]
var/other_moles = 0
- for(var/datum/gas/G in environment.trace_gases)
- other_moles+=G.moles
+ for(var/i in 5 to environment.gases.len)
+ other_moles+=environment.gases[i][MOLES]
var/other_danger = cur_tlv.get_danger_level(other_moles*partial_pressure)
environment_data += list(list("name" = "Other", "value" = other_moles / total * 100, "unit" = "%", "danger_level" = other_danger))
@@ -612,18 +612,18 @@
var/pressure_dangerlevel = cur_tlv.get_danger_level(environment_pressure)
cur_tlv = TLV["oxygen"]
- var/oxygen_dangerlevel = cur_tlv.get_danger_level(environment.oxygen*GET_PP)
+ var/oxygen_dangerlevel = cur_tlv.get_danger_level(environment.gases[GAS_O2][MOLES]*GET_PP)
cur_tlv = TLV["carbon dioxide"]
- var/co2_dangerlevel = cur_tlv.get_danger_level(environment.carbon_dioxide*GET_PP)
+ var/co2_dangerlevel = cur_tlv.get_danger_level(environment.gases[GAS_CO2][MOLES]*GET_PP)
cur_tlv = TLV["plasma"]
- var/plasma_dangerlevel = cur_tlv.get_danger_level(environment.toxins*GET_PP)
+ var/plasma_dangerlevel = cur_tlv.get_danger_level(environment.gases[GAS_PL][MOLES]*GET_PP)
cur_tlv = TLV["other"]
var/other_moles = 0
- for(var/datum/gas/G in environment.trace_gases)
- other_moles+=G.moles
+ for(var/i in 5 to environment.gases.len)
+ other_moles+=environment.gases[i][MOLES]
var/other_dangerlevel = cur_tlv.get_danger_level(other_moles*GET_PP)
cur_tlv = TLV["temperature"]
diff --git a/code/game/machinery/atmo_control.dm b/code/game/machinery/atmo_control.dm
index 89c4d084ced..fcb0c8d3693 100644
--- a/code/game/machinery/atmo_control.dm
+++ b/code/game/machinery/atmo_control.dm
@@ -47,13 +47,13 @@
var/total_moles = air_sample.total_moles()
if(total_moles > 0)
if(output&4)
- signal.data["oxygen"] = round(100*air_sample.oxygen/total_moles,0.1)
+ signal.data["oxygen"] = round(100*air_sample.gases[GAS_O2][MOLES]/total_moles,0.1)
if(output&8)
- signal.data["toxins"] = round(100*air_sample.toxins/total_moles,0.1)
+ signal.data["toxins"] = round(100*air_sample.gases[GAS_PL][MOLES]/total_moles,0.1)
if(output&16)
- signal.data["nitrogen"] = round(100*air_sample.nitrogen/total_moles,0.1)
+ signal.data["nitrogen"] = round(100*air_sample.gases[GAS_N2][MOLES]/total_moles,0.1)
if(output&32)
- signal.data["carbon_dioxide"] = round(100*air_sample.carbon_dioxide/total_moles,0.1)
+ signal.data["carbon_dioxide"] = round(100*air_sample.gases[GAS_CO2][MOLES]/total_moles,0.1)
else
signal.data["oxygen"] = 0
signal.data["toxins"] = 0
diff --git a/code/game/machinery/atmoalter/canister.dm b/code/game/machinery/atmoalter/canister.dm
index 3d0cb1bd520..9828774c9ad 100644
--- a/code/game/machinery/atmoalter/canister.dm
+++ b/code/game/machinery/atmoalter/canister.dm
@@ -344,11 +344,10 @@ update_flag
logmsg = "Valve was opened by [key_name(usr)], starting the transfer into the [holding]
"
else
logmsg = "Valve was opened by [key_name(usr)], starting the transfer into the air
"
- if(air_contents.toxins > 0)
+ if(air_contents.gases[GAS_PL][MOLES] > 0)
message_admins("[key_name_admin(usr)] (?) (FLW) opened a canister that contains plasma! (JMP)")
log_admin("[key_name(usr)] opened a canister that contains plasma at [x], [y], [z]")
- var/datum/gas/sleeping_agent = locate(/datum/gas/sleeping_agent) in air_contents.trace_gases
- if(sleeping_agent && (sleeping_agent.moles > 1))
+ if(air_contents.gases[GAS_N2O][MOLES] > 1)
message_admins("[key_name_admin(usr)] (?) (FLW) opened a canister that contains N2O! (JMP)")
log_admin("[key_name(usr)] opened a canister that contains N2O at [x], [y], [z]")
investigate_log(logmsg, "atmos")
@@ -367,30 +366,29 @@ update_flag
/obj/machinery/portable_atmospherics/canister/toxins/New()
..()
- src.air_contents.toxins = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
+ air_contents.gases[GAS_PL][MOLES] = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
- src.update_icon()
+ update_icon()
return 1
/obj/machinery/portable_atmospherics/canister/oxygen/New()
..()
- src.air_contents.oxygen = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
+ air_contents.gases[GAS_O2][MOLES] = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
- src.update_icon()
+ update_icon()
return 1
/obj/machinery/portable_atmospherics/canister/sleeping_agent/New()
..()
- var/datum/gas/sleeping_agent/trace_gas = new
- air_contents.trace_gases += trace_gas
- trace_gas.moles = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
+ air_contents.gases[GAS_N2O][MOLES] = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
- src.update_icon()
+ update_icon()
return 1
//Dirty way to fill room with gas. However it is a bit easier to do than creating some floor/engine/n2o -rastaf0
+/*
/obj/machinery/portable_atmospherics/canister/sleeping_agent/roomfiller/New()
..()
@@ -404,30 +402,31 @@ update_flag
location.assume_air(air_contents)
air_contents = new
return 1
+*/
/obj/machinery/portable_atmospherics/canister/nitrogen/New()
..()
- src.air_contents.nitrogen = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
+ air_contents.gases[GAS_N2][MOLES] = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
- src.update_icon()
+ update_icon()
return 1
/obj/machinery/portable_atmospherics/canister/carbon_dioxide/New()
..()
- src.air_contents.carbon_dioxide = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
+ air_contents.gases[GAS_CO2][MOLES] = (src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
- src.update_icon()
+ update_icon()
return 1
/obj/machinery/portable_atmospherics/canister/air/New()
..()
- src.air_contents.oxygen = (O2STANDARD*src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
- src.air_contents.nitrogen = (N2STANDARD*src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
+ air_contents.gases[GAS_O2][MOLES] = (O2STANDARD*src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
+ air_contents.gases[GAS_N2][MOLES] = (N2STANDARD*src.maximum_pressure*filled)*air_contents.volume/(R_IDEAL_GAS_EQUATION*air_contents.temperature)
- src.update_icon()
+ update_icon()
return 1
diff --git a/code/game/machinery/atmoalter/scrubber.dm b/code/game/machinery/atmoalter/scrubber.dm
index 5b8100857c1..62c33f85b93 100644
--- a/code/game/machinery/atmoalter/scrubber.dm
+++ b/code/game/machinery/atmoalter/scrubber.dm
@@ -76,23 +76,17 @@
filtered_out.temperature = removed.temperature
- filtered_out.toxins = removed.toxins
- removed.toxins = 0
+ filtered_out.gases[GAS_PL][MOLES] = removed.gases[GAS_PL][MOLES]
+ removed.gases[GAS_PL][MOLES] = 0
- filtered_out.carbon_dioxide = removed.carbon_dioxide
- removed.carbon_dioxide = 0
+ filtered_out.gases[GAS_CO2][MOLES] = removed.gases[GAS_CO2][MOLES]
+ removed.gases[GAS_CO2][MOLES] = 0
- if(removed.trace_gases.len>0)
- for(var/datum/gas/trace_gas in removed.trace_gases)
- if(istype(trace_gas, /datum/gas/sleeping_agent))
- removed.trace_gases -= trace_gas
- filtered_out.trace_gases += trace_gas
+ filtered_out.gases[GAS_AGENT_B][MOLES] = removed.gases[GAS_AGENT_B][MOLES]
+ removed.gases[GAS_AGENT_B][MOLES] = 0
- if(removed.trace_gases.len>0)
- for(var/datum/gas/trace_gas in removed.trace_gases)
- if(istype(trace_gas, /datum/gas/oxygen_agent_b))
- removed.trace_gases -= trace_gas
- filtered_out.trace_gases += trace_gas
+ filtered_out.gases[GAS_N2O][MOLES] = removed.gases[GAS_N2O][MOLES]
+ removed.gases[GAS_AGENT_B][MOLES] = 0
//Remix the resulting gases
air_contents.merge(filtered_out)
diff --git a/code/game/mecha/equipment/tools/other_tools.dm b/code/game/mecha/equipment/tools/other_tools.dm
index 0f53b062e7f..c6c85b66a5d 100644
--- a/code/game/mecha/equipment/tools/other_tools.dm
+++ b/code/game/mecha/equipment/tools/other_tools.dm
@@ -437,12 +437,12 @@
return
var/datum/gas_mixture/GM = new
if(prob(10))
- GM.toxins += 100
+ GM.gases[GAS_PL][MOLES] += 100
GM.temperature = 1500+T0C //should be enough to start a fire
T.visible_message("The [src] suddenly disgorges a cloud of heated plasma.")
qdel(src)
else
- GM.toxins += 5
+ GM.gases[GAS_PL][MOLES] += 5
GM.temperature = istype(T) ? T.air.return_temperature() : T20C
T.visible_message("The [src] suddenly disgorges a cloud of plasma.")
T.assume_air(GM)
diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm
index 2c892b128a9..f4a3bfbbf04 100644
--- a/code/game/mecha/mecha.dm
+++ b/code/game/mecha/mecha.dm
@@ -177,8 +177,8 @@
cabin_air = new
cabin_air.temperature = T20C
cabin_air.volume = 200
- cabin_air.oxygen = O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
- cabin_air.nitrogen = N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
+ cabin_air.gases[GAS_O2][MOLES] = O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
+ cabin_air.gases[GAS_N2][MOLES] = N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
return cabin_air
/obj/mecha/proc/add_radio()
diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm
index cb5f4de5cdd..8db33729e76 100644
--- a/code/game/objects/effects/effect_system/effects_smoke.dm
+++ b/code/game/objects/effects/effect_system/effects_smoke.dm
@@ -163,9 +163,9 @@
T.air_update_turf()
for(var/obj/effect/hotspot/H in T)
qdel(H)
- if(G.toxins)
- G.nitrogen += (G.toxins)
- G.toxins = 0
+ if(G.gases[GAS_PL][MOLES])
+ G.gases[GAS_N2][MOLES] += (G.gases[GAS_PL][MOLES])
+ G.gases[GAS_PL][MOLES] = 0
for(var/obj/machinery/atmospherics/components/unary/U in T)
if(!isnull(U.welded) && !U.welded) //must be an unwelded vent pump or vent scrubber.
U.welded = 1
diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm
index 590dcb2731c..327ba3fa09d 100644
--- a/code/game/objects/items/devices/PDA/PDA.dm
+++ b/code/game/objects/items/devices/PDA/PDA.dm
@@ -421,17 +421,11 @@ var/global/list/obj/item/device/pda/PDAs = list()
dat += "Air Pressure: [round(pressure,0.1)] kPa
"
if (total_moles)
- var/o2_level = environment.oxygen/total_moles
- var/n2_level = environment.nitrogen/total_moles
- var/co2_level = environment.carbon_dioxide/total_moles
- var/plasma_level = environment.toxins/total_moles
- var/unknown_level = 1-(o2_level+n2_level+co2_level+plasma_level)
- dat += "Nitrogen: [round(n2_level*100)]%
"
- dat += "Oxygen: [round(o2_level*100)]%
"
- dat += "Carbon Dioxide: [round(co2_level*100)]%
"
- dat += "Plasma: [round(plasma_level*100)]%
"
- if(unknown_level > 0.01)
- dat += "OTHER: [round(unknown_level)]%
"
+ for(var/gas in environment.gases)
+ var/gas_level = gas[MOLES]/total_moles
+ if(gas[GAS_INDEX] <= 4 || gas_level > 0.01)
+ dat += "[gas[GAS_NAME]]: [round(gas_level*100)]%
"
+
dat += "Temperature: [round(environment.temperature-T0C)]°C
"
dat += "
"
@@ -719,7 +713,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
if(!message || !targets.len)
return
-
+
if(last_text && world.time < last_text + 5)
return
@@ -746,7 +740,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
user << "ERROR: Server isn't responding."
return
photo = null
-
+
if(multiple)
show_to_sender(last_sucessful_msg,1)
show_to_ghosts(last_sucessful_msg,1)
@@ -808,7 +802,7 @@ var/global/list/obj/item/device/pda/PDAs = list()
if(useTC == 2)
return useMS
else
- return null
+ return null
/obj/item/device/pda/proc/send_to_all(mob/living/U = usr)
diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm
index 32fdb40f65b..8dbc5731f23 100644
--- a/code/game/objects/items/devices/scanners.dm
+++ b/code/game/objects/items/devices/scanners.dm
@@ -268,12 +268,11 @@ MASS SPECTROMETER
else
user.show_message("Pressure: [round(pressure,0.1)] kPa", 1)
if(total_moles)
- var/o2_concentration = environment.oxygen/total_moles
- var/n2_concentration = environment.nitrogen/total_moles
- var/co2_concentration = environment.carbon_dioxide/total_moles
- var/plasma_concentration = environment.toxins/total_moles
+ var/o2_concentration = environment.gases[GAS_O2][MOLES]/total_moles
+ var/n2_concentration = environment.gases[GAS_N2][MOLES]/total_moles
+ var/co2_concentration = environment.gases[GAS_CO2][MOLES]/total_moles
+ var/plasma_concentration = environment.gases[GAS_PL][MOLES]/total_moles
- var/unknown_concentration = 1-(o2_concentration+n2_concentration+co2_concentration+plasma_concentration)
if(abs(n2_concentration - N2STANDARD) < 20)
user.show_message("Nitrogen: [round(n2_concentration*100)] %", 1)
else
@@ -292,8 +291,9 @@ MASS SPECTROMETER
if(plasma_concentration > 0.01)
user.show_message("Plasma: [round(plasma_concentration*100)] %", 1)
- if(unknown_concentration > 0.01)
- user.show_message("Unknown: [round(unknown_concentration*100)] %", 1)
+ for(var/i in 5 to environment.gases.len)
+ var/gas_concentration = environment.gases[i][MOLES]/total_moles
+ user.show_message("[environment.gases[i][GAS_NAME]]: [round(gas_concentration*100)] %", 1)
user.show_message("Temperature: [round(environment.temperature-T0C)] °C", 1)
diff --git a/code/game/objects/items/weapons/chrono_eraser.dm b/code/game/objects/items/weapons/chrono_eraser.dm
index 96c48aab975..7ecf363f140 100644
--- a/code/game/objects/items/weapons/chrono_eraser.dm
+++ b/code/game/objects/items/weapons/chrono_eraser.dm
@@ -239,8 +239,8 @@
/obj/effect/chrono_field/return_air() //we always have nominal air and temperature
var/datum/gas_mixture/GM = new
- GM.oxygen = MOLES_O2STANDARD
- GM.nitrogen = MOLES_N2STANDARD
+ GM.gases[GAS_O2][MOLES] = MOLES_O2STANDARD
+ GM.gases[GAS_N2][MOLES] = MOLES_N2STANDARD
GM.temperature = T20C
return GM
diff --git a/code/game/objects/items/weapons/flamethrower.dm b/code/game/objects/items/weapons/flamethrower.dm
index bdb527ff358..9b5b7bfa64d 100644
--- a/code/game/objects/items/weapons/flamethrower.dm
+++ b/code/game/objects/items/weapons/flamethrower.dm
@@ -194,7 +194,7 @@
//TODO: DEFERRED Consider checking to make sure tank pressure is high enough before doing this...
//Transfer 5% of current tank air contents to turf
var/datum/gas_mixture/air_transfer = ptank.air_contents.remove_ratio(release_amount)
- air_transfer.toxins = air_transfer.toxins * 5
+ air_transfer.gases[GAS_PL][MOLES] = air_transfer.gases[GAS_PL][MOLES] * 5
target.assume_air(air_transfer)
//Burn it based on transfered gas
target.hotspot_expose((ptank.air_contents.temperature*2) + 380,500)
diff --git a/code/game/objects/items/weapons/tanks/jetpack.dm b/code/game/objects/items/weapons/tanks/jetpack.dm
index 6d7db63e8a8..1d6c042c9c2 100644
--- a/code/game/objects/items/weapons/tanks/jetpack.dm
+++ b/code/game/objects/items/weapons/tanks/jetpack.dm
@@ -54,7 +54,7 @@
var/datum/gas_mixture/G = src.air_contents.remove(num)
- var/allgases = G.carbon_dioxide + G.nitrogen + G.oxygen + G.toxins //fuck trace gases -Pete
+ var/allgases = G.total_moles()
if(allgases >= 0.005)
return 1
@@ -73,7 +73,7 @@
/obj/item/weapon/tank/jetpack/void/New()
..()
- air_contents.oxygen = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
+ air_contents.gases[GAS_O2][MOLES] = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
/obj/item/weapon/tank/jetpack/oxygen
@@ -84,7 +84,7 @@
/obj/item/weapon/tank/jetpack/oxygen/New()
..()
- air_contents.oxygen = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
+ air_contents.gases[GAS_O2][MOLES] = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
/obj/item/weapon/tank/jetpack/oxygen/harness
name = "jet harness (oxygen)"
@@ -114,7 +114,7 @@
..()
ion_trail = new /datum/effect_system/trail_follow/ion()
ion_trail.set_up(src)
- air_contents.carbon_dioxide = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
+ air_contents.gases[GAS_CO2][MOLES] = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
/obj/item/weapon/tank/jetpack/suit
diff --git a/code/game/objects/items/weapons/tanks/tank_types.dm b/code/game/objects/items/weapons/tanks/tank_types.dm
index 586e3a47ddc..f2b018dc493 100644
--- a/code/game/objects/items/weapons/tanks/tank_types.dm
+++ b/code/game/objects/items/weapons/tanks/tank_types.dm
@@ -20,7 +20,7 @@
/obj/item/weapon/tank/internals/oxygen/New()
..()
- src.air_contents.oxygen = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
+ air_contents.gases[GAS_O2][MOLES] = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return
@@ -45,13 +45,8 @@
/obj/item/weapon/tank/internals/anesthetic/New()
..()
-
- src.air_contents.oxygen = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD
-
- var/datum/gas/sleeping_agent/trace_gas = new()
- trace_gas.moles = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD
-
- src.air_contents.trace_gases += trace_gas
+ air_contents.gases[GAS_O2][MOLES] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD
+ air_contents.gases[GAS_N2O][MOLES] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD
return
/*
@@ -67,8 +62,8 @@
/obj/item/weapon/tank/internals/air/New()
..()
- src.air_contents.oxygen = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD
- src.air_contents.nitrogen = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD
+ air_contents.gases[GAS_O2][MOLES] = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD
+ air_contents.gases[GAS_N2][MOLES] = (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD
return
@@ -87,7 +82,7 @@
/obj/item/weapon/tank/internals/plasma/New()
..()
- src.air_contents.toxins = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
+ air_contents.gases[GAS_PL][MOLES] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return
/obj/item/weapon/tank/internals/plasma/attackby(obj/item/weapon/W, mob/user, params)
@@ -105,7 +100,7 @@
/obj/item/weapon/tank/internals/plasma/full/New()
..()
- src.air_contents.toxins = (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
+ air_contents.gases[GAS_PL][MOLES] = (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return
@@ -121,13 +116,13 @@
/obj/item/weapon/tank/internals/plasmaman/New()
..()
- src.air_contents.toxins = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
+ air_contents.gases[GAS_PL][MOLES] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return
/obj/item/weapon/tank/internals/plasmaman/full/New()
..()
- src.air_contents.toxins = (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
+ air_contents.gases[GAS_PL][MOLES] = (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return
@@ -140,7 +135,7 @@
/obj/item/weapon/tank/internals/plasmaman/belt/full/New()
..()
- src.air_contents.toxins = (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
+ air_contents.gases[GAS_PL][MOLES] = (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return
@@ -162,7 +157,7 @@
/obj/item/weapon/tank/internals/emergency_oxygen/New()
..()
- src.air_contents.oxygen = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
+ air_contents.gases[GAS_O2][MOLES] = (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)
return
/obj/item/weapon/tank/internals/emergency_oxygen/engi
diff --git a/code/game/objects/structures/crates_lockers/crates.dm b/code/game/objects/structures/crates_lockers/crates.dm
index 44edb4a6f24..73d79abbe06 100644
--- a/code/game/objects/structures/crates_lockers/crates.dm
+++ b/code/game/objects/structures/crates_lockers/crates.dm
@@ -66,15 +66,14 @@
/obj/structure/closet/crate/freezer/return_air()
var/datum/gas_mixture/gas = (..())
- if(!gas) return null
+ if(!gas)
+ return null
+
var/datum/gas_mixture/newgas = new/datum/gas_mixture()
- newgas.oxygen = gas.oxygen
- newgas.carbon_dioxide = gas.carbon_dioxide
- newgas.nitrogen = gas.nitrogen
- newgas.toxins = gas.toxins
- newgas.volume = gas.volume
- newgas.temperature = gas.temperature
- if(newgas.temperature <= target_temp) return
+ newgas.copy_from(gas)
+
+ if(newgas.temperature <= target_temp)
+ return
if((newgas.temperature - cooling_power) > target_temp)
newgas.temperature -= cooling_power
diff --git a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
index a4bd81856e7..2644b756170 100644
--- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
+++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
@@ -11,8 +11,8 @@
/obj/structure/transit_tube_pod/New(loc)
..(loc)
- air_contents.oxygen = MOLES_O2STANDARD * 2
- air_contents.nitrogen = MOLES_N2STANDARD
+ air_contents.gases[GAS_O2][MOLES] = MOLES_O2STANDARD * 2
+ air_contents.gases[GAS_N2][MOLES] = MOLES_N2STANDARD
air_contents.temperature = T20C
// Give auto tubes time to align before trying to start moving
@@ -123,11 +123,7 @@
// datum, there might be problems if I don't...
/obj/structure/transit_tube_pod/return_air()
var/datum/gas_mixture/GM = new()
- GM.oxygen = air_contents.oxygen
- GM.carbon_dioxide = air_contents.carbon_dioxide
- GM.nitrogen = air_contents.nitrogen
- GM.toxins = air_contents.toxins
- GM.temperature = air_contents.temperature
+ GM.copy_from(air_contents)
return GM
// For now, copying what I found in an unused FEA file (and almost identical in a
diff --git a/code/game/turfs/simulated/floor/plating.dm b/code/game/turfs/simulated/floor/plating.dm
index 4aa16f11ec1..9a118b04874 100644
--- a/code/game/turfs/simulated/floor/plating.dm
+++ b/code/game/turfs/simulated/floor/plating.dm
@@ -134,10 +134,8 @@
/turf/simulated/floor/engine/n20/New()
..()
var/datum/gas_mixture/adding = new
- var/datum/gas/sleeping_agent/trace_gas = new
- trace_gas.moles = 6000
- adding.trace_gases += trace_gas
+ adding.gases[GAS_N2O][MOLES] = 6000
adding.temperature = T20C
assume_air(adding)
diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm
index 34c8ce714e0..845fb5c2bb1 100644
--- a/code/game/turfs/turf.dm
+++ b/code/game/turfs/turf.dm
@@ -141,11 +141,7 @@
//////Assimilate Air//////
/turf/simulated/proc/Assimilate_Air()
if(air)
- var/aoxy = 0//Holders to assimilate air from nearby turfs
- var/anitro = 0
- var/aco = 0
- var/atox = 0
- var/atemp = 0
+ var/datum/gas_mixture/a_gas_mixture = new//Holders to assimilate air from nearby turfs
var/turf_count = 0
for(var/direction in cardinal)//Only use cardinals to cut down on lag
@@ -156,17 +152,13 @@
else if(istype(T,/turf/simulated/floor))
var/turf/simulated/S = T
if(S.air)//Add the air's contents to the holders
- aoxy += S.air.oxygen
- anitro += S.air.nitrogen
- aco += S.air.carbon_dioxide
- atox += S.air.toxins
- atemp += S.air.temperature
+ for(var/gas in a_gas_mixture.gases)
+ gas[MOLES] += S.air.gases[gas[GAS_INDEX]][MOLES]
+ a_gas_mixture.temperature += S.air.temperature
turf_count ++
- air.oxygen = (aoxy/max(turf_count,1))//Averages contents of the turfs, ignoring walls and the like
- air.nitrogen = (anitro/max(turf_count,1))
- air.carbon_dioxide = (aco/max(turf_count,1))
- air.toxins = (atox/max(turf_count,1))
- air.temperature = (atemp/max(turf_count,1))//Trace gases can get bant
+ for(var/gas in air.gases)
+ gas[MOLES] = (a_gas_mixture.gases[gas[GAS_INDEX]][MOLES]/max(turf_count,1))//Averages contents of the turfs, ignoring walls and the like
+ air.temperature = (a_gas_mixture.temperature/max(turf_count,1))//Trace gases can get bant
SSair.add_to_active(src)
/turf/proc/ReplaceWithLattice()
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index 93d8d3a830f..7d5963e7a28 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -189,10 +189,9 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
var/datum/gas_mixture/env = T.return_air()
var/t = ""
- t+= "Nitrogen : [env.nitrogen]\n"
- t+= "Oxygen : [env.oxygen]\n"
- t+= "Plasma : [env.toxins]\n"
- t+= "CO2: [env.carbon_dioxide]\n"
+ for(var/gas in env.gases)
+ if(gas[GAS_INDEX] <= 4 || gas[MOLES])
+ t+= "[gas[GAS_NAME]] : [gas[MOLES]]\n"
usr.show_message(t, 1)
feedback_add_details("admin_verb","ASL") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
@@ -631,7 +630,7 @@ var/global/list/g_fancy_list_of_types = null
if(Rad.anchored)
if(!Rad.P)
var/obj/item/weapon/tank/internals/plasma/Plasma = new/obj/item/weapon/tank/internals/plasma(Rad)
- Plasma.air_contents.toxins = 70
+ Plasma.air_contents.gases[GAS_PL][MOLES] = 70
Rad.drainratio = 0
Rad.P = Plasma
Plasma.loc = Rad
diff --git a/code/modules/admin/verbs/diagnostics.dm b/code/modules/admin/verbs/diagnostics.dm
index c1284154c64..e6ee935b9d0 100644
--- a/code/modules/admin/verbs/diagnostics.dm
+++ b/code/modules/admin/verbs/diagnostics.dm
@@ -12,9 +12,10 @@
if(T.active_hotspot)
burning = 1
- usr << "@[target.x],[target.y]: O:[GM.oxygen] T:[GM.toxins] N:[GM.nitrogen] C:[GM.carbon_dioxide] w [GM.temperature] Kelvin, [GM.return_pressure()] kPa [(burning)?("\red BURNING"):(null)]"
- for(var/datum/gas/trace_gas in GM.trace_gases)
- usr << "[trace_gas.type]: [trace_gas.moles]"
+ usr << "@[target.x],[target.y]: [GM.temperature] Kelvin, [GM.return_pressure()] kPa [(burning)?("\red BURNING"):(null)]"
+ for(var/gas in GM.gases)
+ if(gas[GAS_INDEX] <= 4 || gas[MOLES])
+ usr << "[gas[GAS_NAME]]: [gas[MOLES]]"
feedback_add_details("admin_verb","DAST") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/fix_next_move()
diff --git a/code/modules/assembly/bomb.dm b/code/modules/assembly/bomb.dm
index 9e5cc53faf9..9424b141538 100644
--- a/code/modules/assembly/bomb.dm
+++ b/code/modules/assembly/bomb.dm
@@ -108,7 +108,7 @@
return
/obj/item/weapon/tank/proc/ignite() //This happens when a bomb is told to explode
- var/fuel_moles = air_contents.toxins + air_contents.oxygen/6
+ var/fuel_moles = air_contents.gases[GAS_PL][MOLES] + air_contents.gases[GAS_O2][MOLES]/6
var/strength = 1
var/turf/ground_zero = get_turf(loc)
diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm
index ba20754944b..56745637b03 100644
--- a/code/modules/events/spacevine.dm
+++ b/code/modules/events/spacevine.dm
@@ -228,7 +228,7 @@
var/turf/simulated/floor/T = holder.loc
if(istype(T))
var/datum/gas_mixture/GM = T.air
- GM.oxygen = max(0, GM.oxygen - severity * holder.energy)
+ GM.gases[GAS_O2][MOLES] = max(0, GM.gases[GAS_O2][MOLES] - severity * holder.energy)
/datum/spacevine_mutation/nitro_eater
name = "nitrogen consuming"
@@ -240,7 +240,7 @@
var/turf/simulated/floor/T = holder.loc
if(istype(T))
var/datum/gas_mixture/GM = T.air
- GM.nitrogen = max(0, GM.nitrogen - severity * holder.energy)
+ GM.gases[GAS_N2][MOLES] = max(0, GM.gases[GAS_N2][MOLES] - severity * holder.energy)
/datum/spacevine_mutation/carbondioxide_eater
name = "CO2 consuming"
@@ -252,7 +252,7 @@
var/turf/simulated/floor/T = holder.loc
if(istype(T))
var/datum/gas_mixture/GM = T.air
- GM.carbon_dioxide = max(0, GM.carbon_dioxide - severity * holder.energy)
+ GM.gases[GAS_CO2][MOLES] = max(0, GM.gases[GAS_CO2][MOLES] - severity * holder.energy)
/datum/spacevine_mutation/plasma_eater
name = "toxins consuming"
@@ -264,7 +264,7 @@
var/turf/simulated/floor/T = holder.loc
if(istype(T))
var/datum/gas_mixture/GM = T.air
- GM.toxins = max(0, GM.toxins - severity * holder.energy)
+ GM.gases[GAS_PL][MOLES] = max(0, GM.gases[GAS_PL][MOLES] - severity * holder.energy)
/datum/spacevine_mutation/thorns
name = "thorny"
diff --git a/code/modules/mining/mine_items.dm b/code/modules/mining/mine_items.dm
index 5958d0275ad..ce18003d005 100644
--- a/code/modules/mining/mine_items.dm
+++ b/code/modules/mining/mine_items.dm
@@ -254,11 +254,7 @@
A.nitrogen = 82
A.carbon_dioxide = 0
A.toxins = 0
- A.air.oxygen = 21
- A.air.carbon_dioxide = 0
- A.air.nitrogen = 82
- A.air.toxins = 0
- A.air.temperature = 293.15
+ A.air.copy_from_turf(A)
SSair.add_to_active(A)
A.overlays.Cut()
diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm
index 4162a583675..d2fb94df7ca 100644
--- a/code/modules/mob/living/carbon/alien/life.dm
+++ b/code/modules/mob/living/carbon/alien/life.dm
@@ -11,20 +11,20 @@
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
//Partial pressure of the toxins in our breath
- var/Toxins_pp = (breath.toxins/breath.total_moles())*breath_pressure
+ var/Toxins_pp = (breath.gases[GAS_PL][MOLES]/breath.total_moles())*breath_pressure
if(Toxins_pp) // Detect toxins in air
- adjustPlasma(breath.toxins*250)
+ adjustPlasma(breath.gases[GAS_PL][MOLES]*250)
throw_alert("alien_tox", /obj/screen/alert/alien_tox)
- toxins_used = breath.toxins
+ toxins_used = breath.gases[GAS_PL][MOLES]
else
clear_alert("alien_tox")
//Breathe in toxins and out oxygen
- breath.toxins -= toxins_used
- breath.oxygen += toxins_used
+ breath.gases[GAS_PL][MOLES] -= toxins_used
+ breath.gases[GAS_O2][MOLES] += toxins_used
//BREATH TEMPERATURE
handle_breath_temperature(breath)
diff --git a/code/modules/mob/living/carbon/human/species.dm b/code/modules/mob/living/carbon/human/species.dm
index bd834169e4e..29533ed6204 100644
--- a/code/modules/mob/living/carbon/human/species.dm
+++ b/code/modules/mob/living/carbon/human/species.dm
@@ -1168,9 +1168,9 @@
var/gas_breathed = 0
//Partial pressures in our breath
- var/O2_pp = breath.get_breath_partial_pressure(breath.oxygen)
- var/Toxins_pp = breath.get_breath_partial_pressure(breath.toxins)
- var/CO2_pp = breath.get_breath_partial_pressure(breath.carbon_dioxide)
+ var/O2_pp = breath.get_breath_partial_pressure(breath.gases[GAS_O2][MOLES])
+ var/Toxins_pp = breath.get_breath_partial_pressure(breath.gases[GAS_PL][MOLES])
+ var/CO2_pp = breath.get_breath_partial_pressure(breath.gases[GAS_CO2][MOLES])
//-- OXY --//
@@ -1178,7 +1178,7 @@
//Too much oxygen! //Yes, some species may not like it.
if(safe_oxygen_max)
if(O2_pp > safe_oxygen_max && !(NOBREATH in specflags))
- var/ratio = (breath.oxygen/safe_oxygen_max) * 10
+ var/ratio = (breath.gases[GAS_O2][MOLES]/safe_oxygen_max) * 10
H.adjustOxyLoss(Clamp(ratio,oxy_breath_dam_min,oxy_breath_dam_max))
H.throw_alert("too_much_oxy", /obj/screen/alert/too_much_oxy)
else
@@ -1187,17 +1187,17 @@
//Too little oxygen!
if(safe_oxygen_min)
if(O2_pp < safe_oxygen_min)
- gas_breathed = handle_too_little_breath(H,O2_pp,safe_oxygen_min,breath.oxygen)
+ gas_breathed = handle_too_little_breath(H,O2_pp,safe_oxygen_min,breath.gases[GAS_O2][MOLES])
H.throw_alert("oxy", /obj/screen/alert/oxy)
else
H.failed_last_breath = 0
H.adjustOxyLoss(-5)
- gas_breathed = breath.oxygen/6
+ gas_breathed = breath.gases[GAS_O2][MOLES]/6
H.clear_alert("oxy")
//Exhale
- breath.oxygen -= gas_breathed
- breath.carbon_dioxide += gas_breathed
+ breath.gases[GAS_O2][MOLES] -= gas_breathed
+ breath.gases[GAS_CO2][MOLES] += gas_breathed
gas_breathed = 0
@@ -1224,17 +1224,17 @@
//Too little CO2!
if(safe_co2_min)
if(CO2_pp < safe_co2_min)
- gas_breathed = handle_too_little_breath(H,CO2_pp, safe_co2_min,breath.carbon_dioxide)
+ gas_breathed = handle_too_little_breath(H,CO2_pp, safe_co2_min,breath.gases[GAS_CO2][MOLES])
H.throw_alert("not_enough_co2", /obj/screen/alert/not_enough_co2)
else
H.failed_last_breath = 0
H.adjustOxyLoss(-5)
- gas_breathed = breath.carbon_dioxide/6
+ gas_breathed = breath.gases[GAS_CO2][MOLES]/6
H.clear_alert("not_enough_co2")
//Exhale
- breath.carbon_dioxide -= gas_breathed
- breath.oxygen += gas_breathed
+ breath.gases[GAS_CO2][MOLES] -= gas_breathed
+ breath.gases[GAS_O2][MOLES] += gas_breathed
gas_breathed = 0
@@ -1243,7 +1243,7 @@
//Too much toxins!
if(safe_toxins_max)
if(Toxins_pp > safe_toxins_max && !(NOBREATH in specflags))
- var/ratio = (breath.toxins/safe_toxins_max) * 10
+ var/ratio = (breath.gases[GAS_PL][MOLES]/safe_toxins_max) * 10
if(H.reagents)
H.reagents.add_reagent("plasma", Clamp(ratio, tox_breath_dam_min, tox_breath_dam_max))
H.throw_alert("tox_in_air", /obj/screen/alert/tox_in_air)
@@ -1254,32 +1254,32 @@
//Too little toxins!
if(safe_toxins_min)
if(Toxins_pp < safe_toxins_min && !(NOBREATH in specflags))
- gas_breathed = handle_too_little_breath(H,Toxins_pp, safe_toxins_min, breath.toxins)
+ gas_breathed = handle_too_little_breath(H,Toxins_pp, safe_toxins_min, breath.gases[GAS_PL][MOLES])
H.throw_alert("not_enough_tox", /obj/screen/alert/not_enough_tox)
else
H.failed_last_breath = 0
H.adjustOxyLoss(-5)
- gas_breathed = breath.toxins/6
+ gas_breathed = breath.gases[GAS_PL][MOLES]/6
H.clear_alert("not_enough_tox")
//Exhale
- breath.toxins -= gas_breathed
- breath.carbon_dioxide += gas_breathed
+ breath.gases[GAS_PL][MOLES] -= gas_breathed
+ breath.gases[GAS_CO2][MOLES] += gas_breathed
gas_breathed = 0
//-- TRACES --//
- if(breath.trace_gases.len && !(NOBREATH in specflags)) // If there's some other shit in the air lets deal with it here.
- for(var/datum/gas/sleeping_agent/SA in breath.trace_gases)
- var/SA_pp = breath.get_breath_partial_pressure(SA.moles)
- if(SA_pp > SA_para_min) // Enough to make us paralysed for a bit
- H.Paralyse(3) // 3 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
- H.sleeping = max(H.sleeping+2, 10)
- else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning
- if(prob(20))
- spawn(0) H.emote(pick("giggle", "laugh"))
+ if(breath && !(NOBREATH in specflags)) // If there's some other shit in the air lets deal with it here.
+ var/SA_pp = breath.get_breath_partial_pressure(breath.gases[GAS_N2O][MOLES])
+ if(SA_pp > SA_para_min) // Enough to make us paralysed for a bit
+ H.Paralyse(3) // 3 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
+ H.sleeping = max(H.sleeping+2, 10)
+ else if(SA_pp > 0.01) // There is sleeping gas in their lungs, but only a little, so give them a bit of a warning
+ if(prob(20))
+ spawn(0)
+ H.emote(pick("giggle", "laugh"))
handle_breath_temperature(breath, H)
diff --git a/code/modules/mob/living/carbon/human/species_types.dm b/code/modules/mob/living/carbon/human/species_types.dm
index c8ae6d2343f..e9e1cca013e 100644
--- a/code/modules/mob/living/carbon/human/species_types.dm
+++ b/code/modules/mob/living/carbon/human/species_types.dm
@@ -505,7 +505,7 @@ var/global/image/plasmaman_on_fire = image("icon"='icons/mob/OnFire.dmi', "icon_
if(environment)
var/total_moles = environment.total_moles()
if(total_moles)
- if((environment.oxygen /total_moles) >= 0.01)
+ if((environment.gases[GAS_O2][MOLES] /total_moles) >= 0.01)
H.adjust_fire_stacks(0.5)
if(!H.on_fire && H.fire_stacks > 0)
H.visible_message("[H]'s body reacts with the atmosphere and bursts into flames!","Your body reacts with the atmosphere and bursts into flame!")
diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm
index cf61c41cdab..e3fd3fc9c9b 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -105,9 +105,9 @@
var/oxygen_used = 0
var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.temperature)/BREATH_VOLUME
- var/O2_partialpressure = (breath.oxygen/breath.total_moles())*breath_pressure
- var/Toxins_partialpressure = (breath.toxins/breath.total_moles())*breath_pressure
- var/CO2_partialpressure = (breath.carbon_dioxide/breath.total_moles())*breath_pressure
+ var/O2_partialpressure = (breath.gases[GAS_O2][MOLES]/breath.total_moles())*breath_pressure
+ var/Toxins_partialpressure = (breath.gases[GAS_PL][MOLES]/breath.total_moles())*breath_pressure
+ var/CO2_partialpressure = (breath.gases[GAS_CO2][MOLES]/breath.total_moles())*breath_pressure
//OXYGEN
@@ -119,7 +119,7 @@
var/ratio = safe_oxy_min/O2_partialpressure
adjustOxyLoss(min(5*ratio, 3))
failed_last_breath = 1
- oxygen_used = breath.oxygen*ratio/6
+ oxygen_used = breath.gases[GAS_O2][MOLES]*ratio/6
else
adjustOxyLoss(3)
failed_last_breath = 1
@@ -128,11 +128,11 @@
else //Enough oxygen
failed_last_breath = 0
adjustOxyLoss(-5)
- oxygen_used = breath.oxygen/6
+ oxygen_used = breath.gases[GAS_O2][MOLES]/6
clear_alert("oxy")
- breath.oxygen -= oxygen_used
- breath.carbon_dioxide += oxygen_used
+ breath.gases[GAS_O2][MOLES] -= oxygen_used
+ breath.gases[GAS_CO2][MOLES] += oxygen_used
//CARBON DIOXIDE
if(CO2_partialpressure > safe_co2_max)
@@ -151,24 +151,23 @@
//TOXINS/PLASMA
if(Toxins_partialpressure > safe_tox_max)
- var/ratio = (breath.toxins/safe_tox_max) * 10
+ var/ratio = (breath.gases[GAS_PL][MOLES]/safe_tox_max) * 10
if(reagents)
reagents.add_reagent("plasma", Clamp(ratio, MIN_PLASMA_DAMAGE, MAX_PLASMA_DAMAGE))
throw_alert("tox_in_air", /obj/screen/alert/tox_in_air)
else
clear_alert("tox_in_air")
- //TRACE GASES
- if(breath.trace_gases.len)
- for(var/datum/gas/sleeping_agent/SA in breath.trace_gases)
- var/SA_partialpressure = (SA.moles/breath.total_moles())*breath_pressure
- if(SA_partialpressure > SA_para_min)
- Paralyse(3)
- if(SA_partialpressure > SA_sleep_min)
- sleeping = max(sleeping+2, 10)
- else if(SA_partialpressure > 0.01)
- if(prob(20))
- spawn(0) emote(pick("giggle","laugh"))
+ //NITROUS OXIDE
+ if(breath.gases[GAS_N2O][MOLES])
+ var/SA_partialpressure = (breath.gases[GAS_N2O][MOLES]/breath.total_moles())*breath_pressure
+ if(SA_partialpressure > SA_para_min)
+ Paralyse(3)
+ if(SA_partialpressure > SA_sleep_min)
+ sleeping = max(sleeping+2, 10)
+ else if(SA_partialpressure > 0.01)
+ if(prob(20))
+ spawn(0) emote(pick("giggle","laugh"))
//BREATH TEMPERATURE
handle_breath_temperature(breath)
diff --git a/code/modules/mob/living/living_defense.dm b/code/modules/mob/living/living_defense.dm
index 462c2912e93..82a41f3dd6d 100644
--- a/code/modules/mob/living/living_defense.dm
+++ b/code/modules/mob/living/living_defense.dm
@@ -142,7 +142,7 @@
ExtinguishMob()
return
var/datum/gas_mixture/G = loc.return_air() // Check if we're standing in an oxygenless environment
- if(G.oxygen < 1)
+ if(G.gases[GAS_O2][MOLES] < 1)
ExtinguishMob() //If there's no oxygen in the tile we're on, put out the fire
return
var/turf/location = get_turf(src)
diff --git a/code/modules/mob/living/silicon/pai/software.dm b/code/modules/mob/living/silicon/pai/software.dm
index 4aea4929e76..a4cf27c51be 100644
--- a/code/modules/mob/living/silicon/pai/software.dm
+++ b/code/modules/mob/living/silicon/pai/software.dm
@@ -534,17 +534,10 @@
dat += "Air Pressure: [round(pressure,0.1)] kPa
"
if (total_moles)
- var/o2_level = environment.oxygen/total_moles
- var/n2_level = environment.nitrogen/total_moles
- var/co2_level = environment.carbon_dioxide/total_moles
- var/plasma_level = environment.toxins/total_moles
- var/unknown_level = 1-(o2_level+n2_level+co2_level+plasma_level)
- dat += "Nitrogen: [round(n2_level*100)]%
"
- dat += "Oxygen: [round(o2_level*100)]%
"
- dat += "Carbon Dioxide: [round(co2_level*100)]%
"
- dat += "Plasma: [round(plasma_level*100)]%
"
- if(unknown_level > 0.01)
- dat += "OTHER: [round(unknown_level)]%
"
+ for(var/gas in environment.gases)
+ var/gas_level = gas[MOLES]/total_moles
+ if(gas[GAS_INDEX] <= 4 || gas_level > 0.01)
+ dat += "[gas[GAS_NAME]]: [round(gas_level*100)]%
"
dat += "Temperature: [round(environment.temperature-T0C)]°C
"
dat += "Refresh Reading
"
dat += "
"
diff --git a/code/modules/mob/living/simple_animal/guardian/guardian.dm b/code/modules/mob/living/simple_animal/guardian/guardian.dm
index c4e5c7efb8c..0d8dc6aee35 100644
--- a/code/modules/mob/living/simple_animal/guardian/guardian.dm
+++ b/code/modules/mob/living/simple_animal/guardian/guardian.dm
@@ -386,7 +386,12 @@
if(src.beacon) //Check that the beacon still exists and is in a safe place. No instant kills.
if(beacon.air)
var/datum/gas_mixture/Z = beacon.air
- if(Z.oxygen >= 16 && !Z.toxins && Z.carbon_dioxide < 10 && !Z.trace_gases.len)
+ var/trace_gases
+ for(var/i in 5 to Z.gases.len)
+ if(Z.gases[i][MOLES])
+ trace_gases = TRUE
+ break
+ if(Z.gases[GAS_O2][MOLES] >= 16 && !Z.gases[GAS_PL][MOLES] && Z.gases[GAS_CO2][MOLES] < 10 && !trace_gases)
if((Z.temperature > 270) && (Z.temperature < 360))
var/pressure = Z.return_pressure()
if((pressure > 20) && (pressure < 550))
diff --git a/code/modules/mob/living/simple_animal/hostile/tree.dm b/code/modules/mob/living/simple_animal/hostile/tree.dm
index 885a188ac4c..422e435695c 100644
--- a/code/modules/mob/living/simple_animal/hostile/tree.dm
+++ b/code/modules/mob/living/simple_animal/hostile/tree.dm
@@ -42,11 +42,11 @@
if(istype(src.loc, /turf/simulated))
var/turf/simulated/T = src.loc
if(T.air)
- var/co2 = T.air.carbon_dioxide
+ var/co2 = T.air.gases[GAS_CO2][MOLES]
if(co2 > 0)
if(prob(25))
var/amt = min(co2, 9)
- T.air.carbon_dioxide -= amt
+ T.air.gases[GAS_CO2][MOLES] -= amt
T.atmos_spawn_air(SPAWN_OXYGEN, amt)
/mob/living/simple_animal/hostile/tree/AttackingTarget()
diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm
index f0c670e6d9a..eab36005bf6 100644
--- a/code/modules/mob/living/simple_animal/simple_animal.dm
+++ b/code/modules/mob/living/simple_animal/simple_animal.dm
@@ -196,10 +196,10 @@
if(istype(T,/turf/simulated))
var/turf/simulated/ST = T
if(ST.air)
- var/tox = ST.air.toxins
- var/oxy = ST.air.oxygen
- var/n2 = ST.air.nitrogen
- var/co2 = ST.air.carbon_dioxide
+ var/tox = ST.air.gases[GAS_PL][MOLES]
+ var/oxy = ST.air.gases[GAS_O2][MOLES]
+ var/n2 = ST.air.gases[GAS_N2][MOLES]
+ var/co2 = ST.air.gases[GAS_CO2][MOLES]
if(atmos_requirements["min_oxy"] && oxy < atmos_requirements["min_oxy"])
atmos_suitable = 0
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index 585d7ddb96c..94387e19ba3 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -33,14 +33,11 @@ var/next_mob_id = 0
var/datum/gas_mixture/environment = loc.return_air()
- var/t = "Coordinates: [x],[y] \n"
- t+= "Temperature: [environment.temperature] \n"
- t+= "Nitrogen: [environment.nitrogen] \n"
- t+= "Oxygen: [environment.oxygen] \n"
- t+= "Plasma : [environment.toxins] \n"
- t+= "Carbon Dioxide: [environment.carbon_dioxide] \n"
- for(var/datum/gas/trace_gas in environment.trace_gases)
- t+= "[trace_gas.type]: [trace_gas.moles] \n"
+ var/t = "Coordinates: [x],[y] \n"
+ t += "Temperature: [environment.temperature] \n"
+ for(var/gas in environment.gases)
+ if(gas[MOLES])
+ t+="[gas[GAS_NAME]]: [gas[MOLES]] \n"
usr.show_message(t, 1)
diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm
index aab80c9e97f..6901140a0b9 100644
--- a/code/modules/power/singularity/collector.dm
+++ b/code/modules/power/singularity/collector.dm
@@ -26,12 +26,12 @@ var/global/list/rad_collectors = list()
/obj/machinery/power/rad_collector/process()
if(P)
- if(P.air_contents.toxins <= 0)
+ if(P.air_contents.gases[GAS_PL][MOLES] <= 0)
investigate_log("out of fuel.","singulo")
- P.air_contents.toxins = 0
+ P.air_contents.gases[GAS_PL][MOLES] = 0
eject()
else
- P.air_contents.toxins -= 0.001*drainratio
+ P.air_contents.gases[GAS_PL][MOLES] -= 0.001*drainratio
return
@@ -43,7 +43,7 @@ var/global/list/rad_collectors = list()
toggle_power()
user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \
"You turn the [src.name] [active? "on":"off"].")
- investigate_log("turned [active?"on":"off"] by [user.key]. [P?"Fuel: [round(P.air_contents.toxins/0.29)]%":"It is empty"].","singulo")
+ investigate_log("turned [active?"on":"off"] by [user.key]. [P?"Fuel: [round(P.air_contents.gases[GAS_PL][MOLES]/0.29)]%":"It is empty"].","singulo")
return
else
user << "The controls are locked!"
@@ -130,7 +130,7 @@ var/global/list/rad_collectors = list()
/obj/machinery/power/rad_collector/proc/receive_pulse(pulse_strength)
if(P && active)
var/power_produced = 0
- power_produced = P.air_contents.toxins*pulse_strength*20
+ power_produced = P.air_contents.gases[GAS_PL][MOLES]*pulse_strength*20
add_avail(power_produced)
last_power = power_produced
return
diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm
index 18a05a582a4..8b70dc80e59 100644
--- a/code/modules/power/supermatter/supermatter.dm
+++ b/code/modules/power/supermatter/supermatter.dm
@@ -138,7 +138,7 @@
damage = max( damage + ( (removed.temperature - 800) / 150 ) , 0 )
//Ok, 100% oxygen atmosphere = best reaction
//Maxes out at 100% oxygen pressure
- oxygen = max(min((removed.oxygen - (removed.nitrogen * NITROGEN_RETARDATION_FACTOR)) / MOLES_CELLSTANDARD, 1), 0)
+ oxygen = max(min((removed.gases[GAS_O2][MOLES] - (removed.gases[GAS_N2][MOLES] * NITROGEN_RETARDATION_FACTOR)) / MOLES_CELLSTANDARD, 1), 0)
var/temp_factor = 50
@@ -169,9 +169,9 @@
removed.temperature = max(0, min(removed.temperature, 2500))
//Calculate how much gas to release
- removed.toxins += max(device_energy / PLASMA_RELEASE_MODIFIER, 0)
+ removed.gases[GAS_PL][MOLES] += max(device_energy / PLASMA_RELEASE_MODIFIER, 0)
- removed.oxygen += max((device_energy + removed.temperature - T0C) / OXYGEN_RELEASE_MODIFIER, 0)
+ removed.gases[GAS_O2][MOLES] += max((device_energy + removed.temperature - T0C) / OXYGEN_RELEASE_MODIFIER, 0)
env.merge(removed)
diff --git a/code/modules/procedural mapping/mapGeneratorModules/helpers.dm b/code/modules/procedural mapping/mapGeneratorModules/helpers.dm
index 2c76915504b..ff7ea4fc8f7 100644
--- a/code/modules/procedural mapping/mapGeneratorModules/helpers.dm
+++ b/code/modules/procedural mapping/mapGeneratorModules/helpers.dm
@@ -14,11 +14,7 @@
SSair.remove_from_active(T)
for(var/turf/simulated/T in map)
if(T.air)
- T.air.oxygen = T.oxygen
- T.air.nitrogen = T.nitrogen
- T.air.carbon_dioxide = T.carbon_dioxide
- T.air.toxins = T.toxins
- T.air.temperature = T.temperature
+ T.air.copy_from_turf(T)
SSair.add_to_active(T)
//Only places atoms/turfs on area borders