Skip to content

Commit

Permalink
Minor refactor of how gas IDs are handled (tgstation#31528)
Browse files Browse the repository at this point in the history
* gas IDs -> gas datum paths

* updates parse_gas_string() to handle both paths and IDs

* fixes compile errors

* fixes parse_gas_string() ignoring amounts of gas

* fixes roundstart jetpack runtimes

* fixes filters

* fixes map-edited filters

* fixes empty canister runtimes on initialization
  • Loading branch information
duncathan authored and Cyberboss committed Oct 11, 2017
1 parent 79cd75b commit 454d16f
Show file tree
Hide file tree
Showing 52 changed files with 384 additions and 371 deletions.
4 changes: 2 additions & 2 deletions _maps/RandomRuins/SpaceRuins/deepstorage.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -3305,7 +3305,7 @@
"ga" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 1;
filter_type = "o2";
filter_type = /datum/gas/oxygen;
on = 1
},
/turf/open/floor/plasteel/floorgrime{
Expand Down Expand Up @@ -3719,7 +3719,7 @@
"gO" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 1;
filter_type = "n2o";
filter_type = /datum/gas/nitrous_oxide;
on = 1
},
/turf/open/floor/plasteel/floorgrime{
Expand Down
4 changes: 2 additions & 2 deletions _maps/RandomZLevels/undergroundoutpost45.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -14187,7 +14187,7 @@
"um" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 4;
filter_type = "n2";
filter_type = /datum/gas/nitrogen;
on = 1
},
/turf/open/floor/plasteel/red/side{
Expand Down Expand Up @@ -14236,7 +14236,7 @@
"up" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 4;
filter_type = "o2";
filter_type = /datum/gas/oxygen;
on = 1
},
/turf/open/floor/plasteel/blue/side{
Expand Down
14 changes: 7 additions & 7 deletions _maps/map_files/BoxStation/BoxStation.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -43114,7 +43114,7 @@
"bWb" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 1;
filter_type = "n2o";
filter_type = /datum/gas/nitrous_oxide;
on = 1
},
/turf/open/floor/plasteel,
Expand Down Expand Up @@ -44675,7 +44675,7 @@
"bZJ" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 1;
filter_type = "plasma";
filter_type = /datum/gas/plasma;
on = 1
},
/turf/open/floor/plasteel,
Expand Down Expand Up @@ -46466,7 +46466,7 @@
"cdB" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 1;
filter_type = "co2";
filter_type = /datum/gas/carbon_dioxide;
on = 1
},
/turf/open/floor/plasteel,
Expand Down Expand Up @@ -47094,7 +47094,7 @@
"cfi" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 2;
filter_type = "n2";
filter_type = /datum/gas/nitrogen;
on = 1
},
/turf/open/floor/plasteel,
Expand Down Expand Up @@ -47346,7 +47346,7 @@
"cfR" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 4;
filter_type = "o2";
filter_type = /datum/gas/oxygen;
on = 1
},
/turf/open/floor/plasteel,
Expand Down Expand Up @@ -57398,7 +57398,7 @@
"cGf" = (
/obj/machinery/atmospherics/components/trinary/filter/flipped/critical{
dir = 8;
filter_type = "n2"
filter_type = /datum/gas/nitrogen
},
/turf/open/floor/engine,
/area/engine/engineering)
Expand Down Expand Up @@ -58514,7 +58514,7 @@
"cSJ" = (
/obj/machinery/atmospherics/components/trinary/filter/flipped/critical{
dir = 8;
filter_type = "freon";
filter_type = /datum/gas/freon;
name = "gas filter (freon)"
},
/turf/open/floor/engine,
Expand Down
16 changes: 8 additions & 8 deletions _maps/map_files/Deltastation/DeltaStation2.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -6987,7 +6987,7 @@
},
/obj/machinery/atmospherics/components/trinary/filter/critical{
dir = 4;
filter_type = "n2"
filter_type = /datum/gas/nitrogen
},
/turf/open/floor/plasteel/neutral,
/area/engine/atmospherics_engine)
Expand Down Expand Up @@ -10811,7 +10811,7 @@
/area/shuttle/supply)
"aza" = (
/obj/machinery/atmospherics/components/trinary/filter/flipped/critical{
filter_type = "n2";
filter_type = /datum/gas/nitrogen;
name = "nitrogen filter"
},
/turf/open/floor/plasteel/yellow,
Expand Down Expand Up @@ -23007,7 +23007,7 @@
/obj/structure/window/reinforced,
/obj/machinery/atmospherics/components/trinary/filter{
dir = 2;
filter_type = "co2";
filter_type = /datum/gas/carbon_dioxide;
name = "co2 filter";
on = 1
},
Expand Down Expand Up @@ -24580,7 +24580,7 @@
/obj/structure/window/reinforced,
/obj/machinery/atmospherics/components/trinary/filter{
dir = 1;
filter_type = "o2";
filter_type = /datum/gas/oxygen;
name = "oxygen filter";
on = 1
},
Expand Down Expand Up @@ -25841,7 +25841,7 @@
/obj/structure/window/reinforced,
/obj/machinery/atmospherics/components/trinary/filter{
dir = 2;
filter_type = "plasma";
filter_type = /datum/gas/plasma;
name = "waste filter";
on = 1
},
Expand Down Expand Up @@ -27484,7 +27484,7 @@
/obj/structure/window/reinforced,
/obj/machinery/atmospherics/components/trinary/filter{
dir = 1;
filter_type = "n2";
filter_type = /datum/gas/nitrogen;
name = "nitrogen filter";
on = 1
},
Expand Down Expand Up @@ -29207,7 +29207,7 @@
/obj/structure/window/reinforced,
/obj/machinery/atmospherics/components/trinary/filter{
dir = 2;
filter_type = "n2o";
filter_type = /datum/gas/nitrous_oxide;
name = "n2o filter";
on = 1
},
Expand Down Expand Up @@ -105710,7 +105710,7 @@
},
/obj/machinery/atmospherics/components/trinary/filter/critical{
dir = 4;
filter_type = "freon";
filter_type = /datum/gas/freon;
name = "gas filter (freon)"
},
/turf/open/floor/plasteel/neutral,
Expand Down
14 changes: 7 additions & 7 deletions _maps/map_files/MetaStation/MetaStation.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -46859,7 +46859,7 @@
"bMk" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 1;
filter_type = "n2o";
filter_type = /datum/gas/nitrous_oxide;
on = 1
},
/obj/structure/window/reinforced{
Expand Down Expand Up @@ -49916,7 +49916,7 @@
"bSj" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 1;
filter_type = "plasma";
filter_type = /datum/gas/plasma;
on = 1
},
/obj/structure/window/reinforced{
Expand Down Expand Up @@ -52635,7 +52635,7 @@
"bXq" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 1;
filter_type = "co2";
filter_type = /datum/gas/carbon_dioxide;
on = 1
},
/obj/structure/window/reinforced{
Expand Down Expand Up @@ -54519,7 +54519,7 @@
"cbd" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 4;
filter_type = "n2";
filter_type = /datum/gas/nitrogen;
on = 1
},
/obj/structure/window/reinforced,
Expand Down Expand Up @@ -54574,7 +54574,7 @@
/obj/structure/window/reinforced,
/obj/machinery/atmospherics/components/trinary/filter{
dir = 4;
filter_type = "o2";
filter_type = /datum/gas/oxygen;
on = 1
},
/turf/open/floor/plasteel/blue,
Expand Down Expand Up @@ -82681,7 +82681,7 @@
dir = 4
},
/obj/machinery/atmospherics/components/trinary/filter/flipped/critical{
filter_type = "freon";
filter_type = /datum/gas/freon;
name = "gas filter (freon)"
},
/turf/open/floor/engine,
Expand Down Expand Up @@ -82881,7 +82881,7 @@
dir = 4
},
/obj/machinery/atmospherics/components/trinary/filter/flipped/critical{
filter_type = "n2"
filter_type = /datum/gas/nitrogen
},
/turf/open/floor/engine,
/area/engine/engineering)
Expand Down
10 changes: 5 additions & 5 deletions _maps/map_files/OmegaStation/OmegaStation.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -11009,7 +11009,7 @@
"asz" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 2;
filter_type = "n2";
filter_type = /datum/gas/nitrogen;
name = "nitrogen filter";
on = 1
},
Expand Down Expand Up @@ -13296,7 +13296,7 @@
"awD" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 2;
filter_type = "o2";
filter_type = /datum/gas/oxygen;
name = "oxygen filter";
on = 1
},
Expand Down Expand Up @@ -14109,7 +14109,7 @@
"ayf" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 1;
filter_type = "plasma";
filter_type = /datum/gas/plasma;
name = "waste filter";
on = 1
},
Expand Down Expand Up @@ -21607,7 +21607,7 @@
},
/obj/machinery/atmospherics/components/trinary/filter/flipped/critical{
dir = 1;
filter_type = "n2"
filter_type = /datum/gas/nitrogen
},
/turf/open/floor/plasteel,
/area/engine/engineering)
Expand Down Expand Up @@ -23873,7 +23873,7 @@
},
/obj/machinery/atmospherics/components/trinary/filter/flipped/critical{
dir = 1;
filter_type = "freon";
filter_type = /datum/gas/freon;
name = "gas filter (freon)"
},
/turf/open/floor/plasteel,
Expand Down
8 changes: 4 additions & 4 deletions _maps/map_files/PubbyStation/PubbyStation.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -41924,7 +41924,7 @@
"bQN" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 1;
filter_type = "n2o";
filter_type = /datum/gas/nitrous_oxide;
on = 1
},
/turf/open/floor/plasteel,
Expand Down Expand Up @@ -43351,7 +43351,7 @@
"bTU" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 1;
filter_type = "plasma";
filter_type = /datum/gas/plasma;
on = 1
},
/turf/open/floor/plasteel,
Expand Down Expand Up @@ -44738,7 +44738,7 @@
"bWK" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 4;
filter_type = "o2";
filter_type = /datum/gas/oxygen;
on = 1
},
/turf/open/floor/plasteel,
Expand Down Expand Up @@ -44777,7 +44777,7 @@
"bWQ" = (
/obj/machinery/atmospherics/components/trinary/filter{
dir = 1;
filter_type = "co2";
filter_type = /datum/gas/carbon_dioxide;
on = 1
},
/turf/open/floor/plasteel,
Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/atmospherics.dm
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#define META_GAS_MOLES_VISIBLE 3
#define META_GAS_OVERLAY 4
#define META_GAS_DANGER 5
#define META_GAS_ID 6

//stuff you should probably leave well alone!
//ATMOS
Expand Down
6 changes: 3 additions & 3 deletions code/datums/helper_datums/teleport.dm
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@
// Can most things breathe?
if(trace_gases)
continue
if(!(A_gases["o2"] && A_gases["o2"][MOLES] >= 16))
if(!(A_gases[/datum/gas/oxygen] && A_gases[/datum/gas/oxygen][MOLES] >= 16))
continue
if(A_gases["plasma"])
if(A_gases[/datum/gas/plasma])
continue
if(A_gases["co2"] && A_gases["co2"][MOLES] >= 10)
if(A_gases[/datum/gas/carbon_dioxide] && A_gases[/datum/gas/carbon_dioxide][MOLES] >= 10)
continue

// Aim for goldilocks temperatures and pressure
Expand Down
2 changes: 1 addition & 1 deletion code/game/gamemodes/objective_items.dm
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
/datum/objective_item/steal/plasma/check_special_completion(obj/item/tank/T)
var/target_amount = text2num(name)
var/found_amount = 0
found_amount += T.air_contents.gases["plasma"] ? T.air_contents.gases["plasma"][MOLES] : 0
found_amount += T.air_contents.gases[/datum/gas/plasma] ? T.air_contents.gases[/datum/gas/plasma][MOLES] : 0
return found_amount>=target_amount


Expand Down
6 changes: 3 additions & 3 deletions code/game/mecha/equipment/tools/other_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,14 @@
if(!istype(T))
return
var/datum/gas_mixture/GM = new
ASSERT_GAS("plasma", GM)
ADD_GAS(/datum/gas/plasma, GM.gases)
if(prob(10))
GM.gases["plasma"][MOLES] += 100
GM.gases[/datum/gas/plasma][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.gases["plasma"][MOLES] += 5
GM.gases[/datum/gas/plasma][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)
Expand Down
6 changes: 3 additions & 3 deletions code/game/mecha/mecha.dm
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@
cabin_air = new
cabin_air.temperature = T20C
cabin_air.volume = 200
cabin_air.assert_gases("o2","n2")
cabin_air.gases["o2"][MOLES] = O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
cabin_air.gases["n2"][MOLES] = N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
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/nitrogen][MOLES] = N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature)
return cabin_air

/obj/mecha/proc/add_radio()
Expand Down
5 changes: 3 additions & 2 deletions code/game/objects/effects/effect_system/effects_foam.dm
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,9 @@
qdel(H)
var/list/G_gases = G.gases
for(var/I in G_gases)
if(I != "o2" && I != "n2")
G.gases[I][MOLES] = 0
if(I == /datum/gas/oxygen || I == /datum/gas/nitrogen)
continue
G_gases[I][MOLES] = 0
G.garbage_collect()
O.air_update_turf()
for(var/obj/machinery/atmospherics/components/unary/U in O)
Expand Down
Loading

0 comments on commit 454d16f

Please sign in to comment.