diff --git a/SpacemanDMM.toml b/SpacemanDMM.toml index dc79b57af259..2cc934471078 100644 --- a/SpacemanDMM.toml +++ b/SpacemanDMM.toml @@ -1,5 +1,10 @@ -[langserver] -dreamchecker = true - -[debugger] -engine = "extools" +environment = "yogstation.dme" + +[langserver] +dreamchecker = true + +[diagnostics] +var_in_proc_parameter = "off" + +[debugger] +engine = "auxtools" diff --git a/_maps/RandomRuins/StationRuins/BoxStation/engine_sm.dmm b/_maps/RandomRuins/StationRuins/BoxStation/engine_sm.dmm index 142f68d2201c..733a2ef2a261 100644 --- a/_maps/RandomRuins/StationRuins/BoxStation/engine_sm.dmm +++ b/_maps/RandomRuins/StationRuins/BoxStation/engine_sm.dmm @@ -1137,7 +1137,7 @@ "do" = ( /obj/machinery/atmospherics/components/trinary/filter/flipped/critical{ dir = 8; - filter_type = list(/datum/gas/nitrogen) + filter_type = list("n2") }, /turf/open/floor/engine, /area/engine/engineering) diff --git a/_maps/RandomRuins/StationRuins/MetaStation/meta_sm.dmm b/_maps/RandomRuins/StationRuins/MetaStation/meta_sm.dmm index cea332dfe4a9..7c18da9f5dd5 100644 --- a/_maps/RandomRuins/StationRuins/MetaStation/meta_sm.dmm +++ b/_maps/RandomRuins/StationRuins/MetaStation/meta_sm.dmm @@ -42,7 +42,7 @@ dir = 4 }, /obj/machinery/atmospherics/components/trinary/filter/flipped/critical{ - filter_type = list(/datum/gas/nitrogen) + filter_type = list("n2") }, /turf/open/floor/engine, /area/engine/engineering) diff --git a/_maps/RandomZLevels/VR/snowdin_VR.dmm b/_maps/RandomZLevels/VR/snowdin_VR.dmm index a11ea4463d80..e8859e690f32 100644 --- a/_maps/RandomZLevels/VR/snowdin_VR.dmm +++ b/_maps/RandomZLevels/VR/snowdin_VR.dmm @@ -2671,14 +2671,14 @@ "gc" = ( /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "gd" = ( /obj/effect/spawner/lootdrop/crate_spawner, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "ge" = ( @@ -2689,7 +2689,7 @@ /obj/effect/spawner/lootdrop/snowdin/dungeonheavy, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "gg" = ( @@ -3046,14 +3046,14 @@ /obj/effect/decal/remains/human, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "gV" = ( /obj/effect/decal/cleanable/blood/old, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "gW" = ( @@ -3372,7 +3372,7 @@ /obj/structure/destructible/cult/pylon, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "hG" = ( @@ -3637,7 +3637,7 @@ /obj/effect/spawner/lootdrop/snowdin/dungeonmid, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "im" = ( @@ -3647,7 +3647,7 @@ }, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "in" = ( @@ -3657,7 +3657,7 @@ }, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "io" = ( @@ -4458,7 +4458,7 @@ }, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "jP" = ( @@ -5553,7 +5553,7 @@ /obj/effect/spawner/lootdrop/snowdin/dungeonlite, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "lU" = ( @@ -7439,7 +7439,7 @@ /obj/structure/flora/rock/pile/icy, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "qh" = ( @@ -13071,7 +13071,7 @@ /turf/open/floor/mineral/plastitanium{ initial_gas_mix = "o2=22;n2=82;TEMP=180"; planetary_atmos = 1; - temperature = 180 + initial_temperature = 180 }, /area/awaymission/snowdin/cave) "EF" = ( @@ -13083,7 +13083,7 @@ /turf/open/floor/mineral/plastitanium{ initial_gas_mix = "o2=22;n2=82;TEMP=180"; planetary_atmos = 1; - temperature = 180 + initial_temperature = 180 }, /area/awaymission/snowdin/cave) "EG" = ( @@ -13097,7 +13097,7 @@ /turf/open/floor/mineral/plastitanium{ initial_gas_mix = "o2=22;n2=82;TEMP=180"; planetary_atmos = 1; - temperature = 180 + initial_temperature = 180 }, /area/awaymission/snowdin/cave) "EH" = ( diff --git a/_maps/RandomZLevels/moonoutpost19.dmm b/_maps/RandomZLevels/moonoutpost19.dmm index 5bb51263e5fc..1e0cf6ce459a 100644 --- a/_maps/RandomZLevels/moonoutpost19.dmm +++ b/_maps/RandomZLevels/moonoutpost19.dmm @@ -954,7 +954,7 @@ /turf/open/floor/plating{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "bY" = ( @@ -981,7 +981,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "ca" = ( @@ -989,7 +989,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cb" = ( @@ -1002,7 +1002,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cc" = ( @@ -1016,7 +1016,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cd" = ( @@ -1030,7 +1030,7 @@ heat_capacity = 1e+006; icon_state = "floorscorched2"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "ce" = ( @@ -1044,7 +1044,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cf" = ( @@ -1058,7 +1058,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cg" = ( @@ -1071,7 +1071,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "ch" = ( @@ -1086,7 +1086,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "ci" = ( @@ -1164,7 +1164,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cp" = ( @@ -1181,7 +1181,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cr" = ( @@ -1211,7 +1211,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "ct" = ( @@ -1234,7 +1234,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cv" = ( @@ -1248,7 +1248,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cw" = ( @@ -1324,7 +1324,7 @@ /turf/open/floor/plating{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cD" = ( @@ -1341,7 +1341,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cF" = ( @@ -1353,7 +1353,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cG" = ( @@ -1378,7 +1378,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cI" = ( @@ -1390,7 +1390,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cJ" = ( @@ -1401,7 +1401,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cK" = ( @@ -1422,7 +1422,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cL" = ( @@ -1437,7 +1437,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cM" = ( @@ -1498,7 +1498,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cR" = ( @@ -1507,7 +1507,7 @@ heat_capacity = 1e+006; icon_state = "damaged4"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cS" = ( @@ -1527,7 +1527,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cT" = ( @@ -1563,7 +1563,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cW" = ( @@ -1572,7 +1572,7 @@ heat_capacity = 1e+006; icon_state = "damaged2"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cX" = ( @@ -1581,7 +1581,7 @@ heat_capacity = 1e+006; icon_state = "damaged3"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cY" = ( @@ -1598,7 +1598,7 @@ dir = 1; heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "cZ" = ( @@ -1664,7 +1664,7 @@ /turf/open/floor/plating{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "df" = ( @@ -1686,7 +1686,7 @@ dir = 1; heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "dh" = ( @@ -1738,7 +1738,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "dm" = ( @@ -1749,7 +1749,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "dn" = ( @@ -1759,7 +1759,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "do" = ( @@ -1768,7 +1768,7 @@ heat_capacity = 1e+006; icon_state = "damaged1"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "dp" = ( @@ -1782,7 +1782,7 @@ heat_capacity = 1e+006; icon_state = "platingdmg3"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "dq" = ( @@ -1870,7 +1870,7 @@ /turf/open/floor/plating{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "dx" = ( @@ -1892,7 +1892,7 @@ /turf/open/floor/plating{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "dz" = ( @@ -1921,7 +1921,7 @@ /turf/open/floor/plating{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "dC" = ( @@ -1929,7 +1929,7 @@ heat_capacity = 1e+006; icon_state = "platingdmg1"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "dD" = ( @@ -1941,7 +1941,7 @@ /turf/open/floor/plating{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "dE" = ( @@ -2005,7 +2005,7 @@ icon_plating = "asteroidplating"; icon_state = "asteroidplating"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "dJ" = ( @@ -2031,7 +2031,7 @@ icon_plating = "asteroidplating"; icon_state = "asteroidplating"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/syndicate) "dM" = ( @@ -2040,7 +2040,7 @@ icon_plating = "asteroidplating"; icon_state = "asteroidplating"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/main) "dN" = ( @@ -4936,7 +4936,7 @@ heat_capacity = 1e+006; icon_state = "platingdmg1"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "jB" = ( @@ -5188,7 +5188,7 @@ heat_capacity = 1e+006; icon_state = "floorscorched2"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "kd" = ( @@ -5200,7 +5200,7 @@ heat_capacity = 1e+006; icon_state = "damaged1"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "ke" = ( @@ -5212,7 +5212,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "kf" = ( @@ -5226,7 +5226,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "kg" = ( @@ -5238,7 +5238,7 @@ heat_capacity = 1e+006; icon_state = "floorscorched1"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "kh" = ( @@ -5249,7 +5249,7 @@ heat_capacity = 1e+006; icon_state = "platingdmg1"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "ki" = ( @@ -5261,7 +5261,7 @@ heat_capacity = 1e+006; icon_state = "damaged3"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "kj" = ( @@ -5448,7 +5448,7 @@ heat_capacity = 1e+006; icon_state = "damaged2"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "kC" = ( @@ -5467,7 +5467,7 @@ heat_capacity = 1e+006; icon_state = "damaged4"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "kE" = ( @@ -5475,7 +5475,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "kF" = ( @@ -5484,7 +5484,7 @@ heat_capacity = 1e+006; icon_state = "damaged5"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "kG" = ( @@ -5493,7 +5493,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "kH" = ( @@ -5591,7 +5591,7 @@ heat_capacity = 1e+006; icon_state = "platingdmg3"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "kR" = ( @@ -5779,7 +5779,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "ll" = ( @@ -5791,7 +5791,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "lm" = ( @@ -5901,7 +5901,7 @@ "lv" = ( /turf/open/floor/plasteel/showroomfloor{ heat_capacity = 1e+006; - temperature = 273.15 + initial_temperature = 273.15 }, /area/awaymission/moonoutpost19/arrivals) "lw" = ( @@ -5912,7 +5912,7 @@ }, /turf/open/floor/plasteel/showroomfloor{ heat_capacity = 1e+006; - temperature = 273.15 + initial_temperature = 273.15 }, /area/awaymission/moonoutpost19/arrivals) "lx" = ( @@ -5924,7 +5924,7 @@ /obj/item/clothing/under/waiter, /turf/open/floor/plasteel/showroomfloor{ heat_capacity = 1e+006; - temperature = 273.15 + initial_temperature = 273.15 }, /area/awaymission/moonoutpost19/arrivals) "lA" = ( @@ -5940,7 +5940,7 @@ }, /turf/open/floor/plating{ initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "lE" = ( @@ -5983,7 +5983,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "lJ" = ( @@ -5993,7 +5993,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "lK" = ( @@ -6067,7 +6067,7 @@ /obj/item/gun/ballistic/shotgun/sc_pump, /turf/open/floor/plasteel/showroomfloor{ heat_capacity = 1e+006; - temperature = 273.15 + initial_temperature = 273.15 }, /area/awaymission/moonoutpost19/arrivals) "lW" = ( @@ -6141,7 +6141,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "mi" = ( @@ -6192,7 +6192,7 @@ /obj/effect/decal/cleanable/dirt, /turf/open/floor/plasteel/showroomfloor{ heat_capacity = 1e+006; - temperature = 273.15 + initial_temperature = 273.15 }, /area/awaymission/moonoutpost19/arrivals) "mn" = ( @@ -6207,7 +6207,7 @@ /obj/item/reagent_containers/food/snacks/meat/slab/monkey, /turf/open/floor/plasteel/showroomfloor{ heat_capacity = 1e+006; - temperature = 273.15 + initial_temperature = 273.15 }, /area/awaymission/moonoutpost19/arrivals) "mo" = ( @@ -6222,7 +6222,7 @@ /obj/item/storage/fancy/egg_box, /turf/open/floor/plasteel/showroomfloor{ heat_capacity = 1e+006; - temperature = 273.15 + initial_temperature = 273.15 }, /area/awaymission/moonoutpost19/arrivals) "mp" = ( @@ -6289,7 +6289,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "my" = ( @@ -6457,7 +6457,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "mQ" = ( @@ -6471,7 +6471,7 @@ heat_capacity = 1e+006; icon_state = "floorscorched2"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "mR" = ( @@ -6548,7 +6548,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "na" = ( @@ -6601,7 +6601,7 @@ heat_capacity = 1e+006; icon_state = "floorscorched2"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "nj" = ( @@ -6614,7 +6614,7 @@ heat_capacity = 1e+006; icon_state = "damaged2"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "nk" = ( @@ -6673,7 +6673,7 @@ heat_capacity = 1e+006; icon_state = "damaged1"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "nr" = ( @@ -6704,7 +6704,7 @@ icon_plating = "asteroidplating"; icon_state = "asteroidplating"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "nw" = ( @@ -6718,7 +6718,7 @@ /turf/open/floor/plasteel/cafeteria{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "nx" = ( @@ -6742,7 +6742,7 @@ /turf/open/floor/plasteel/cafeteria{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "ny" = ( @@ -6757,7 +6757,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "nz" = ( @@ -6810,7 +6810,7 @@ heat_capacity = 1e+006; icon_state = "platingdmg1"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "nE" = ( @@ -6823,7 +6823,7 @@ heat_capacity = 1e+006; icon_state = "platingdmg3"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "nF" = ( @@ -6836,7 +6836,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "nG" = ( @@ -6849,7 +6849,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "nH" = ( @@ -6911,7 +6911,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "nN" = ( @@ -6922,7 +6922,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "nO" = ( @@ -6966,7 +6966,7 @@ heat_capacity = 1e+006; icon_state = "damaged1"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "nT" = ( @@ -7003,7 +7003,7 @@ icon_plating = "asteroidplating"; icon_state = "asteroidplating"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "nX" = ( @@ -7015,7 +7015,7 @@ heat_capacity = 1e+006; icon_state = "floorscorched2"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "nY" = ( @@ -7029,7 +7029,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "nZ" = ( @@ -7039,7 +7039,7 @@ icon_plating = "asteroidplating"; icon_state = "asteroidplating"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/main) "oa" = ( @@ -7061,7 +7061,7 @@ /turf/open/floor/plasteel{ heat_capacity = 1e+006; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/arrivals) "oc" = ( @@ -7074,7 +7074,7 @@ icon_plating = "asteroidplating"; icon_state = "asteroidplating"; initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251"; - temperature = 251 + initial_temperature = 251 }, /area/awaymission/moonoutpost19/main) "od" = ( diff --git a/_maps/RandomZLevels/snowdin.dmm b/_maps/RandomZLevels/snowdin.dmm index 69a2ac9a86c6..ab80473ae735 100644 --- a/_maps/RandomZLevels/snowdin.dmm +++ b/_maps/RandomZLevels/snowdin.dmm @@ -2688,14 +2688,14 @@ "gc" = ( /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "gd" = ( /obj/effect/spawner/lootdrop/crate_spawner, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "ge" = ( @@ -2706,7 +2706,7 @@ /obj/effect/spawner/lootdrop/snowdin/dungeonheavy, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "gg" = ( @@ -3077,14 +3077,14 @@ /obj/effect/decal/remains/human, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "gV" = ( /obj/effect/decal/cleanable/blood/old, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "gW" = ( @@ -3391,7 +3391,7 @@ /obj/structure/destructible/cult/pylon, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "hG" = ( @@ -3652,7 +3652,7 @@ /obj/effect/spawner/lootdrop/snowdin/dungeonmid, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "im" = ( @@ -3662,7 +3662,7 @@ }, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "in" = ( @@ -3672,7 +3672,7 @@ }, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "io" = ( @@ -4489,7 +4489,7 @@ }, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "jP" = ( @@ -5615,7 +5615,7 @@ /obj/effect/spawner/lootdrop/snowdin/dungeonlite, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "lU" = ( @@ -7509,7 +7509,7 @@ /obj/structure/flora/rock/pile/icy, /turf/open/floor/engine/cult{ initial_gas_mix = "o2=0;n2=82;plasma=24;TEMP=120"; - temperature = 120 + initial_temperature = 120 }, /area/awaymission/snowdin/cave/cavern) "qh" = ( @@ -13210,7 +13210,7 @@ /turf/open/floor/mineral/plastitanium{ initial_gas_mix = "o2=22;n2=82;TEMP=180"; planetary_atmos = 1; - temperature = 180 + initial_temperature = 180 }, /area/awaymission/snowdin/cave) "EF" = ( @@ -13222,7 +13222,7 @@ /turf/open/floor/mineral/plastitanium{ initial_gas_mix = "o2=22;n2=82;TEMP=180"; planetary_atmos = 1; - temperature = 180 + initial_temperature = 180 }, /area/awaymission/snowdin/cave) "EG" = ( @@ -13236,7 +13236,7 @@ /turf/open/floor/mineral/plastitanium{ initial_gas_mix = "o2=22;n2=82;TEMP=180"; planetary_atmos = 1; - temperature = 180 + initial_temperature = 180 }, /area/awaymission/snowdin/cave) "EH" = ( diff --git a/_maps/RandomZLevels/undergroundoutpost45.dmm b/_maps/RandomZLevels/undergroundoutpost45.dmm index 2b15f9a3ec6a..3bb3fb1b1440 100644 --- a/_maps/RandomZLevels/undergroundoutpost45.dmm +++ b/_maps/RandomZLevels/undergroundoutpost45.dmm @@ -807,7 +807,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 351.9 + initial_temperature = 351.9 }, /area/awaymission/undergroundoutpost45/caves) "bX" = ( @@ -815,7 +815,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 351.9 + initial_temperature = 351.9 }, /area/awaymission/undergroundoutpost45/caves) "bY" = ( @@ -2112,7 +2112,7 @@ icon_plating = "asteroidplating"; icon_state = "asteroidplating"; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "ev" = ( @@ -2247,7 +2247,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "eK" = ( @@ -2625,7 +2625,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/central) "fo" = ( @@ -2861,7 +2861,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/central) "fK" = ( @@ -3042,7 +3042,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "gg" = ( @@ -3190,7 +3190,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/crew_quarters) "gC" = ( @@ -3462,7 +3462,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/research) "he" = ( @@ -3473,7 +3473,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/crew_quarters) "hf" = ( @@ -3505,7 +3505,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/crew_quarters) "hi" = ( @@ -4904,7 +4904,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/gateway) "jM" = ( @@ -4938,7 +4938,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/research) "jR" = ( @@ -6754,7 +6754,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/gateway) "mJ" = ( @@ -8519,7 +8519,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "pv" = ( @@ -8530,7 +8530,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "pw" = ( @@ -8542,7 +8542,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/engineering) "px" = ( @@ -8835,7 +8835,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "qb" = ( @@ -9069,7 +9069,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "qA" = ( @@ -9080,7 +9080,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "qB" = ( @@ -9091,7 +9091,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "qC" = ( @@ -11292,7 +11292,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/crew_quarters) "uc" = ( @@ -11946,7 +11946,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "vm" = ( @@ -12172,7 +12172,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/research) "vI" = ( @@ -12469,7 +12469,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/mining) "wk" = ( @@ -13692,7 +13692,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/mining) "yh" = ( @@ -13701,7 +13701,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yi" = ( @@ -13710,7 +13710,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yj" = ( @@ -13721,7 +13721,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yk" = ( @@ -13731,7 +13731,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yl" = ( @@ -13742,7 +13742,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "ym" = ( @@ -13752,7 +13752,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yn" = ( @@ -13761,7 +13761,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yo" = ( @@ -13771,7 +13771,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yp" = ( @@ -13781,7 +13781,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yq" = ( @@ -13790,7 +13790,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yr" = ( @@ -13799,7 +13799,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yt" = ( @@ -13809,7 +13809,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yu" = ( @@ -13819,7 +13819,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yw" = ( @@ -13829,7 +13829,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yz" = ( @@ -13838,7 +13838,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yA" = ( @@ -13848,7 +13848,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yB" = ( @@ -13857,7 +13857,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yC" = ( @@ -13867,7 +13867,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yD" = ( @@ -13878,7 +13878,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "yH" = ( @@ -13889,7 +13889,7 @@ heat_capacity = 1e+006; initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9"; name = "Cave Floor"; - temperature = 363.9 + initial_temperature = 363.9 }, /area/awaymission/undergroundoutpost45/caves) "zi" = ( diff --git a/_maps/map_files/GaxStation/GaxStation.dmm b/_maps/map_files/GaxStation/GaxStation.dmm index 0b8073605426..eb04435ea5f7 100644 --- a/_maps/map_files/GaxStation/GaxStation.dmm +++ b/_maps/map_files/GaxStation/GaxStation.dmm @@ -19832,7 +19832,7 @@ }, /obj/machinery/atmospherics/components/trinary/filter/flipped/critical{ dir = 1; - filter_type = list(/datum/gas/nitrogen) + filter_type = list("n2") }, /turf/open/floor/engine, /area/engine/engineering) diff --git a/auxmos.dll b/auxmos.dll new file mode 100644 index 000000000000..6f76316c3f72 Binary files /dev/null and b/auxmos.dll differ diff --git a/auxmos.pdb b/auxmos.pdb new file mode 100644 index 000000000000..c86057ac0181 Binary files /dev/null and b/auxmos.pdb differ diff --git a/byond-extools.dll b/byond-extools.dll deleted file mode 100644 index 37efe6c6e403..000000000000 Binary files a/byond-extools.dll and /dev/null differ diff --git a/byond-extools.pdb b/byond-extools.pdb deleted file mode 100644 index b0665dcfea62..000000000000 Binary files a/byond-extools.pdb and /dev/null differ diff --git a/code/__DEFINES/MC.dm b/code/__DEFINES/MC.dm index 7c84b693e31c..aa1d6214bd26 100644 --- a/code/__DEFINES/MC.dm +++ b/code/__DEFINES/MC.dm @@ -9,6 +9,8 @@ Master.current_ticklimit = original_tick_limit;\ } +#define MC_TICK_REMAINING_MS ((Master.current_ticklimit - TICK_USAGE) * world.tick_lag) + // Used to smooth out costs to try and avoid oscillation. #define MC_AVERAGE_FAST(average, current) (0.7 * (average) + 0.3 * (current)) #define MC_AVERAGE(average, current) (0.8 * (average) + 0.2 * (current)) diff --git a/code/__DEFINES/_auxtools.dm b/code/__DEFINES/_auxtools.dm new file mode 100644 index 000000000000..a907be8ecf8f --- /dev/null +++ b/code/__DEFINES/_auxtools.dm @@ -0,0 +1,8 @@ +/proc/auxtools_stack_trace(msg) + CRASH(msg) + +/proc/auxtools_expr_stub() + CRASH("auxtools not loaded") + +/proc/enable_debugging(mode, port) + CRASH("auxtools not loaded") diff --git a/code/__DEFINES/ai.dm b/code/__DEFINES/ai.dm index 3107edc5b84a..e0d742e1ad66 100644 --- a/code/__DEFINES/ai.dm +++ b/code/__DEFINES/ai.dm @@ -4,6 +4,8 @@ ///Temperature limit of all AI machinery #define AI_TEMP_LIMIT 288.15 //15C, much hotter than a normal server room for leniency :) +#define AI_HEATSINK_CAPACITY 5000 +#define AI_HEATSINK_COEFF 1 ///How many ticks can an AI data core store? When this amount of ticks have passed while it's in an INVALID state it can no longer be used by an AI #define MAX_AI_DATA_CORE_TICKS 45 diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm index ca7383a8b4a0..62eeffd3106f 100644 --- a/code/__DEFINES/atmospherics.dm +++ b/code/__DEFINES/atmospherics.dm @@ -1,15 +1,3 @@ -//LISTMOS -//indices of values in gas lists. -#define MOLES 1 -#define ARCHIVE 2 -#define GAS_META 3 -#define META_GAS_SPECIFIC_HEAT 1 -#define META_GAS_NAME 2 -#define META_GAS_MOLES_VISIBLE 3 -#define META_GAS_OVERLAY 4 -#define META_GAS_DANGER 5 -#define META_GAS_ID 6 -#define META_GAS_FUSION_POWER 7 //ATMOS //stuff you should probably leave well alone! /// kPa*L/(K*mol) @@ -437,6 +425,32 @@ /// north/south east/west doesn't matter, auto normalize on build. #define PIPING_CARDINAL_AUTONORMALIZE (1<<3) +// Gas defines because i hate typepaths +#define GAS_O2 "o2" +#define GAS_N2 "n2" +#define GAS_CO2 "co2" +#define GAS_PLASMA "plasma" +#define GAS_H2O "water_vapor" +#define GAS_HYPERNOB "hypernob" +#define GAS_NITROUS "n2o" +#define GAS_NITRIUM "no2" +#define GAS_TRITIUM "tritium" +#define GAS_BZ "bz" +#define GAS_PLUOXIUM "pluox" +#define GAS_MIASMA "miasma" +#define GAS_H2 "hydrogen" +#define GAS_FREON "freon" +#define GAS_HEALIUM "healium" +#define GAS_PLUONIUM "pluonium" +#define GAS_HALON "halon" +#define GAS_ANTINOB "antinob" +#define GAS_ZAUKER "zauker" +#define GAS_HEXANE "hexane" +#define GAS_DILITHIUM "dilithium" + +#define GAS_FLAG_DANGEROUS (1<<0) +#define GAS_FLAG_BREATH_PROC (1<<1) + //HELPERS #define PIPING_LAYER_SHIFT(T, PipingLayer) \ if(T.dir & (NORTH|SOUTH)) { \ @@ -458,24 +472,6 @@ T.pixel_x = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_X;\ T.pixel_y = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_Y; -#ifdef TESTING -GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0)) -#define CALCULATE_ADJACENT_TURFS(T) if (SSadjacent_air.queue[T]) { GLOB.atmos_adjacent_savings[1] += 1 } else { GLOB.atmos_adjacent_savings[2] += 1; SSadjacent_air.queue[T] = 1 } -#else -#define CALCULATE_ADJACENT_TURFS(T) SSadjacent_air.queue[T] = 1 -#endif - -GLOBAL_VAR(atmos_extools_initialized) // this must be an uninitialized (null) one or init_monstermos will be called twice because reasons -#define ATMOS_EXTOOLS_CHECK if(!GLOB.atmos_extools_initialized){\ - GLOB.atmos_extools_initialized=TRUE;\ - if(fexists(EXTOOLS)){\ - var/result = LIBCALL(EXTOOLS,"init_monstermos")();\ - if(result != "ok") {CRASH(result);}\ - } else {\ - CRASH("byond-extools.dll does not exist!");\ - }\ -} - GLOBAL_LIST_INIT(pipe_paint_colors, list( "amethyst" = rgb(130,43,255), //supplymain "blue" = rgb(0,0,255), @@ -494,6 +490,11 @@ GLOBAL_LIST_INIT(pipe_paint_colors, list( #define MIASMA_CORPSE_MOLES 0.02 #define MIASMA_GIBS_MOLES 0.005 +//PIPENET UPDATE STATUS +#define PIPENET_UPDATE_STATUS_DORMANT 0 +#define PIPENET_UPDATE_STATUS_REACT_NEEDED 1 +#define PIPENET_UPDATE_STATUS_RECONCILE_NEEDED 2 + #define TURF_SHARES(T) (LAZYLEN(T.atmos_adjacent_turfs)) //Defines for air alarm severities in areas. diff --git a/code/__DEFINES/bindings.dm b/code/__DEFINES/bindings.dm new file mode 100644 index 000000000000..18f8586433bf --- /dev/null +++ b/code/__DEFINES/bindings.dm @@ -0,0 +1,182 @@ +#define AUXMOS (__detect_auxmos()) + +/proc/__detect_auxmos() + if (world.system_type == UNIX) + return "libauxmos" + else + return "auxmos" + +/turf/proc/__update_auxtools_turf_adjacency_info() + return call_ext(AUXMOS, "byond:hook_infos_ffi")(src) + +/turf/proc/update_air_ref(flag) + return call_ext(AUXMOS, "byond:hook_register_turf_ffi")(src, flag) + +/datum/gas_mixture/proc/__auxtools_parse_gas_string(string) + return call_ext(AUXMOS, "byond:parse_gas_string_ffi")(src, string) + +/datum/controller/subsystem/air/proc/get_max_gas_mixes() + return call_ext(AUXMOS, "byond:hook_max_gas_mixes_ffi")() + +/datum/controller/subsystem/air/proc/get_amt_gas_mixes() + return call_ext(AUXMOS, "byond:hook_amt_gas_mixes_ffi")() + +/proc/equalize_all_gases_in_list(gas_list) + return call_ext(AUXMOS, "byond:equalize_all_hook_ffi")(gas_list) + +/datum/gas_mixture/proc/get_oxidation_power(temp) + return call_ext(AUXMOS, "byond:oxidation_power_hook_ffi")(src, temp) + +/datum/gas_mixture/proc/get_fuel_amount(temp) + return call_ext(AUXMOS, "byond:fuel_amount_hook_ffi")(src, temp) + +/datum/gas_mixture/proc/equalize_with(total) + return call_ext(AUXMOS, "byond:equalize_with_hook_ffi")(src, total) + +/datum/gas_mixture/proc/transfer_ratio_to(other, ratio) + return call_ext(AUXMOS, "byond:transfer_ratio_hook_ffi")(src, other, ratio) + +/datum/gas_mixture/proc/transfer_to(other, moles) + return call_ext(AUXMOS, "byond:transfer_hook_ffi")(src, other, moles) + +/datum/gas_mixture/proc/adjust_heat(temp) + return call_ext(AUXMOS, "byond:adjust_heat_hook_ffi")(src, temp) + +/datum/gas_mixture/proc/react(holder) + return call_ext(AUXMOS, "byond:react_hook_ffi")(src, holder) + +/datum/gas_mixture/proc/compare(other) + return call_ext(AUXMOS, "byond:compare_hook_ffi")(src, other) + +/datum/gas_mixture/proc/clear() + return call_ext(AUXMOS, "byond:clear_hook_ffi")(src) + +/datum/gas_mixture/proc/mark_immutable() + return call_ext(AUXMOS, "byond:mark_immutable_hook_ffi")(src) + +/datum/gas_mixture/proc/scrub_into(into, ratio_v, gas_list) + return call_ext(AUXMOS, "byond:scrub_into_hook_ffi")(src, into, ratio_v, gas_list) + +/datum/gas_mixture/proc/get_by_flag(flag_val) + return call_ext(AUXMOS, "byond:get_by_flag_hook_ffi")(src, flag_val) + +/datum/gas_mixture/proc/__remove_by_flag(into, flag_val, amount_val) + return call_ext(AUXMOS, "byond:remove_by_flag_hook_ffi")(src, into, flag_val, amount_val) + +/datum/gas_mixture/proc/divide(num_val) + return call_ext(AUXMOS, "byond:divide_hook_ffi")(src, num_val) + +/datum/gas_mixture/proc/multiply(num_val) + return call_ext(AUXMOS, "byond:multiply_hook_ffi")(src, num_val) + +/datum/gas_mixture/proc/subtract(num_val) + return call_ext(AUXMOS, "byond:subtract_hook_ffi")(src, num_val) + +/datum/gas_mixture/proc/add(num_val) + return call_ext(AUXMOS, "byond:add_hook_ffi")(src, num_val) + +/datum/gas_mixture/proc/adjust_multi(...) + var/list/args_copy = args.Copy() + args_copy.Insert(1, src) + return call_ext(AUXMOS, "byond:adjust_multi_hook_ffi")(arglist(args_copy)) + +/datum/gas_mixture/proc/adjust_moles_temp(id_val, num_val, temp_val) + return call_ext(AUXMOS, "byond:adjust_moles_temp_hook_ffi")(src, id_val, num_val, temp_val) + +/datum/gas_mixture/proc/adjust_moles(id_val, num_val) + return call_ext(AUXMOS, "byond:adjust_moles_hook_ffi")(src, id_val, num_val) + +/datum/gas_mixture/proc/set_moles(gas_id, amt_val) + return call_ext(AUXMOS, "byond:set_moles_hook_ffi")(src, gas_id, amt_val) + +/datum/gas_mixture/proc/get_moles(gas_id) + return call_ext(AUXMOS, "byond:get_moles_hook_ffi")(src, gas_id) + +/datum/gas_mixture/proc/set_volume(vol_arg) + return call_ext(AUXMOS, "byond:set_volume_hook_ffi")(src, vol_arg) + +/datum/gas_mixture/proc/partial_heat_capacity(gas_id) + return call_ext(AUXMOS, "byond:partial_heat_capacity_ffi")(src, gas_id) + +/datum/gas_mixture/proc/set_temperature(arg_temp) + return call_ext(AUXMOS, "byond:set_temperature_hook_ffi")(src, arg_temp) + +/datum/gas_mixture/proc/get_gases() + return call_ext(AUXMOS, "byond:get_gases_hook_ffi")(src) + +/datum/gas_mixture/proc/temperature_share(...) + var/list/args_copy = args.Copy() + args_copy.Insert(1, src) + return call_ext(AUXMOS, "byond:temperature_share_hook_ffi")(arglist(args_copy)) + +/datum/gas_mixture/proc/copy_from(giver) + return call_ext(AUXMOS, "byond:copy_from_hook_ffi")(src, giver) + +/datum/gas_mixture/proc/__remove(into, amount_arg) + return call_ext(AUXMOS, "byond:remove_hook_ffi")(src, into, amount_arg) + +/datum/gas_mixture/proc/__remove_ratio(into, ratio_arg) + return call_ext(AUXMOS, "byond:remove_ratio_hook_ffi")(src, into, ratio_arg) + +/datum/gas_mixture/proc/merge(giver) + return call_ext(AUXMOS, "byond:merge_hook_ffi")(src, giver) + +/datum/gas_mixture/proc/thermal_energy() + return call_ext(AUXMOS, "byond:thermal_energy_hook_ffi")(src) + +/datum/gas_mixture/proc/return_volume() + return call_ext(AUXMOS, "byond:return_volume_hook_ffi")(src) + +/datum/gas_mixture/proc/return_temperature() + return call_ext(AUXMOS, "byond:return_temperature_hook_ffi")(src) + +/datum/gas_mixture/proc/return_pressure() + return call_ext(AUXMOS, "byond:return_pressure_hook_ffi")(src) + +/datum/gas_mixture/proc/total_moles() + return call_ext(AUXMOS, "byond:total_moles_hook_ffi")(src) + +/datum/gas_mixture/proc/set_min_heat_capacity(arg_min) + return call_ext(AUXMOS, "byond:min_heat_cap_hook_ffi")(src, arg_min) + +/datum/gas_mixture/proc/heat_capacity() + return call_ext(AUXMOS, "byond:heat_cap_hook_ffi")(src) + +/datum/gas_mixture/proc/__gasmixture_unregister() + return call_ext(AUXMOS, "byond:unregister_gasmixture_hook_ffi")(src) + +/datum/gas_mixture/proc/__gasmixture_register() + return call_ext(AUXMOS, "byond:register_gasmixture_hook_ffi")(src) + +/proc/process_atmos_callbacks(remaining) + return call_ext(AUXMOS, "byond:atmos_callback_handle_ffi")(remaining) + +/datum/controller/subsystem/air/proc/process_turf_equalize_auxtools(remaining) + return call_ext(AUXMOS, "byond:equalize_hook_ffi")(src, remaining) + +/datum/controller/subsystem/air/proc/process_excited_groups_auxtools(remaining) + return call_ext(AUXMOS, "byond:groups_hook_ffi")(src, remaining) + +/proc/finalize_gas_refs() + return call_ext(AUXMOS, "byond:finalize_gas_refs_ffi")() + +/datum/controller/subsystem/air/proc/auxtools_update_reactions() + return call_ext(AUXMOS, "byond:update_reactions_ffi")() + +/proc/auxtools_atmos_init(gas_data) + return call_ext(AUXMOS, "byond:hook_init_ffi")(gas_data) + +/proc/_auxtools_register_gas(gas) + return call_ext(AUXMOS, "byond:hook_register_gas_ffi")(gas) + +/proc/__auxmos_shutdown() + return call_ext(AUXMOS, "byond:auxmos_shutdown_ffi")() + +/datum/controller/subsystem/air/proc/process_turfs_auxtools(remaining) + return call_ext(AUXMOS, "byond:process_turf_hook_ffi")(src, remaining) + +/datum/controller/subsystem/air/proc/finish_turf_processing_auxtools(time_remaining) + return call_ext(AUXMOS, "byond:finish_process_turfs_ffi")(time_remaining) + +/datum/controller/subsystem/air/proc/thread_running() + return call_ext(AUXMOS, "byond:thread_running_hook_ffi")() diff --git a/code/__DEFINES/directional.dm b/code/__DEFINES/directional.dm index 192a57706772..85d746a43882 100644 --- a/code/__DEFINES/directional.dm +++ b/code/__DEFINES/directional.dm @@ -8,6 +8,3 @@ #define TEXT_SOUTH "[SOUTH]" #define TEXT_EAST "[EAST]" #define TEXT_WEST "[WEST]" - -/// Inverse direction, taking into account UP|DOWN if necessary. -#define REVERSE_DIR(dir) ( ((dir & 85) << 1) | ((dir & 170) >> 1) ) diff --git a/code/__DEFINES/extools.dm b/code/__DEFINES/extools.dm deleted file mode 100644 index 0c20aeec1376..000000000000 --- a/code/__DEFINES/extools.dm +++ /dev/null @@ -1,144 +0,0 @@ -#define EXTOOLS_SUCCESS "SUCCESS" -#define EXTOOLS_FAILED "FAIL" -GLOBAL_VAR_INIT(enable_memdump, 0) - -/* - Core - Provides necessary functionality for other modules. - Initializing any other modules also initializes this so it shouldn't be necessary to call this. -*/ - -/proc/extools_initialize() - return LIBCALL(EXTOOLS, "core_initialize")() == EXTOOLS_SUCCESS - -/* - TFFI - Threaded FFI - All DLL calls are automatically threaded off. - Black magic is used to suspend (sleep) the currently executing proc, allowing non-blocking FFI. - You may call a DLL function and sleep until it returns, pass a callback to be called with the result, - or call resolve() on the /datum/promise to receive the return value at any time. - Example: - var/x = call_wait("sample.dll", "do_work", "arg1", "arg2", "arg3") - - Calls the do_work function from sample.dll with 3 arguments. The proc sleeps until do_work returns. - var/datum/promise/P = call_async("sample.dll", "do_work", "arg1") - ... do something else ... - var/result = P.resolve() - - Calls do_work with 1 argument. Returns a promise object. Runs some other code before calling P.resolve() to obtain the result. - /proc/print_result(result) - world << result - call_cb("sample.dll", "do_work", /proc/print_result, "arg1", "arg2") - - Calls do_work with 2 arguments. The callback is invoked with the result as the single argument. Execution resumes immediately. -*/ - -#if 0 - -/proc/tffi_initialize() - return LIBCALL(EXTOOLS, "tffi_initialize")() == EXTOOLS_SUCCESS - -GLOBAL_VAR_INIT(fallback_alerted, FALSE) -GLOBAL_VAR_INIT(next_promise_id, 0) - -/datum/promise - var/completed = FALSE - var/result = "" - var/callback_context = GLOBAL_PROC - var/callback_proc = null - var/__id = 0 - -/datum/promise/New() - __id = next_promise_id++ //please don't create more than 10^38 promises in a single tick - -//This proc's bytecode is overwritten to allow suspending and resuming on demand. -//None of the code here should run. -/datum/promise/proc/__internal_resolve(ref, id) - if(!fallback_alerted && world.system_type != UNIX) // the rewriting is currently broken on Linux. - world << "TFFI: __internal_resolve has not been rewritten, the TFFI DLL was not loaded correctly." - world.log << "TFFI: __internal_resolve has not been rewritten, the TFFI DLL was not loaded correctly." - fallback_alerted = TRUE - while(!completed) - sleep(1) - //It might be better to just fail and notify the user that something went wrong. - -/datum/promise/proc/__resolve_callback() - __internal_resolve("\ref[src]", __id) - if(callback_context == GLOBAL_PROC) - call(callback_proc)(result) - else - call(callback_context, callback_proc)(result) - -/datum/promise/proc/resolve() - __internal_resolve("\ref[src]", __id) - return result - -/proc/call_async() - var/list/arguments = args.Copy() - var/datum/promise/P = new - arguments.Insert(1, "\ref[P]") - LIBCALL(EXTOOLS, "call_async")(arglist(arguments)) - return P - -/proc/call_cb() - var/list/arguments = args.Copy() - var/context = arguments[3] - var/callback = arguments[4] - arguments.Cut(3, 5) - var/datum/promise/P = new - P.callback_context = context - P.callback_proc = callback - arguments.Insert(1, "\ref[P]") - LIBCALL(EXTOOLS, "call_async")(arglist(arguments)) - spawn(0) - P.__resolve_callback() - -/proc/call_wait() - return call_async(arglist(args)).resolve() - -#endif - -/* - Extended Profiling - High precision in-depth performance profiling. - Turning on extended profiling for a proc will cause each execution of it to generate a file in the ./profiles directory - containing a breakdown of time spent executing the proc and each sub-proc it calls. Import the file into https://www.speedscope.app/ to - view a good visual representation. - Be aware that sleeping counts as stopping and restarting the execution of the proc, which will generate multiple files, one between each sleep. - For large procs the profiles may become unusably large. Optimizations pending. - Example: - start_profiling(/datum/explosion/New) - - Enables profiling for /datum/explosion/New(), which will produce a detailed breakdown of each explosion that occurs afterwards. - stop_profiling(/datum/explosion/New) - - Disables profiling for explosions. Any currently running profiles will stop when the proc finishes executing or enters a sleep. -*/ - -/proc/profiling_initialize() - return LIBCALL(EXTOOLS, "extended_profiling_initialize")() == EXTOOLS_SUCCESS - -/proc/start_profiling(procpath) - LIBCALL(EXTOOLS, "enable_extended_profiling")("[procpath]") - -/proc/stop_profiling(procpath) - LIBCALL(EXTOOLS, "disable_extended_profiling")("[procpath]") - -/* - Debug Server - High and low level debugging of DM code. - Calling debugger_initialize will start a debug server that allows connections from frontends, - such as SpaceManiac's VSCode extension for line-by-line debugging (and more), or Steamport's - Somnium for bytecode inspection. - Call with pause = TRUE to wait until the debugger connected and immediately break on the next instruction after the call. -*/ - -/proc/debugger_initialize(pause = FALSE) - return LIBCALL(EXTOOLS, "debug_initialize")(pause ? "pause" : "") == EXTOOLS_SUCCESS - -/* - Misc -*/ - -//Programatically enable and disable the built-in byond profiler. Useful if you want to, for example, profile subsystem initializations. -/proc/enable_profiling() - return LIBCALL(EXTOOLS, "enable_profiling")() == EXTOOLS_SUCCESS - -/proc/disable_profiling() - return LIBCALL(EXTOOLS, "disable_profiling")() == EXTOOLS_SUCCESS - -// Will dump the server's in-depth memory profile into the file specified. -/proc/dump_memory_profile(file_name) - return LIBCALL(EXTOOLS, "dump_memory_usage")(file_name) == EXTOOLS_SUCCESS diff --git a/code/__DEFINES/maths.dm b/code/__DEFINES/maths.dm index 74cf20faa8eb..be6ebb9eb03e 100644 --- a/code/__DEFINES/maths.dm +++ b/code/__DEFINES/maths.dm @@ -228,5 +228,22 @@ #define DT_PROB(prob_per_second_percent, delta_time) (prob(100*DT_PROB_RATE(prob_per_second_percent/100, delta_time))) // ) +/// Taxicab distance--gets you the **actual** time it takes to get from one turf to another due to how we calculate diagonal movement +#define MANHATTAN_DISTANCE(a, b) (abs(a.x - b.x) + abs(a.y - b.y)) +// ) + +/// A function that exponentially approaches a maximum value of L +/// k is the rate at which is approaches L, x_0 is the point where the function = 0 +#define LOGISTIC_FUNCTION(L,k,x,x_0) (L/(1+(NUM_E**(-k*(x-x_0))))) + +// ) +/// Make sure something is a boolean TRUE/FALSE 1/0 value, since things like bitfield & bitflag doesn't always give 1s and 0s. +#define FORCE_BOOLEAN(x) ((x)? TRUE : FALSE) + +// ) +/// Gives the number of pixels in an orthogonal line of tiles. +#define TILES_TO_PIXELS(tiles) (tiles * PIXELS) +// ) + /// The number of cells in a taxicab circle (rasterized diamond) of radius X. #define DIAMOND_AREA(X) (1 + 2*(X)*((X)+1)) diff --git a/code/__DEFINES/profile.dm b/code/__DEFINES/profile.dm index 5fc847890145..ec79d942a984 100644 --- a/code/__DEFINES/profile.dm +++ b/code/__DEFINES/profile.dm @@ -27,3 +27,5 @@ #define PROFILE_ITEM_LEN 2 #define PROFILE_ITEM_TIME 1 #define PROFILE_ITEM_COUNT 2 + +GLOBAL_VAR_INIT(enable_memdump, 0) diff --git a/code/__DEFINES/reactions.dm b/code/__DEFINES/reactions.dm index 722bb656567a..f032c69a70de 100644 --- a/code/__DEFINES/reactions.dm +++ b/code/__DEFINES/reactions.dm @@ -80,3 +80,5 @@ #define FUSION_RAD_MAX 1500 #define FUSION_RAD_COEFFICIENT (-1000) #define FUSION_INSTABILITY_ENDOTHERMALITY 2 +// Snowflake fire product types +#define FIRE_PRODUCT_PLASMA 0 diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm index a7b960b6e83b..944f6ef36c98 100644 --- a/code/__DEFINES/subsystems.dm +++ b/code/__DEFINES/subsystems.dm @@ -150,7 +150,8 @@ #define INIT_ORDER_CIRCUIT 15 #define INIT_ORDER_TIMER 1 #define INIT_ORDER_DEFAULT 0 -#define INIT_ORDER_AIR -1 +#define INIT_ORDER_AIR_MACHINERY -0.5 +#define INIT_ORDER_AIR -2 #define INIT_ORDER_PERSISTENCE -2 #define INIT_ORDER_PERSISTENT_PAINTINGS -3 // Assets relies on this #define INIT_ORDER_ASSETS -4 @@ -195,6 +196,7 @@ #define FIRE_PRIORITY_DEFAULT 50 #define FIRE_PRIORITY_PARALLAX 65 #define FIRE_PRIORITY_INSTRUMENTS 80 +#define FIRE_PRIORITY_CALLBACKS 90 #define FIRE_PRIORITY_MOBS 100 #define FIRE_PRIORITY_ASSETS 105 #define FIRE_PRIORITY_TGUI 110 @@ -217,6 +219,24 @@ #define RUNLEVELS_DEFAULT (RUNLEVEL_SETUP | RUNLEVEL_GAME | RUNLEVEL_POSTGAME) +// SSair run section +#define SSAIR_PIPENETS 1 +#define SSAIR_ATMOSMACHINERY 2 +#define SSAIR_EXCITEDGROUPS 3 +#define SSAIR_HIGHPRESSURE 4 +#define SSAIR_HOTSPOTS 5 +#define SSAIR_TURF_CONDUCTION 6 +#define SSAIR_REBUILD_PIPENETS 7 +#define SSAIR_EQUALIZE 8 +#define SSAIR_ACTIVETURFS 9 +#define SSAIR_TURF_POST_PROCESS 10 +#define SSAIR_FINALIZE_TURFS 11 +#define SSAIR_ATMOSMACHINERY_AIR 12 +#define SSAIR_DEFERRED_AIRS 13 + +//Pipeline rebuild helper defines, these suck but it'll do for now //Fools you actually merged it +#define SSAIR_REBUILD_PIPELINE 1 +#define SSAIR_REBUILD_QUEUE 2 // Truly disgusting, TG. Truly disgusting. //! ## Overlays subsystem @@ -250,18 +270,6 @@ */ #define addtimer(args...) _addtimer(args, file = __FILE__, line = __LINE__) -// Air subsystem subtasks -#define SSAIR_PIPENETS 1 -#define SSAIR_ATMOSMACHINERY 2 -#define SSAIR_EQUALIZE 3 -#define SSAIR_ACTIVETURFS 4 -#define SSAIR_EXCITEDGROUPS 5 -#define SSAIR_HIGHPRESSURE 6 -#define SSAIR_HOTSPOTS 7 -#define SSAIR_SUPERCONDUCTIVITY 8 -#define SSAIR_REBUILD_PIPENETS 9 - - // Explosion Subsystem subtasks #define SSEXPLOSIONS_MOVABLES 1 #define SSEXPLOSIONS_TURFS 2 diff --git a/code/__DEFINES/vv.dm b/code/__DEFINES/vv.dm index a7b44a55f1d5..7be173cddf12 100644 --- a/code/__DEFINES/vv.dm +++ b/code/__DEFINES/vv.dm @@ -80,6 +80,13 @@ #define VV_HK_ADD_EMITTER "add_emitter" #define VV_HK_REMOVE_EMITTER "remove_emitter" +// /datum/gas_mixture +#define VV_HK_SET_MOLES "set_moles" +#define VV_HK_EMPTY "empty" +#define VV_HK_SET_TEMPERATURE "set_temp" +#define VV_HK_PARSE_GASSTRING "parse_gasstring" +#define VV_HK_SET_VOLUME "set_volume" + // /obj #define VV_HK_OSAY "osay" #define VV_HK_MASS_DEL_TYPE "mass_delete_type" diff --git a/code/__HELPERS/_extools_api.dm b/code/__HELPERS/_extools_api.dm new file mode 100644 index 000000000000..59af733d97ff --- /dev/null +++ b/code/__HELPERS/_extools_api.dm @@ -0,0 +1,5 @@ +//#define AUXOOLS_LOGGING // rust_g is used as a fallback if this is undefined + +/proc/extools_log_write() + +/proc/extools_finalize_logging() diff --git a/code/__HELPERS/_logging.dm b/code/__HELPERS/_logging.dm index 34cd5e3ea0b8..d678e57e513d 100644 --- a/code/__HELPERS/_logging.dm +++ b/code/__HELPERS/_logging.dm @@ -7,8 +7,13 @@ #define WRITE_FILE(file, text) DIRECT_OUTPUT(file, text) #define READ_FILE(file, text) DIRECT_INPUT(file, text) //This is an external call, "true" and "false" are how rust parses out booleans +#ifdef EXTOOLS_LOGGING +#define WRITE_LOG(log, text) extools_log_write(log, text, TRUE) +#define WRITE_LOG_NO_FORMAT(log, text) extools_log_write(log, text, FALSE) +#else #define WRITE_LOG(log, text) rustg_log_write(log, "\[[worldtime2text()]\] [text]", "true") #define WRITE_LOG_NO_FORMAT(log, text) rustg_log_write(log, text, "false") +#endif //print a warning message to world.log #define WARNING(MSG) warning("[MSG] in [__FILE__] at line [__LINE__] src: [UNLINT(src)] usr: [usr].") @@ -250,7 +255,12 @@ /* Close open log handles. This should be called as late as possible, and no logging should hapen after. */ /proc/shutdown_logging() +#ifdef EXTOOLS_LOGGING + extools_finalize_logging() +#else rustg_log_close_all() +#endif + /* Helper procs for building detailed log lines */ diff --git a/code/__HELPERS/game.dm b/code/__HELPERS/game.dm index cc774bb2b446..67751fd75f4b 100644 --- a/code/__HELPERS/game.dm +++ b/code/__HELPERS/game.dm @@ -707,7 +707,7 @@ if(!istype(T)) return var/datum/gas_mixture/environment = T.return_air() - if(!istype(environment)) + if(!environment) return var/pressure = environment.return_pressure() if(pressure <= LAVALAND_EQUIPMENT_EFFECT_PRESSURE) diff --git a/code/__HELPERS/unsorted.dm b/code/__HELPERS/unsorted.dm index 74ec550f4a37..d346e7fae044 100644 --- a/code/__HELPERS/unsorted.dm +++ b/code/__HELPERS/unsorted.dm @@ -41,6 +41,9 @@ else if(x<0) .+=360 +//Better performant than an artisanal proc and more reliable than Turn(). From TGMC. +#define REVERSE_DIR(dir) ( ((dir & 85) << 1) | ((dir & 170) >> 1) ) + //Returns location. Returns null if no location was found. /proc/get_teleport_loc(turf/location,mob/target,distance = 1, density = FALSE, errorx = 0, errory = 0, eoffsetx = 0, eoffsety = 0) /* diff --git a/code/__byond_version_compat.dm b/code/__byond_version_compat.dm index a670b3d8da66..609907e9702f 100644 --- a/code/__byond_version_compat.dm +++ b/code/__byond_version_compat.dm @@ -1,17 +1,17 @@ // This file contains defines allowing targeting byond versions newer than the supported //Update this whenever you need to take advantage of more recent byond features -#define MIN_COMPILER_VERSION 514 -#define MIN_COMPILER_BUILD 1556 +#define MIN_COMPILER_VERSION 515 +#define MIN_COMPILER_BUILD 1620 #if (DM_VERSION < MIN_COMPILER_VERSION || DM_BUILD < MIN_COMPILER_BUILD) && !defined(SPACEMAN_DMM) //Don't forget to update this part #error Your version of BYOND is too out-of-date to compile this project. Go to https://secure.byond.com/download and update. -#error You need version 514.1556 or higher +#error You need version 515.1620 or higher #endif //If you update these values, update the message in the #error #define MAX_BYOND_MAJOR 515 -#define MAX_BYOND_MINOR 1603 +#define MAX_BYOND_MINOR 1620 // You can define IGNORE_MAX_BYOND_VERSION to bypass the max version check. // Note: This will likely break the game, especially any extools/auxtools linkage. Only use if you know what you're doing! @@ -25,7 +25,7 @@ #if ((DM_VERSION > MAX_BYOND_MAJOR) || (DM_BUILD > MAX_BYOND_MINOR)) && !defined(IGNORE_MAX_BYOND_VERSION) // Not updating until we fully move to 515 -#error Your version of BYOND is too new to compile this project. Download version 514.1589 at www.byond.com/download/build/514/514.1589_byond.exe +#error Your version of BYOND is too new to compile this project. Download version 515.1620 at www.byond.com/download/build/515/515.1620_byond.exe #endif // 515 split call for external libraries into call_ext diff --git a/code/_debugger.dm b/code/_debugger.dm new file mode 100644 index 000000000000..1518908fa9a0 --- /dev/null +++ b/code/_debugger.dm @@ -0,0 +1,13 @@ +//Datum used to init Auxtools debugging as early as possible +//Datum gets created in master.dm because for whatever reason global code in there gets runs first +//In case we ever figure out how to manipulate global init order please move the datum creation into this file +/datum/debugger + +/datum/debugger/New() + enable_debugger() + +/datum/debugger/proc/enable_debugger() + var/dll = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL") + if (dll) + LIBCALL(dll, "auxtools_init")() + enable_debugging() diff --git a/code/controllers/master.dm b/code/controllers/master.dm index 7d37a7224b47..99074b343c48 100644 --- a/code/controllers/master.dm +++ b/code/controllers/master.dm @@ -11,7 +11,7 @@ //You might wonder why not just create the debugger datum global in its own file, since its loaded way earlier than this DM file //Well for whatever reason then the Master gets created first and then the debugger when doing that //So thats why this code lives here now, until someone finds out how Byond inits globals -//GLOBAL_REAL(Debugger, /datum/debugger) = new +GLOBAL_REAL(Debugger, /datum/debugger) = new //This is the ABSOLUTE ONLY THING that should init globally like this //2019 update: the failsafe,config and Global controllers also do it diff --git a/code/controllers/subsystem/adjacent_air.dm b/code/controllers/subsystem/adjacent_air.dm deleted file mode 100644 index 2acb22b61e83..000000000000 --- a/code/controllers/subsystem/adjacent_air.dm +++ /dev/null @@ -1,43 +0,0 @@ -SUBSYSTEM_DEF(adjacent_air) - name = "Atmos Adjacency" - flags = SS_BACKGROUND - runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME - wait = 10 - priority = FIRE_PRIORITY_ATMOS_ADJACENCY - - loading_points = 0.7 SECONDS // Yogs -- loading times - - var/list/queue = list() - -/datum/controller/subsystem/adjacent_air/stat_entry(msg) -#ifdef TESTING - msg = "P:[length(queue)], S:[GLOB.atmos_adjacent_savings[1]], T:[GLOB.atmos_adjacent_savings[2]]" -#else - msg = "P:[length(queue)]" -#endif - return ..() - -/datum/controller/subsystem/adjacent_air/get_metrics() - . = ..() - .["queued"] = length(queue) - -/datum/controller/subsystem/adjacent_air/Initialize() - while(length(queue)) - fire(mc_check = FALSE) - return SS_INIT_SUCCESS - -/datum/controller/subsystem/adjacent_air/fire(resumed = FALSE, mc_check = TRUE) - - var/list/queue = src.queue - - while (length(queue)) - var/turf/currT = queue[1] - queue.Cut(1,2) - - currT.ImmediateCalculateAdjacentTurfs() - - if(mc_check) - if(MC_TICK_CHECK) - break - else - CHECK_TICK diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm index 61bdbc4ce00f..271a0e3ac661 100644 --- a/code/controllers/subsystem/air.dm +++ b/code/controllers/subsystem/air.dm @@ -5,164 +5,210 @@ SUBSYSTEM_DEF(air) wait = 0.5 SECONDS flags = SS_BACKGROUND runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME - loading_points = 4.2 SECONDS // Yogs -- loading times var/cached_cost = 0 + var/cost_turfs = 0 var/cost_groups = 0 var/cost_highpressure = 0 var/cost_hotspots = 0 + var/cost_post_process = 0 var/cost_superconductivity = 0 var/cost_pipenets = 0 var/cost_rebuilds = 0 - var/cost_atmos_machinery = 0 var/cost_equalize = 0 - var/list/active_turfs = list() + var/thread_wait_ticks = 0 + var/cur_thread_wait_ticks = 0 + + var/low_pressure_turfs = 0 + var/high_pressure_turfs = 0 + + var/num_group_turfs_processed = 0 + var/num_equalize_processed = 0 + + var/gas_mixes_count = 0 + var/gas_mixes_allocated = 0 + var/list/hotspots = list() var/list/networks = list() - var/list/pipenets_needing_rebuilt = list() - var/list/obj/machinery/atmos_machinery = list() + var/list/rebuild_queue = list() + var/list/expansion_queue = list() var/list/pipe_init_dirs_cache = list() //atmos singletons var/list/gas_reactions = list() //Special functions lists - var/list/turf/active_super_conductivity = list() var/list/turf/open/high_pressure_delta = list() var/list/currentrun = list() - var/currentpart = SSAIR_REBUILD_PIPENETS + var/currentpart = SSAIR_FINALIZE_TURFS var/map_loading = TRUE - var/list/queued_for_activation var/lasttick = 0 var/log_explosive_decompression = TRUE // If things get spammy, admemes can turn this off. + /// Max number of turfs equalization will grab. + var/equalize_turf_limit = 10 + /// Max number of turfs to look for a space turf, and max number of turfs that will be decompressed. + var/equalize_hard_turf_limit = 2000 + /// Whether equalization should be enabled at all. + var/equalize_enabled = TRUE + /// Whether turf-to-turf heat exchanging should be enabled. + var/heat_enabled = FALSE + /// Max number of times process_turfs will share in a tick. + var/share_max_steps = 3 + /// Excited group processing will try to equalize groups with total pressure difference less than this amount. + var/excited_group_pressure_goal = 1 + + var/list/paused_z_levels //Paused z-levels will not add turfs to active + +//hack +/proc/get_overlays() + return GLOB.gas_data.overlays + +//hack +/proc/get_hpds() + return SSair.high_pressure_delta + +//hack +/proc/get_reactions() + return SSair.gas_reactions + /datum/controller/subsystem/air/stat_entry(msg) msg += "C:{" - msg += "EQ:[round(cost_equalize,1)]|" - msg += "AT:[round(cost_turfs,1)]|" - msg += "EG:[round(cost_groups,1)]|" msg += "HP:[round(cost_highpressure,1)]|" msg += "HS:[round(cost_hotspots,1)]|" msg += "SC:[round(cost_superconductivity,1)]|" msg += "PN:[round(cost_pipenets,1)]|" msg += "RB:[round(cost_rebuilds,1)]|" - msg += "AM:[round(cost_atmos_machinery,1)]" msg += "} " - msg += "AT:[active_turfs.len]|" - msg += "EG:[get_amt_excited_groups()]|" + msg += "TC:{" + msg += "AT:[round(cost_turfs,1)]|" + msg += "EG:[round(cost_groups,1)]|" + msg += "EQ:[round(cost_equalize,1)]|" + msg += "PO:[round(cost_post_process,1)]" + msg += "}" + msg += "TH:[round(thread_wait_ticks,1)]|" msg += "HS:[hotspots.len]|" msg += "PN:[networks.len]|" msg += "HP:[high_pressure_delta.len]|" - msg += "AS:[active_super_conductivity.len]|" - msg += "AT/MS:[round((cost ? active_turfs.len/cost : 0),0.1)]" + msg += "HT:[high_pressure_turfs]|" + msg += "LT:[low_pressure_turfs]|" + msg += "ET:[num_equalize_processed]|" + msg += "GT:[num_group_turfs_processed]|" + msg += "GA:[gas_mixes_count]|" + msg += "MG:[gas_mixes_allocated]" return ..() /datum/controller/subsystem/air/get_metrics() . = ..() - .["cost_equalize"] = cost_equalize .["cost_turfs"] = cost_turfs .["cost_groups"] = cost_groups .["cost_highpressure"] = cost_highpressure .["cost_hotspots"] = cost_hotspots + .["cost_post_process"] = cost_post_process .["cost_superconductivity"] = cost_superconductivity .["cost_pipenets"] = cost_pipenets .["cost_rebuilds"] = cost_rebuilds - .["cost_atmos_machinery"] = cost_atmos_machinery - .["active_turfs"] = active_turfs.len - .["excited_gruops"] = get_amt_excited_groups() + .["cost_equalize"] = cost_equalize .["hotspts"] = hotspots.len .["networks"] = networks.len + .["gas_mixes_count"] = gas_mixes_count + .["gas_mixes_allocated"] = gas_mixes_allocated + .["high_pressure_turfs"] = high_pressure_turfs + .["low_pressure_turfs"] = low_pressure_turfs + .["num_equalize_processed"] = num_equalize_processed + .["num_group_turfs_processed"] = num_group_turfs_processed .["high_pressure_delta"] = high_pressure_delta.len - .["active_super_conductivity"] = active_super_conductivity.len /datum/controller/subsystem/air/Initialize(timeofday) - extools_update_ssair() map_loading = FALSE setup_allturfs() - setup_atmos_machinery() setup_pipenets() gas_reactions = init_gas_reactions() + auxtools_update_reactions() return SS_INIT_SUCCESS /datum/controller/subsystem/air/proc/extools_update_ssair() +/proc/reset_all_air() + SSair.can_fire = FALSE + message_admins("Air reset begun.") + for(var/turf/open/T in world) + T.Initalize_Atmos(0) + CHECK_TICK + message_admins("Air reset done.") + SSair.can_fire = TRUE + +/datum/controller/subsystem/air/proc/check_threads() + if(thread_running()) + cur_thread_wait_ticks++ + pause() + return FALSE + return TRUE + /datum/controller/subsystem/air/fire(resumed = 0) var/timer = TICK_USAGE_REAL - if(currentpart == SSAIR_REBUILD_PIPENETS) - var/list/pipenet_rebuilds = pipenets_needing_rebuilt - for(var/thing in pipenet_rebuilds) - var/obj/machinery/atmospherics/AT = thing - AT.build_network() - cost_rebuilds = MC_AVERAGE(cost_rebuilds, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) - pipenets_needing_rebuilt.Cut() + thread_wait_ticks = MC_AVERAGE(thread_wait_ticks, cur_thread_wait_ticks) + cur_thread_wait_ticks = 0 + + gas_mixes_count = get_amt_gas_mixes() + gas_mixes_allocated = get_max_gas_mixes() + + if(length(rebuild_queue) || length(expansion_queue)) + timer = TICK_USAGE_REAL + process_rebuilds() + //This does mean that the apperent rebuild costs fluctuate very quickly, this is just the cost of having them always process, no matter what + cost_rebuilds = TICK_USAGE_REAL - timer if(state != SS_RUNNING) return - resumed = FALSE - currentpart = SSAIR_PIPENETS - if(currentpart == SSAIR_PIPENETS || !resumed) + + if(currentpart == SSAIR_ACTIVETURFS) timer = TICK_USAGE_REAL - if(!resumed) - cached_cost = 0 - process_pipenets(resumed) - cached_cost += TICK_USAGE_REAL - timer + process_turfs(resumed) if(state != SS_RUNNING) return - cost_pipenets = MC_AVERAGE(cost_pipenets, TICK_DELTA_TO_MS(cached_cost)) - resumed = FALSE - currentpart = SSAIR_ATMOSMACHINERY + resumed = 0 + currentpart = SSAIR_EXCITEDGROUPS - if(currentpart == SSAIR_ATMOSMACHINERY) - timer = TICK_USAGE_REAL - if(!resumed) - cached_cost = 0 - process_atmos_machinery(resumed) - cached_cost += TICK_USAGE_REAL - timer + if(currentpart == SSAIR_EXCITEDGROUPS) + process_excited_groups(resumed) if(state != SS_RUNNING) return - cost_atmos_machinery = MC_AVERAGE(cost_atmos_machinery, TICK_DELTA_TO_MS(cached_cost)) - resumed = FALSE + resumed = 0 currentpart = SSAIR_EQUALIZE if(currentpart == SSAIR_EQUALIZE) - timer = TICK_USAGE_REAL - if(!resumed) - cached_cost = 0 process_turf_equalize(resumed) if(state != SS_RUNNING) return - cost_equalize = MC_AVERAGE(cost_equalize, TICK_DELTA_TO_MS(cached_cost)) - resumed = FALSE - currentpart = SSAIR_ACTIVETURFS + resumed = 0 + currentpart = SSAIR_FINALIZE_TURFS - if(currentpart == SSAIR_ACTIVETURFS) - timer = TICK_USAGE_REAL - if(!resumed) - cached_cost = 0 - process_active_turfs(resumed) + if(currentpart == SSAIR_FINALIZE_TURFS) + finish_turf_processing(resumed) if(state != SS_RUNNING) return - cost_turfs = MC_AVERAGE(cost_turfs, TICK_DELTA_TO_MS(cached_cost)) - resumed = FALSE - currentpart = SSAIR_EXCITEDGROUPS + resumed = 0 + currentpart = SSAIR_PIPENETS - if(currentpart == SSAIR_EXCITEDGROUPS) + if(currentpart == SSAIR_PIPENETS || !resumed) timer = TICK_USAGE_REAL if(!resumed) cached_cost = 0 - process_excited_groups(resumed) + process_pipenets(resumed) + cached_cost += TICK_USAGE_REAL - timer if(state != SS_RUNNING) return - cost_groups = MC_AVERAGE(cost_groups, TICK_DELTA_TO_MS(cached_cost)) - resumed = FALSE + cost_pipenets = MC_AVERAGE(cost_pipenets, TICK_DELTA_TO_MS(cached_cost)) + resumed = 0 currentpart = SSAIR_HIGHPRESSURE if(currentpart == SSAIR_HIGHPRESSURE) @@ -170,10 +216,11 @@ SUBSYSTEM_DEF(air) if(!resumed) cached_cost = 0 process_high_pressure_delta(resumed) + cached_cost += TICK_USAGE_REAL - timer if(state != SS_RUNNING) return cost_highpressure = MC_AVERAGE(cost_highpressure, TICK_DELTA_TO_MS(cached_cost)) - resumed = FALSE + resumed = 0 currentpart = SSAIR_HOTSPOTS if(currentpart == SSAIR_HOTSPOTS) @@ -181,26 +228,25 @@ SUBSYSTEM_DEF(air) if(!resumed) cached_cost = 0 process_hotspots(resumed) + cached_cost += TICK_USAGE_REAL - timer if(state != SS_RUNNING) return cost_hotspots = MC_AVERAGE(cost_hotspots, TICK_DELTA_TO_MS(cached_cost)) - resumed = FALSE - currentpart = SSAIR_SUPERCONDUCTIVITY + resumed = 0 + currentpart = heat_enabled ? SSAIR_TURF_CONDUCTION : SSAIR_ACTIVETURFS - if(currentpart == SSAIR_SUPERCONDUCTIVITY) + // Heat -- slow and of questionable usefulness. Off by default for this reason. Pretty cool, though. + if(currentpart == SSAIR_TURF_CONDUCTION) timer = TICK_USAGE_REAL - if(!resumed) - cached_cost = 0 - process_super_conductivity(resumed) + if(process_turf_heat(MC_TICK_REMAINING_MS)) + pause() + cost_superconductivity = MC_AVERAGE(cost_superconductivity, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) if(state != SS_RUNNING) return - cost_superconductivity = MC_AVERAGE(cost_superconductivity, TICK_DELTA_TO_MS(cached_cost)) - resumed = FALSE - currentpart = SSAIR_REBUILD_PIPENETS - - + resumed = 0 + currentpart = SSAIR_ACTIVETURFS -/datum/controller/subsystem/air/proc/process_pipenets(resumed = 0) +/datum/controller/subsystem/air/proc/process_pipenets(resumed = FALSE) if (!resumed) src.currentrun = networks.Copy() //cache for sanic speed (lists are references anyways) @@ -215,36 +261,91 @@ SUBSYSTEM_DEF(air) if(MC_TICK_CHECK) return -/datum/controller/subsystem/air/proc/add_to_rebuild_queue(atmos_machine) - if(istype(atmos_machine, /obj/machinery/atmospherics)) - pipenets_needing_rebuilt += atmos_machine - -/datum/controller/subsystem/air/proc/process_atmos_machinery(resumed = FALSE) - if (!resumed) - src.currentrun = atmos_machinery.Copy() - //cache for sanic speed (lists are references anyways) - var/list/currentrun = src.currentrun - while(currentrun.len) - var/obj/machinery/M = currentrun[currentrun.len] - currentrun.len-- - if(!M || (M.process_atmos(wait / (1 SECONDS)) == PROCESS_KILL)) - atmos_machinery.Remove(M) - if(MC_TICK_CHECK) +/datum/controller/subsystem/air/proc/add_to_rebuild_queue(obj/machinery/atmospherics/atmos_machine) + if(istype(atmos_machine, /obj/machinery/atmospherics) && !atmos_machine.rebuilding) + rebuild_queue += atmos_machine + atmos_machine.rebuilding = TRUE + +/datum/controller/subsystem/air/proc/add_to_expansion(datum/pipeline/line, starting_point) + var/list/new_packet = new(SSAIR_REBUILD_QUEUE) + new_packet[SSAIR_REBUILD_PIPELINE] = line + new_packet[SSAIR_REBUILD_QUEUE] = list(starting_point) + expansion_queue += list(new_packet) + +/datum/controller/subsystem/air/proc/remove_from_expansion(datum/pipeline/line) + for(var/list/packet in expansion_queue) + if(packet[SSAIR_REBUILD_PIPELINE] == line) + expansion_queue -= packet return +/datum/controller/subsystem/air/proc/process_rebuilds() + //Yes this does mean rebuilding pipenets can freeze up the subsystem forever, but if we're in that situation something else is very wrong + var/list/currentrun = rebuild_queue + while(currentrun.len || length(expansion_queue)) + while(currentrun.len && !length(expansion_queue)) //If we found anything, process that first + var/obj/machinery/atmospherics/remake = currentrun[currentrun.len] + currentrun.len-- + if (!remake) + continue + remake.rebuild_pipes() + if (MC_TICK_CHECK) + return + + var/list/queue = expansion_queue + while(queue.len) + var/list/pack = queue[queue.len] + //We operate directly with the pipeline like this because we can trust any rebuilds to remake it properly + var/datum/pipeline/linepipe = pack[SSAIR_REBUILD_PIPELINE] + var/list/border = pack[SSAIR_REBUILD_QUEUE] + expand_pipeline(linepipe, border) + if(state != SS_RUNNING) //expand_pipeline can fail a tick check, we shouldn't let things get too fucky here + return + + linepipe.building = FALSE + queue.len-- + if (MC_TICK_CHECK) + return + +///Rebuilds a pipeline by expanding outwards, while yielding when sane +/datum/controller/subsystem/air/proc/expand_pipeline(datum/pipeline/net, list/border) + while(border.len) + var/obj/machinery/atmospherics/borderline = border[border.len] + border.len-- + + var/list/result = borderline.pipeline_expansion(net) + if(!length(result)) + continue + for(var/obj/machinery/atmospherics/considered_device in result) + if(!istype(considered_device, /obj/machinery/atmospherics/pipe)) + considered_device.set_pipenet(net, borderline) + net.add_machinery_member(considered_device) + continue + var/obj/machinery/atmospherics/pipe/item = considered_device + if(net.members.Find(item)) + continue + if(item.parent) + var/static/pipenetwarnings = 10 + if(pipenetwarnings > 0) + log_mapping("build_pipeline(): [item.type] added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf) around [AREACOORD(item)].") + pipenetwarnings-- + if(pipenetwarnings == 0) + log_mapping("build_pipeline(): further messages about pipenets will be suppressed") + + net.members += item + border += item + + net.air.set_volume(net.air.return_volume() + item.volume) + item.parent = net + + if(item.air_temporary) + net.air.merge(item.air_temporary) + item.air_temporary = null -/datum/controller/subsystem/air/proc/process_super_conductivity(resumed = 0) - if (!resumed) - src.currentrun = active_super_conductivity.Copy() - //cache for sanic speed (lists are references anyways) - var/list/currentrun = src.currentrun - while(currentrun.len) - var/turf/T = currentrun[currentrun.len] - currentrun.len-- - T.super_conduct() - if(MC_TICK_CHECK) + if (MC_TICK_CHECK) return +/datum/controller/subsystem/air/proc/process_turf_heat() + /datum/controller/subsystem/air/proc/process_hotspots(resumed = FALSE) if (!resumed) src.currentrun = hotspots.Copy() @@ -272,110 +373,32 @@ SUBSYSTEM_DEF(air) return /datum/controller/subsystem/air/proc/process_turf_equalize(resumed = 0) - //cache for sanic speed - var/fire_count = times_fired - if (!resumed) - src.currentrun = active_turfs.Copy() - //cache for sanic speed (lists are references anyways) - var/list/currentrun = src.currentrun - while(currentrun.len) - var/turf/open/T = currentrun[currentrun.len] - currentrun.len-- - if (T) - if(istype(T)) - T.equalize_pressure_in_zone(fire_count) - //equalize_pressure_in_zone(T, fire_count) - if (MC_TICK_CHECK) - return + if(process_turf_equalize_auxtools(MC_TICK_REMAINING_MS)) + pause() -/datum/controller/subsystem/air/proc/process_active_turfs(resumed = 0) - //cache for sanic speed - var/fire_count = times_fired - if (!resumed) - src.currentrun = active_turfs.Copy() - //cache for sanic speed (lists are references anyways) - var/list/currentrun = src.currentrun - while(currentrun.len) - var/turf/open/T = currentrun[currentrun.len] - currentrun.len-- - if (T) - T.process_cell(fire_count) - if (MC_TICK_CHECK) - return +/datum/controller/subsystem/air/proc/process_turfs(resumed = 0) + if(process_turfs_auxtools(MC_TICK_REMAINING_MS)) + pause() /datum/controller/subsystem/air/proc/process_excited_groups(resumed = 0) - if(process_excited_groups_extools(resumed, (Master.current_ticklimit - TICK_USAGE) * 0.01 * world.tick_lag)) - sleep() - /* - if (!resumed) - src.currentrun = excited_groups.Copy() - //cache for sanic speed (lists are references anyways) - var/list/currentrun = src.currentrun - while(currentrun.len) - var/datum/excited_group/EG = currentrun[currentrun.len] - currentrun.len-- - EG.breakdown_cooldown++ - EG.dismantle_cooldown++ - if(EG.breakdown_cooldown >= EXCITED_GROUP_BREAKDOWN_CYCLES) - EG.self_breakdown() - else if(EG.dismantle_cooldown >= EXCITED_GROUP_DISMANTLE_CYCLES) - EG.dismantle() - if (MC_TICK_CHECK) - return - */ + if(process_excited_groups_auxtools(MC_TICK_REMAINING_MS)) + pause() -/datum/controller/subsystem/air/proc/process_excited_groups_extools() -/datum/controller/subsystem/air/proc/get_amt_excited_groups() - -/datum/controller/subsystem/air/proc/remove_from_active(turf/open/T) - active_turfs -= T - if(currentpart == SSAIR_ACTIVETURFS) - currentrun -= T - #ifdef VISUALIZE_ACTIVE_TURFS - T.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, "#00ff00") - #endif - if(istype(T)) - T.set_excited(FALSE) - T.eg_garbage_collect() - -/datum/controller/subsystem/air/proc/add_to_active(turf/open/T, blockchanges = 1) - if(istype(T) && T.air) - #ifdef VISUALIZE_ACTIVE_TURFS - T.add_atom_colour("#00ff00", TEMPORARY_COLOUR_PRIORITY) - #endif - T.set_excited(TRUE) - active_turfs |= T - if(currentpart == SSAIR_ACTIVETURFS) - currentrun |= T - if(blockchanges) - T.eg_garbage_collect() - else if(T.flags_1 & INITIALIZED_1) - for(var/turf/S in T.atmos_adjacent_turfs) - add_to_active(S) - else if(map_loading) - if(queued_for_activation) - queued_for_activation[T] = T - return - else - T.requires_activation = TRUE +/datum/controller/subsystem/air/proc/finish_turf_processing(resumed = 0) + if(finish_turf_processing_auxtools(MC_TICK_REMAINING_MS)) + pause() /datum/controller/subsystem/air/StartLoadingMap() - LAZYINITLIST(queued_for_activation) map_loading = TRUE /datum/controller/subsystem/air/StopLoadingMap() map_loading = FALSE - for(var/T in queued_for_activation) - add_to_active(T) - queued_for_activation.Cut() /datum/controller/subsystem/air/proc/setup_allturfs() - var/list/active_turfs = src.active_turfs var/times_fired = ++src.times_fired // Clear active turfs - faster than removing every single turf in the world // one-by-one, and Initalize_Atmos only ever adds `src` back in. - active_turfs.Cut() for(var/thing in ALL_TURFS()) var/turf/T = thing @@ -384,94 +407,28 @@ SUBSYSTEM_DEF(air) T.Initalize_Atmos(times_fired) CHECK_TICK - if(active_turfs.len) - var/starting_ats = active_turfs.len - sleep(world.tick_lag) - var/timer = world.timeofday - log_mapping("There are [starting_ats] active turfs at roundstart caused by a difference of the air between the adjacent turfs. You can see its coordinates using \"Mapping -> Show roundstart AT list\" verb (debug verbs required).") - for(var/turf/T in active_turfs) - GLOB.active_turfs_startlist += T - - //now lets clear out these active turfs - var/list/turfs_to_check = active_turfs.Copy() - do - var/list/new_turfs_to_check = list() - for(var/turf/open/T in turfs_to_check) - new_turfs_to_check += T.resolve_active_graph() - CHECK_TICK - - active_turfs += new_turfs_to_check - turfs_to_check = new_turfs_to_check - - while (turfs_to_check.len) - var/ending_ats = active_turfs.len - /*for(var/thing in excited_groups) - var/datum/excited_group/EG = thing - //EG.self_breakdown(space_is_all_consuming = 1) - //EG.dismantle() - CHECK_TICK*/ - - //Yogs start -- prettier atmos notices - var/msg = "HEY! LISTEN! [(world.timeofday - timer)/10] seconds were wasted processing [starting_ats] turf(s) (connected to [ending_ats] other turfs) with atmos differences at round start." - to_chat(GLOB.permissions.admins, - type = MESSAGE_TYPE_DEBUG, - html = span_notice(msg), - confidential = FALSE) - warning(msg) // This logs it - //yogs end - -/turf/open/proc/resolve_active_graph() - . = list() - /* - var/datum/excited_group/EG = excited_group - if (blocks_air || !air) - return - if (!EG) - EG = new - EG.add_turf(src) - - for (var/turf/open/ET in atmos_adjacent_turfs) - if ( ET.blocks_air || !ET.air) - continue - - var/ET_EG = ET.excited_group - if (ET_EG) - if (ET_EG != EG) - EG.merge_groups(ET_EG) - EG = excited_group //merge_groups() may decide to replace our current EG - else - EG.add_turf(ET) - if (!ET.excited) - ET.excited = 1 - . += ET*/ - -/turf/open/space/resolve_active_graph() - return list() - -/datum/controller/subsystem/air/proc/setup_atmos_machinery() - for (var/obj/machinery/atmospherics/AM in atmos_machinery) - AM.atmosinit() - CHECK_TICK - //this can't be done with setup_atmos_machinery() because -// all atmos machinery has to initalize before the first -// pipenet can be built. +// all atmos machinery has to initalize before the first +// pipenet can be built. /datum/controller/subsystem/air/proc/setup_pipenets() - for (var/obj/machinery/atmospherics/AM in atmos_machinery) - AM.build_network() + for (var/obj/machinery/atmospherics/AM in SSair_machinery.atmos_machinery) + var/list/targets = AM.get_rebuild_targets() + for(var/datum/pipeline/build_off as anything in targets) + build_off.build_pipeline_blocking(AM) CHECK_TICK /datum/controller/subsystem/air/proc/setup_template_machinery(list/atmos_machines) - if(!initialized) // yogs - fixes randomized bars - return // yogs - for(var/A in atmos_machines) - var/obj/machinery/atmospherics/AM = A - AM.atmosinit() + var/obj/machinery/atmospherics/AM + for(var/A in 1 to atmos_machines.len) + AM = atmos_machines[A] + AM.atmos_init() CHECK_TICK - for(var/A in atmos_machines) - var/obj/machinery/atmospherics/AM = A - AM.build_network() + for(var/A in 1 to atmos_machines.len) + AM = atmos_machines[A] + var/list/targets = AM.get_rebuild_targets() + for(var/datum/pipeline/build_off as anything in targets) + build_off.build_pipeline_blocking(AM) CHECK_TICK /datum/controller/subsystem/air/proc/get_init_dirs(type, dir) @@ -480,7 +437,7 @@ SUBSYSTEM_DEF(air) if(!pipe_init_dirs_cache[type]["[dir]"]) var/obj/machinery/atmospherics/temp = new type(null, FALSE, dir) - pipe_init_dirs_cache[type]["[dir]"] = temp.GetInitDirections() + pipe_init_dirs_cache[type]["[dir]"] = temp.get_init_directions() qdel(temp) return pipe_init_dirs_cache[type]["[dir]"] diff --git a/code/controllers/subsystem/air_machinery.dm b/code/controllers/subsystem/air_machinery.dm new file mode 100644 index 000000000000..99fea09a63f6 --- /dev/null +++ b/code/controllers/subsystem/air_machinery.dm @@ -0,0 +1,49 @@ + +SUBSYSTEM_DEF(air_machinery) + name = "Atmospherics Machinery" + init_order = INIT_ORDER_AIR_MACHINERY + priority = FIRE_PRIORITY_AIR + wait = 1 SECONDS + flags = SS_BACKGROUND + runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME + loading_points = 4.2 SECONDS // Yogs -- loading times + + var/list/obj/machinery/atmos_machinery = list() + var/list/currentrun = list() + +/datum/controller/subsystem/air_machinery/Initialize(timeofday) + setup_atmos_machinery() + return SS_INIT_SUCCESS + +/datum/controller/subsystem/air_machinery/proc/setup_atmos_machinery() + for (var/obj/machinery/atmospherics/AM in atmos_machinery) + AM.atmos_init() + CHECK_TICK + +/datum/controller/subsystem/air_machinery/proc/start_processing_machine(obj/machinery/machine) + if(machine.atmos_processing) + return + machine.atmos_processing = TRUE + atmos_machinery += machine + +/datum/controller/subsystem/air_machinery/proc/stop_processing_machine(obj/machinery/machine) + if(!machine.atmos_processing) + return + machine.atmos_processing = FALSE + atmos_machinery -= machine + currentrun -= machine + +/datum/controller/subsystem/air_machinery/fire(resumed = 0) + if (!resumed) + src.currentrun = atmos_machinery.Copy() + //cache for sanic speed (lists are references anyways) + var/list/currentrun = src.currentrun + while(currentrun.len) + var/obj/machinery/M = currentrun[currentrun.len] + currentrun.len-- + if(M == null) + atmos_machinery.Remove(M) + if(!M || (M.process_atmos(wait / (1 SECONDS)) == PROCESS_KILL)) + stop_processing_machine(M) + if(MC_TICK_CHECK) + return diff --git a/code/controllers/subsystem/callback.dm b/code/controllers/subsystem/callback.dm new file mode 100644 index 000000000000..b105dfd86573 --- /dev/null +++ b/code/controllers/subsystem/callback.dm @@ -0,0 +1,13 @@ +SUBSYSTEM_DEF(callbacks) + name = "Auxtools Callbacks" + flags = SS_TICKER | SS_NO_INIT + wait = 1 + priority = FIRE_PRIORITY_CALLBACKS + +/datum/controller/subsystem/callbacks/fire() + if(SSair.thread_running()) + pause() + return + + if(process_atmos_callbacks(MC_TICK_REMAINING_MS)) + pause() diff --git a/code/controllers/subsystem/explosions.dm b/code/controllers/subsystem/explosions.dm index 0053761a9ec4..fc16a2fc891a 100644 --- a/code/controllers/subsystem/explosions.dm +++ b/code/controllers/subsystem/explosions.dm @@ -586,3 +586,5 @@ SUBSYSTEM_DEF(explosions) cost_throwturf = MC_AVERAGE(cost_throwturf, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer)) currentpart = SSEXPLOSIONS_TURFS + +#undef SSAIR_REBUILD_PIPENETS diff --git a/code/datums/components/rot.dm b/code/datums/components/rot.dm index 1eb32bd0138d..b37c6773f3f2 100644 --- a/code/datums/components/rot.dm +++ b/code/datums/components/rot.dm @@ -21,22 +21,23 @@ return var/datum/gas_mixture/turf_air = T.return_air() + if(!turf_air) + return var/datum/gas_mixture/stank_breath = T.remove_air(1 / turf_air.return_volume() * turf_air.total_moles()) if(!stank_breath) return stank_breath.set_volume(1) - var/oxygen_pp = stank_breath.get_moles(/datum/gas/oxygen) * R_IDEAL_GAS_EQUATION * stank_breath.return_temperature() / stank_breath.return_volume() + var/oxygen_pp = stank_breath.get_moles(GAS_O2) * R_IDEAL_GAS_EQUATION * stank_breath.return_temperature() / stank_breath.return_volume() if(oxygen_pp > 18) var/this_amount = min((oxygen_pp - 8) * stank_breath.return_volume() / stank_breath.return_temperature() / R_IDEAL_GAS_EQUATION, amount) - stank_breath.adjust_moles(/datum/gas/oxygen, -this_amount) + stank_breath.adjust_moles(GAS_O2, -this_amount) var/datum/gas_mixture/stank = new - stank.set_moles(/datum/gas/miasma, this_amount) + stank.set_moles(GAS_MIASMA, this_amount) stank.set_temperature(BODYTEMP_NORMAL) // otherwise we have gas below 2.7K which will break our lag generator stank_breath.merge(stank) T.assume_air(stank_breath) - T.air_update_turf() /datum/component/rot/corpse amount = MIASMA_CORPSE_MOLES diff --git a/code/datums/diseases/advance/symptoms/heal.dm b/code/datums/diseases/advance/symptoms/heal.dm index cbe2008187c2..0a409a1ded27 100644 --- a/code/datums/diseases/advance/symptoms/heal.dm +++ b/code/datums/diseases/advance/symptoms/heal.dm @@ -405,9 +405,9 @@ . = 0 if(M.loc) - environment = M.loc.return_air() + environment = M.return_air() if(environment) - if(environment.get_moles(/datum/gas/plasma) > GLOB.meta_gas_info[/datum/gas/plasma][META_GAS_MOLES_VISIBLE]) //if there's enough plasma in the air to see + if(environment.get_moles(GAS_PLASMA) > GLOB.gas_data.visibility[GAS_PLASMA]) //if there's enough plasma in the air to see . += power * 0.5 var/requires_metabolizing = !(A.process_dead && M.stat == DEAD) //don't require metabolizing if our host is dead and we have necrotic metabolsim if(M.reagents.has_reagent(/datum/reagent/toxin/plasma, needs_metabolizing = requires_metabolizing)) diff --git a/code/datums/helper_datums/teleport.dm b/code/datums/helper_datums/teleport.dm index aeec4dbdc21b..fcca5c762f24 100644 --- a/code/datums/helper_datums/teleport.dm +++ b/code/datums/helper_datums/teleport.dm @@ -155,11 +155,11 @@ // Can most things breathe? if(trace_gases) continue - if(A.get_moles(/datum/gas/oxygen) < 16) + if(A.get_moles(GAS_O2) < 16) continue - if(A.get_moles(/datum/gas/plasma)) + if(A.get_moles(GAS_PLASMA)) continue - if(A.get_moles(/datum/gas/carbon_dioxide) >= 10) + if(A.get_moles(GAS_CO2) >= 10) continue // Aim for goldilocks temperatures and pressure diff --git a/code/datums/status_effects/debuffs/fire_stacks.dm b/code/datums/status_effects/debuffs/fire_stacks.dm index 76b6b64f6100..55978eb6bbdb 100644 --- a/code/datums/status_effects/debuffs/fire_stacks.dm +++ b/code/datums/status_effects/debuffs/fire_stacks.dm @@ -153,7 +153,7 @@ return TRUE var/datum/gas_mixture/air = owner.loc.return_air() - if(!air || (air.get_moles(/datum/gas/oxygen) < 1)) + if(!air || (air.get_moles(GAS_O2) < 1)) qdel(src) return TRUE diff --git a/code/game/atoms.dm b/code/game/atoms.dm index a1def6de5e72..191525de75e4 100644 --- a/code/game/atoms.dm +++ b/code/game/atoms.dm @@ -381,23 +381,38 @@ ///Take air from the passed in gas mixture datum /atom/proc/assume_air(datum/gas_mixture/giver) - qdel(giver) + return null + +/atom/proc/assume_air_moles(datum/gas_mixture/giver, moles) + return null + +/atom/proc/assume_air_ratio(datum/gas_mixture/giver, ratio) return null ///Remove air from this atom /atom/proc/remove_air(amount) return null +/atom/proc/remove_air_ratio(ratio) + return null + +/atom/proc/transfer_air(datum/gas_mixture/taker, amount) + return null + +/atom/proc/transfer_air_ratio(datum/gas_mixture/taker, ratio) + return null + ///Return the current air environment in this atom /atom/proc/return_air() if(loc) return loc.return_air() - else - return null + return null +///Return the air if we can analyze it /atom/proc/return_analyzable_air() return null + ///Return the air if we can analyze it ///Check if this atoms eye is still alive (probably) /atom/proc/check_eye(mob/user) diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm index e1f80cde837e..99dc8e01778b 100644 --- a/code/game/atoms_movable.dm +++ b/code/game/atoms_movable.dm @@ -93,7 +93,7 @@ //Restore air flow if we were blocking it (movables with ATMOS_PASS_PROC will need to do this manually if necessary) if(((CanAtmosPass == ATMOS_PASS_DENSITY && density) || CanAtmosPass == ATMOS_PASS_NO) && isturf(loc)) CanAtmosPass = ATMOS_PASS_YES - air_update_turf(TRUE) + air_update_turf() loc.handle_atom_del(src) if(opacity) diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm index 0b5069abaa5a..e9a990cd8e30 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm @@ -443,7 +443,7 @@ continue // No parent vent // Stops Aliens getting stuck in small networks. // See: Security, Virology - if(temp_vent_parent.other_atmosmch.len > 20) + if(temp_vent_parent.other_atmos_machines.len > 20) vents += temp_vent if(!vents.len) return FALSE diff --git a/code/game/gamemodes/objective_items.dm b/code/game/gamemodes/objective_items.dm index 72c151b38701..4a923f59efac 100644 --- a/code/game/gamemodes/objective_items.dm +++ b/code/game/gamemodes/objective_items.dm @@ -150,12 +150,12 @@ if(!istype(o, /obj/item/tank)) continue var/obj/item/tank/T = o - found_amount += T.air_contents.get_moles(/datum/gas/plasma) + found_amount += T.air_contents.get_moles(GAS_PLASMA) if (istype(objective.team, /datum/team/infiltrator)) for (var/area/A in world) if (is_type_in_typecache(A, GLOB.infiltrator_objective_areas)) for (var/obj/item/tank/T in A.get_all_contents()) //Check for items - found_amount += T.air_contents.get_moles(/datum/gas/plasma) + found_amount += T.air_contents.get_moles(GAS_PLASMA) CHECK_TICK CHECK_TICK CHECK_TICK diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm index 050e4f840d37..d65fc2005be4 100644 --- a/code/game/machinery/_machinery.dm +++ b/code/game/machinery/_machinery.dm @@ -137,6 +137,9 @@ Class Procs: /// Mobtype of last user. Typecast to [/mob/living] for initial() usage var/mob/living/last_user_mobtype + ///Boolean on whether this machines interact with atmos + var/atmos_processing = FALSE + /obj/machinery/Initialize(mapload) if(!armor) armor = list(MELEE = 25, BULLET = 10, LASER = 10, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 70) diff --git a/code/game/machinery/airlock_cycle_control.dm b/code/game/machinery/airlock_cycle_control.dm index 852ac542b135..7a142582f6f5 100644 --- a/code/game/machinery/airlock_cycle_control.dm +++ b/code/game/machinery/airlock_cycle_control.dm @@ -113,12 +113,12 @@ qdel(wires) wires = null cut_links() - SSair.atmos_machinery -= src + SSair_machinery.stop_processing_machine(src) return ..() /obj/machinery/advanced_airlock_controller/Initialize(mapload) . = ..() - SSair.atmos_machinery += src + SSair_machinery.start_processing_machine(src) scan_on_late_init = mapload if(mapload && (. != INITIALIZE_HINT_QDEL)) return INITIALIZE_HINT_LATELOAD @@ -135,14 +135,12 @@ airlock.bolt() /obj/machinery/advanced_airlock_controller/proc/update_cycle_icon(use_hash = FALSE) - var/turf/location = get_turf(src) - if(!location) + if(!isopenturf(get_turf(src))) return var/pressure = 0 - if(location) - var/datum/gas_mixture/environment = location.return_air() - if(environment) - pressure = environment.return_pressure() + var/datum/gas_mixture/environment = return_air() + if(environment) + pressure = environment.return_pressure() var/maxpressure = (exterior_pressure && (cyclestate == AIRLOCK_CYCLESTATE_OUTCLOSING || cyclestate == AIRLOCK_CYCLESTATE_OUTOPENING || cyclestate == AIRLOCK_CYCLESTATE_OUTOPEN)) ? exterior_pressure : interior_pressure var/pressure_bars = round(pressure / maxpressure * 5 + 0.01) @@ -295,15 +293,13 @@ update_cycle_icon(TRUE) return - var/turf/location = get_turf(src) - if(!location) + if(!isopenturf(get_turf(src))) update_cycle_icon(TRUE) return var/pressure = 0 - if(location) - var/datum/gas_mixture/environment = location.return_air() - if(environment) - pressure = environment.return_pressure() + var/datum/gas_mixture/environment = return_air() + if(environment) + pressure = environment.return_pressure() update_error_status() var/doors_valid = TRUE @@ -596,10 +592,9 @@ ui.open() /obj/machinery/advanced_airlock_controller/ui_data(mob/user) - var/turf/T = get_turf(src) var/pressure = 0 - if(T) - var/datum/gas_mixture/environment = T.return_air() + if(isopenturf(get_turf(src))) + var/datum/gas_mixture/environment = return_air() if(environment) pressure = environment.return_pressure() diff --git a/code/game/machinery/computer/atmos_control.dm b/code/game/machinery/computer/atmos_control.dm index 7474377cc462..7ed11ce00534 100644 --- a/code/game/machinery/computer/atmos_control.dm +++ b/code/game/machinery/computer/atmos_control.dm @@ -61,7 +61,7 @@ var/total_moles = air_sample.total_moles() if(total_moles) for(var/gas_id in air_sample.get_gases()) - var/gas_name = GLOB.meta_gas_info[gas_id][META_GAS_NAME] + var/gas_name = GLOB.gas_data.names[gas_id] signal.data["gases"][gas_name] = air_sample.get_moles(gas_id) / total_moles * 100 radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA) @@ -74,11 +74,11 @@ /obj/machinery/air_sensor/Initialize(mapload) . = ..() - SSair.atmos_machinery += src + SSair_machinery.start_processing_machine(src) set_frequency(frequency) /obj/machinery/air_sensor/Destroy() - SSair.atmos_machinery -= src + SSair_machinery.stop_processing_machine(src) SSradio.remove_object(src, frequency) return ..() diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm index 7d9f72c774f2..317170179bc2 100644 --- a/code/game/machinery/doors/airlock.dm +++ b/code/game/machinery/doors/airlock.dm @@ -1427,7 +1427,7 @@ sleep(0.1 SECONDS) density = FALSE sleep(0.3 SECONDS) - air_update_turf(1) + air_update_turf() sleep(0.1 SECONDS) layer = OPEN_DOOR_LAYER update_icon(state = AIRLOCK_OPEN, override = TRUE) @@ -1469,11 +1469,11 @@ layer = CLOSED_DOOR_LAYER if(air_tight) density = TRUE - air_update_turf(1) + air_update_turf() sleep(0.1 SECONDS) density = TRUE if(!air_tight) - air_update_turf(1) + air_update_turf() sleep(0.4 SECONDS) if(!safe) crush() diff --git a/code/game/machinery/doors/airlock_types.dm b/code/game/machinery/doors/airlock_types.dm index 158448fd889f..80f82e598534 100644 --- a/code/game/machinery/doors/airlock_types.dm +++ b/code/game/machinery/doors/airlock_types.dm @@ -229,8 +229,8 @@ DA.update_appearance() qdel(src) -/obj/machinery/door/airlock/plasma/BlockSuperconductivity() //we don't stop the heat~ - return 0 +/obj/machinery/door/airlock/plasma/BlockThermalConductivity() //we don't stop the heat~ + return FALSE /obj/machinery/door/airlock/plasma/attackby(obj/item/C, mob/user, params) if(C.is_hot() > 300)//If the temperature of the object is over 300, then ignite diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm index 714947cdd5e0..ec977b8bf6f1 100644 --- a/code/game/machinery/doors/door.dm +++ b/code/game/machinery/doors/door.dm @@ -83,7 +83,7 @@ . = ..() set_init_door_layer() update_freelook_sight() - air_update_turf(1) + air_update_turf() GLOB.airlocks += src spark_system = new /datum/effect_system/spark_spread spark_system.set_up(2, 1, src) @@ -263,9 +263,9 @@ var/max_moles = min_moles // okay this is a bit hacky. First, we set density to 0 and recalculate our adjacent turfs density = FALSE - T.ImmediateCalculateAdjacentTurfs() + var/list/adj_turfs = T.get_adjacent_atmos_turfs() // then we use those adjacent turfs to figure out what the difference between the lowest and highest pressures we'd be holding is - for(var/turf/open/T2 in T.atmos_adjacent_turfs) + for(var/turf/open/T2 in adj_turfs) if((flags_1 & ON_BORDER_1) && get_dir(src, T2) != dir) continue var/moles = T2.air.total_moles() @@ -274,7 +274,6 @@ if(moles > max_moles) max_moles = moles density = TRUE - T.ImmediateCalculateAdjacentTurfs() // alright lets put it back return max_moles - min_moles > 20 /obj/machinery/door/attackby(obj/item/I, mob/user, params) @@ -366,7 +365,7 @@ update_appearance(UPDATE_ICON) set_opacity(0) operating = FALSE - air_update_turf(1) + air_update_turf() update_freelook_sight() if(autoclose) spawn(autoclose) @@ -398,7 +397,7 @@ if(visible && !glass) set_opacity(1) operating = FALSE - air_update_turf(1) + air_update_turf() update_freelook_sight() if(safe) CheckForMobs() @@ -454,8 +453,8 @@ if(!glass && GLOB.cameranet) GLOB.cameranet.updateVisibility(src, 0) -/obj/machinery/door/BlockSuperconductivity() // All non-glass airlocks block heat, this is intended. - if(opacity || heat_proof) +/obj/machinery/door/BlockThermalConductivity() // All non-glass airlocks block heat, this is intended. + if(heat_proof && density) return TRUE return FALSE diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm index 329686d9fea2..eb8f08bcdf05 100644 --- a/code/game/machinery/doors/firedoor.dm +++ b/code/game/machinery/doors/firedoor.dm @@ -70,10 +70,7 @@ /obj/machinery/door/firedoor/Destroy() remove_from_areas() affecting_areas.Cut() - var/turf/T = get_turf(src) - spawn(0) - if(T) - T.ImmediateCalculateAdjacentTurfs() + air_update_turf() return ..() /obj/machinery/door/firedoor/Bumped(atom/movable/AM) @@ -222,6 +219,7 @@ else icon_state = "door_open" SSdemo.mark_dirty(src) + air_update_turf() /obj/machinery/door/firedoor/update_overlays() . = ..() @@ -240,17 +238,15 @@ . = ..() latetoggle() -/obj/machinery/door/firedoor/proc/whack_a_mole(reconsider_immediately = FALSE) - set waitfor = 0 +/obj/machinery/door/firedoor/proc/whack_a_mole() for(var/cdir in GLOB.cardinals) if((flags_1 & ON_BORDER_1) && cdir != dir) continue - whack_a_mole_part(get_step(src, cdir), reconsider_immediately) + whack_a_mole_part(get_step(src, cdir)) if(flags_1 & ON_BORDER_1) - whack_a_mole_part(get_turf(src), reconsider_immediately) + whack_a_mole_part(get_turf(src)) -/obj/machinery/door/firedoor/proc/whack_a_mole_part(turf/start_point, reconsider_immediately) - set waitfor = 0 +/obj/machinery/door/firedoor/proc/whack_a_mole_part(turf/start_point) var/list/doors_to_close = list() var/list/turfs = list() turfs[start_point] = 1 @@ -283,17 +279,24 @@ return // too big, don't bother for(var/obj/machinery/door/firedoor/FD in doors_to_close) FD.emergency_pressure_stop(FALSE) - if(reconsider_immediately) - var/turf/open/T = FD.loc - if(istype(T)) - T.ImmediateCalculateAdjacentTurfs() /obj/machinery/door/firedoor/proc/emergency_pressure_stop(consider_timer = TRUE) - set waitfor = 0 if(density || operating || welded) return if(world.time >= emergency_close_timer || !consider_timer) - close() + emergency_pressure_close() + +//this is here to prevent sleeps from messing with decomp, by closing firedoors instantly +/obj/machinery/door/firedoor/proc/emergency_pressure_close() + density = TRUE + air_update_turf() + layer = closingLayer + update_icon() + if(visible && !glass) + set_opacity(1) + update_freelook_sight() + if(!(flags_1 & ON_BORDER_1)) + crush() /obj/machinery/door/firedoor/deconstruct(disassembled = TRUE) if(!(flags_1 & NODECONSTRUCT_1) && disassembled) @@ -330,6 +333,14 @@ return TRUE if(operating || welded) return + check_pulls() + . = ..() + +/obj/machinery/door/firedoor/border_only/emergency_pressure_close() + check_pulls() + . = ..() + +/obj/machinery/door/firedoor/border_only/proc/check_pulls() var/turf/T1 = get_turf(src) var/turf/T2 = get_step(T1, dir) for(var/mob/living/M in T1) @@ -347,7 +358,6 @@ to_chat(M, span_notice("You pull [M.pulling] through [src] right as it closes")) M.pulling.forceMove(T2) M.start_pulling(M2) - . = ..() /obj/machinery/door/firedoor/border_only/allow_hand_open(mob/user) var/area/A = get_area(src) @@ -401,6 +411,11 @@ else return TRUE +/obj/machinery/door/firedoor/border_only/BlockThermalConductivity(opp_dir) + if(opp_dir == dir) + return density + return FALSE + /obj/machinery/door/firedoor/heavy name = "heavy firelock" icon = 'icons/obj/doors/doorfire.dmi' diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm index 99712b02ac83..5facd26aa3b7 100644 --- a/code/game/machinery/doors/windowdoor.dm +++ b/code/game/machinery/doors/windowdoor.dm @@ -158,7 +158,7 @@ sleep(1 SECONDS) density = FALSE - air_update_turf(1) + air_update_turf() update_freelook_sight() if(operating == 1) //emag again @@ -180,7 +180,7 @@ icon_state = base_state density = TRUE - air_update_turf(1) + air_update_turf() update_freelook_sight() sleep(1 SECONDS) diff --git a/code/game/machinery/electrolyzer.dm b/code/game/machinery/electrolyzer.dm index a3b56108a132..1460a455aec0 100644 --- a/code/game/machinery/electrolyzer.dm +++ b/code/game/machinery/electrolyzer.dm @@ -63,7 +63,7 @@ if(panel_open) . += "electrolyzer-open" -/obj/machinery/electrolyzer/process(delta_time) +/obj/machinery/electrolyzer/process_atmos() if((stat & (BROKEN|MAINT)) && on) on = FALSE if(!on) @@ -76,8 +76,7 @@ update_appearance(UPDATE_ICON) return FALSE - var/turf/L = loc - if(!istype(L)) + if(!isopenturf(get_turf(src))) if(mode != ELECTROLYZER_MODE_STANDBY) mode = ELECTROLYZER_MODE_STANDBY update_appearance(UPDATE_ICON) @@ -92,24 +91,23 @@ if(mode == ELECTROLYZER_MODE_STANDBY) return - var/datum/gas_mixture/env = L.return_air() //get air from the turf + var/datum/gas_mixture/env = return_air() //get air from the turf var/datum/gas_mixture/removed = env.remove(0.1 * env.total_moles()) if(!removed) return var/proportion = 0 - if(removed.get_moles(/datum/gas/water_vapor)) - proportion = min(removed.get_moles(/datum/gas/water_vapor), (3 * delta_time * workingPower)) //Works to max 12 moles at a time. - removed.adjust_moles(/datum/gas/water_vapor, -proportion) - removed.adjust_moles(/datum/gas/oxygen, proportion / 2) - removed.adjust_moles(/datum/gas/hydrogen, proportion) - if(removed.get_moles(/datum/gas/hypernoblium)) - proportion = min(removed.get_moles(/datum/gas/hypernoblium), (delta_time * workingPower)) // up to 4 moles at a time - removed.adjust_moles(/datum/gas/hypernoblium, -proportion) - removed.adjust_moles(/datum/gas/antinoblium, proportion) + if(removed.get_moles(GAS_H2O)) + proportion = min(removed.get_moles(GAS_H2O), (3 * workingPower)) //Works to max 12 moles at a time. + removed.adjust_moles(GAS_H2O, -proportion) + removed.adjust_moles(GAS_O2, proportion / 2) + removed.adjust_moles(GAS_H2, proportion) + if(removed.get_moles(GAS_HYPERNOB)) + proportion = min(removed.get_moles(GAS_HYPERNOB), workingPower) // up to 4 moles at a time + removed.adjust_moles(GAS_HYPERNOB, -proportion) + removed.adjust_moles(GAS_ANTINOB, proportion) env.merge(removed) //put back the new gases in the turf - air_update_turf() var/working = TRUE @@ -205,7 +203,9 @@ usr.visible_message(span_notice("[usr] switches [on ? "on" : "off"] \the [src]."), span_notice("You switch [on ? "on" : "off"] \the [src].")) update_appearance(UPDATE_ICON) if (on) - START_PROCESSING(SSmachines, src) + SSair_machinery.start_processing_machine(src) + else + SSair_machinery.stop_processing_machine(src) . = TRUE if("eject") if(panel_open && cell) diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm index 91742d81c00a..33c9676d86dc 100644 --- a/code/game/machinery/pipe/construction.dm +++ b/code/game/machinery/pipe/construction.dm @@ -64,10 +64,10 @@ Buildable meters /obj/item/pipe/dropped() if(loc) - setPipingLayer(piping_layer) + set_piping_layer(piping_layer) return ..() -/obj/item/pipe/proc/setPipingLayer(new_layer = PIPING_LAYER_DEFAULT) +/obj/item/pipe/proc/set_piping_layer(new_layer = PIPING_LAYER_DEFAULT) var/obj/machinery/atmospherics/fakeA = pipe_type if(initial(fakeA.pipe_flags) & PIPING_ALL_LAYER) @@ -139,7 +139,7 @@ Buildable meters return TRUE if((M.piping_layer != piping_layer) && !((M.pipe_flags | flags) & PIPING_ALL_LAYER)) //don't continue if either pipe goes across all layers continue - if(M.GetInitDirections() & SSair.get_init_dirs(pipe_type, fixed_dir())) // matches at least one direction on either type of pipe + if(M.get_init_directions() & SSair.get_init_dirs(pipe_type, fixed_dir())) // matches at least one direction on either type of pipe to_chat(user, span_warning("There is already a pipe at that location!")) return TRUE // no conflicts found @@ -159,7 +159,7 @@ Buildable meters /obj/item/pipe/proc/build_pipe(obj/machinery/atmospherics/A) A.setDir(fixed_dir()) - A.SetInitDirections() + A.set_init_directions() if(pipename) A.name = pipename diff --git a/code/game/machinery/pipe/pipe_dispenser.dm b/code/game/machinery/pipe/pipe_dispenser.dm index 2fbde8399a12..4f3656c062b9 100644 --- a/code/game/machinery/pipe/pipe_dispenser.dm +++ b/code/game/machinery/pipe/pipe_dispenser.dm @@ -47,7 +47,7 @@ return var/p_dir = text2num(href_list["dir"]) var/obj/item/pipe/P = new (loc, p_type, p_dir) - P.setPipingLayer(piping_layer) + P.set_piping_layer(piping_layer) P.add_fingerprint(usr) wait = world.time + 10 if(href_list["makemeter"]) diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm index 127b93e5af87..26750d15bcf2 100644 --- a/code/game/machinery/shieldgen.dm +++ b/code/game/machinery/shieldgen.dm @@ -14,7 +14,7 @@ /obj/structure/emergency_shield/Initialize(mapload) . = ..() setDir(pick(GLOB.cardinals)) - air_update_turf(1) + air_update_turf() /obj/structure/emergency_shield/Move() var/turf/T = loc diff --git a/code/game/machinery/shuttle/shuttle_engine.dm b/code/game/machinery/shuttle/shuttle_engine.dm index 73f146992974..4743665672fb 100644 --- a/code/game/machinery/shuttle/shuttle_engine.dm +++ b/code/game/machinery/shuttle/shuttle_engine.dm @@ -118,10 +118,11 @@ //Thanks to spaceheater.dm for inspiration :) /obj/machinery/shuttle/engine/proc/fireEngine() - var/turf/heatTurf = loc - if(!heatTurf) + if(!isopenturf(get_turf(src))) + return + var/datum/gas_mixture/env = return_air() + if(!env) return - var/datum/gas_mixture/env = heatTurf.return_air() var/heat_cap = env.heat_capacity() var/req_power = abs(env.return_temperature() - ENGINE_HEAT_TARGET) * heat_cap req_power = min(req_power, ENGINE_HEATING_POWER) @@ -129,7 +130,6 @@ if(deltaTemperature < 0) return env.set_temperature(env.return_temperature() + deltaTemperature) - air_update_turf() /obj/machinery/shuttle/engine/attackby(obj/item/I, mob/living/user, params) check_setup() diff --git a/code/game/machinery/shuttle/shuttle_heater.dm b/code/game/machinery/shuttle/shuttle_heater.dm index beb24acf2085..dc83f02e6814 100644 --- a/code/game/machinery/shuttle/shuttle_heater.dm +++ b/code/game/machinery/shuttle/shuttle_heater.dm @@ -28,14 +28,14 @@ pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY - var/gas_type = /datum/gas/plasma + var/gas_type = GAS_PLASMA var/efficiency_multiplier = 1 var/gas_capacity = 0 /obj/machinery/atmospherics/components/unary/shuttle/heater/New() . = ..() GLOB.custom_shuttle_machines += src - SetInitDirections() + set_init_directions() update_adjacent_engines() updateGasStats() @@ -46,27 +46,27 @@ /obj/machinery/atmospherics/components/unary/shuttle/heater/on_construction() ..(dir, dir) - SetInitDirections() + set_init_directions() update_adjacent_engines() /obj/machinery/atmospherics/components/unary/shuttle/heater/default_change_direction_wrench(mob/user, obj/item/I) if(!..()) return FALSE - SetInitDirections() + set_init_directions() var/obj/machinery/atmospherics/node = nodes[1] if(node) node.disconnect(src) nodes[1] = null if(!parents[1]) return - nullifyPipenet(parents[1]) + nullify_pipenet(parents[1]) - atmosinit() + atmos_init() node = nodes[1] if(node) - node.atmosinit() - node.addMember(src) - build_network() + node.atmos_init() + node.add_member(src) + SSair.add_to_rebuild_queue(src) return TRUE /obj/machinery/atmospherics/components/unary/shuttle/heater/RefreshParts() @@ -91,8 +91,6 @@ return air_contents.set_volume(gas_capacity) air_contents.set_temperature(T20C) - if(gas_type) - air_contents.set_moles(gas_type) /obj/machinery/atmospherics/components/unary/shuttle/heater/proc/hasFuel(required) var/datum/gas_mixture/air_contents = airs[1] diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm index 8b7946707bd0..90482de1d7e8 100644 --- a/code/game/machinery/spaceheater.dm +++ b/code/game/machinery/spaceheater.dm @@ -66,7 +66,7 @@ if(panel_open) . += "sheater-open" -/obj/machinery/space_heater/process(delta_time) +/obj/machinery/space_heater/process_atmos() if(!on || stat & (BROKEN|MAINT)) if (on) // If it's broken, turn it off too on = FALSE @@ -103,7 +103,7 @@ var/heat_capacity = env.heat_capacity() var/requiredEnergy = abs(env.return_temperature() - targetTemperature) * heat_capacity - requiredEnergy = min(requiredEnergy, heatingPower * delta_time) + requiredEnergy = min(requiredEnergy, heatingPower) if(requiredEnergy < 1) return @@ -115,7 +115,6 @@ for (var/turf/open/turf in ((L.atmos_adjacent_turfs || list()) + L)) var/datum/gas_mixture/turf_gasmix = turf.return_air() turf_gasmix.set_temperature(turf_gasmix.return_temperature() + deltaTemperature) - air_update_turf(FALSE, FALSE) var/working = TRUE @@ -213,13 +212,10 @@ data["minTemp"] = max(settableTemperatureMedian - settableTemperatureRange - T0C, TCMB) data["maxTemp"] = settableTemperatureMedian + settableTemperatureRange - T0C - var/turf/L = get_turf(loc) var/curTemp - if(istype(L)) - var/datum/gas_mixture/env = L.return_air() - curTemp = env.return_temperature() - else if(isturf(L)) - curTemp = L.return_temperature() + if(isopenturf(get_turf(src))) + var/datum/gas_mixture/env = return_air() + curTemp = env?.return_temperature() if(isnull(curTemp)) data["currentTemp"] = "N/A" else @@ -268,7 +264,9 @@ usr.visible_message("[usr] switches [on ? "on" : "off"] \the [src].", span_notice("You switch [on ? "on" : "off"] \the [src].")) update_appearance(UPDATE_ICON) if (on) - START_PROCESSING(SSmachines, src) + SSair_machinery.start_processing_machine(src) + else + SSair_machinery.stop_processing_machine(src) /obj/machinery/space_heater/AltClick(mob/user) if(!user.canUseTopic(src, !issilicon(user))) diff --git a/code/game/machinery/telecomms/telecomunications.dm b/code/game/machinery/telecomms/telecomunications.dm index 6bf5c01110be..39455a7972a4 100644 --- a/code/game/machinery/telecomms/telecomunications.dm +++ b/code/game/machinery/telecomms/telecomunications.dm @@ -153,10 +153,9 @@ GLOBAL_LIST_EMPTY(telecomms_list) /obj/machinery/telecomms/proc/update_speed() if(!on) return - var/turf/T = get_turf(src) //yogs var/speedloss = 0 - var/datum/gas_mixture/env = T.return_air() - var/temperature = env.return_temperature() + var/datum/gas_mixture/env = return_air() + var/temperature = env?.return_temperature() if(temperature <= 150) // 150K optimal operating parameters net_efective = 100 else diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm index df65db8ff4a2..80dd0936ce17 100644 --- a/code/game/mecha/mecha.dm +++ b/code/game/mecha/mecha.dm @@ -213,11 +213,7 @@ scanmod = null capacitor = null internal_tank = null - if(loc) - loc.assume_air(cabin_air) - air_update_turf() - else - qdel(cabin_air) + assume_air(cabin_air) cabin_air = null qdel(spark_system) spark_system = null @@ -276,8 +272,8 @@ cabin_air = new cabin_air.set_temperature(T20C) cabin_air.set_volume(200) - cabin_air.set_moles(/datum/gas/oxygen, O2STANDARD*cabin_air.return_volume()/(R_IDEAL_GAS_EQUATION*cabin_air.return_temperature())) - cabin_air.set_moles(/datum/gas/nitrogen, N2STANDARD*cabin_air.return_volume()/(R_IDEAL_GAS_EQUATION*cabin_air.return_temperature())) + cabin_air.set_moles(GAS_O2, O2STANDARD*cabin_air.return_volume()/(R_IDEAL_GAS_EQUATION*cabin_air.return_temperature())) + cabin_air.set_moles(GAS_N2, N2STANDARD*cabin_air.return_volume()/(R_IDEAL_GAS_EQUATION*cabin_air.return_temperature())) return cabin_air /obj/mecha/proc/add_radio() @@ -410,13 +406,7 @@ if(internal_damage & MECHA_INT_TANK_BREACH) //remove some air from internal tank if(internal_tank) - var/datum/gas_mixture/int_tank_air = internal_tank.return_air() - var/datum/gas_mixture/leaked_gas = int_tank_air.remove_ratio(0.1) - if(loc) - loc.assume_air(leaked_gas) - air_update_turf() - else - qdel(leaked_gas) + assume_air_ratio(internal_tank.return_air(), 0.1) if(internal_damage & MECHA_INT_SHORT_CIRCUIT) if(get_charge()) @@ -439,8 +429,7 @@ if(pressure_delta > 0) //cabin pressure lower than release pressure if(tank_air.return_temperature() > 0) transfer_moles = pressure_delta*cabin_air.return_volume()/(cabin_air.return_temperature() * R_IDEAL_GAS_EQUATION) - var/datum/gas_mixture/removed = tank_air.remove(transfer_moles) - cabin_air.merge(removed) + tank_air.transfer_to(cabin_air,transfer_moles) else if(pressure_delta < 0) //cabin pressure higher than release pressure var/datum/gas_mixture/t_air = return_air() pressure_delta = cabin_pressure - release_pressure @@ -448,11 +437,7 @@ pressure_delta = min(cabin_pressure - t_air.return_pressure(), pressure_delta) if(pressure_delta > 0) //if location pressure is lower than cabin pressure transfer_moles = pressure_delta*cabin_air.return_volume()/(cabin_air.return_temperature() * R_IDEAL_GAS_EQUATION) - var/datum/gas_mixture/removed = cabin_air.remove(transfer_moles) - if(t_air) - t_air.merge(removed) - else //just delete the cabin gas, we're in space or some shit - qdel(removed) + cabin_air.transfer_to(t_air, transfer_moles) if(occupant) if(cell) @@ -959,6 +944,11 @@ return cabin_air.remove(amount) return ..() +/obj/mecha/remove_air_ratio(ratio) + if(use_internal_tank) + return cabin_air.remove_ratio(ratio) + return ..() + /obj/mecha/return_air() if(use_internal_tank) return cabin_air diff --git a/code/game/objects/effects/effect_system/fluid_spread/effects_foam.dm b/code/game/objects/effects/effect_system/fluid_spread/effects_foam.dm index ef1e1897b4cf..ca003178d8da 100644 --- a/code/game/objects/effects/effect_system/fluid_spread/effects_foam.dm +++ b/code/game/objects/effects/effect_system/fluid_spread/effects_foam.dm @@ -262,15 +262,13 @@ QDEL_NULL(turf_fire) var/datum/gas_mixture/air = location.air - var/scrub_amt = min(30, air.get_moles(/datum/gas/plasma)) //Absorb some plasma - air.adjust_moles(/datum/gas/plasma, -scrub_amt) + var/scrub_amt = min(30, air.get_moles(GAS_PLASMA)) //Absorb some plasma + air.adjust_moles(GAS_PLASMA, -scrub_amt) absorbed_plasma += scrub_amt if (air.return_temperature() > T20C) air.set_temperature(max(air.return_temperature() / 2, T20C)) - location.air_update_turf(FALSE, FALSE) - /obj/effect/particle_effect/fluid/foam/firefighting/make_result() if(!absorbed_plasma) // don't bother if it didn't scrub any plasma return @@ -322,7 +320,7 @@ /obj/structure/foamedmetal/Initialize(mapload) . = ..() - air_update_turf(1) + air_update_turf() /obj/structure/foamedmetal/Move() var/turf/T = loc @@ -409,11 +407,10 @@ for(var/gas_type in air.get_gases()) switch(gas_type) - if(/datum/gas/oxygen, /datum/gas/nitrogen) + if(GAS_O2, GAS_N2) continue else air.set_moles(gas_type, 0) - location.air_update_turf() for(var/obj/machinery/atmospherics/components/unary/comp in location) if(!comp.welded) diff --git a/code/game/objects/effects/effect_system/fluid_spread/effects_smoke.dm b/code/game/objects/effects/effect_system/fluid_spread/effects_smoke.dm index e2a1d4352544..030d78c8d201 100644 --- a/code/game/objects/effects/effect_system/fluid_spread/effects_smoke.dm +++ b/code/game/objects/effects/effect_system/fluid_spread/effects_smoke.dm @@ -294,13 +294,12 @@ if(!distcheck || get_dist(location, chilly) < blast) // Otherwise we'll get silliness like people using Nanofrost to kill people through walls with cold air air.set_temperature(temperature) - if(air.get_moles(/datum/gas/plasma)) - air.adjust_moles(/datum/gas/nitrogen, air.get_moles(/datum/gas/plasma)) - air.set_moles(/datum/gas/plasma, 0) + if(air.get_moles(GAS_PLASMA)) + air.adjust_moles(GAS_N2, air.get_moles(GAS_PLASMA)) + air.set_moles(GAS_PLASMA, 0) for(var/obj/effect/hotspot/fire in chilly) qdel(fire) - chilly.air_update_turf() if(weldvents) for(var/obj/machinery/atmospherics/components/unary/comp in chilly) diff --git a/code/game/objects/effects/portals.dm b/code/game/objects/effects/portals.dm index 6cd4f737e7bf..9e85bedc2839 100644 --- a/code/game/objects/effects/portals.dm +++ b/code/game/objects/effects/portals.dm @@ -121,8 +121,6 @@ return FALSE atmos_source.atmos_adjacent_turfs[atmos_destination] = TRUE atmos_destination.atmos_adjacent_turfs[atmos_source] = TRUE - atmos_source.air_update_turf(FALSE) - atmos_destination.air_update_turf(FALSE) /obj/effect/portal/proc/unlink_atmos() if(istype(atmos_source)) diff --git a/code/game/objects/effects/spawners/bombspawner.dm b/code/game/objects/effects/spawners/bombspawner.dm index 40bd2405fda6..9e07ee6a7a14 100644 --- a/code/game/objects/effects/spawners/bombspawner.dm +++ b/code/game/objects/effects/spawners/bombspawner.dm @@ -1,6 +1,6 @@ #define CELSIUS_TO_KELVIN(T_K) ((T_K) + T0C) -#define OPTIMAL_TEMP_K_PLA_BURN_SCALE(PRESSURE_P,PRESSURE_O,TEMP_O) (((PRESSURE_P) * GLOB.meta_gas_info[/datum/gas/plasma][META_GAS_SPECIFIC_HEAT]) / (((PRESSURE_P) * GLOB.meta_gas_info[/datum/gas/plasma][META_GAS_SPECIFIC_HEAT] + (PRESSURE_O) * GLOB.meta_gas_info[/datum/gas/oxygen][META_GAS_SPECIFIC_HEAT]) / PLASMA_UPPER_TEMPERATURE - (PRESSURE_O) * GLOB.meta_gas_info[/datum/gas/oxygen][META_GAS_SPECIFIC_HEAT] / CELSIUS_TO_KELVIN(TEMP_O))) +#define OPTIMAL_TEMP_K_PLA_BURN_SCALE(PRESSURE_P,PRESSURE_O,TEMP_O) (((PRESSURE_P) * GLOB.gas_data.specific_heats[GAS_PLASMA]) / (((PRESSURE_P) * GLOB.gas_data.specific_heats[GAS_PLASMA] + (PRESSURE_O) * GLOB.gas_data.specific_heats[GAS_O2]) / PLASMA_UPPER_TEMPERATURE - (PRESSURE_O) * GLOB.gas_data.specific_heats[GAS_O2] / CELSIUS_TO_KELVIN(TEMP_O))) #define OPTIMAL_TEMP_K_PLA_BURN_RATIO(PRESSURE_P,PRESSURE_O,TEMP_O) (CELSIUS_TO_KELVIN(TEMP_O) * PLASMA_OXYGEN_FULLBURN * (PRESSURE_P) / (PRESSURE_O)) /obj/effect/spawner/newbomb @@ -19,10 +19,10 @@ var/obj/item/tank/internals/plasma/PT = new(V) var/obj/item/tank/internals/oxygen/OT = new(V) - PT.air_contents.set_moles(/datum/gas/plasma, pressure_p*PT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_p))) + PT.air_contents.set_moles(GAS_PLASMA, pressure_p*PT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_p))) PT.air_contents.set_temperature(CELSIUS_TO_KELVIN(temp_p)) - OT.air_contents.set_moles(/datum/gas/oxygen, pressure_o*OT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o))) + OT.air_contents.set_moles(GAS_O2, pressure_o*OT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o))) OT.air_contents.set_temperature(CELSIUS_TO_KELVIN(temp_o)) V.tank_one = PT diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm index dc3cb66af6d0..08f70d4bd4af 100644 --- a/code/game/objects/effects/spiders.dm +++ b/code/game/objects/effects/spiders.dm @@ -133,7 +133,7 @@ if(get_dist(src, entry_vent) <= 1) var/list/vents = list() var/datum/pipeline/entry_vent_parent = entry_vent.parents[1] - for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent in entry_vent_parent.other_atmosmch) + for(var/obj/machinery/atmospherics/components/unary/vent_pump/temp_vent in entry_vent_parent.other_atmos_machines) vents.Add(temp_vent) if(!vents.len) entry_vent = null diff --git a/code/game/objects/effects/turf_fire.dm b/code/game/objects/effects/turf_fire.dm index 62e2e514ab1d..a7f98193af91 100644 --- a/code/game/objects/effects/turf_fire.dm +++ b/code/game/objects/effects/turf_fire.dm @@ -108,7 +108,7 @@ /obj/effect/abstract/turf_fire/proc/process_waste() if(open_turf.planetary_atmos) return TRUE - var/oxy = open_turf.air.get_moles(/datum/gas/oxygen) + var/oxy = open_turf.air.get_moles(GAS_O2) if (oxy < TURF_FIRE_BURN_MINIMUM_OXYGEN_REQUIRED) return FALSE var/thermal_energy = open_turf.air.return_temperature() * open_turf.air.heat_capacity() @@ -116,8 +116,8 @@ if(burn_rate > oxy) burn_rate = oxy - open_turf.air.adjust_moles(/datum/gas/oxygen, -burn_rate) - open_turf.air.adjust_moles(/datum/gas/carbon_dioxide, burn_rate * TURF_FIRE_BURN_CARBON_DIOXIDE_MULTIPLIER) + open_turf.air.adjust_moles(GAS_O2, -burn_rate) + open_turf.air.adjust_moles(GAS_CO2, burn_rate * TURF_FIRE_BURN_CARBON_DIOXIDE_MULTIPLIER) open_turf.air.set_temperature((thermal_energy + (burn_rate * TURF_FIRE_ENERGY_PER_BURNED_OXY_MOL)) / open_turf.air.heat_capacity()) open_turf.air_update_turf(TRUE) diff --git a/code/game/objects/items/RPD.dm b/code/game/objects/items/RPD.dm index 5b9ec8c74943..523293932963 100644 --- a/code/game/objects/items/RPD.dm +++ b/code/game/objects/items/RPD.dm @@ -467,7 +467,7 @@ GLOBAL_LIST_INIT(fluid_duct_recipes, list( P.update() P.add_fingerprint(usr) - P.setPipingLayer(piping_layer) + P.set_piping_layer(piping_layer) if(findtext("[queued_p_type]", "/obj/machinery/atmospherics/pipe") && !findtext("[queued_p_type]", "layer_manifold")) P.add_atom_colour(GLOB.pipe_paint_colors[paint_color], FIXED_COLOUR_PRIORITY) if(mode&WRENCH_MODE) diff --git a/code/game/objects/items/chrono_eraser.dm b/code/game/objects/items/chrono_eraser.dm index a11921c19de2..3095d7a3cd7d 100644 --- a/code/game/objects/items/chrono_eraser.dm +++ b/code/game/objects/items/chrono_eraser.dm @@ -253,12 +253,18 @@ return BULLET_ACT_HIT /obj/structure/chrono_field/assume_air() - return 0 + return null + +/obj/effect/chrono_field/assume_air_moles() + return null + +/obj/effect/chrono_field/assume_air_ratio() + return null /obj/structure/chrono_field/return_air() //we always have nominal air and temperature var/datum/gas_mixture/GM = new - GM.set_moles(/datum/gas/oxygen, MOLES_O2STANDARD) - GM.set_moles(/datum/gas/nitrogen, MOLES_N2STANDARD) + GM.set_moles(GAS_O2, MOLES_O2STANDARD) + GM.set_moles(GAS_N2, MOLES_N2STANDARD) GM.set_temperature(T20C) return GM diff --git a/code/game/objects/items/devices/PDA/PDA.dm b/code/game/objects/items/devices/PDA/PDA.dm index 51edcb5d3e2f..2b184cbf362b 100644 --- a/code/game/objects/items/devices/PDA/PDA.dm +++ b/code/game/objects/items/devices/PDA/PDA.dm @@ -410,14 +410,13 @@ GLOBAL_LIST_EMPTY(PDAs) if (3) dat += "

[PDAIMG(atmos)] Atmospheric Readings

" - var/turf/T = user.loc - if (isnull(T)) + if (!isopenturf(get_turf(user))) dat += "Unable to obtain a reading.
" else - var/datum/gas_mixture/environment = T.return_air() + var/datum/gas_mixture/environment = user.return_air() - var/pressure = environment.return_pressure() - var/total_moles = environment.total_moles() + var/pressure = environment?.return_pressure() + var/total_moles = environment?.total_moles() dat += "Air Pressure: [round(pressure,0.1)] kPa
" @@ -425,7 +424,7 @@ GLOBAL_LIST_EMPTY(PDAs) for(var/id in environment.get_gases()) var/gas_level = environment.get_moles(id)/total_moles if(gas_level > 0) - dat += "[GLOB.meta_gas_info[id][META_GAS_NAME]]: [round(gas_level*100, 0.01)]%
" + dat += "[GLOB.gas_data.names[id]]: [round(gas_level*100, 0.01)]%
" dat += "Temperature: [round(environment.return_temperature()-T0C)]°C
" dat += "
" diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm index 7d32ab02180d..7b7e66a7769a 100644 --- a/code/game/objects/items/devices/scanners.dm +++ b/code/game/objects/items/devices/scanners.dm @@ -623,11 +623,14 @@ GENE SCANNER if (user.stat || user.eye_blind) return - var/turf/location = user.loc - if(!istype(location)) + if(!isopenturf(get_turf(user))) return - var/datum/gas_mixture/environment = location.return_air() + var/datum/gas_mixture/environment = user.return_air() + + if(!environment) + to_chat(user, span_info("No air detected.")) + return var/pressure = environment.return_pressure() var/total_moles = environment.total_moles() @@ -638,36 +641,36 @@ GENE SCANNER else combined_msg += span_alert("Pressure: [round(pressure, 0.01)] kPa") if(total_moles) - var/o2_concentration = environment.get_moles(/datum/gas/oxygen)/total_moles - var/n2_concentration = environment.get_moles(/datum/gas/nitrogen)/total_moles - var/co2_concentration = environment.get_moles(/datum/gas/carbon_dioxide)/total_moles - var/plasma_concentration = environment.get_moles(/datum/gas/plasma)/total_moles + var/o2_concentration = environment.get_moles(GAS_O2)/total_moles + var/n2_concentration = environment.get_moles(GAS_N2)/total_moles + var/co2_concentration = environment.get_moles(GAS_CO2)/total_moles + var/plasma_concentration = environment.get_moles(GAS_PLASMA)/total_moles if(abs(n2_concentration - N2STANDARD) < 20) - combined_msg += span_info("Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/nitrogen), 0.01)] mol)") + combined_msg += span_info("Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(environment.get_moles(GAS_N2), 0.01)] mol)") else - combined_msg += span_alert("Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/nitrogen), 0.01)] mol)") + combined_msg += span_alert("Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(environment.get_moles(GAS_N2), 0.01)] mol)") if(abs(o2_concentration - O2STANDARD) < 2) - combined_msg += span_info("Oxygen: [round(o2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/oxygen), 0.01)] mol)") + combined_msg += span_info("Oxygen: [round(o2_concentration*100, 0.01)] % ([round(environment.get_moles(GAS_O2), 0.01)] mol)") else - combined_msg += span_alert("Oxygen: [round(o2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/oxygen), 0.01)] mol)") + combined_msg += span_alert("Oxygen: [round(o2_concentration*100, 0.01)] % ([round(environment.get_moles(GAS_O2), 0.01)] mol)") if(co2_concentration > 0.01) - combined_msg += span_alert("CO2: [round(co2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/carbon_dioxide), 0.01)] mol)") + combined_msg += span_alert("CO2: [round(co2_concentration*100, 0.01)] % ([round(environment.get_moles(GAS_CO2), 0.01)] mol)") else - combined_msg += span_info("CO2: [round(co2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/carbon_dioxide), 0.01)] mol)") + combined_msg += span_info("CO2: [round(co2_concentration*100, 0.01)] % ([round(environment.get_moles(GAS_CO2), 0.01)] mol)") if(plasma_concentration > 0.005) - combined_msg += span_alert("Plasma: [round(plasma_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/plasma), 0.01)] mol)") + combined_msg += span_alert("Plasma: [round(plasma_concentration*100, 0.01)] % ([round(environment.get_moles(GAS_PLASMA), 0.01)] mol)") else - combined_msg += span_info("Plasma: [round(plasma_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/plasma), 0.01)] mol)") + combined_msg += span_info("Plasma: [round(plasma_concentration*100, 0.01)] % ([round(environment.get_moles(GAS_PLASMA), 0.01)] mol)") for(var/id in environment.get_gases()) if(id in GLOB.hardcoded_gases) continue var/gas_concentration = environment.get_moles(id)/total_moles - combined_msg += span_alert("[GLOB.meta_gas_info[id][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] % ([round(environment.get_moles(id), 0.01)] mol)") + combined_msg += span_alert("[GLOB.gas_data.names[id]]: [round(gas_concentration*100, 0.01)] % ([round(environment.get_moles(id), 0.01)] mol)") combined_msg += span_info("Temperature: [round(environment.return_temperature()-T0C, 0.01)] °C ([round(environment.return_temperature(), 0.01)] K)") to_chat(user, examine_block(combined_msg.Join("\n"))) @@ -764,7 +767,7 @@ GENE SCANNER for(var/id in air_contents.get_gases()) var/gas_concentration = air_contents.get_moles(id)/total_moles - combined_msg += span_notice("[GLOB.meta_gas_info[id][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] % ([round(air_contents.get_moles(id), 0.01)] mol)") + combined_msg += span_notice("[GLOB.gas_data.names[id]]: [round(gas_concentration*100, 0.01)] % ([round(air_contents.get_moles(id), 0.01)] mol)") combined_msg += span_notice("Temperature: [round(temperature - T0C,0.01)] °C ([round(temperature, 0.01)] K)") else diff --git a/code/game/objects/items/devices/transfer_valve.dm b/code/game/objects/items/devices/transfer_valve.dm index 8848dd0e2f28..7a195a99be79 100644 --- a/code/game/objects/items/devices/transfer_valve.dm +++ b/code/game/objects/items/devices/transfer_valve.dm @@ -130,22 +130,17 @@ target_self = TRUE if(change_volume) if(!target_self) - target.set_volume(target.return_volume() + tank_two.air_contents.return_volume()) + target.set_volume(target.return_volume() + tank_two.volume) target.set_volume(target.return_volume() + tank_one.air_contents.return_volume()) - var/datum/gas_mixture/temp - temp = tank_one.air_contents.remove_ratio(1) - target.merge(temp) + tank_one.air_contents.transfer_ratio_to(target, 1) if(!target_self) - temp = tank_two.air_contents.remove_ratio(1) - target.merge(temp) + tank_two.air_contents.transfer_ratio_to(target, 1) /obj/item/transfer_valve/proc/split_gases() if (!valve_open || !tank_one || !tank_two) return var/ratio1 = tank_one.air_contents.return_volume()/tank_two.air_contents.return_volume() - var/datum/gas_mixture/temp - temp = tank_two.air_contents.remove_ratio(ratio1) - tank_one.air_contents.merge(temp) + tank_two.air_contents.transfer_ratio_to(tank_one.air_contents, ratio1) tank_two.air_contents.set_volume(tank_two.air_contents.return_volume() - tank_one.air_contents.return_volume()) /* diff --git a/code/game/objects/items/flamethrower.dm b/code/game/objects/items/flamethrower.dm index 1ef10bf9a414..1d49b434522e 100644 --- a/code/game/objects/items/flamethrower.dm +++ b/code/game/objects/items/flamethrower.dm @@ -205,27 +205,27 @@ var/datum/gas_mixture/fuel_mix = ptank.air_contents.remove_ratio(ratio_removed) // Return of the stimball flamethrower, wear radiation protection when using this or you're just as likely to die as your target - if(fuel_mix.get_moles(/datum/gas/plasma) >= NITRO_BALL_MOLES_REQUIRED && fuel_mix.get_moles(/datum/gas/nitrium) >= NITRO_BALL_MOLES_REQUIRED && fuel_mix.get_moles(/datum/gas/pluoxium) >= NITRO_BALL_MOLES_REQUIRED) - var/balls_shot = round(min(fuel_mix.get_moles(/datum/gas/nitrium), fuel_mix.get_moles(/datum/gas/pluoxium), NITRO_BALL_MAX_REACT_RATE / NITRO_BALL_MOLES_REQUIRED)) + if(fuel_mix.get_moles(GAS_PLASMA) >= NITRO_BALL_MOLES_REQUIRED && fuel_mix.get_moles(GAS_NITRIUM) >= NITRO_BALL_MOLES_REQUIRED && fuel_mix.get_moles(GAS_PLUOXIUM) >= NITRO_BALL_MOLES_REQUIRED) + var/balls_shot = round(min(fuel_mix.get_moles(GAS_NITRIUM), fuel_mix.get_moles(GAS_PLUOXIUM), NITRO_BALL_MAX_REACT_RATE / NITRO_BALL_MOLES_REQUIRED)) var/angular_increment = 360/balls_shot var/random_starting_angle = rand(0,360) for(var/i in 1 to balls_shot) target.fire_nuclear_particle((i*angular_increment+random_starting_angle)) - fuel_mix.adjust_moles(/datum/gas/plasma, -balls_shot * NITRO_BALL_MOLES_REQUIRED) // No free extra damage for you, conservation of mass go brrrrr + fuel_mix.adjust_moles(GAS_PLASMA, -balls_shot * NITRO_BALL_MOLES_REQUIRED) // No free extra damage for you, conservation of mass go brrrrr // Funny rad flamethrower go brrr - if(fuel_mix.get_moles(/datum/gas/tritium)) // Tritium fires cause a bit of radiation - radiation_pulse(target, min(fuel_mix.get_moles(/datum/gas/tritium), fuel_mix.get_moles(/datum/gas/oxygen)/2) * FIRE_HYDROGEN_ENERGY_RELEASED / TRITIUM_BURN_RADIOACTIVITY_FACTOR) + if(fuel_mix.get_moles(GAS_TRITIUM)) // Tritium fires cause a bit of radiation + radiation_pulse(target, min(fuel_mix.get_moles(GAS_TRITIUM), fuel_mix.get_moles(GAS_O2)/2) * FIRE_HYDROGEN_ENERGY_RELEASED / TRITIUM_BURN_RADIOACTIVITY_FACTOR) // 8 damage at 0.5 mole transfer or ~17 kPa release pressure // 16 damage at 1 mole transfer or ~35 kPa release pressure - var/damage = fuel_mix.get_moles(/datum/gas/plasma) * 16 + var/damage = fuel_mix.get_moles(GAS_PLASMA) * 16 // harder to achieve than plasma - damage += fuel_mix.get_moles(/datum/gas/tritium) * 24 // Lower damage than hydrogen, causes minor radiation - damage += fuel_mix.get_moles(/datum/gas/hydrogen) * 32 + damage += fuel_mix.get_moles(GAS_TRITIUM) * 24 // Lower damage than hydrogen, causes minor radiation + damage += fuel_mix.get_moles(GAS_H2) * 32 // Maximum damage restricted by the available oxygen, with a hard cap at 16 var/datum/gas_mixture/turf_air = target.return_air() - damage = min(damage, turf_air.get_moles(/datum/gas/oxygen) + fuel_mix.get_moles(/datum/gas/oxygen), max_damage) // capped by combined oxygen in the fuel mix and enviroment + damage = min(damage, turf_air.get_moles(GAS_O2) + fuel_mix.get_moles(GAS_O2), max_damage) // capped by combined oxygen in the fuel mix and enviroment // If there's not enough fuel and/or oxygen to do more than 1 damage, shut itself off if(damage < 1) diff --git a/code/game/objects/items/grenades/atmos_grenades.dm b/code/game/objects/items/grenades/atmos_grenades.dm index 27d8c8eda24c..0df6b3d6a9d7 100644 --- a/code/game/objects/items/grenades/atmos_grenades.dm +++ b/code/game/objects/items/grenades/atmos_grenades.dm @@ -44,9 +44,8 @@ if(floor_loc.air.return_temperature() > 370) floor_loc.atmos_spawn_air("n2=[gas_amount / distance_from_center];TEMP=30") floor_loc.MakeSlippery(TURF_WET_PERMAFROST, (5 / distance_from_center) MINUTES) - if(floor_loc.air.get_gases(/datum/gas/plasma)) - floor_loc.air.adjust_moles(/datum/gas/plasma, -(floor_loc.air.get_moles(/datum/gas/plasma) * 0.5 / distance_from_center)) - floor_loc.air_update_turf() + if(floor_loc.air.get_gases(GAS_PLASMA)) + floor_loc.air.adjust_moles(GAS_PLASMA, -(floor_loc.air.get_moles(GAS_PLASMA) * 0.5 / distance_from_center)) for(var/mob/living/carbon/live_mob in turf_loc) live_mob.adjustStaminaLoss(stamina_damage / distance_from_center) live_mob.adjust_bodytemperature(-150 / distance_from_center) diff --git a/code/game/objects/items/melee/misc.dm b/code/game/objects/items/melee/misc.dm index da1f73bfdd5b..4a3f74dea584 100644 --- a/code/game/objects/items/melee/misc.dm +++ b/code/game/objects/items/melee/misc.dm @@ -626,7 +626,6 @@ T.visible_message(span_danger("[T] smacks into [src] and rapidly flashes to ash."),\ span_italics("You hear a loud crack as you are washed with a wave of heat.")) shard.Consume() - CALCULATE_ADJACENT_TURFS(T) /obj/item/melee/supermatter_sword/add_blood_DNA(list/blood_dna) return FALSE diff --git a/code/game/objects/items/powerfist.dm b/code/game/objects/items/powerfist.dm index 820d75f92d07..d76085808c99 100644 --- a/code/game/objects/items/powerfist.dm +++ b/code/game/objects/items/powerfist.dm @@ -97,7 +97,6 @@ if(!T) return T.assume_air(gasused) - T.air_update_turf() if(!gasused) to_chat(user, span_warning("\The [src]'s tank is empty!")) do_attack(user, target, force / 5) diff --git a/code/game/objects/items/tanks/jetpack.dm b/code/game/objects/items/tanks/jetpack.dm index 53ead5abe5ef..d33469f42132 100644 --- a/code/game/objects/items/tanks/jetpack.dm +++ b/code/game/objects/items/tanks/jetpack.dm @@ -9,7 +9,7 @@ distribute_pressure = ONE_ATMOSPHERE * O2STANDARD actions_types = list(/datum/action/item_action/set_internals, /datum/action/item_action/toggle_jetpack, /datum/action/item_action/jetpack_stabilization) cryo_preserve = TRUE - var/gas_type = /datum/gas/oxygen + var/gas_type = GAS_O2 var/on = FALSE var/stabilizers = FALSE var/full_speed = TRUE // If the jetpack will have a speedboost in space/nograv or not @@ -90,13 +90,7 @@ turn_off(user) return - var/datum/gas_mixture/removed = air_contents.remove(num) - if(removed.total_moles() < 0.005) - turn_off(user) - return - - var/turf/T = get_turf(user) - T.assume_air(removed) + assume_air_moles(air_contents, num) return TRUE @@ -129,13 +123,7 @@ turn_off(user) return - var/datum/gas_mixture/removed = air_contents.remove(num) - if(removed.total_moles() < 0.005) - turn_off(user) - return - - var/turf/T = get_turf(user) - T.assume_air(removed) + assume_air_moles(air_contents, num) return TRUE @@ -185,7 +173,7 @@ icon_state = "jetpack-black" item_state = "jetpack-black" distribute_pressure = 0 - gas_type = /datum/gas/carbon_dioxide + gas_type = GAS_CO2 /obj/item/tank/jetpack/suit diff --git a/code/game/objects/items/tanks/tank_types.dm b/code/game/objects/items/tanks/tank_types.dm index cd72c64e4858..b6c02c3494ca 100644 --- a/code/game/objects/items/tanks/tank_types.dm +++ b/code/game/objects/items/tanks/tank_types.dm @@ -30,7 +30,7 @@ /obj/item/tank/internals/oxygen/populate_gas() - air_contents.set_moles(/datum/gas/oxygen, (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)) + air_contents.set_moles(GAS_O2, (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)) /obj/item/tank/internals/oxygen/yellow @@ -62,8 +62,8 @@ force = 10 /obj/item/tank/internals/anesthetic/populate_gas() - air_contents.set_moles(/datum/gas/oxygen, (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD) - air_contents.set_moles(/datum/gas/nitrous_oxide, (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD) + air_contents.set_moles(GAS_O2, (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD) + air_contents.set_moles(GAS_NITROUS, (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD) /* * Air @@ -77,8 +77,8 @@ dog_fashion = /datum/dog_fashion/back /obj/item/tank/internals/air/populate_gas() - air_contents.set_moles(/datum/gas/oxygen, (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD) - air_contents.set_moles(/datum/gas/nitrogen, (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD) + air_contents.set_moles(GAS_O2, (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD) + air_contents.set_moles(GAS_N2, (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD) /* * Plasma @@ -94,7 +94,7 @@ /obj/item/tank/internals/plasma/populate_gas() - air_contents.set_moles(/datum/gas/plasma, (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)) + air_contents.set_moles(GAS_PLASMA, (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)) /obj/item/tank/internals/plasma/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/flamethrower)) @@ -110,7 +110,7 @@ return ..() /obj/item/tank/internals/plasma/full/populate_gas() - air_contents.set_moles(/datum/gas/plasma, (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)) + air_contents.set_moles(GAS_PLASMA, (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)) /obj/item/tank/internals/plasma/empty/populate_gas() return @@ -128,10 +128,10 @@ distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE /obj/item/tank/internals/plasmaman/populate_gas() - air_contents.set_moles(/datum/gas/plasma, (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)) + air_contents.set_moles(GAS_PLASMA, (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)) /obj/item/tank/internals/plasmaman/full/populate_gas() - air_contents.set_moles(/datum/gas/plasma, (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)) + air_contents.set_moles(GAS_PLASMA, (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)) /obj/item/tank/internals/plasmaman/belt @@ -143,7 +143,7 @@ w_class = WEIGHT_CLASS_SMALL //thanks i forgot this /obj/item/tank/internals/plasmaman/belt/full/populate_gas() - air_contents.set_moles(/datum/gas/plasma, (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)) + air_contents.set_moles(GAS_PLASMA, (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)) /obj/item/tank/internals/plasmaman/belt/empty/populate_gas() return @@ -166,7 +166,7 @@ /obj/item/tank/internals/emergency_oxygen/populate_gas() - air_contents.set_moles(/datum/gas/oxygen, (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)) + air_contents.set_moles(GAS_O2, (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C)) /obj/item/tank/internals/emergency_oxygen/empty/populate_gas() @@ -200,7 +200,7 @@ distribute_pressure = 8 /obj/item/tank/internals/ipc_coolant/populate_gas() - air_contents.set_moles(/datum/gas/nitrogen, (10 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * (T0C - 50))) + air_contents.set_moles(GAS_N2, (10 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * (T0C - 50))) air_contents.set_temperature(T0C - 50) /obj/item/tank/internals/ipc_coolant/empty/populate_gas() diff --git a/code/game/objects/items/tanks/tanks.dm b/code/game/objects/items/tanks/tanks.dm index 8816fec2a7d7..41483a0b7a6f 100644 --- a/code/game/objects/items/tanks/tanks.dm +++ b/code/game/objects/items/tanks/tanks.dm @@ -138,7 +138,6 @@ var/turf/T = get_turf(src) if(T) T.assume_air(air_contents) - air_update_turf() playsound(src.loc, 'sound/effects/spray.ogg', 10, 1, -3) qdel(src) @@ -230,6 +229,9 @@ /obj/item/tank/remove_air(amount) return air_contents.remove(amount) +/obj/item/tank/remove_air_ratio(ratio) + return air_contents.remove_ratio(ratio) + /obj/item/tank/return_air() return air_contents @@ -242,6 +244,18 @@ check_status() return 1 +/obj/item/tank/assume_air_moles(datum/gas_mixture/giver, moles) + giver.transfer_to(air_contents, moles) + + check_status() + return TRUE + +/obj/item/tank/assume_air_ratio(datum/gas_mixture/giver, ratio) + giver.transfer_ratio_to(air_contents, ratio) + + check_status() + return TRUE + /obj/item/tank/proc/remove_air_volume(volume_to_return) if(!air_contents) return null @@ -417,7 +431,7 @@ update_appearance(UPDATE_ICON) /obj/item/tank/proc/ignite() //This happens when a bomb is told to explode - var/fuel_moles = air_contents.get_moles(/datum/gas/tritium) + air_contents.get_moles(/datum/gas/hydrogen) + air_contents.get_moles(/datum/gas/plasma) + air_contents.get_moles(/datum/gas/oxygen)/6 + var/fuel_moles = air_contents.get_moles(GAS_TRITIUM) + air_contents.get_moles(GAS_H2) + air_contents.get_moles(GAS_PLASMA) + air_contents.get_moles(GAS_O2)/6 var/datum/gas_mixture/bomb_mixture = air_contents.copy() var/strength = 1 @@ -464,12 +478,9 @@ ground_zero.assume_air(bomb_mixture) ground_zero.hotspot_expose(1000, 125) - ground_zero.air_update_turf() - /obj/item/tank/proc/release() //This happens when the bomb is not welded. Tank contents are just spat out. var/datum/gas_mixture/removed = air_contents.remove(air_contents.total_moles()) var/turf/T = get_turf(src) if(!T) return T.assume_air(removed) - air_update_turf() diff --git a/code/game/objects/objs.dm b/code/game/objects/objs.dm index 13fa98a11173..1da9c19201fc 100644 --- a/code/game/objects/objs.dm +++ b/code/game/objects/objs.dm @@ -102,17 +102,39 @@ else return null +/obj/assume_air_moles(datum/gas_mixture/giver, moles) + if(loc) + return loc.assume_air_moles(giver, moles) + return null + +/obj/assume_air_ratio(datum/gas_mixture/giver, ratio) + if(loc) + return loc.assume_air_ratio(giver, ratio) + return null +/obj/transfer_air(datum/gas_mixture/taker, moles) + if(loc) + return loc.transfer_air(taker, moles) + return null + +/obj/transfer_air_ratio(datum/gas_mixture/taker, ratio) + if(loc) + return loc.transfer_air_ratio(taker, ratio) + return null + /obj/remove_air(amount) if(loc) return loc.remove_air(amount) - else - return null + return null + +/obj/remove_air_ratio(ratio) + if(loc) + return loc.remove_air_ratio(ratio) + return null /obj/return_air() if(loc) return loc.return_air() - else - return null + return null /obj/proc/handle_internal_lifeform(mob/lifeform_inside_me, breath_request) //Return: (NONSTANDARD) @@ -122,8 +144,7 @@ if(breath_request>0) var/datum/gas_mixture/environment = return_air() - var/breath_percentage = BREATH_VOLUME / environment.return_volume() - return remove_air(environment.total_moles() * breath_percentage) + return remove_air_ratio(BREATH_VOLUME / environment.return_volume()) else return null diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm index f8dc7141cdba..8837107f9cb7 100644 --- a/code/game/objects/structures/aliens.dm +++ b/code/game/objects/structures/aliens.dm @@ -66,7 +66,7 @@ /obj/structure/alien/resin/Initialize(mapload) . = ..() - air_update_turf(TRUE) + air_update_turf() /obj/structure/alien/resin/Move() var/turf/T = loc @@ -81,7 +81,7 @@ resintype = "wall" canSmoothWith = list(/obj/structure/alien/resin/wall, /obj/structure/alien/resin/membrane) -/obj/structure/alien/resin/wall/BlockSuperconductivity() +/obj/structure/alien/resin/wall/BlockThermalConductivity() return 1 /obj/structure/alien/resin/membrane diff --git a/code/game/objects/structures/crates_lockers/closets.dm b/code/game/objects/structures/crates_lockers/closets.dm index 6aefe0e9fb8e..e0b28c32f251 100644 --- a/code/game/objects/structures/crates_lockers/closets.dm +++ b/code/game/objects/structures/crates_lockers/closets.dm @@ -625,7 +625,6 @@ GLOBAL_LIST_EMPTY(lockers) var/remove_amount = (loc_air.total_moles() + air_contents.total_moles()) * air_contents.return_volume() / (loc_air.return_volume() + air_contents.return_volume()) loc.assume_air(air_contents) loc.remove_air(remove_amount) - loc.air_update_turf() air_contents = null /obj/structure/closet/return_air() diff --git a/code/game/objects/structures/crates_lockers/closets/bodybag.dm b/code/game/objects/structures/crates_lockers/closets/bodybag.dm index 63fdda6bd680..536d10fe4b5c 100644 --- a/code/game/objects/structures/crates_lockers/closets/bodybag.dm +++ b/code/game/objects/structures/crates_lockers/closets/bodybag.dm @@ -336,8 +336,8 @@ air_contents = null air_contents = new(50) // liters air_contents.set_temperature(T20C) - air_contents.set_moles(/datum/gas/oxygen, (ONE_ATMOSPHERE*50)/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD) - air_contents.set_moles(/datum/gas/nitrous_oxide, (ONE_ATMOSPHERE*50)/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD) + air_contents.set_moles(GAS_O2, (ONE_ATMOSPHERE*50)/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD) + air_contents.set_moles(GAS_NITROUS, (ONE_ATMOSPHERE*50)/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD) /obj/structure/closet/body_bag/environmental/prisoner/syndicate/Destroy() STOP_PROCESSING(SSobj, src) diff --git a/code/game/objects/structures/crates_lockers/crates/critter.dm b/code/game/objects/structures/crates_lockers/crates/critter.dm index c376d57616fa..6b3f7269f587 100644 --- a/code/game/objects/structures/crates_lockers/crates/critter.dm +++ b/code/game/objects/structures/crates_lockers/crates/critter.dm @@ -39,7 +39,7 @@ if(tank) return tank.air_contents else - return loc.return_air() + return loc?.return_air() /obj/structure/closet/crate/critter/return_analyzable_air() if(tank) diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm index 96f9f9f91983..3ca29103d44a 100644 --- a/code/game/objects/structures/false_walls.dm +++ b/code/game/objects/structures/false_walls.dm @@ -35,7 +35,7 @@ /obj/structure/falsewall/Initialize(mapload) . = ..() - air_update_turf(TRUE) + air_update_turf() /obj/structure/falsewall/ratvar_act() new /obj/structure/falsewall/brass(loc) @@ -68,7 +68,7 @@ set_opacity(density) opening = FALSE update_appearance(UPDATE_ICON) - air_update_turf(TRUE) + air_update_turf() /obj/structure/falsewall/update_icon_state() . = ..() diff --git a/code/game/objects/structures/holosign.dm b/code/game/objects/structures/holosign.dm index 4765c9a98f12..828568c9f071 100644 --- a/code/game/objects/structures/holosign.dm +++ b/code/game/objects/structures/holosign.dm @@ -134,7 +134,7 @@ /obj/structure/holosign/barrier/atmos/Initialize(mapload) . = ..() - air_update_turf(TRUE) + air_update_turf() /obj/structure/holosign/barrier/cyborg name = "Energy Field" diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm index 67204afc2eeb..c05798db10ab 100644 --- a/code/game/objects/structures/mineral_doors.dm +++ b/code/game/objects/structures/mineral_doors.dm @@ -29,7 +29,7 @@ /obj/structure/mineral_door/Initialize(mapload) . = ..() - air_update_turf(TRUE) + air_update_turf() /obj/structure/mineral_door/Move() var/turf/T = loc @@ -94,7 +94,7 @@ density = FALSE door_opened = TRUE layer = OPEN_DOOR_LAYER - air_update_turf(1) + air_update_turf() update_appearance(UPDATE_ICON) isSwitchingStates = FALSE @@ -115,7 +115,7 @@ set_opacity(TRUE) door_opened = FALSE layer = initial(layer) - air_update_turf(1) + air_update_turf() update_appearance(UPDATE_ICON) isSwitchingStates = FALSE @@ -134,7 +134,7 @@ /obj/structure/mineral_door/setAnchored(anchorvalue) //called in default_unfasten_wrench() chain . = ..() set_opacity(anchored ? !door_opened : FALSE) - air_update_turf(TRUE) + air_update_turf() /obj/structure/mineral_door/wrench_act(mob/living/user, obj/item/I) default_unfasten_wrench(user, I, 40) diff --git a/code/game/objects/structures/plasticflaps.dm b/code/game/objects/structures/plasticflaps.dm index a47afc12f122..5a4394975542 100644 --- a/code/game/objects/structures/plasticflaps.dm +++ b/code/game/objects/structures/plasticflaps.dm @@ -103,10 +103,10 @@ /obj/structure/plasticflaps/Initialize(mapload) . = ..() - air_update_turf(TRUE) + air_update_turf() /obj/structure/plasticflaps/Destroy() var/atom/oldloc = loc . = ..() if (oldloc) - oldloc.air_update_turf(1) + oldloc.air_update_turf() diff --git a/code/game/objects/structures/railings.dm b/code/game/objects/structures/railings.dm index 3b33ffcc7404..728282c02ca5 100644 --- a/code/game/objects/structures/railings.dm +++ b/code/game/objects/structures/railings.dm @@ -110,6 +110,5 @@ return TRUE /obj/structure/railing/proc/after_rotation(mob/user,rotation_type) - air_update_turf(1) ini_dir = dir add_fingerprint(user) diff --git a/code/game/objects/structures/transit_tubes/station.dm b/code/game/objects/structures/transit_tubes/station.dm index 96b932d81924..bf336c208e80 100644 --- a/code/game/objects/structures/transit_tubes/station.dm +++ b/code/game/objects/structures/transit_tubes/station.dm @@ -177,11 +177,9 @@ sleep(OPEN_DURATION + 0.2 SECONDS) pod_moving = FALSE if(!QDELETED(pod)) - var/datum/gas_mixture/floor_mixture = loc.return_air() - floor_mixture.archive() - pod.air_contents.archive() - pod.air_contents.share(floor_mixture, 1) //mix the pod's gas mixture with the tile it's on - air_update_turf() + var/datum/gas_mixture/floor_mixture = loc?.return_air() + if(floor_mixture) + equalize_all_gases_in_list(list(pod.air_contents,floor_mixture)) /obj/structure/transit_tube/station/init_tube_dirs() switch(dir) 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 843b93e57cc0..2b8c1f72a377 100644 --- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm +++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm @@ -10,8 +10,8 @@ /obj/structure/transit_tube_pod/Initialize(mapload) . = ..() - air_contents.set_moles(/datum/gas/oxygen, MOLES_O2STANDARD) - air_contents.set_moles(/datum/gas/nitrogen, MOLES_N2STANDARD) + air_contents.set_moles(GAS_O2, MOLES_O2STANDARD) + air_contents.set_moles(GAS_N2, MOLES_N2STANDARD) air_contents.set_temperature(T20C) @@ -166,9 +166,24 @@ /obj/structure/transit_tube_pod/assume_air(datum/gas_mixture/giver) return air_contents.merge(giver) +/obj/structure/transit_tube_pod/assume_air_moles(datum/gas_mixture/giver, moles) + return giver.transfer_to(air_contents, moles) + +/obj/structure/transit_tube_pod/assume_air_ratio(datum/gas_mixture/giver, ratio) + return giver.transfer_ratio_to(air_contents, ratio) + /obj/structure/transit_tube_pod/remove_air(amount) return air_contents.remove(amount) +/obj/structure/transit_tube_pod/remove_air_ratio(ratio) + return air_contents.remove_ratio(ratio) + +/obj/structure/transit_tube_pod/transfer_air(datum/gas_mixture/taker, moles) + return air_contents.transfer_to(taker, moles) + +/obj/structure/transit_tube_pod/transfer_air_ratio(datum/gas_mixture/taker, ratio) + return air_contents.transfer_ratio_to(taker, ratio) + /obj/structure/transit_tube_pod/relaymove(mob/mob, direction) if(istype(mob) && mob.client) if(!moving) diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm index 5f5c415a1589..aabd13e23356 100644 --- a/code/game/objects/structures/windoor_assembly.dm +++ b/code/game/objects/structures/windoor_assembly.dm @@ -34,11 +34,11 @@ if(set_dir) setDir(set_dir) ini_dir = dir - air_update_turf(1) + air_update_turf() /obj/structure/windoor_assembly/Destroy() density = FALSE - air_update_turf(1) + air_update_turf() return ..() /obj/structure/windoor_assembly/Move() diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm index 587c4746861c..d4a01fd2a175 100644 --- a/code/game/objects/structures/window.dm +++ b/code/game/objects/structures/window.dm @@ -55,7 +55,7 @@ state = RWINDOW_SECURE ini_dir = dir - air_update_turf(1) + air_update_turf() if(fulltile) setDir() @@ -219,7 +219,7 @@ /obj/structure/window/setAnchored(anchorvalue) ..() - air_update_turf(TRUE) + air_update_turf() update_nearby_icons() /obj/structure/window/proc/check_state(checked_state) @@ -302,17 +302,16 @@ return TRUE /obj/structure/window/proc/after_rotation(mob/user,rotation_type) - air_update_turf(1) + air_update_turf() ini_dir = dir add_fingerprint(user) /obj/structure/window/Destroy() density = FALSE - air_update_turf(1) + air_update_turf() update_nearby_icons() return ..() - /obj/structure/window/Move() var/turf/T = loc . = ..() @@ -510,6 +509,11 @@ if (fulltile) . += new /obj/item/shard/plasma(location) +/obj/structure/window/plasma/BlockThermalConductivity(opp_dir) + if(!anchored || !density) + return FALSE + return FULLTILE_WINDOW_DIR == dir || dir == opp_dir + /obj/structure/window/plasma/spawner/east dir = EAST diff --git a/code/game/turfs/change_turf.dm b/code/game/turfs/change_turf.dm index 6bc5d80d4385..9c110801ed2a 100644 --- a/code/game/turfs/change_turf.dm +++ b/code/game/turfs/change_turf.dm @@ -14,14 +14,11 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( qdel(thing, force=TRUE) if(turf_type) - var/turf/newT = ChangeTurf(turf_type, baseturf_type, flags) - SSair.remove_from_active(newT) - CALCULATE_ADJACENT_TURFS(newT) - SSair.add_to_active(newT,1) + ChangeTurf(turf_type, baseturf_type, flags) -/turf/proc/copyTurf(turf/T) +/turf/proc/copyTurf(turf/T, copy_air, flags) if(T.type != type) - T.ChangeTurf(type) + T.ChangeTurf(type, null, flags) if(T.icon_state != icon_state) T.icon_state = icon_state if(T.icon != icon) @@ -48,6 +45,14 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( /turf/proc/TerraformTurf(path, new_baseturf, flags) return ChangeTurf(path, new_baseturf, flags) +/turf/proc/get_z_base_turf() + . = SSmapping.level_trait(z, ZTRAIT_BASETURF) || /turf/open/space + if (!ispath(.)) + . = text2path(.) + if (!ispath(.)) + warning("Z-level [z] has invalid baseturf '[SSmapping.level_trait(z, ZTRAIT_BASETURF)]'") + . = /turf/open/space + // Creates a new turf // new_baseturfs can be either a single type or list of types, formated the same as baseturfs. see turf.dm /turf/proc/ChangeTurf(path, list/new_baseturfs, flags) @@ -137,8 +142,10 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( return W /turf/open/ChangeTurf(path, list/new_baseturfs, flags) + //don't + if(!SSair.initialized) + return ..() if ((flags & CHANGETURF_INHERIT_AIR) && ispath(path, /turf/open)) - SSair.remove_from_active(src) var/datum/gas_mixture/stashed_air = new() stashed_air.copy_from(air) . = ..() @@ -154,14 +161,18 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( if (!istype(newTurf.air, /datum/gas_mixture/immutable/space)) QDEL_NULL(newTurf.air) newTurf.air = stashed_air - update_air_ref() - SSair.add_to_active(newTurf) + update_air_ref(planetary_atmos ? 1 : 2) else if(turf_fire) qdel(turf_fire) if(ispath(path,/turf/closed)|| ispath(path,/turf/cordon)) flags |= CHANGETURF_RECALC_ADJACENT - return ..() + update_air_ref(-1) + . = ..() + else + . = ..() + if(!istype(air,/datum/gas_mixture)) + Initalize_Atmos(0) // Take off the top layer turf and replace it with the next baseturf down /turf/proc/ScrapeAway(amount=1, flags) @@ -259,7 +270,7 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( // Copy an existing turf and put it on top // Returns the new turf -/turf/proc/CopyOnTop(turf/copytarget, ignore_bottom=1, depth=INFINITY, copy_air = FALSE) +/turf/proc/CopyOnTop(turf/copytarget, ignore_bottom=1, depth=INFINITY, copy_air = FALSE, flags) var/list/new_baseturfs = list() new_baseturfs += baseturfs new_baseturfs += type @@ -276,7 +287,7 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( target_baseturfs -= new_baseturfs & GLOB.blacklisted_automated_baseturfs new_baseturfs += target_baseturfs - var/turf/newT = copytarget.copyTurf(src, copy_air) + var/turf/newT = copytarget.copyTurf(src, copy_air, flags) newT.baseturfs = new_baseturfs return newT @@ -284,11 +295,7 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( //If you modify this function, ensure it works correctly with lateloaded map templates. /turf/proc/AfterChange(flags) //called after a turf has been replaced in ChangeTurf() levelupdate() - if(flags & CHANGETURF_RECALC_ADJACENT) - ImmediateCalculateAdjacentTurfs() - else - CALCULATE_ADJACENT_TURFS(src) - SSair.add_to_active(src) + ImmediateCalculateAdjacentTurfs() //update firedoor adjacency var/list/turfs_to_check = get_adjacent_open_turfs(src) | src @@ -322,7 +329,6 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list( total.merge(S.air) air.copy_from(total.remove_ratio(1/turf_count)) - SSair.add_to_active(src) /turf/proc/ReplaceWithLattice() ScrapeToBottom(flags = CHANGETURF_INHERIT_AIR) // Yogs -- fixes this not actually replacing the turf with a lattice, lmao (ScrapeToBottom defined in yogs file) diff --git a/code/game/turfs/closed.dm b/code/game/turfs/closed.dm index 65d94a5a4aeb..114bcd368b51 100644 --- a/code/game/turfs/closed.dm +++ b/code/game/turfs/closed.dm @@ -6,14 +6,9 @@ flags_1 = RAD_PROTECT_CONTENTS_1 | RAD_NO_CONTAMINATE_1 rad_insulation = RAD_MEDIUM_INSULATION -/turf/closed/Initialize(mapload) - . = ..() - update_air_ref() - /turf/closed/AfterChange() . = ..() SSair.high_pressure_delta -= src - update_air_ref() /turf/closed/get_smooth_underlay_icon(mutable_appearance/underlay_appearance, turf/asking_turf, adjacency_dir) return FALSE diff --git a/code/game/turfs/open.dm b/code/game/turfs/open.dm index affcf0cd9e5d..82203455e9de 100644 --- a/code/game/turfs/open.dm +++ b/code/game/turfs/open.dm @@ -487,18 +487,12 @@ icon_state = "info" /turf/open/Initalize_Atmos(times_fired) - set_excited(FALSE) - update_visuals() - - current_cycle = times_fired + if(!blocks_air) + if(!istype(air,/datum/gas_mixture/turf)) + air = new(2500,src) + air.copy_from_turf(src) + update_air_ref(planetary_atmos ? 1 : 2) ImmediateCalculateAdjacentTurfs() - for(var/i in atmos_adjacent_turfs) - var/turf/open/enemy_tile = i - var/datum/gas_mixture/enemy_air = enemy_tile.return_air() - if(!get_excited() && air.compare(enemy_air)) - //testing("Active turf found. Return value of compare(): [is_active]") - set_excited(TRUE) - SSair.active_turfs |= src /turf/open/proc/GetHeatCapacity() . = air.heat_capacity() @@ -508,7 +502,6 @@ /turf/open/proc/TakeTemperature(temp) air.set_temperature(air.return_temperature() + temp) - air_update_turf() /turf/open/proc/freeze_turf() for(var/obj/I in contents) @@ -592,20 +585,18 @@ /turf/open/rad_act(pulse_strength, collectable_radiation) . = ..() - if (air.get_moles(/datum/gas/carbon_dioxide) && air.get_moles(/datum/gas/oxygen) && !(air.get_moles(/datum/gas/hypernoblium)>=REACTION_OPPRESSION_THRESHOLD)) - pulse_strength = min(pulse_strength,air.get_moles(/datum/gas/carbon_dioxide)*1000,air.get_moles(/datum/gas/oxygen)*2000) //Ensures matter is conserved properly - air.set_moles(/datum/gas/carbon_dioxide, max(air.get_moles(/datum/gas/carbon_dioxide)-(pulse_strength * 0.001),0)) - air.set_moles(/datum/gas/oxygen, max(air.get_moles(/datum/gas/oxygen)-(pulse_strength * 0.002),0)) - air.adjust_moles(/datum/gas/pluoxium, pulse_strength * 0.004) - air_update_turf() - if (air.get_moles(/datum/gas/hydrogen) && !(air.get_moles(/datum/gas/hypernoblium)>=REACTION_OPPRESSION_THRESHOLD)) - pulse_strength = min(pulse_strength, air.get_moles(/datum/gas/hydrogen) * 1000) - air.set_moles(/datum/gas/hydrogen, max(air.get_moles(/datum/gas/hydrogen) - (pulse_strength * 0.001), 0)) - air.adjust_moles(/datum/gas/tritium, pulse_strength * 0.001) - air_update_turf() + if (air.get_moles(GAS_CO2) && air.get_moles(GAS_O2) && !(air.get_moles(GAS_HYPERNOB) >= REACTION_OPPRESSION_THRESHOLD) ) + pulse_strength = min(pulse_strength,air.get_moles(GAS_CO2)*1000,air.get_moles(GAS_O2)*2000) //Ensures matter is conserved properly + air.set_moles(GAS_CO2, max(air.get_moles(GAS_CO2)-(pulse_strength * 0.001),0)) + air.set_moles(GAS_O2, max(air.get_moles(GAS_O2)-(pulse_strength * 0.002),0)) + air.adjust_moles(GAS_PLUOXIUM, pulse_strength * 0.004) + if (air.get_moles(GAS_H2) && !(air.get_moles(GAS_HYPERNOB) >= REACTION_OPPRESSION_THRESHOLD)) + pulse_strength = min(pulse_strength, air.get_moles(GAS_H2) * 1000) + air.set_moles(GAS_H2, max(air.get_moles(GAS_H2) - (pulse_strength * 0.001), 0)) + air.adjust_moles(GAS_TRITIUM, pulse_strength * 0.001) /turf/open/IgniteTurf(power, fire_color="red") - if(air.get_moles(/datum/gas/oxygen) < 1) + if(air.get_moles(GAS_O2) < 1) return if(turf_fire) turf_fire.AddPower(power) diff --git a/code/game/turfs/simulated/floor/plating/asteroid.dm b/code/game/turfs/simulated/floor/plating/asteroid.dm index 642beded649c..4f3960ac2d02 100644 --- a/code/game/turfs/simulated/floor/plating/asteroid.dm +++ b/code/game/turfs/simulated/floor/plating/asteroid.dm @@ -135,6 +135,10 @@ baseturfs = /turf/open/floor/plating/asteroid/airless turf_type = /turf/open/floor/plating/asteroid/airless +// / Breathing types. Lungs can access either by these or by a string, which will be considered a gas ID. +#define BREATH_OXY /datum/breathing_class/oxygen +#define BREATH_PLASMA /datum/breathing_class/plasma + /turf/open/floor/plating/asteroid/snow gender = PLURAL name = "snow" diff --git a/code/game/turfs/simulated/floor/plating/misc_plating.dm b/code/game/turfs/simulated/floor/plating/misc_plating.dm index a14885d02ad9..c3cae2da310b 100644 --- a/code/game/turfs/simulated/floor/plating/misc_plating.dm +++ b/code/game/turfs/simulated/floor/plating/misc_plating.dm @@ -173,7 +173,7 @@ icon = 'icons/turf/floors/ice_turf.dmi' icon_state = "unsmooth" initial_gas_mix = FROZEN_ATMOS - temperature = 180 + initial_temperature = 180 planetary_atmos = TRUE baseturfs = /turf/open/floor/plating/ice attachment_holes = FALSE @@ -201,10 +201,10 @@ canSmoothWith = list(/turf/open/floor/plating/ice/smooth, /turf/open/floor/plating/ice) /turf/open/floor/plating/ice/colder - temperature = 140 + initial_temperature = 140 /turf/open/floor/plating/ice/temperate - temperature = 255.37 + initial_temperature = 255.37 /turf/open/floor/plating/ice/break_tile() return @@ -225,7 +225,7 @@ icon = 'icons/turf/snow.dmi' icon_state = "snowplating" initial_gas_mix = FROZEN_ATMOS - temperature = 180 + initial_temperature = 180 attachment_holes = FALSE planetary_atmos = TRUE footstep = FOOTSTEP_SAND @@ -244,10 +244,10 @@ icon_state = "smooth" /turf/open/floor/plating/snowed/colder - temperature = 140 + initial_temperature = 140 /turf/open/floor/plating/snowed/temperatre - temperature = 255.37 + initial_temperature = 255.37 /turf/open/floor/plating/snowed/smoothed/icemoon initial_gas_mix = ICEMOON_DEFAULT_ATMOS diff --git a/code/game/turfs/simulated/minerals.dm b/code/game/turfs/simulated/minerals.dm index 1f5725f38fa4..b9e8d6521e16 100644 --- a/code/game/turfs/simulated/minerals.dm +++ b/code/game/turfs/simulated/minerals.dm @@ -13,7 +13,7 @@ opacity = TRUE density = TRUE layer = EDGED_TURF_LAYER - temperature = TCMB + initial_temperature = TCMB var/environment_type = "asteroid" var/turf/open/floor/plating/turf_type = /turf/open/floor/plating/asteroid/airless var/mineralType = null diff --git a/code/game/turfs/simulated/walls.dm b/code/game/turfs/simulated/walls.dm index 3d67d31f7459..aff1b3ae03f4 100644 --- a/code/game/turfs/simulated/walls.dm +++ b/code/game/turfs/simulated/walls.dm @@ -81,8 +81,7 @@ var/obj/structure/sign/poster/P = O P.roll_and_drop(src) - var/turf/new_floor = ScrapeAway() - new_floor.air_update_turf() + ScrapeAway() /turf/closed/wall/proc/break_wall() new sheet_type(src, sheet_amount) diff --git a/code/game/turfs/space/space.dm b/code/game/turfs/space/space.dm index f45f1085b16f..253cf793e805 100644 --- a/code/game/turfs/space/space.dm +++ b/code/game/turfs/space/space.dm @@ -4,8 +4,8 @@ name = "\proper space" intact = 0 - temperature = TCMB - thermal_conductivity = OPEN_HEAT_TRANSFER_COEFFICIENT + initial_temperature = TCMB + thermal_conductivity = 0 heat_capacity = 700000 FASTDMM_PROP(\ @@ -16,7 +16,7 @@ var/destination_x var/destination_y - var/global/datum/gas_mixture/immutable/space/space_gas = new + var/global/datum/gas_mixture/immutable/space/space_gas plane = PLANE_SPACE layer = SPACE_LAYER light_power = 0.25 @@ -30,8 +30,10 @@ /turf/open/space/Initialize(mapload) SHOULD_CALL_PARENT(FALSE) icon_state = SPACE_ICON_STATE + if(!space_gas) + space_gas = new air = space_gas - update_air_ref() + update_air_ref(0) vis_contents.Cut() //removes inherited overlays visibilityChanged() @@ -44,9 +46,6 @@ if(!IS_DYNAMIC_LIGHTING(src) && IS_DYNAMIC_LIGHTING(A)) add_overlay(/obj/effect/fullbright) - if(requires_activation) - SSair.add_to_active(src) - if (light_system == STATIC_LIGHT && light_power && light_range) update_light() @@ -80,6 +79,13 @@ /turf/open/space/remove_air(amount) return null +/turf/open/space/remove_air_ratio(amount) + return null + +//IT SHOULD RETURN NULL YOU MONKEY, WHY IN TARNATION WHAT THE FUCKING FUCK +/turf/open/space/remove_air(amount) + return null + /turf/open/space/proc/update_starlight() if(CONFIG_GET(flag/starlight)) for(var/t in RANGE_TURFS(1,src)) //RANGE_TURFS is in code\__HELPERS\game.dm diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm old mode 100644 new mode 100755 index 57df5c8c6f31..0d676cd092d3 --- a/code/game/turfs/turf.dm +++ b/code/game/turfs/turf.dm @@ -16,7 +16,7 @@ GLOBAL_LIST_EMPTY(station_turfs) // This shouldn't be modified directly, use the helper procs. var/list/baseturfs = /turf/baseturf_bottom - var/temperature = T20C + var/initial_temperature = T20C var/to_be_destroyed = 0 //Used for fire, if a melting temperature was reached, it will be destroyed var/max_fire_temperature_sustained = 0 //The max temperature of the fire which it was subjected to @@ -87,11 +87,10 @@ GLOBAL_LIST_EMPTY(station_turfs) add_overlay(/obj/effect/fullbright) if(requires_activation) - CALCULATE_ADJACENT_TURFS(src) - SSair.add_to_active(src) + ImmediateCalculateAdjacentTurfs() + if(color) add_atom_colour(color, FIXED_COLOUR_PRIORITY) - if (light_system == STATIC_LIGHT && light_power && light_range) update_light() @@ -107,12 +106,27 @@ GLOBAL_LIST_EMPTY(station_turfs) if (opacity) directional_opacity = ALL_CARDINALS + if(isopenturf(src)) + var/turf/open/O = src + __auxtools_update_turf_temp_info(isspaceturf(get_z_base_turf()) && !O.planetary_atmos) + else + update_air_ref(-1) + __auxtools_update_turf_temp_info(isspaceturf(get_z_base_turf())) + if(color) add_atom_colour(color, FIXED_COLOUR_PRIORITY) return INITIALIZE_HINT_NORMAL +/turf/proc/__auxtools_update_turf_temp_info() + +/turf/proc/__auxtools_update_turf_infos(immediate) + +/turf/return_temperature() + +/turf/proc/set_temperature() + /turf/proc/Initalize_Atmos(times_fired) - CALCULATE_ADJACENT_TURFS(src) + ImmediateCalculateAdjacentTurfs() /turf/Destroy(force) . = QDEL_HINT_IWILLGC @@ -134,7 +148,6 @@ GLOBAL_LIST_EMPTY(station_turfs) for(var/I in B.vars) B.vars[I] = null return - SSair.remove_from_active(src) visibilityChanged() QDEL_LIST(blueprint_data) flags_1 &= ~INITIALIZED_1 diff --git a/code/game/world.dm b/code/game/world.dm index 042d4c90519b..65b4cbdc23a3 100644 --- a/code/game/world.dm +++ b/code/game/world.dm @@ -272,17 +272,15 @@ GLOBAL_VAR(restart_counter) log_world("World rebooted at [time_stamp()]") shutdown_logging() // Past this point, no logging procs can be used, at risk of data loss. + __auxmos_shutdown() ..() /world/Del() - // memory leaks bad - var/num_deleted = 0 - for(var/datum/gas_mixture/GM) - GM.__gasmixture_unregister() - num_deleted++ - log_world("Deallocated [num_deleted] gas mixtures") - if(fexists(EXTOOLS)) - LIBCALL(EXTOOLS, "cleanup")() + shutdown_logging() // makes sure the thread is closed before end, else we terminate + __auxmos_shutdown() + var/debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL") + if (debug_server) + LIBCALL(debug_server, "auxtools_shutdown")() ..() /world/proc/update_status() //yogs -- Mirrored in the Yogs folder in March 2019. Do not edit, swallow, or submerge in acid diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm index 612ff69e0c8e..41933cd0ae11 100644 --- a/code/modules/admin/admin_verbs.dm +++ b/code/modules/admin/admin_verbs.dm @@ -20,6 +20,7 @@ GLOBAL_PROTECT(admin_verbs_default) /client/proc/stop_sounds, /client/proc/fix_air, // yogs - fix air verb /client/proc/fix_air_z, + /client/proc/clear_all_pipenets, /client/proc/debugstatpanel, /client/proc/clear_mfa, /client/proc/show_rights @@ -155,7 +156,6 @@ GLOBAL_PROTECT(admin_verbs_server) /client/proc/panicbunker, /client/proc/toggle_hub, /client/proc/mentor_memo, // YOGS - something stupid about "Mentor memos" - /client/proc/dump_memory_usage, /client/proc/release_queue, // Yogs -- Adds some queue-manipulation verbs /client/proc/toggle_cdn ) @@ -812,7 +812,7 @@ GLOBAL_PROTECT(admin_verbs_hideable) log_admin("[key_name(usr)] has [AI_Interact ? "activated" : "deactivated"] Admin AI Interact") message_admins("[key_name_admin(usr)] has [AI_Interact ? "activated" : "deactivated"] their AI interaction") - +/* /client/proc/dump_memory_usage() set name = "Dump Server Memory Usage" set category = "Server" @@ -841,6 +841,7 @@ GLOBAL_PROTECT(admin_verbs_hideable) to_chat(usr, span_warning("File creation failed. Please check to see if the data/logs/memory folder actually exists.")) else to_chat(usr, span_notice("Memory dump completed.")) +*/ /client/proc/debugstatpanel() diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm index 15916f9e5423..893c26ed104e 100644 --- a/code/modules/admin/verbs/debug.dm +++ b/code/modules/admin/verbs/debug.dm @@ -872,7 +872,7 @@ GLOBAL_PROTECT(AdminProcCallSpamPrevention) if(Rad.anchored) if(!Rad.loaded_tank) var/obj/item/tank/internals/plasma/Plasma = new/obj/item/tank/internals/plasma(Rad) - Plasma.air_contents.set_moles(/datum/gas/plasma, 70) + Plasma.air_contents.set_moles(GAS_PLASMA, 70) Rad.drainratio = 0 Rad.loaded_tank = Plasma Plasma.forceMove(Rad) diff --git a/code/modules/antagonists/blob/structures/_blob.dm b/code/modules/antagonists/blob/structures/_blob.dm index 480c1ed139b7..97d62b945c89 100644 --- a/code/modules/antagonists/blob/structures/_blob.dm +++ b/code/modules/antagonists/blob/structures/_blob.dm @@ -31,7 +31,7 @@ setDir(pick(GLOB.cardinals)) update_appearance(UPDATE_ICON) if(atmosblock) - air_update_turf(1) + air_update_turf() ConsumeTile() /obj/structure/blob/proc/creation_action() //When it's created by the overmind, do this. @@ -40,7 +40,7 @@ /obj/structure/blob/Destroy() if(atmosblock) atmosblock = FALSE - air_update_turf(1) + air_update_turf() if(overmind) overmind.blobs_legit -= src //if it was in the legit blobs list, it isn't now GLOB.blobs -= src //it's no longer in the all blobs list either @@ -64,7 +64,7 @@ result++ . -= result - 1 -/obj/structure/blob/BlockSuperconductivity() +/obj/structure/blob/BlockThermalConductivity() return atmosblock /obj/structure/blob/CanAllowThrough(atom/movable/mover, turf/target) diff --git a/code/modules/antagonists/blob/structures/shield.dm b/code/modules/antagonists/blob/structures/shield.dm index 8efcb868cd75..fd34cb45ecb1 100644 --- a/code/modules/antagonists/blob/structures/shield.dm +++ b/code/modules/antagonists/blob/structures/shield.dm @@ -31,7 +31,7 @@ name = initial(name) desc = initial(desc) atmosblock = TRUE - air_update_turf(1) + air_update_turf() /obj/structure/blob/shield/reflective name = "reflective blob" diff --git a/code/modules/antagonists/bloodsuckers/powers/olfaction.dm b/code/modules/antagonists/bloodsuckers/powers/olfaction.dm index 1089d603dc9a..f97c5fe9fd69 100644 --- a/code/modules/antagonists/bloodsuckers/powers/olfaction.dm +++ b/code/modules/antagonists/bloodsuckers/powers/olfaction.dm @@ -47,7 +47,7 @@ return FALSE DeactivatePower() var/datum/gas_mixture/air = owner.loc.return_air() - if(air.get_moles(/datum/gas/miasma) >= 0.1/sensitivity && sensitive) + if(air.get_moles(GAS_MIASMA) >= 0.1/sensitivity && sensitive) owner.adjust_disgust(sensitivity * 45) to_chat(owner, span_warning("With your overly sensitive nose, you get a whiff of stench and feel sick! Try moving to a cleaner area!")) return diff --git a/code/modules/antagonists/bloodsuckers/structures/bloodsucker_life.dm b/code/modules/antagonists/bloodsuckers/structures/bloodsucker_life.dm index 718b13382163..0e12b0e0ba8d 100644 --- a/code/modules/antagonists/bloodsuckers/structures/bloodsucker_life.dm +++ b/code/modules/antagonists/bloodsuckers/structures/bloodsucker_life.dm @@ -463,13 +463,12 @@ return //If we're on Masquerade, we appear to have full blood, unless we are REALLY low, in which case we don't look as bad. if(HAS_TRAIT(owner.current, TRAIT_MASQUERADE)) - switch(bloodsucker_blood_volume) - if(BLOOD_VOLUME_OKAY(owner.current) to INFINITY) // 336 and up, we are perfectly fine. - owner.current.blood_volume = initial(bloodsucker_blood_volume) - if(BLOOD_VOLUME_BAD(owner.current) to BLOOD_VOLUME_OKAY(owner.current)) // 224 to 336 - owner.current.blood_volume = BLOOD_VOLUME_SAFE(owner.current) - else // 224 and below - owner.current.blood_volume = BLOOD_VOLUME_OKAY(owner.current) + if(bloodsucker_blood_volume >= BLOOD_VOLUME_OKAY(owner.current)) + owner.current.blood_volume = initial(bloodsucker_blood_volume) + else if(bloodsucker_blood_volume >= BLOOD_VOLUME_BAD(owner.current)) + owner.current.blood_volume = BLOOD_VOLUME_SAFE(owner.current) + else + owner.current.blood_volume = BLOOD_VOLUME_OKAY(owner.current) return owner.current.blood_volume = bloodsucker_blood_volume diff --git a/code/modules/antagonists/clockcult/clock_effects/servant_blocker.dm b/code/modules/antagonists/clockcult/clock_effects/servant_blocker.dm index e1d464e41047..9bf278d7800e 100644 --- a/code/modules/antagonists/clockcult/clock_effects/servant_blocker.dm +++ b/code/modules/antagonists/clockcult/clock_effects/servant_blocker.dm @@ -10,7 +10,7 @@ /obj/effect/clockwork/servant_blocker/Initialize(mapload) . = ..() - air_update_turf(TRUE) + air_update_turf() /obj/effect/clockwork/servant_blocker/Destroy(force) if(!force) @@ -30,7 +30,7 @@ return FALSE return TRUE -/obj/effect/clockwork/servant_blocker/BlockSuperconductivity() +/obj/effect/clockwork/servant_blocker/BlockThermalConductivity() return TRUE /obj/effect/clockwork/servant_blocker/singularity_act() diff --git a/code/modules/antagonists/cult/runes.dm b/code/modules/antagonists/cult/runes.dm index 4884191cd10c..041ce4d5db7f 100644 --- a/code/modules/antagonists/cult/runes.dm +++ b/code/modules/antagonists/cult/runes.dm @@ -699,7 +699,7 @@ structure_check() searches for nearby cultist structures required for the invoca GLOB.wall_runes -= src return ..() -/obj/effect/rune/wall/BlockSuperconductivity() +/obj/effect/rune/wall/BlockThermalConductivity() return density /obj/effect/rune/wall/invoke(list/invokers) @@ -742,7 +742,7 @@ structure_check() searches for nearby cultist structures required for the invoca /obj/effect/rune/wall/proc/update_state() deltimer(density_timer) - air_update_turf(1) + air_update_turf() if(density) density_timer = addtimer(CALLBACK(src, PROC_REF(lose_density)), 300, TIMER_STOPPABLE) //yogs: 30 seconds instead of 300 I could microwave a pizza before a barrier rune went down naturally var/mutable_appearance/shimmer = mutable_appearance('icons/effects/effects.dmi', "barriershimmer", ABOVE_MOB_LAYER) diff --git a/code/modules/antagonists/eldritch_cult/transmutations/ash_transmutations.dm b/code/modules/antagonists/eldritch_cult/transmutations/ash_transmutations.dm index ee4b5cd647d2..111e7052270b 100644 --- a/code/modules/antagonists/eldritch_cult/transmutations/ash_transmutations.dm +++ b/code/modules/antagonists/eldritch_cult/transmutations/ash_transmutations.dm @@ -99,5 +99,3 @@ env = T.return_air() current_temp = env.return_temperature() env.set_temperature(current_temp+25) - T.air_update_turf() - L.air_update_turf() diff --git a/code/modules/atmospherics/auxgm/breathing_classes.dm b/code/modules/atmospherics/auxgm/breathing_classes.dm new file mode 100644 index 000000000000..caabb4cf688f --- /dev/null +++ b/code/modules/atmospherics/auxgm/breathing_classes.dm @@ -0,0 +1,92 @@ +// Breathing classes are, yes, just a list of gases, associated with numbers. +// But they're very simple: pluoxium's status as O2 * 8 is represented here, +// with a single line of code, no hardcoding and special-casing across the codebase. +// Not only that, but they're very general: you could have a negative value +// to simulate asphyxiants, e.g. if I add krypton it could go into the oxygen +// breathing class at -7, simulating krypton narcosis. + +/datum/breathing_class + ///Gases that we consume and count as respirable + var/list/gases + ///Gases that we breathe out + var/list/products + ///Reagent generated if we breathe in too much of the gases in the gas_max value of gases defined in lungs + var/danger_reagent + ///Catergory of the alert generated if we do not have enough required gases + var/low_alert_category = "not_enough_oxy" + ///Type of the alert generated if we do not have enough required gases + var/low_alert_datum = /atom/movable/screen/alert/not_enough_oxy + ///Catergory of the alert generated if we breathe in too much of the gases in the gas_max value of gases defined in lungs + var/high_alert_category = "too_much_oxy" + ///Type of the alert generated if we breathe in too much of the gases in the gas_max value of gases defined in lungs + var/high_alert_datum = /atom/movable/screen/alert/too_much_oxy + +/datum/breathing_class/proc/get_effective_pp(datum/gas_mixture/breath) + var/mol = 0 + for(var/gas in gases) + mol += breath.get_moles(gas) * gases[gas] + return (mol/breath.total_moles()) * breath.return_pressure() + +/datum/breathing_class/oxygen + gases = list( + GAS_O2 = 1, + GAS_PLUOXIUM = 8, + GAS_CO2 = -0.7, // CO2 isn't actually toxic, just an asphyxiant + ) + products = list( + GAS_CO2 = 1, + ) + +/datum/breathing_class/oxygen_plas + gases = list( + GAS_O2 = 1, + GAS_PLUOXIUM = 8, + GAS_CO2 = -0.7, // CO2 isn't actually toxic, just an asphyxiant + GAS_PLASMA = 1 + ) + products = list( + GAS_CO2 = 1, + ) + +/datum/breathing_class/oxygen_co2 + gases = list( + GAS_O2 = 1, + GAS_PLUOXIUM = 8, + GAS_CO2 = 1, + ) + products = list( + GAS_CO2 = 1, + ) + +/datum/breathing_class/plasma + gases = list( + GAS_PLASMA = 1 + ) + products = list( + GAS_CO2 = 1 + ) + low_alert_category = "not_enough_tox" + low_alert_datum = /atom/movable/screen/alert/not_enough_tox + high_alert_category = "too_much_tox" + high_alert_datum = /atom/movable/screen/alert/too_much_tox + +/datum/breathing_class/oxygen_vapor + gases = list( + GAS_O2 = 1, + GAS_PLUOXIUM = 8, + GAS_CO2 = -0.7, // CO2 isn't actually toxic, just an asphyxiant + GAS_H2O = 1, + ) + products = list( + GAS_CO2 = 1, + ) + +/datum/breathing_class/oxygen_double + gases = list( + GAS_O2 = 1 * 2, + GAS_PLUOXIUM = 8 * 2, + GAS_CO2 = -0.7 * 2, // CO2 isn't actually toxic, just an asphyxiant + ) + products = list( + GAS_CO2 = 1, + ) diff --git a/code/modules/atmospherics/auxgm/gas_types.dm b/code/modules/atmospherics/auxgm/gas_types.dm new file mode 100644 index 000000000000..324ee7f7c4e7 --- /dev/null +++ b/code/modules/atmospherics/auxgm/gas_types.dm @@ -0,0 +1,195 @@ +/datum/gas/oxygen + id = GAS_O2 + specific_heat = 20 + name = "Oxygen" + ui_color = "blue" + +/datum/gas/nitrogen + id = GAS_N2 + specific_heat = 20 + name = "Nitrogen" + breath_alert_info = list( + not_enough_alert = list( + alert_category = "not_enough_nitro", + alert_type = /atom/movable/screen/alert/not_enough_nitro, + ), + too_much_alert = list( + alert_category = "too_much_nitro", + alert_type = /atom/movable/screen/alert/too_much_nitro, + ) + ) + ui_color = "red" + +/datum/gas/carbon_dioxide //what the fuck is this? + id = GAS_CO2 + specific_heat = 30 + name = "Carbon Dioxide" + breath_results = GAS_O2 + breath_alert_info = list( + not_enough_alert = list( + alert_category = "not_enough_co2", + alert_type = /atom/movable/screen/alert/not_enough_co2, + ), + too_much_alert = list( + alert_category = "too_much_co2", + alert_type = /atom/movable/screen/alert/too_much_co2, + ) + ) + ui_color = "grey" + +/datum/gas/plasma + id = GAS_PLASMA + specific_heat = 200 + name = "Plasma" + gas_overlay = "plasma" + moles_visible = MOLES_GAS_VISIBLE + flags = GAS_FLAG_DANGEROUS + ui_color = "orange" + +/datum/gas/water_vapor + id = GAS_H2O + specific_heat = 40 + name = "Water Vapor" + gas_overlay = "water_vapor" + moles_visible = MOLES_GAS_VISIBLE + breath_reagent = /datum/reagent/water + fusion_power = 8 + ui_color = "lightsteelblue" + +/datum/gas/hypernoblium + id = GAS_HYPERNOB + specific_heat = 2000 + name = "Hyper-noblium" + gas_overlay = "freon" + moles_visible = MOLES_GAS_VISIBLE + flags = GAS_FLAG_DANGEROUS + ui_color = "teal" + +/datum/gas/nitrous_oxide + id = GAS_NITROUS + specific_heat = 40 + name = "Nitrous Oxide" + gas_overlay = "nitrous_oxide" + moles_visible = MOLES_GAS_VISIBLE * 2 + fusion_power = 10 + flags = GAS_FLAG_DANGEROUS + ui_color = "bisque" + +/datum/gas/nitrium + id = GAS_NITRIUM + specific_heat = 10 + name = "Nitrium" + gas_overlay = "nitrium" + moles_visible = MOLES_GAS_VISIBLE + flags = GAS_FLAG_DANGEROUS + fusion_power = 7 + ui_color = "brown" + +/datum/gas/tritium + id = GAS_TRITIUM + specific_heat = 10 + name = "Tritium" + gas_overlay = "tritium" + moles_visible = MOLES_GAS_VISIBLE + flags = GAS_FLAG_DANGEROUS + fusion_power = 1 + ui_color = "limegreen" + +/datum/gas/bz + id = GAS_BZ + specific_heat = 20 + name = "BZ" + flags = GAS_FLAG_DANGEROUS + fusion_power = 8 + ui_color = "mediumpurple" + +/datum/gas/pluoxium + id = GAS_PLUOXIUM + specific_heat = 80 + name = "Pluoxium" + fusion_power = -10 + ui_color = "mediumslateblue" + +/datum/gas/miasma + id = GAS_MIASMA + specific_heat = 20 + name = "Miasma" + gas_overlay = "miasma" + moles_visible = MOLES_GAS_VISIBLE * 60 + ui_color = "olive" + +/datum/gas/freon + id = GAS_FREON + specific_heat = 600 + name = "Freon" + gas_overlay = "freon" + moles_visible = MOLES_GAS_VISIBLE *30 + fusion_power = -5 + ui_color = "paleturquoise" + +/datum/gas/hydrogen + id = GAS_H2 + specific_heat = 15 + name = "Hydrogen" + flags = GAS_FLAG_DANGEROUS + ui_color = "white" + +/datum/gas/healium + id = GAS_HEALIUM + specific_heat = 10 + name = "Healium" + gas_overlay = "healium" + moles_visible = MOLES_GAS_VISIBLE + ui_color = "salmon" + +/datum/gas/pluonium + id = GAS_PLUONIUM + specific_heat = 30 + name = "Pluonium" + flags = GAS_FLAG_DANGEROUS + gas_overlay = "pluonium" + moles_visible = MOLES_GAS_VISIBLE + ui_color = "greenyellow" + +/datum/gas/halon + id = GAS_HALON + specific_heat = 175 + name = "Halon" + flags = GAS_FLAG_DANGEROUS + gas_overlay = "halon" + moles_visible = MOLES_GAS_VISIBLE + ui_color = "purple" + +/datum/gas/antinoblium + id = GAS_ANTINOB + specific_heat = 1 + name = "Antinoblium" + gas_overlay = "antinoblium" + moles_visible = MOLES_GAS_VISIBLE + fusion_power = 20 + ui_color = "maroon" + +/datum/gas/zauker + id = GAS_ZAUKER + specific_heat = 350 + name = "Zauker" + flags = GAS_FLAG_DANGEROUS + gas_overlay = "zauker" + moles_visible = MOLES_GAS_VISIBLE + ui_color = "darkgreen" + +/datum/gas/hexane + id = GAS_HEXANE + specific_heat = 5 + name = "Hexane" + flags = GAS_FLAG_DANGEROUS + gas_overlay = "hexane" + moles_visible = MOLES_GAS_VISIBLE + ui_color = "plum" + +/datum/gas/dilithium // Main point is that this helps fusion occur at a significantly lower temperature than normal + id = GAS_DILITHIUM + specific_heat = 55 + name = "Dilithium" + fusion_power = 1 + ui_color = "pink" diff --git a/code/modules/atmospherics/environmental/LINDA_fire.dm b/code/modules/atmospherics/environmental/LINDA_fire.dm index a211e76706d2..635a5d5b1dae 100644 --- a/code/modules/atmospherics/environmental/LINDA_fire.dm +++ b/code/modules/atmospherics/environmental/LINDA_fire.dm @@ -17,33 +17,23 @@ if(!air) return - if(air.get_moles(/datum/gas/hypernoblium) > REACTION_OPPRESSION_THRESHOLD) + if (air.get_moles(GAS_O2) < 0.5 || air.get_moles(GAS_HYPERNOB) > REACTION_OPPRESSION_THRESHOLD) return - var/oxy = air.get_moles(/datum/gas/oxygen) - if (oxy < 0.5) - return - var/tox = air.get_moles(/datum/gas/plasma) - var/trit = air.get_moles(/datum/gas/tritium) - var/h2 = air.get_moles(/datum/gas/hydrogen) + var/has_fuel = air.get_moles(GAS_PLASMA) > 0.5 || air.get_moles(GAS_TRITIUM) > 0.5 || air.get_moles(GAS_H2) > 0.5 if(active_hotspot) if(soh) - if(tox > 0.5 || trit > 0.5 || h2 > 0.5) + if(has_fuel) if(active_hotspot.temperature < exposed_temperature) active_hotspot.temperature = exposed_temperature if(active_hotspot.volume < exposed_volume) active_hotspot.volume = exposed_volume return - if((exposed_temperature > PLASMA_MINIMUM_BURN_TEMPERATURE) && (tox > 0.5 || trit > 0.5 || h2 > 0.5)) - + if((exposed_temperature > PLASMA_MINIMUM_BURN_TEMPERATURE) && has_fuel) active_hotspot = new /obj/effect/hotspot(src, exposed_volume*25, exposed_temperature) - active_hotspot.just_spawned = (current_cycle < SSair.times_fired) - //remove just_spawned protection if no longer processing this cell - SSair.add_to_active(src, 0) - //This is the icon for fire on turfs, also helps for nurturing small fires until they are full tile /obj/effect/hotspot anchored = TRUE @@ -73,7 +63,6 @@ if(!perform_exposure()) return INITIALIZE_HINT_QDEL setDir(pick(GLOB.cardinals)) - air_update_turf() /obj/effect/hotspot/proc/perform_exposure() var/turf/open/location = loc @@ -163,7 +152,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) alpha = heat_a -#define INSUFFICIENT(path) (location.air.get_moles(path) < 0.5) +#define INSUFFICIENT(id) (location.air.get_moles(id) < 0.5) /obj/effect/hotspot/process() if(just_spawned) just_spawned = FALSE @@ -181,7 +170,7 @@ return //Not enough / nothing to burn - if(!location.air || (INSUFFICIENT(/datum/gas/plasma) && INSUFFICIENT(/datum/gas/tritium)) && INSUFFICIENT(/datum/gas/hydrogen) || INSUFFICIENT(/datum/gas/oxygen)) + if(!location.air || (INSUFFICIENT(GAS_PLASMA) && INSUFFICIENT(GAS_TRITIUM)) && INSUFFICIENT(GAS_H2) || INSUFFICIENT(GAS_O2)) qdel(src) return diff --git a/code/modules/atmospherics/environmental/LINDA_system.dm b/code/modules/atmospherics/environmental/LINDA_system.dm index 21dc6069a6c2..fc3d4ffa183b 100644 --- a/code/modules/atmospherics/environmental/LINDA_system.dm +++ b/code/modules/atmospherics/environmental/LINDA_system.dm @@ -18,58 +18,112 @@ /turf/open/CanAtmosPass(turf/T, vertical = FALSE) var/dir = vertical? get_dir_multiz(src, T) : get_dir(src, T) - var/opp = dir_inverse_multiz(dir) - var/R = FALSE + . = TRUE if(vertical && !(zAirOut(dir, T) && T.zAirIn(dir, src))) - R = TRUE + . = FALSE if(blocks_air || T.blocks_air) - R = TRUE + . = FALSE if (T == src) - return !R + return . for(var/obj/O in contents+T.contents) var/turf/other = (O.loc == src ? T : src) if(!(vertical? (CANVERTICALATMOSPASS(O, other)) : (CANATMOSPASS(O, other)))) - R = TRUE - if(O.BlockSuperconductivity()) //the direction and open/closed are already checked on CanAtmosPass() so there are no arguments - atmos_supeconductivity |= dir - T.atmos_supeconductivity |= opp - return FALSE //no need to keep going, we got all we asked + . = FALSE - atmos_supeconductivity &= ~dir - T.atmos_supeconductivity &= ~opp +/turf/proc/update_conductivity(turf/T) + var/dir = get_dir_multiz(src, T) + var/opp = REVERSE_DIR(dir) - return !R + if(T == src) + return + + //all these must be above zero for auxmos to even consider them + if(!thermal_conductivity || !heat_capacity || !T.thermal_conductivity || !T.heat_capacity) + conductivity_blocked_directions |= dir + T.conductivity_blocked_directions |= opp + return + + for(var/obj/O in contents+T.contents) + if(O.BlockThermalConductivity(opp)) //the direction and open/closed are already checked on CanAtmosPass() so there are no arguments + conductivity_blocked_directions |= dir + T.conductivity_blocked_directions |= opp + +/turf/proc/block_all_conductivity() + conductivity_blocked_directions |= NORTH | SOUTH | EAST | WEST | UP | DOWN -/atom/movable/proc/BlockSuperconductivity() // objects that block air and don't let superconductivity act. Only firelocks atm. +//dir of this obj to the other turf +/atom/movable/proc/BlockThermalConductivity(dir) // Objects that don't let heat through. return FALSE /turf/proc/ImmediateCalculateAdjacentTurfs() - var/canpass = CANATMOSPASS(src, src) + var/canpass = CANATMOSPASS(src, src) var/canvpass = CANVERTICALATMOSPASS(src, src) + + conductivity_blocked_directions = 0 + + var/src_contains_firelock = 1 + if(locate(/obj/machinery/door/firedoor) in src) + src_contains_firelock |= 2 + for(var/direction in GLOB.cardinals_multiz) var/turf/T = get_step_multiz(src, direction) - var/opp_dir = dir_inverse_multiz(direction) - if(!isopenturf(T)) + if(!istype(T)) + conductivity_blocked_directions |= direction continue - if(!(blocks_air || T.blocks_air) && ((direction & (UP|DOWN))? (canvpass && CANVERTICALATMOSPASS(T, src)) : (canpass && CANATMOSPASS(T, src))) ) + + var/other_contains_firelock = 1 + if(locate(/obj/machinery/door/firedoor) in T) + other_contains_firelock |= 2 + + update_conductivity(T) + + if(isopenturf(T) && !(blocks_air || T.blocks_air) && ((direction & (UP|DOWN))? (canvpass && CANVERTICALATMOSPASS(T, src)) : (canpass && CANATMOSPASS(T, src))) ) LAZYINITLIST(atmos_adjacent_turfs) LAZYINITLIST(T.atmos_adjacent_turfs) - atmos_adjacent_turfs[T] = direction - T.atmos_adjacent_turfs[src] = opp_dir - T.__update_extools_adjacent_turfs() + atmos_adjacent_turfs[T] = other_contains_firelock | src_contains_firelock + T.atmos_adjacent_turfs[src] = src_contains_firelock else if (atmos_adjacent_turfs) atmos_adjacent_turfs -= T if (T.atmos_adjacent_turfs) T.atmos_adjacent_turfs -= src - T.__update_extools_adjacent_turfs() UNSETEMPTY(T.atmos_adjacent_turfs) + + T.__update_auxtools_turf_adjacency_info() UNSETEMPTY(atmos_adjacent_turfs) src.atmos_adjacent_turfs = atmos_adjacent_turfs - __update_extools_adjacent_turfs() + __update_auxtools_turf_adjacency_info() -/turf/proc/__update_extools_adjacent_turfs() +/turf/proc/clear_adjacencies() + block_all_conductivity() + for(var/direction in GLOB.cardinals_multiz) + var/turf/T = get_step_multiz(src, direction) + if(!T) + continue + if (atmos_adjacent_turfs) + atmos_adjacent_turfs -= T + if (T.atmos_adjacent_turfs) + T.atmos_adjacent_turfs -= src + UNSETEMPTY(T.atmos_adjacent_turfs) + T.__update_auxtools_turf_adjacency_info() + LAZYNULL(atmos_adjacent_turfs) + __update_auxtools_turf_adjacency_info() + + +//Only gets a list of adjacencies, does NOT update +/turf/proc/get_adjacent_atmos_turfs() + . = list() + var/canpass = CANATMOSPASS(src, src) + var/canvpass = CANVERTICALATMOSPASS(src, src) + + for(var/direction in GLOB.cardinals_multiz) + var/turf/T = get_step_multiz(src, direction) + if(isopenturf(T) && !(blocks_air || T.blocks_air) && ((direction & (UP|DOWN))? (canvpass && CANVERTICALATMOSPASS(T, src)) : (canpass && CANATMOSPASS(T, src))) ) + .[T] = 0 + else + . -= T + UNSETEMPTY(.) //returns a list of adjacent turfs that can share air with this one. //alldir includes adjacent diagonal tiles that can share @@ -106,21 +160,19 @@ return adjacent_turfs -/atom/proc/air_update_turf(command = 0) - if(!isturf(loc) && command) +/atom/proc/air_update_turf() + var/turf/T = get_turf(src) + if(!T) return - var/turf/T = get_turf(loc) - T.air_update_turf(command) + T.air_update_turf() -/turf/air_update_turf(command = 0) - if(command) - ImmediateCalculateAdjacentTurfs() - SSair.add_to_active(src,command) +/turf/air_update_turf() + ImmediateCalculateAdjacentTurfs() /atom/movable/proc/move_update_air(turf/T) if(isturf(T)) - T.air_update_turf(1) - air_update_turf(1) + T.air_update_turf() + air_update_turf() /atom/proc/atmos_spawn_air(text) //because a lot of people loves to copy paste awful code lets just make an easy proc to spawn your plasma fires var/turf/open/T = get_turf(src) @@ -134,7 +186,4 @@ var/datum/gas_mixture/G = new G.parse_gas_string(text) - - air.merge(G) - archive() - SSair.add_to_active(src, 0) + assume_air(G) diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm index 1fd2e701d888..af36d33d22d4 100644 --- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm +++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm @@ -1,18 +1,12 @@ /turf - //used for temperature calculations + //conductivity is divided by 10 when interacting with air for balance purposes var/thermal_conductivity = 0.05 var/heat_capacity = 1 - var/temperature_archived //list of open turfs adjacent to us var/list/atmos_adjacent_turfs - //bitfield of dirs in which we are superconducitng - var/atmos_supeconductivity = NONE - var/is_openturf = FALSE // used by extools shizz. - - //used to determine whether we should archive - var/archived_cycle = 0 - var/current_cycle = 0 + ///bitfield of dirs in which we thermal conductivity is blocked + var/conductivity_blocked_directions = NONE //used for mapping and for breathing while in walls (because that's a thing that needs to be accounted for...) //string parsed by /datum/gas/proc/copy_from_turf @@ -32,13 +26,15 @@ var/planetary_atmos = FALSE //air will revert to initial_gas_mix over time var/list/atmos_overlay_types //gas IDs of current active gas overlays - is_openturf = TRUE + +/turf/proc/should_conduct_to_space() + return get_z_base_turf() == /turf/open/space /turf/open/Initialize(mapload) if(!blocks_air) - air = new + air = new(2500,src) air.copy_from_turf(src) - update_air_ref() + update_air_ref(planetary_atmos ? 1 : 2) if(wet) AddComponent(/datum/component/wet_floor, wet, INFINITY, 0, INFINITY, TRUE) return ..() @@ -46,26 +42,45 @@ /turf/open/Destroy() if(active_hotspot) QDEL_NULL(active_hotspot) - // Adds the adjacent turfs to the current atmos processing - for(var/T in atmos_adjacent_turfs) - SSair.add_to_active(T) return ..() -/turf/proc/update_air_ref() - /////////////////GAS MIXTURE PROCS/////////////////// /turf/open/assume_air(datum/gas_mixture/giver) //use this for machines to adjust air + return assume_air_ratio(giver, 1) + +/turf/open/assume_air_moles(datum/gas_mixture/giver, moles) + if(!giver) + return FALSE + giver.transfer_to(air, moles) + return TRUE + +/turf/open/assume_air_ratio(datum/gas_mixture/giver, ratio) if(!giver) return FALSE - air.merge(giver) - update_visuals() + giver.transfer_ratio_to(air, ratio) + return TRUE + +/turf/open/transfer_air(datum/gas_mixture/taker, moles) + if(!taker || !return_air()) // shouldn't transfer from space + return FALSE + air.transfer_to(taker, moles) + return TRUE + +/turf/open/transfer_air_ratio(datum/gas_mixture/taker, ratio) + if(!taker || !return_air()) + return FALSE + air.transfer_ratio_to(taker, ratio) return TRUE /turf/open/remove_air(amount) var/datum/gas_mixture/ours = return_air() var/datum/gas_mixture/removed = ours.remove(amount) - update_visuals() + return removed + +/turf/open/remove_air_ratio(ratio) + var/datum/gas_mixture/ours = return_air() + var/datum/gas_mixture/removed = ours.remove_ratio(ratio) return removed /turf/open/proc/copy_air_with_tile(turf/open/T) @@ -90,16 +105,9 @@ return return_air() /turf/temperature_expose() - if(temperature > heat_capacity) + if(return_temperature() > heat_capacity) to_be_destroyed = TRUE -/turf/proc/archive() - temperature_archived = temperature - -/turf/open/archive() - air.archive() - archived_cycle = SSair.times_fired - temperature_archived = temperature /turf/open/proc/eg_reset_cooldowns() /turf/open/proc/eg_garbage_collect() @@ -122,12 +130,12 @@ src.atmos_overlay_types = null return + for(var/id in air.get_gases()) - if(nonoverlaying_gases[id]) + if (nonoverlaying_gases[id]) continue - var/gas_meta = GLOB.meta_gas_info[id] - var/gas_overlay = gas_meta[META_GAS_OVERLAY] - if(gas_overlay && air.get_moles(id) > gas_meta[META_GAS_MOLES_VISIBLE]) + var/gas_overlay = GLOB.gas_data.overlays[id] + if(gas_overlay && air.get_moles(id) > GLOB.gas_data.visibility[id]) new_overlay_types += gas_overlay[min(FACTOR_GAS_VISIBLE_MAX, CEILING(air.get_moles(id) / MOLES_GAS_VISIBLE_STEP, 1))] if (atmos_overlay_types) @@ -143,6 +151,7 @@ UNSETEMPTY(new_overlay_types) src.atmos_overlay_types = new_overlay_types +//called by auxmos, do not remove /turf/open/proc/set_visuals(list/new_overlay_types) if (atmos_overlay_types) for(var/overlay in atmos_overlay_types-new_overlay_types) //doesn't remove overlays that would only be added @@ -161,49 +170,40 @@ for (var/gastype in subtypesof(/datum/gas)) var/datum/gas/gasvar = gastype if (!initial(gasvar.gas_overlay)) - .[gastype] = TRUE + .[initial(gasvar.id)] = TRUE /////////////////////////////SIMULATION/////////////////////////////////// -/*#define LAST_SHARE_CHECK \ - var/last_share = our_air.get_last_share();\ - if(last_share > MINIMUM_AIR_TO_SUSPEND){\ - our_excited_group.reset_cooldowns();\ - cached_atmos_cooldown = 0;\ - } else if(last_share > MINIMUM_MOLES_DELTA_TO_MOVE) {\ - our_excited_group.dismantle_cooldown = 0;\ - cached_atmos_cooldown = 0;\ - } -*/ /turf/proc/process_cell(fire_count) - SSair.remove_from_active(src) /turf/open/proc/equalize_pressure_in_zone(cyclenum) /turf/open/proc/consider_firelocks(turf/T2) - var/reconsider_adj = FALSE for(var/obj/machinery/door/firedoor/FD in T2) - if((FD.flags_1 & ON_BORDER_1) && get_dir(T2, src) != FD.dir) - continue FD.emergency_pressure_stop() - reconsider_adj = TRUE for(var/obj/machinery/door/firedoor/FD in src) - if((FD.flags_1 & ON_BORDER_1) && get_dir(src, T2) != FD.dir) - continue FD.emergency_pressure_stop() - reconsider_adj = TRUE - if(reconsider_adj) - T2.ImmediateCalculateAdjacentTurfs() // We want those firelocks closed yesterday. /turf/proc/handle_decompression_floor_rip() /turf/open/floor/handle_decompression_floor_rip(sum) - if(sum > 20 && prob(clamp(sum / 10, 0, 30))) - remove_tile() + if(sum > 20 && prob(clamp(sum / 20, 0, 15))) + if(floor_tile) + new floor_tile(src) + make_plating() + +/turf/open/floor/plating/handle_decompression_floor_rip() + return + +/turf/open/floor/engine/handle_decompression_floor_rip() + return /turf/open/process_cell(fire_count) //////////////////////////SPACEWIND///////////////////////////// -/turf/open/proc/consider_pressure_difference(turf/T, difference) +/turf/proc/consider_pressure_difference() + return + +/turf/open/consider_pressure_difference(turf/T, difference) SSair.high_pressure_delta |= src if(difference > pressure_difference) pressure_direction = get_dir(src, T) @@ -227,7 +227,7 @@ /atom/movable/var/last_high_pressure_movement_air_cycle = 0 /atom/movable/proc/experience_pressure_difference(pressure_difference, direction, pressure_resistance_prob_delta = 0, throw_target) - var/const/PROBABILITY_OFFSET = 25 + var/const/PROBABILITY_OFFSET = 40 var/const/PROBABILITY_BASE_PRECENT = 10 var/max_force = sqrt(pressure_difference)*(MOVE_FORCE_DEFAULT / 5) set waitfor = 0 @@ -237,124 +237,13 @@ move_prob += pressure_resistance_prob_delta if (move_prob > PROBABILITY_OFFSET && prob(move_prob) && (move_resist != INFINITY) && (!anchored && (max_force >= (move_resist * MOVE_FORCE_PUSH_RATIO))) || (anchored && (max_force >= (move_resist * MOVE_FORCE_FORCEPUSH_RATIO)))) var/move_force = max_force * clamp(move_prob, 0, 100) / 100 - if(move_force > 4000) + if(move_force > 6000) // WALLSLAM HELL TIME OH BOY var/turf/throw_turf = get_ranged_target_turf(get_turf(src), direction, round(move_force / 2000)) if(throw_target && (get_dir(src, throw_target) & direction)) throw_turf = get_turf(throw_target) - var/throw_speed = clamp(round(move_force / 2000), 1, 10) - if(iscarbon(src)) - throw_speed = min(throw_speed, 4) - throw_at(throw_turf, move_force / 2000, throw_speed) + var/throw_speed = clamp(round(move_force / 3000), 1, 10) + throw_at(throw_turf, move_force / 3000, throw_speed, quickstart = FALSE) else step(src, direction) last_high_pressure_movement_air_cycle = SSair.times_fired - -////////////////////////SUPERCONDUCTIVITY///////////////////////////// -/turf/proc/conductivity_directions() - if(archived_cycle < SSair.times_fired) - archive() - return ALL_CARDINALS - -/turf/open/conductivity_directions() - if(blocks_air) - return ..() - for(var/direction in GLOB.cardinals) - var/turf/T = get_step(src, direction) - if(!(T in atmos_adjacent_turfs) && !(atmos_supeconductivity & direction)) - . |= direction - -/turf/proc/neighbor_conduct_with_src(turf/open/other) - if(!other.blocks_air) //Open but neighbor is solid - other.temperature_share_open_to_solid(src) - else //Both tiles are solid - other.share_temperature_mutual_solid(src, thermal_conductivity) - temperature_expose(null, temperature, null) - -/turf/open/neighbor_conduct_with_src(turf/other) - if(blocks_air) - ..() - return - - if(!other.blocks_air) //Both tiles are open - var/turf/open/T = other - T.air.temperature_share(air, WINDOW_HEAT_TRANSFER_COEFFICIENT) - else //Solid but neighbor is open - temperature_share_open_to_solid(other) - SSair.add_to_active(src, 0) - -/turf/proc/super_conduct() - var/conductivity_directions = conductivity_directions() - - if(conductivity_directions) - //Conduct with tiles around me - for(var/direction in GLOB.cardinals) - if(conductivity_directions & direction) - var/turf/neighbor = get_step(src,direction) - - if(!neighbor.thermal_conductivity) - continue - - if(neighbor.archived_cycle < SSair.times_fired) - neighbor.archive() - - neighbor.neighbor_conduct_with_src(src) - - neighbor.consider_superconductivity() - - radiate_to_spess() - - finish_superconduction() - -/turf/proc/finish_superconduction(temp = temperature) - //Make sure still hot enough to continue conducting heat - if(temp < MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION) - SSair.active_super_conductivity -= src - return FALSE - -/turf/open/finish_superconduction() - //Conduct with air on my tile if I have it - if(!blocks_air) - temperature = air.temperature_share(null, thermal_conductivity, temperature, heat_capacity) - ..((blocks_air ? temperature : air.return_temperature())) - -/turf/proc/consider_superconductivity() - if(!thermal_conductivity) - return FALSE - - SSair.active_super_conductivity |= src - return TRUE - -/turf/open/consider_superconductivity(starting) - if(air.return_temperature() < (starting?MINIMUM_TEMPERATURE_START_SUPERCONDUCTION:MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION)) - return FALSE - if(air.heat_capacity() < M_CELL_WITH_RATIO) // Was: MOLES_CELLSTANDARD*0.1*0.05 Since there are no variables here we can make this a constant. - return FALSE - return ..() - -/turf/closed/consider_superconductivity(starting) - if(temperature < (starting?MINIMUM_TEMPERATURE_START_SUPERCONDUCTION:MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION)) - return FALSE - return ..() - -/turf/proc/radiate_to_spess() //Radiate excess tile heat to space - if(temperature > T0C) //Considering 0 degC as te break even point for radiation in and out - var/delta_temperature = (temperature_archived - TCMB) //hardcoded space temperature - if((heat_capacity > 0) && (abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)) - - var/heat = thermal_conductivity*delta_temperature* \ - (heat_capacity*HEAT_CAPACITY_VACUUM/(heat_capacity+HEAT_CAPACITY_VACUUM)) - temperature -= heat/heat_capacity - -/turf/open/proc/temperature_share_open_to_solid(turf/sharer) - sharer.temperature = air.temperature_share(null, sharer.thermal_conductivity, sharer.temperature, sharer.heat_capacity) - -/turf/proc/share_temperature_mutual_solid(turf/sharer, conduction_coefficient) //to be understood - var/delta_temperature = (temperature_archived - sharer.temperature_archived) - if(abs(delta_temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER && heat_capacity && sharer.heat_capacity) - - var/heat = conduction_coefficient*delta_temperature* \ - (heat_capacity*sharer.heat_capacity/(heat_capacity+sharer.heat_capacity)) - - temperature -= heat/heat_capacity - sharer.temperature += heat/sharer.heat_capacity diff --git a/code/modules/atmospherics/gasmixtures/auxgm.dm b/code/modules/atmospherics/gasmixtures/auxgm.dm new file mode 100644 index 000000000000..f5dcb9f4d974 --- /dev/null +++ b/code/modules/atmospherics/gasmixtures/auxgm.dm @@ -0,0 +1,141 @@ +///the main four gases, which were at one time hardcoded +GLOBAL_LIST_INIT(hardcoded_gases, list( + GAS_O2, + GAS_N2, + GAS_CO2, + GAS_PLASMA, +)) +///Gasses that are unable to react amongst themselves +GLOBAL_LIST_INIT(nonreactive_gases, typecacheof( + list( + GAS_O2, + GAS_N2, + GAS_CO2, + GAS_PLUOXIUM, + ), +)) + +// Auxgm +// It's a send-up of XGM, like what baystation got. +// It's got the same architecture as XGM, but it's structured +// differently to make it more convenient for auxmos. + +// Most important compared to TG is that it does away with hardcoded typepaths, +// which lead to problems on the auxmos end anyway. We cache the string value +// references on the Rust end, so no performance is lost here. + +// Also allows you to add new gases at runtime + +/datum/auxgm + var/list/datums = list() + var/list/specific_heats = list() + var/list/names = list() + var/list/visibility = list() + var/list/overlays = list() + var/list/flags = list() + var/list/ids = list() + var/list/typepaths = list() + var/list/fusion_powers = list() + var/list/breathing_classes = list() + var/list/breath_results = list() + var/list/breath_reagents = list() + var/list/breath_reagents_dangerous = list() + var/list/breath_alert_info = list() + var/list/oxidation_temperatures = list() + var/list/oxidation_rates = list() + var/list/fire_temperatures = list() + var/list/enthalpies = list() + var/list/fire_products = list() + var/list/fire_burn_rates = list() + var/list/ui_colors = list() + +/datum/gas + var/id = "" + var/specific_heat = 0 + var/name = "" + var/gas_overlay = "" //icon_state in icons/effects/atmospherics.dmi + var/moles_visible = null + var/flags = NONE //currently used by canisters + var/fusion_power = 0 // How much the gas destabilizes a fusion reaction + var/breath_results = GAS_CO2 // what breathing this breathes out + var/breath_reagent = null // what breathing this adds to your reagents + var/breath_reagent_dangerous = null // what breathing this adds to your reagents IF it's above a danger threshold + var/list/breath_alert_info = null // list for alerts that pop up when you have too much/not enough of something + var/oxidation_temperature = null // temperature above which this gas is an oxidizer; null for none + var/oxidation_rate = 1 // how many moles of this can oxidize how many moles of material + var/fire_temperature = null // temperature above which gas may catch fire; null for none + var/list/fire_products = null // what results when this gas is burned (oxidizer or fuel); null for none + var/enthalpy = 0 // Standard enthalpy of formation in joules, used for fires + var/fire_burn_rate = 1 // how many moles are burned per product released + var/fire_radiation_released = 0 // How much radiation is released when this gas burns + var/ui_color = "white" + +/datum/gas/proc/breath(partial_pressure, light_threshold, heavy_threshold, moles, mob/living/carbon/C, obj/item/organ/lungs/lungs) + // This is only called on gases with the GAS_FLAG_BREATH_PROC flag. When possible, do NOT use this-- + // greatly prefer just adding a reagent. This is mostly around for legacy reasons. + return null + +/datum/auxgm/proc/add_gas(datum/gas/gas) + var/g = gas.id + if(g) + datums[g] = gas + specific_heats[g] = gas.specific_heat + names[g] = gas.name + if(gas.moles_visible) + visibility[g] = gas.moles_visible + overlays[g] = new /list(FACTOR_GAS_VISIBLE_MAX) + for(var/i in 1 to FACTOR_GAS_VISIBLE_MAX) + overlays[g][i] = new /obj/effect/overlay/gas(gas.gas_overlay, i * 255 / FACTOR_GAS_VISIBLE_MAX) + else + visibility[g] = 0 + overlays[g] = 0 + flags[g] = gas.flags + ids[g] = g + typepaths[g] = gas.type + fusion_powers[g] = gas.fusion_power + ui_colors[g] = gas.ui_color + + if(gas.breath_alert_info) + breath_alert_info[g] = gas.breath_alert_info + breath_results[g] = gas.breath_results + if(gas.breath_reagent) + breath_reagents[g] = gas.breath_reagent + if(gas.breath_reagent_dangerous) + breath_reagents_dangerous[g] = gas.breath_reagent_dangerous + if(gas.oxidation_temperature) + oxidation_temperatures[g] = gas.oxidation_temperature + oxidation_rates[g] = gas.oxidation_rate + if(gas.fire_products) + fire_products[g] = gas.fire_products + enthalpies[g] = gas.enthalpy + else if(gas.fire_temperature) + fire_temperatures[g] = gas.fire_temperature + fire_burn_rates[g] = gas.fire_burn_rate + if(gas.fire_products) + fire_products[g] = gas.fire_products + enthalpies[g] = gas.enthalpy + _auxtools_register_gas(gas) + +/datum/auxgm/New() + for(var/gas_path in subtypesof(/datum/gas)) + var/datum/gas/gas = new gas_path + add_gas(gas) + for(var/breathing_class_path in subtypesof(/datum/breathing_class)) + var/datum/breathing_class/class = new breathing_class_path + breathing_classes[breathing_class_path] = class + finalize_gas_refs() + +GLOBAL_DATUM_INIT(gas_data, /datum/auxgm, new) + +/obj/effect/overlay/gas + icon = 'icons/effects/atmospherics.dmi' + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + anchored = TRUE // should only appear in vis_contents, but to be safe + layer = FLY_LAYER + appearance_flags = TILE_BOUND + vis_flags = NONE + +/obj/effect/overlay/gas/New(state, alph) + . = ..() + icon_state = state + alpha = alph diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm index 991907fbd814..247734a0d22a 100644 --- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm +++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm @@ -21,44 +21,105 @@ 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 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(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 + /// Never ever set this variable, hooked into vv_get_var for view variables viewing. + var/gas_list_view_only var/initial_volume = CELL_VOLUME //liters var/list/reaction_results var/list/analyzer_results //used for analyzer feedback - not initialized until its used - var/_extools_pointer_gasmixture = 0 // Contains the memory address of the shared_ptr object for this gas mixture in c++ land. Don't. Touch. This. Var. + var/_extools_pointer_gasmixture // Contains the index in the gas vector for this gas mixture in rust land. Don't. Touch. This. Var. + +GLOBAL_VAR_INIT(auxtools_atmos_initialized, FALSE) /datum/gas_mixture/New(volume) if (!isnull(volume)) initial_volume = volume - ATMOS_EXTOOLS_CHECK + if(!GLOB.auxtools_atmos_initialized && auxtools_atmos_init(GLOB.gas_data)) + GLOB.auxtools_atmos_initialized = TRUE __gasmixture_register() reaction_results = new +/datum/gas_mixture/Del() + __gasmixture_unregister() + . = ..() + /datum/gas_mixture/vv_edit_var(var_name, var_value) if(var_name == NAMEOF(src, _extools_pointer_gasmixture)) return FALSE // please no. segfaults bad. + if(var_name == "gas_list_view_only") + return FALSE return ..() -/* -/datum/gas_mixture/Del() - __gasmixture_unregister() - . = ..()*/ -/datum/gas_mixture/proc/__gasmixture_unregister() -/datum/gas_mixture/proc/__gasmixture_register() +/datum/gas_mixture/vv_get_var(var_name) + . = ..() + if(var_name == "gas_list_view_only") + var/list/dummy = get_gases() + for(var/gas in dummy) + dummy[gas] = get_moles(gas) + dummy["CAP [gas]"] = partial_heat_capacity(gas) + dummy["TEMP"] = return_temperature() + dummy["PRESSURE"] = return_pressure() + dummy["HEAT CAPACITY"] = heat_capacity() + dummy["TOTAL MOLES"] = total_moles() + dummy["VOLUME"] = return_volume() + dummy["THERMAL ENERGY"] = thermal_energy() + return debug_variable("gases (READ ONLY)", dummy, 0, src) + +/datum/gas_mixture/vv_get_dropdown() + . = ..() + VV_DROPDOWN_OPTION("", "---") + VV_DROPDOWN_OPTION(VV_HK_PARSE_GASSTRING, "Parse Gas String") + VV_DROPDOWN_OPTION(VV_HK_EMPTY, "Empty") + VV_DROPDOWN_OPTION(VV_HK_SET_MOLES, "Set Moles") + VV_DROPDOWN_OPTION(VV_HK_SET_TEMPERATURE, "Set Temperature") + VV_DROPDOWN_OPTION(VV_HK_SET_VOLUME, "Set Volume") + +/datum/gas_mixture/vv_do_topic(list/href_list) + . = ..() + if(!.) + return + if(href_list[VV_HK_PARSE_GASSTRING]) + var/gasstring = input(usr, "Input Gas String (WARNING: Advanced. Don't use this unless you know how these work.", "Gas String Parse") as text|null + if(!istext(gasstring)) + return + log_admin("[key_name(usr)] modified gas mixture [REF(src)]: Set to gas string [gasstring].") + message_admins("[key_name(usr)] modified gas mixture [REF(src)]: Set to gas string [gasstring].") + parse_gas_string(gasstring) + if(href_list[VV_HK_EMPTY]) + log_admin("[key_name(usr)] emptied gas mixture [REF(src)].") + message_admins("[key_name(usr)] emptied gas mixture [REF(src)].") + clear() + if(href_list[VV_HK_SET_MOLES]) + var/list/gases = get_gases() + for(var/gas in gases) + gases[gas] = get_moles(gas) + var/gasid = input(usr, "What kind of gas?", "Set Gas") as null|anything in GLOB.gas_data.ids + if(!gasid) + return + var/amount = input(usr, "Input amount", "Set Gas", gases[gasid] || 0) as num|null + if(!isnum(amount)) + return + amount = max(0, amount) + log_admin("[key_name(usr)] modified gas mixture [REF(src)]: Set gas [gasid] to [amount] moles.") + message_admins("[key_name(usr)] modified gas mixture [REF(src)]: Set gas [gasid] to [amount] moles.") + set_moles(gasid, amount) + if(href_list[VV_HK_SET_TEMPERATURE]) + var/temp = input(usr, "Set the temperature of this mixture to?", "Set Temperature", return_temperature()) as num|null + if(!isnum(temp)) + return + temp = max(2.7, temp) + log_admin("[key_name(usr)] modified gas mixture [REF(src)]: Changed temperature to [temp].") + message_admins("[key_name(usr)] modified gas mixture [REF(src)]: Changed temperature to [temp].") + set_temperature(temp) + if(href_list[VV_HK_SET_VOLUME]) + var/volume = input(usr, "Set the volume of this mixture to?", "Set Volume", return_volume()) as num|null + if(!isnum(volume)) + return + volume = max(0, volume) + log_admin("[key_name(usr)] modified gas mixture [REF(src)]: Changed volume to [volume].") + message_admins("[key_name(usr)] modified gas mixture [REF(src)]: Changed volume to [volume].") + set_volume(volume) /proc/gas_types() var/list/L = subtypesof(/datum/gas) @@ -67,50 +128,20 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache()) L[gt] = initial(G.specific_heat) return L -/datum/gas_mixture/proc/heat_capacity(data = MOLES) //joules per kelvin - -/datum/gas_mixture/proc/total_moles() - -/datum/gas_mixture/proc/return_pressure() //kilopascals - -/datum/gas_mixture/proc/return_temperature() //kelvins - -/datum/gas_mixture/proc/set_min_heat_capacity(n) -/datum/gas_mixture/proc/set_temperature(new_temp) -/datum/gas_mixture/proc/set_volume(new_volume) -/datum/gas_mixture/proc/get_moles(gas_type) -/datum/gas_mixture/proc/set_moles(gas_type, moles) -/datum/gas_mixture/proc/scrub_into(datum/gas_mixture/target, list/gases) -/datum/gas_mixture/proc/mark_immutable() -/datum/gas_mixture/proc/get_gases() -/datum/gas_mixture/proc/multiply(factor) /datum/gas_mixture/proc/get_last_share() -/datum/gas_mixture/proc/clear() - -/datum/gas_mixture/proc/adjust_moles(gas_type, amt = 0) - if((get_moles(gas_type) + amt) < 0) - amt = 0 - set_moles(gas_type, get_moles(gas_type) + amt) - -/datum/gas_mixture/proc/return_volume() //liters - -/datum/gas_mixture/proc/thermal_energy() //joules /datum/gas_mixture/proc/archive() //Update archived versions of variables //Returns: 1 in all cases -/datum/gas_mixture/proc/merge(datum/gas_mixture/giver) - //Merges all air from giver into self. giver is untouched. - //Returns: 1 if we are mutable, 0 otherwise /datum/gas_mixture/proc/remove(amount) - //Removes amount of gas from the gas_mixture + //Proportionally removes amount of gas from the gas_mixture //Returns: gas_mixture with the gases removed -/datum/gas_mixture/proc/transfer_to(datum/gas_mixture/target, amount) - //Transfers amount of gas to target. Equivalent to target.merge(remove(amount)) but faster. - //Removes amount of gas from the gas_mixture +/datum/gas_mixture/proc/remove_by_flag(flag, amount) + //Removes amount of gas from the gas mixture by flag + //Returns: gas_mixture with gases that match the flag removed /datum/gas_mixture/proc/remove_ratio(ratio) //Proportionally removes amount of gas from the gas_mixture @@ -120,10 +151,6 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache()) //Creates new, identical gas mixture //Returns: duplicate gas mixture -/datum/gas_mixture/proc/copy_from(datum/gas_mixture/sample) - //Copies variables from sample - //Returns: 1 if we are mutable, 0 otherwise - /datum/gas_mixture/proc/copy_from_turf(turf/model) //Copies all gas info from the turf into the gas list along with temperature //Returns: 1 if we are mutable, 0 otherwise @@ -136,27 +163,18 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache()) //Performs air sharing calculations between two gas_mixtures assuming only 1 boundary length //Returns: amount of gas exchanged (+ if sharer received) -/datum/gas_mixture/proc/temperature_share(datum/gas_mixture/sharer, conduction_coefficient) - //Performs temperature sharing calculations (via conduction) between two gas_mixtures assuming only 1 boundary length - //Returns: new temperature of the sharer - -/datum/gas_mixture/proc/compare(datum/gas_mixture/sample) - //Compares sample to self to see if within acceptable ranges that group processing may be enabled - //Returns: a string indicating what check failed, or "" if check passes - -/datum/gas_mixture/proc/react(turf/open/dump_location) - //Performs various reactions such as combustion or fusion (LOL) - //Returns: 1 if any reaction took place; 0 otherwise +/datum/gas_mixture/remove_by_flag(flag, amount) + var/datum/gas_mixture/removed = new type + __remove_by_flag(removed, flag, amount) + return removed -/datum/gas_mixture/proc/__remove() /datum/gas_mixture/remove(amount) var/datum/gas_mixture/removed = new type __remove(removed, amount) return removed -/datum/gas_mixture/proc/__remove_ratio() /datum/gas_mixture/remove_ratio(ratio) var/datum/gas_mixture/removed = new type __remove_ratio(removed, ratio) @@ -170,75 +188,30 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache()) return copy /datum/gas_mixture/copy_from_turf(turf/model) + set_temperature(initial(model.initial_temperature)) parse_gas_string(model.initial_gas_mix) - - //acounts for changes in temperature - var/turf/model_parent = model.parent_type - if(model.temperature != initial(model.temperature) || model.temperature != initial(model_parent.temperature)) - set_temperature(model.temperature) - return 1 /datum/gas_mixture/parse_gas_string(gas_string) + __auxtools_parse_gas_string(gas_string) + /* var/list/gas = params2list(gas_string) if(gas["TEMP"]) - set_temperature(text2num(gas["TEMP"])) + var/temp = text2num(gas["TEMP"]) gas -= "TEMP" + if(!isnum(temp) || temp < 2.7) + temp = 2.7 + set_temperature(temp) clear() for(var/id in gas) - var/path = id - 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 - set_moles(path, text2num(gas[id])) + set_moles(id, text2num(gas[id])) return 1 - -/datum/gas_mixture/react(datum/holder) - . = NO_REACTION - var/list/reactions = list() - for(var/I in get_gases()) - reactions += SSair.gas_reactions[I] - if(!length(reactions)) - return - if (length(reactions) > 1) - reactions = sortTim(reactions, /proc/cmp_gas_reaction) - reaction_results = new - var/temp = return_temperature() - var/ener = thermal_energy() - - reaction_loop: - for(var/r in reactions) - var/datum/gas_reaction/reaction = r - - var/list/min_reqs = reaction.min_requirements - if( (min_reqs["TEMP"] && temp < min_reqs["TEMP"]) || \ - (min_reqs["ENER"] && ener < min_reqs["ENER"]) || \ - (min_reqs["MAX_TEMP"] && temp > min_reqs["MAX_TEMP"]) - ) - continue - - for(var/id in min_reqs) - if (id == "TEMP" || id == "ENER" || id == "MAX_TEMP") - continue - if(get_moles(id) < min_reqs[id]) - continue reaction_loop - - //at this point, all requirements for the reaction are satisfied. we can now react() - - . |= reaction.react(src, holder) - if (. & STOP_REACTIONS) - break - -//Takes the amount of the gas you want to PP as an argument -//So I don't have to do some hacky switches/defines/magic strings -//eg: -//Tox_PP = get_partial_pressure(gas_mixture.toxins) -//O2_PP = get_partial_pressure(gas_mixture.oxygen) - -/datum/gas_mixture/proc/get_breath_partial_pressure(gas_pressure) - return (gas_pressure * R_IDEAL_GAS_EQUATION * return_temperature()) / BREATH_VOLUME -//inverse -/datum/gas_mixture/proc/get_true_breath_pressure(partial_pressure) - return (partial_pressure * BREATH_VOLUME) / (R_IDEAL_GAS_EQUATION * return_temperature()) + */ + +/datum/gas_mixture/proc/set_analyzer_results(instability) + if(!analyzer_results) + analyzer_results = new + analyzer_results["fusion"] = instability //Mathematical proofs: /* @@ -251,59 +224,6 @@ get_true_breath_pressure(pp) --> gas_pp = pp/breath_pp*total_moles() /datum/gas_mixture/turf -/* -/mob/verb/profile_atmos() - /world{loop_checks = 0;} - var/datum/gas_mixture/A = new - var/datum/gas_mixture/B = new - A.parse_gas_string("o2=200;n2=800;TEMP=50") - B.parse_gas_string("co2=500;plasma=500;TEMP=5000") - var/pa - var/pb - pa = world.tick_usage - for(var/I in 1 to 100000) - B.transfer_to(A, 1) - A.transfer_to(B, 1) - pb = world.tick_usage - var/total_time = (pb-pa) * world.tick_lag - to_chat(src, "Total time (gas transfer): [total_time]ms") - to_chat(src, "Operations per second: [100000 / (total_time/1000)]") - pa = world.tick_usage - for(var/I in 1 to 100000) - B.total_moles(); - pb = world.tick_usage - total_time = (pb-pa) * world.tick_lag - to_chat(src, "Total time (total_moles): [total_time]ms") - to_chat(src, "Operations per second: [100000 / (total_time/1000)]") - pa = world.tick_usage - for(var/I in 1 to 100000) - new /datum/gas_mixture - pb = world.tick_usage - total_time = (pb-pa) * world.tick_lag - to_chat(src, "Total time (new gas mixture): [total_time]ms") - to_chat(src, "Operations per second: [100000 / (total_time/1000)]") -*/ - - -/// Pumps gas from src to output_air. The amount depends on target_pressure -/datum/gas_mixture/proc/pump_gas_to(datum/gas_mixture/output_air, target_pressure) - var/output_starting_pressure = output_air.return_pressure() - - if((target_pressure - output_starting_pressure) < 0.01) - //No need to pump gas if target is already reached! - return FALSE - - //Calculate necessary moles to transfer using PV=nRT - if((total_moles() > 0) && (return_temperature()>0)) - var/pressure_delta = target_pressure - output_starting_pressure - var/transfer_moles = pressure_delta*output_air.return_volume()/(return_temperature() * R_IDEAL_GAS_EQUATION) - - //Actually transfer the gas - var/datum/gas_mixture/removed = remove(transfer_moles) - output_air.merge(removed) - return TRUE - return FALSE - /// Releases gas from src to output air. This means that it can not transfer air to gas mixture with higher pressure. /datum/gas_mixture/proc/release_gas_to(datum/gas_mixture/output_air, target_pressure) var/output_starting_pressure = output_air.return_pressure() @@ -311,7 +231,7 @@ get_true_breath_pressure(pp) --> gas_pp = pp/breath_pp*total_moles() if(output_starting_pressure >= min(target_pressure,input_starting_pressure-10)) //No need to pump gas if target is already reached or input pressure is too low - //Need at least 10 KPa difference to overcome friction in the mechanism + //Need at least 10 kPa difference to overcome friction in the mechanism return FALSE //Calculate necessary moles to transfer using PV = nRT @@ -324,10 +244,12 @@ get_true_breath_pressure(pp) --> gas_pp = pp/breath_pp*total_moles() //Actually transfer the gas var/datum/gas_mixture/removed = remove(transfer_moles) output_air.merge(removed) - return TRUE return FALSE +/datum/gas_mixture/proc/vv_react(datum/holder) + return react(holder) + /datum/gas_mixture/proc/remove_specific_ratio(gas_id, ratio) if(ratio <= 0) return null diff --git a/code/modules/atmospherics/gasmixtures/gas_types.dm b/code/modules/atmospherics/gasmixtures/gas_types.dm deleted file mode 100644 index 2a52acd9cfba..000000000000 --- a/code/modules/atmospherics/gasmixtures/gas_types.dm +++ /dev/null @@ -1,237 +0,0 @@ -GLOBAL_LIST_INIT(hardcoded_gases, list(/datum/gas/oxygen, /datum/gas/nitrogen, /datum/gas/carbon_dioxide, /datum/gas/plasma)) //the main four gases, which were at one time hardcoded -GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/gas/nitrogen, /datum/gas/carbon_dioxide, /datum/gas/pluoxium))) //unable to react amongst themselves - -/proc/meta_gas_list() - . = subtypesof(/datum/gas) - for(var/gas_path in .) - var/list/gas_info = new(7) - var/datum/gas/gas = gas_path - - gas_info[META_GAS_SPECIFIC_HEAT] = initial(gas.specific_heat) - gas_info[META_GAS_NAME] = initial(gas.name) - - gas_info[META_GAS_MOLES_VISIBLE] = initial(gas.moles_visible) - if(initial(gas.moles_visible) != null) - gas_info[META_GAS_OVERLAY] = new /list(FACTOR_GAS_VISIBLE_MAX) - for(var/i in 1 to FACTOR_GAS_VISIBLE_MAX) - gas_info[META_GAS_OVERLAY][i] = new /obj/effect/overlay/gas(initial(gas.gas_overlay), i * 255 / FACTOR_GAS_VISIBLE_MAX) - - gas_info[META_GAS_FUSION_POWER] = initial(gas.fusion_power) - gas_info[META_GAS_DANGER] = initial(gas.dangerous) - gas_info[META_GAS_ID] = initial(gas.id) - .[gas_path] = gas_info - -/proc/gas_id2path(id) - var/list/meta_gas = GLOB.meta_gas_info - if(id in meta_gas) - return id - for(var/path in meta_gas) - if(meta_gas[path][META_GAS_ID] == id) - return path - return "" - -/*||||||||||||||/----------\||||||||||||||*\ -||||||||||||||||[GAS DATUMS]|||||||||||||||| -||||||||||||||||\__________/|||||||||||||||| -||||These should never be instantiated. |||| -||||They exist only to make it easier |||| -||||to add a new gas. They are accessed |||| -||||only by meta_gas_list(). |||| -\*||||||||||||||||||||||||||||||||||||||||*/ - -/datum/gas - var/id = "" - var/specific_heat = 0 - var/name = "" - /// icon_state in icons/effects/atmospherics.dmi - var/gas_overlay = "" - var/moles_visible = null - /// Currently used by canisters - var/dangerous = FALSE - /// How much the gas accelerates a fusion reaction - var/fusion_power = 0 - /// Relative rarity compared to other gases, used when setting up the reactions list. - var/rarity = 0 - -// If you add or remove gases, update TOTAL_NUM_GASES in the extools code to match! -// (dont forget to count shizz in the yogstation folder) - -/datum/gas/oxygen - id = "o2" - specific_heat = 20 - name = "Oxygen" - rarity = 900 - -/datum/gas/nitrogen - id = "n2" - specific_heat = 20 - name = "Nitrogen" - rarity = 1000 - -/datum/gas/carbon_dioxide //what the fuck is this? - id = "co2" - specific_heat = 30 - name = "Carbon Dioxide" - rarity = 700 - -/datum/gas/plasma - id = "plasma" - specific_heat = 200 - name = "Plasma" - gas_overlay = "plasma" - moles_visible = MOLES_GAS_VISIBLE - dangerous = TRUE - rarity = 800 - -/datum/gas/water_vapor - id = "water_vapor" - specific_heat = 40 - name = "Water Vapor" - gas_overlay = "water_vapor" - moles_visible = MOLES_GAS_VISIBLE - fusion_power = 8 - rarity = 500 - -/datum/gas/hypernoblium - id = "nob" - specific_heat = 2000 - name = "Hyper-noblium" - gas_overlay = "freon" - moles_visible = MOLES_GAS_VISIBLE - dangerous = TRUE - rarity = 50 - -/datum/gas/nitrous_oxide - id = "n2o" - specific_heat = 40 - name = "Nitrous Oxide" - gas_overlay = "nitrous_oxide" - moles_visible = MOLES_GAS_VISIBLE * 2 - fusion_power = 10 - dangerous = TRUE - rarity = 600 - -/datum/gas/nitrium - id = "nitrium" - specific_heat = 10 - name = "Nitrium" - fusion_power = 7 - gas_overlay = "nitrium" - moles_visible = MOLES_GAS_VISIBLE - dangerous = TRUE - rarity = 1 - -/datum/gas/tritium - id = "tritium" - specific_heat = 10 - name = "Tritium" - gas_overlay = "tritium" - moles_visible = MOLES_GAS_VISIBLE - dangerous = TRUE - fusion_power = 1 - rarity = 300 - -/datum/gas/bz - id = "bz" - specific_heat = 20 - name = "BZ" - dangerous = TRUE - fusion_power = 8 - rarity = 400 - -/datum/gas/pluoxium - id = "pluox" - specific_heat = 80 - name = "Pluoxium" - fusion_power = -10 - rarity = 200 - -/datum/gas/miasma - id = "miasma" - specific_heat = 20 - name = "Miasma" - gas_overlay = "miasma" - moles_visible = MOLES_GAS_VISIBLE * 60 - rarity = 250 - -/datum/gas/freon - id = "freon" - specific_heat = 600 - name = "Freon" - gas_overlay = "freon" - moles_visible = MOLES_GAS_VISIBLE *30 - fusion_power = -5 - rarity = 10 - -/datum/gas/hydrogen - id = "hydrogen" - specific_heat = 15 - name = "Hydrogen" - dangerous = TRUE - rarity = 700 - -/datum/gas/healium - id = "healium" - specific_heat = 10 - name = "Healium" - dangerous = TRUE - gas_overlay = "healium" - moles_visible = MOLES_GAS_VISIBLE - rarity = 100 - -/datum/gas/pluonium - id = "pluonium" - specific_heat = 30 - name = "Pluonium" - dangerous = TRUE - gas_overlay = "pluonium" - moles_visible = MOLES_GAS_VISIBLE - rarity = 100 - -/datum/gas/halon - id = "halon" - specific_heat = 175 - name = "Halon" - dangerous = TRUE - gas_overlay = "halon" - moles_visible = MOLES_GAS_VISIBLE - rarity = 100 - -/datum/gas/antinoblium - id = "antinoblium" - specific_heat = 1 - name = "Antinoblium" - dangerous = TRUE - gas_overlay = "antinoblium" - moles_visible = MOLES_GAS_VISIBLE - fusion_power = 20 - rarity = 1 - -/datum/gas/zauker - id = "zauker" - specific_heat = 350 - name = "Zauker" - dangerous = TRUE - gas_overlay = "zauker" - moles_visible = MOLES_GAS_VISIBLE - rarity = 1 -/datum/gas/hexane - id = "hexane" - specific_heat = 5 - name = "Hexane" - dangerous = TRUE - gas_overlay = "hexane" - moles_visible = MOLES_GAS_VISIBLE - rarity = 100 - -/obj/effect/overlay/gas - icon = 'icons/effects/atmospherics.dmi' - mouse_opacity = MOUSE_OPACITY_TRANSPARENT - anchored = TRUE // should only appear in vis_contents, but to be safe - layer = FLY_LAYER - appearance_flags = TILE_BOUND - -/obj/effect/overlay/gas/New(state, alph) - . = ..() - icon_state = state - alpha = alph diff --git a/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm b/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm index 2f1a10e2756a..7de056ed0261 100644 --- a/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm +++ b/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm @@ -25,4 +25,4 @@ initial_temperature = T20C /datum/gas_mixture/immutable/cloner/populate() - set_moles(/datum/gas/nitrogen, MOLES_O2STANDARD + MOLES_N2STANDARD) + set_moles(GAS_N2, MOLES_O2STANDARD + MOLES_N2STANDARD) diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm index efe099b4b64d..d97e5e504e98 100644 --- a/code/modules/atmospherics/gasmixtures/reactions.dm +++ b/code/modules/atmospherics/gasmixtures/reactions.dm @@ -1,71 +1,51 @@ //All defines used in reactions are located in ..\__DEFINES\reactions.dm -/*priority so far, check this list to see what are the numbers used. Please use a different priority for each reaction(higher number are done first) -miaster = -10 (this should always be under all other fires) -freonfire = -5 -plasmafire = -4 -h2fire = -3 -tritfire = -2 -halon_o2removal = -1 -nitrous_decomp = 0 -water_vapor = 1 -fusion = 2 -nitrium_formation = 3 -bzformation = 4 -freonformation = 5 -stim_ball = 7 -zauker_decomp = 8 -healium_formation = 9 -pluonium_formation = 10 -zauker_formation = 11 -halon_formation = 12 -hexane_formation = 13 -pluonium_response = 14 - 16 -metalhydrogen = 17 -nobliumsuppression = 1000 -nobliumformation = 1001 -*/ +//priority so far, check this list to see what are the numbers used. +//Please use a different priority for each reaction(higher number are done first) +//or else auxmos will ignore the reaction +//NOTE: ONLY INTEGERS ARE ALLOWED, EXPECT WEIRDNESS IF YOU DON'T FOLLOW THIS +#define MIASTER -10 +#define FREONFIRE -5 +#define PLASMAFIRE -4 +#define H2FIRE -3 +#define TRITFIRE -2 +#define HALONO2REMOVAL -1 +#define NITROUSDECOMP 0 +#define WATERVAPOR 1 +#define FUSION 2 +#define COLDFUSION 3 +#define NITRIUMFORMATION 4 +#define BZFORMATION 5 +#define FREONFORMATION 6 +#define NITROBALL 7 +#define ZAUKERDECOMP 8 +#define HEALIUMFORMATION 9 +#define PLUONIUMFORMATION 10 +#define ZAUKERFORMATION 11 +#define HALONFORMATION 12 +#define HEXANEFORMATION 13 +#define PLUONIUMBZRESPONSE 14 +#define PLUONIUMTRITRESPONSE 15 +#define PLUONIUMH2RESPONSE 16 +#define METALHYDROGEN 17 +#define NOBLIUMSUPPRESSION 1000 +#define NOBLIUMFORMATION 1001 /proc/init_gas_reactions() . = list() - for(var/type in subtypesof(/datum/gas)) - .[type] = list() for(var/r in subtypesof(/datum/gas_reaction)) var/datum/gas_reaction/reaction = r if(initial(reaction.exclude)) continue reaction = new r - var/datum/gas/reaction_key - for (var/req in reaction.min_requirements) - if (ispath(req)) - var/datum/gas/req_gas = req - if (!reaction_key || initial(reaction_key.rarity) > initial(req_gas.rarity)) - reaction_key = req_gas - .[reaction_key] += list(reaction) - sortTim(., /proc/cmp_gas_reactions, TRUE) - -/proc/cmp_gas_reactions(list/datum/gas_reaction/a, list/datum/gas_reaction/b) // compares lists of reactions by the maximum priority contained within the list - if (!length(a) || !length(b)) - return length(b) - length(a) - var/maxa - var/maxb - for (var/datum/gas_reaction/R in a) - if (R.priority > maxa) - maxa = R.priority - for (var/datum/gas_reaction/R in b) - if (R.priority > maxb) - maxb = R.priority - return maxb - maxa - -/proc/cmp_gas_reaction(datum/gas_reaction/a, datum/gas_reaction/b) // compares the priority of two gas reactions - return b.priority - a.priority + . += reaction /datum/gas_reaction //regarding the requirements lists: the minimum or maximum requirements must be non-zero. //when in doubt, use MINIMUM_MOLE_COUNT. var/list/min_requirements var/exclude = FALSE //do it this way to allow for addition/removal of reactions midmatch in the future - var/priority = 100 //lower numbers are checked/react later than higher numbers. if two reactions have the same priority they may happen in either order + var/priority = -1000 //lower numbers are checked/react later than higher numbers. if two reactions have the same priority they may happen in either order var/name = "reaction" var/id = "r" @@ -77,13 +57,23 @@ nobliumformation = 1001 /datum/gas_reaction/proc/react(datum/gas_mixture/air, atom/location) return NO_REACTION +//fires cannot use this proc, because you don't want fires in pipes to proc fire_act on random turfs above the pipe +/proc/get_holder_turf(datum/holder) + var/turf/open/location + if(istype(holder,/datum/pipeline)) //Find the tile the reaction is occuring on, or a random part of the network if it's a pipenet. + var/datum/pipeline/pipenet = holder + location = get_turf(pick(pipenet.members)) + else + location = get_turf(holder) + return location + /datum/gas_reaction/nobliumsuppression - priority = 1000 //ensure all non-HN reactions are lower than this number. + priority = NOBLIUMSUPPRESSION //ensure all non-HN reactions are lower than this number. name = "Hyper-Noblium Reaction Suppression" id = "nobstop" /datum/gas_reaction/nobliumsuppression/init_reqs() - min_requirements = list(/datum/gas/hypernoblium = REACTION_OPPRESSION_THRESHOLD) + min_requirements = list(GAS_HYPERNOB = REACTION_OPPRESSION_THRESHOLD) /datum/gas_reaction/nobliumsuppression/react() return STOP_REACTIONS @@ -95,13 +85,13 @@ nobliumformation = 1001 * Can frost things if the gas is cold enough. */ /datum/gas_reaction/water_vapor - priority = 1 + priority = WATERVAPOR name = "Water Vapor" id = "vapor" /datum/gas_reaction/water_vapor/init_reqs() min_requirements = list( - /datum/gas/water_vapor = MOLES_GAS_VISIBLE, + GAS_H2O = MOLES_GAS_VISIBLE, "MAX_TEMP" = WATER_VAPOR_CONDENSATION_POINT, ) @@ -112,6 +102,7 @@ nobliumformation = 1001 var/turf/open/location = holder var/consumed = 0 + switch(air.return_temperature()) if(-INFINITY to WATER_VAPOR_DEPOSITION_POINT) if(location?.freeze_turf()) @@ -121,25 +112,24 @@ nobliumformation = 1001 consumed = MOLES_GAS_VISIBLE if(consumed) - air.adjust_moles(/datum/gas/water_vapor, -consumed) + air.adjust_moles(GAS_H2O, -consumed) . = REACTING //tritium combustion: combustion of oxygen and tritium (treated as hydrocarbons). creates hotspots. exothermic /datum/gas_reaction/tritfire - priority = -2 //fire should ALWAYS be last, but tritium fires happen before plasma fires + priority = TRITFIRE //fire should ALWAYS be last, but tritium fires happen before plasma fires name = "Tritium Combustion" id = "tritfire" /datum/gas_reaction/tritfire/init_reqs() min_requirements = list( "TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST, - /datum/gas/tritium = MINIMUM_MOLE_COUNT, - /datum/gas/oxygen = MINIMUM_MOLE_COUNT + GAS_TRITIUM = MINIMUM_MOLE_COUNT, + GAS_O2 = MINIMUM_MOLE_COUNT, ) /datum/gas_reaction/tritfire/react(datum/gas_mixture/air, datum/holder) - var/old_heat_capacity = air.heat_capacity() - var/temperature = air.return_temperature() + var/initial_thermal_energy = air.thermal_energy() var/list/cached_results = air.reaction_results cached_results["fire"] = 0 var/turf/open/location = null @@ -150,13 +140,13 @@ nobliumformation = 1001 location = get_turf(pick(combustion_pipenet.members)) else location = get_turf(holder) - var/burned_fuel = min(air.get_moles(/datum/gas/tritium), air.get_moles(/datum/gas/oxygen)) / TRITIUM_BURN_TRIT_FACTOR + var/burned_fuel = min(air.get_moles(GAS_TRITIUM), air.get_moles(GAS_O2)) / TRITIUM_BURN_TRIT_FACTOR if(burned_fuel <= 0) return NO_REACTION - air.adjust_moles(/datum/gas/tritium, -burned_fuel) // Yogs -- Maybe a tiny performance boost? I'unno - air.adjust_moles(/datum/gas/oxygen, -burned_fuel / 2) - air.adjust_moles(/datum/gas/water_vapor, burned_fuel)// Yogs -- Conservation of Mass + air.adjust_moles(GAS_TRITIUM, -burned_fuel) // Yogs -- Maybe a tiny performance boost? I'unno + air.adjust_moles(GAS_O2, -burned_fuel / 2) + air.adjust_moles(GAS_H2O, burned_fuel)// Yogs -- Conservation of Mass var/energy_released = (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel * TRITIUM_BURN_TRIT_FACTOR) // Yogs -- Fixes low-energy tritium fires if(location && prob(10) && burned_fuel > TRITIUM_MINIMUM_RADIATION_ENERGY) //woah there let's not crash the server @@ -167,11 +157,11 @@ nobliumformation = 1001 if(energy_released > 0) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature((temperature*old_heat_capacity + energy_released)/new_heat_capacity) + air.set_temperature((initial_thermal_energy + energy_released)/new_heat_capacity) //let the floor know a fire is happening BUT ONLY IF IT'S ACTUALLY A FLOOR if(istype(location) && isturf(holder)) - temperature = air.return_temperature() + var/temperature = air.return_temperature() if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST) location.hotspot_expose(temperature, CELL_VOLUME) for(var/I in location) @@ -183,20 +173,20 @@ nobliumformation = 1001 //plasma combustion: combustion of oxygen and plasma (treated as hydrocarbons). creates hotspots. exothermic /datum/gas_reaction/plasmafire - priority = -4 //fire should ALWAYS be last, but plasma fires happen after tritium fires + priority = PLASMAFIRE //fire should ALWAYS be last, but plasma fires happen after tritium fires name = "Plasma Combustion" id = "plasmafire" /datum/gas_reaction/plasmafire/init_reqs() min_requirements = list( "TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST, - /datum/gas/plasma = MINIMUM_MOLE_COUNT, - /datum/gas/oxygen = MINIMUM_MOLE_COUNT + GAS_PLASMA = MINIMUM_MOLE_COUNT, + GAS_O2 = MINIMUM_MOLE_COUNT ) /datum/gas_reaction/plasmafire/react(datum/gas_mixture/air, datum/holder) var/energy_released = 0 - var/old_heat_capacity = air.heat_capacity() + var/old_thermal_energy = air.thermal_energy() var/temperature = air.return_temperature() var/list/cached_results = air.reaction_results cached_results["fire"] = 0 @@ -210,27 +200,30 @@ nobliumformation = 1001 //to make tritium var/super_saturation = FALSE + var/initial_o2 = air.get_moles(GAS_O2) + var/initial_plas = air.get_moles(GAS_PLASMA) + if(temperature > PLASMA_UPPER_TEMPERATURE) temperature_scale = 1 else temperature_scale = (temperature-PLASMA_MINIMUM_BURN_TEMPERATURE)/(PLASMA_UPPER_TEMPERATURE-PLASMA_MINIMUM_BURN_TEMPERATURE) if(temperature_scale > 0) oxygen_burn_rate = OXYGEN_BURN_RATE_BASE - temperature_scale - if(air.get_moles(/datum/gas/oxygen) / air.get_moles(/datum/gas/plasma) > SUPER_SATURATION_THRESHOLD) //supersaturation. Form Tritium. + if(initial_o2 / initial_plas > SUPER_SATURATION_THRESHOLD) //supersaturation. Form Tritium. super_saturation = TRUE - if(air.get_moles(/datum/gas/oxygen) > air.get_moles(/datum/gas/plasma)*PLASMA_OXYGEN_FULLBURN) - plasma_burn_rate = (air.get_moles(/datum/gas/plasma)*temperature_scale)/PLASMA_BURN_RATE_DELTA + if(initial_o2 > initial_plas * PLASMA_OXYGEN_FULLBURN) + plasma_burn_rate = (initial_plas*temperature_scale)/PLASMA_BURN_RATE_DELTA else - plasma_burn_rate = (temperature_scale*(air.get_moles(/datum/gas/oxygen)/PLASMA_OXYGEN_FULLBURN))/PLASMA_BURN_RATE_DELTA + plasma_burn_rate = (temperature_scale*(initial_o2/PLASMA_OXYGEN_FULLBURN))/PLASMA_BURN_RATE_DELTA if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY) - plasma_burn_rate = min(plasma_burn_rate,air.get_moles(/datum/gas/plasma),air.get_moles(/datum/gas/oxygen)/oxygen_burn_rate) //Ensures matter is conserved properly - air.set_moles(/datum/gas/plasma, QUANTIZE(air.get_moles(/datum/gas/plasma) - plasma_burn_rate)) - air.set_moles(/datum/gas/oxygen, QUANTIZE(air.get_moles(/datum/gas/oxygen) - (plasma_burn_rate * oxygen_burn_rate))) + plasma_burn_rate = min(plasma_burn_rate,initial_plas,initial_o2/oxygen_burn_rate) //Ensures matter is conserved properly + air.adjust_moles(GAS_PLASMA, -plasma_burn_rate) + air.adjust_moles(GAS_O2, -(plasma_burn_rate * oxygen_burn_rate)) if (super_saturation) - air.adjust_moles(/datum/gas/tritium, plasma_burn_rate) + air.adjust_moles(GAS_TRITIUM, plasma_burn_rate) else - air.adjust_moles(/datum/gas/carbon_dioxide, plasma_burn_rate) + air.adjust_moles(GAS_CO2, plasma_burn_rate) energy_released += FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate) @@ -239,7 +232,7 @@ nobliumformation = 1001 if(energy_released > 0) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature((temperature*old_heat_capacity + energy_released)/new_heat_capacity) + air.set_temperature((old_thermal_energy + energy_released)/new_heat_capacity) //let the floor know a fire is happening if(istype(location)) @@ -254,26 +247,26 @@ nobliumformation = 1001 return cached_results["fire"] ? REACTING : NO_REACTION /datum/gas_reaction/n2odecomp - priority = 0 + priority = NITROUSDECOMP name = "Nitrous Oxide Decomposition" id = "n2odecomp" /datum/gas_reaction/n2odecomp/init_reqs() min_requirements = list( "TEMP" = N2O_DECOMPOSITION_MIN_HEAT, - /datum/gas/nitrous_oxide = MINIMUM_MOLE_COUNT*2 + GAS_NITROUS = MINIMUM_MOLE_COUNT*2 ) /datum/gas_reaction/n2odecomp/react(datum/gas_mixture/air, datum/holder) var/old_heat_capacity = air.heat_capacity() var/temperature = air.return_temperature() - var/nitrous = air.get_moles(/datum/gas/nitrous_oxide) + var/nitrous = air.get_moles(GAS_NITROUS) var/burned_fuel = min(N2O_DECOMPOSITION_RATE*nitrous*temperature*(temperature-N2O_DECOMPOSITION_MAX_HEAT)/((-1/4)*(N2O_DECOMPOSITION_MAX_HEAT**2)), nitrous) if(burned_fuel>0) - air.set_moles(/datum/gas/nitrous_oxide, QUANTIZE(nitrous - burned_fuel)) - air.set_moles(/datum/gas/nitrogen, QUANTIZE(air.get_moles(/datum/gas/nitrogen) + burned_fuel)) - air.set_moles(/datum/gas/oxygen, QUANTIZE(air.get_moles(/datum/gas/oxygen) + burned_fuel/2)) + air.set_moles(GAS_NITROUS, QUANTIZE(nitrous - burned_fuel)) + air.set_moles(GAS_N2, QUANTIZE(air.get_moles(GAS_N2) + burned_fuel)) + air.set_moles(GAS_O2, QUANTIZE(air.get_moles(GAS_O2) + burned_fuel/2)) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) air.set_temperature((temperature*old_heat_capacity + burned_fuel*N2O_DECOMPOSITION_ENERGY)/new_heat_capacity) @@ -285,46 +278,59 @@ nobliumformation = 1001 //Fusion Rework Counter: Please increment this if you make a major overhaul to this system again. //6 reworks +/datum/gas_reaction/cold_fusion + exclude = FALSE + priority = COLDFUSION + name = "Cold Plasmic Fusion" + id = "coldfusion" + +/datum/gas_reaction/cold_fusion/init_reqs() + min_requirements = list( + "TEMP" = FUSION_TEMPERATURE_THRESHOLD_MINIMUM, + "MAX_TEMP" = FUSION_TEMPERATURE_THRESHOLD, + GAS_DILITHIUM = MINIMUM_MOLE_COUNT, + GAS_TRITIUM = FUSION_TRITIUM_MOLES_USED, + GAS_PLASMA = FUSION_MOLE_THRESHOLD, + GAS_CO2 = FUSION_MOLE_THRESHOLD) + +/datum/gas_reaction/cold_fusion/react(datum/gas_mixture/air, datum/holder) + if(air.return_temperature() < (FUSION_TEMPERATURE_THRESHOLD - FUSION_TEMPERATURE_THRESHOLD_MINIMUM) * NUM_E**( - air.get_moles(GAS_DILITHIUM) * DILITHIUM_LAMBDA) + FUSION_TEMPERATURE_THRESHOLD_MINIMUM) + // This is an exponential decay equation, actually. Horizontal Asymptote is FUSION_TEMPERATURE_THRESHOLD_MINIMUM. + return NO_REACTION + return fusion_react(air, holder, id) + /datum/gas_reaction/fusion exclude = FALSE - priority = 2 + priority = FUSION name = "Plasmic Fusion" id = "fusion" /datum/gas_reaction/fusion/init_reqs() min_requirements = list( - "TEMP" = FUSION_TEMPERATURE_THRESHOLD_MINIMUM, // Yogs -- Cold Fusion - /datum/gas/tritium = FUSION_TRITIUM_MOLES_USED, - /datum/gas/plasma = FUSION_MOLE_THRESHOLD, - /datum/gas/carbon_dioxide = FUSION_MOLE_THRESHOLD) + "TEMP" = FUSION_TEMPERATURE_THRESHOLD, + GAS_TRITIUM = FUSION_TRITIUM_MOLES_USED, + GAS_PLASMA = FUSION_MOLE_THRESHOLD, + GAS_CO2 = FUSION_MOLE_THRESHOLD) /datum/gas_reaction/fusion/react(datum/gas_mixture/air, datum/holder) - //Yogs start -- Cold Fusion - if(air.return_temperature() < FUSION_TEMPERATURE_THRESHOLD) - if(!air.get_moles(/datum/gas/dilithium)) - return - if(air.return_temperature() < (FUSION_TEMPERATURE_THRESHOLD - FUSION_TEMPERATURE_THRESHOLD_MINIMUM) * NUM_E**( - air.get_moles(/datum/gas/dilithium) * DILITHIUM_LAMBDA) + FUSION_TEMPERATURE_THRESHOLD_MINIMUM) - // This is an exponential decay equation, actually. Horizontal Asymptote is FUSION_TEMPERATURE_THRESHOLD_MINIMUM. - return - //Yogs End - var/turf/open/location - if (istype(holder,/datum/pipeline)) //Find the tile the reaction is occuring on, or a random part of the network if it's a pipenet. - var/datum/pipeline/fusion_pipenet = holder - location = get_turf(pick(fusion_pipenet.members)) - else - location = get_turf(holder) + return fusion_react(air, holder, id) + +/proc/fusion_react(datum/gas_mixture/air, datum/holder, id) + var/turf/open/location = get_holder_turf(holder) + if(!location) + return NO_REACTION if(!air.analyzer_results) air.analyzer_results = new var/list/cached_scan_results = air.analyzer_results - var/old_heat_capacity = air.heat_capacity() + var/old_thermal_energy = air.thermal_energy() var/reaction_energy = 0 //Reaction energy can be negative or positive, for both exothermic and endothermic reactions. - var/initial_plasma = air.get_moles(/datum/gas/plasma) - var/initial_carbon = air.get_moles(/datum/gas/carbon_dioxide) + var/initial_plasma = air.get_moles(GAS_PLASMA) + var/initial_carbon = air.get_moles(GAS_CO2) var/scale_factor = (air.return_volume())/(PI) //We scale it down by volume/Pi because for fusion conditions, moles roughly = 2*volume, but we want it to be based off something constant between reactions. var/toroidal_size = (2*PI)+TORADIANS(arctan((air.return_volume()-TOROID_VOLUME_BREAKEVEN)/TOROID_VOLUME_BREAKEVEN)) //The size of the phase space hypertorus var/gas_power = 0 for (var/gas_id in air.get_gases()) - gas_power += (GLOB.meta_gas_info[gas_id][META_GAS_FUSION_POWER]*air.get_moles(gas_id)) + gas_power += (GLOB.gas_data.fusion_powers[gas_id]*air.get_moles(gas_id)) var/instability = MODULUS((gas_power*INSTABILITY_GAS_POWER_FACTOR)**2,toroidal_size) //Instability effects how chaotic the behavior of the reaction is cached_scan_results[id] = instability//used for analyzer feedback @@ -336,9 +342,9 @@ nobliumformation = 1001 carbon = MODULUS(carbon - plasma, toroidal_size) - air.set_moles(/datum/gas/plasma, plasma*scale_factor + FUSION_MOLE_THRESHOLD )//Scales the gases back up - air.set_moles(/datum/gas/carbon_dioxide, carbon*scale_factor + FUSION_MOLE_THRESHOLD) - var/delta_plasma = initial_plasma - air.get_moles(/datum/gas/plasma) + air.set_moles(GAS_PLASMA, plasma*scale_factor + FUSION_MOLE_THRESHOLD )//Scales the gases back up + air.set_moles(GAS_CO2, carbon*scale_factor + FUSION_MOLE_THRESHOLD) + var/delta_plasma = initial_plasma - air.get_moles(GAS_PLASMA) reaction_energy += delta_plasma*PLASMA_BINDING_ENERGY //Energy is gained or lost corresponding to the creation or destruction of mass. if(instability < FUSION_INSTABILITY_ENDOTHERMALITY) @@ -347,17 +353,17 @@ nobliumformation = 1001 reaction_energy *= (instability-FUSION_INSTABILITY_ENDOTHERMALITY)**0.5 if(air.thermal_energy() + reaction_energy < 0) //No using energy that doesn't exist. - air.set_moles(/datum/gas/plasma, initial_plasma) - air.set_moles(/datum/gas/carbon_dioxide, initial_carbon) + air.set_moles(GAS_PLASMA, initial_plasma) + air.set_moles(GAS_CO2, initial_carbon) return NO_REACTION - air.adjust_moles(/datum/gas/tritium, -FUSION_TRITIUM_MOLES_USED) + air.adjust_moles(GAS_TRITIUM, -FUSION_TRITIUM_MOLES_USED) //The decay of the tritium and the reaction's energy produces waste gases, different ones depending on whether the reaction is endo or exothermic if(reaction_energy > 0) - air.adjust_moles(/datum/gas/oxygen, FUSION_TRITIUM_MOLES_USED*(reaction_energy*FUSION_TRITIUM_CONVERSION_COEFFICIENT)) - air.adjust_moles(/datum/gas/nitrous_oxide, FUSION_TRITIUM_MOLES_USED*(reaction_energy*FUSION_TRITIUM_CONVERSION_COEFFICIENT)) + air.adjust_moles(GAS_O2, FUSION_TRITIUM_MOLES_USED*(reaction_energy*FUSION_TRITIUM_CONVERSION_COEFFICIENT)) + air.adjust_moles(GAS_NITROUS, FUSION_TRITIUM_MOLES_USED*(reaction_energy*FUSION_TRITIUM_CONVERSION_COEFFICIENT)) else - air.adjust_moles(/datum/gas/bz, FUSION_TRITIUM_MOLES_USED*(reaction_energy*-FUSION_TRITIUM_CONVERSION_COEFFICIENT)) - air.adjust_moles(/datum/gas/nitrium, FUSION_TRITIUM_MOLES_USED*(reaction_energy*-FUSION_TRITIUM_CONVERSION_COEFFICIENT)) + air.adjust_moles(GAS_BZ, FUSION_TRITIUM_MOLES_USED*(reaction_energy*-FUSION_TRITIUM_CONVERSION_COEFFICIENT)) + air.adjust_moles(GAS_NITRIUM, FUSION_TRITIUM_MOLES_USED*(reaction_energy*-FUSION_TRITIUM_CONVERSION_COEFFICIENT)) if(reaction_energy) if(location) @@ -369,70 +375,77 @@ nobliumformation = 1001 var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(clamp(((air.return_temperature()*old_heat_capacity + reaction_energy)/new_heat_capacity),TCMB,INFINITY)) + air.set_temperature(clamp(((old_thermal_energy + reaction_energy)/new_heat_capacity),TCMB,INFINITY)) return REACTING -/datum/gas_reaction/nitrium_formation //The formation of nitrium. Endothermic. Requires N2O as a catalyst. - priority = 3 +/datum/gas_reaction/nitriumformation //The formation of nitrium. Endothermic. Requires N2O as a catalyst. + priority = NITRIUMFORMATION name = "Nitrium formation" - id = "nitrium_formation" + id = "nitriumformation" -/datum/gas_reaction/nitrium_formation/init_reqs() +/datum/gas_reaction/nitriumformation/init_reqs() min_requirements = list( - /datum/gas/nitrogen = 50, - /datum/gas/plasma = 20, - /datum/gas/bz = 20, - /datum/gas/nitrous_oxide = 5, + GAS_N2 = 50, + GAS_PLASMA = 20, + GAS_BZ = 20, + GAS_NITROUS = 5, "TEMP" = NITRIUM_FORMATION_MIN_TEMP, ) -/datum/gas_reaction/nitrium_formation/react(datum/gas_mixture/air) +/datum/gas_reaction/nitriumformation/react(datum/gas_mixture/air) var/temperature = air.return_temperature() - var/old_heat_capacity = air.heat_capacity() + var/old_thermal_energy = air.thermal_energy() + + var/initial_n2 = air.get_moles(GAS_N2) + var/initial_plasma = air.get_moles(GAS_PLASMA) + var/initial_bz = air.get_moles(GAS_BZ) - var/heat_efficency = min(temperature / NITRIUM_FORMATION_ENERGY, air.get_moles(/datum/gas/nitrogen) / 2, air.get_moles(/datum/gas/plasma), air.get_moles(/datum/gas/bz)) - //Shouldn't produce gas from nothing. - if (heat_efficency <= 0 || (air.get_moles(/datum/gas/nitrogen) - heat_efficency < 0 ) || (air.get_moles(/datum/gas/plasma) - heat_efficency < 0) || (air.get_moles(/datum/gas/bz) - heat_efficency < 0)) + var/heat_efficency = min(temperature / NITRIUM_FORMATION_ENERGY, initial_n2 / 2, initial_plasma, initial_bz) + + // Shouldn't produce gas from nothing. + if (heat_efficency <= 0 || (initial_n2 - heat_efficency < 0 ) || (initial_plasma - heat_efficency < 0) || (initial_bz - heat_efficency < 0)) return NO_REACTION - air.adjust_moles(/datum/gas/nitrogen, -heat_efficency * 2) - air.adjust_moles(/datum/gas/plasma, -heat_efficency) - air.adjust_moles(/datum/gas/bz, -heat_efficency) - air.adjust_moles(/datum/gas/nitrium, heat_efficency / 10) + air.adjust_moles(GAS_N2, -heat_efficency * 2) + air.adjust_moles(GAS_PLASMA, -heat_efficency) + air.adjust_moles(GAS_BZ, -heat_efficency) + air.adjust_moles(GAS_NITRIUM, heat_efficency / 10) var/energy_used = heat_efficency * NITRIUM_FORMATION_ENERGY var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(max(((temperature * old_heat_capacity - energy_used) / new_heat_capacity), TCMB)) + air.set_temperature(max(((old_thermal_energy - energy_used) / new_heat_capacity), TCMB)) return REACTING /datum/gas_reaction/bzformation //Formation of BZ by combining plasma and tritium at low pressures. Exothermic. - priority = 4 + priority = BZFORMATION name = "BZ Gas formation" id = "bzformation" /datum/gas_reaction/bzformation/init_reqs() min_requirements = list( - /datum/gas/nitrous_oxide = 10, - /datum/gas/plasma = 10 + GAS_NITROUS = 10, + GAS_PLASMA = 10, ) - /datum/gas_reaction/bzformation/react(datum/gas_mixture/air) - var/temperature = air.return_temperature() var/pressure = air.return_pressure() - var/old_heat_capacity = air.heat_capacity() - var/reaction_efficency = min(1/((clamp(pressure,1,1000)/(0.5*ONE_ATMOSPHERE))*(max(air.get_moles(/datum/gas/plasma)/air.get_moles(/datum/gas/nitrous_oxide),1))),air.get_moles(/datum/gas/nitrous_oxide),air.get_moles(/datum/gas/plasma)/2) + var/old_thermal_energy = air.thermal_energy() + + var/initial_plas = air.get_moles(GAS_PLASMA) + var/initial_nitrous = air.get_moles(GAS_NITROUS) + + var/reaction_efficency = min(1/((clamp(pressure,1,1000)/(0.5*ONE_ATMOSPHERE))*(max(initial_plas/initial_nitrous,1))),initial_nitrous,initial_plas/2) var/energy_released = 2*reaction_efficency*FIRE_CARBON_ENERGY_RELEASED - if ((air.get_moles(/datum/gas/nitrous_oxide) - reaction_efficency < 0 )|| (air.get_moles(/datum/gas/plasma) - (2*reaction_efficency) < 0) || energy_released <= 0) //Shouldn't produce gas from nothing. + if ((initial_nitrous - reaction_efficency < 0 )|| (initial_plas - (2*reaction_efficency) < 0) || energy_released <= 0) //Shouldn't produce gas from nothing. return NO_REACTION - air.adjust_moles(/datum/gas/bz, reaction_efficency) - if(reaction_efficency == air.get_moles(/datum/gas/nitrous_oxide)) - air.adjust_moles(/datum/gas/bz, -min(pressure,1)) - air.adjust_moles(/datum/gas/oxygen, min(pressure,1)) - air.adjust_moles(/datum/gas/nitrous_oxide, -reaction_efficency) - air.adjust_moles(/datum/gas/plasma, -2*reaction_efficency) + air.adjust_moles(GAS_BZ, reaction_efficency) + if(reaction_efficency == initial_nitrous) + air.adjust_moles(GAS_BZ, -min(pressure,1)) + air.adjust_moles(GAS_O2, min(pressure,1)) + air.adjust_moles(GAS_NITROUS, -reaction_efficency) + air.adjust_moles(GAS_PLASMA, -2*reaction_efficency) //clamps by a minimum amount in the event of an underflow. SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, clamp((reaction_efficency**2)*BZ_RESEARCH_AMOUNT,0.01,BZ_RESEARCH_MAX_AMOUNT)) @@ -440,124 +453,139 @@ nobliumformation = 1001 if(energy_released > 0) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(max(((temperature*old_heat_capacity + energy_released)/new_heat_capacity),TCMB)) + air.set_temperature(max(((old_thermal_energy + energy_released)/new_heat_capacity),TCMB)) return REACTING /datum/gas_reaction/nobliumformation //Hyper-Noblium formation is extrememly endothermic, but requires high temperatures to start. Due to its high mass, hyper-nobelium uses large amounts of nitrogen and tritium. BZ can be used as a catalyst to make it less endothermic. - priority = 1001 //Ensure this value is higher than nobstop + priority = NOBLIUMFORMATION //Ensure this value is higher than nobstop name = "Hyper-Noblium condensation" id = "nobformation" /datum/gas_reaction/nobliumformation/init_reqs() min_requirements = list( - /datum/gas/nitrogen = 20, - /datum/gas/tritium = 10, + GAS_N2 = 20, + GAS_TRITIUM = 10, "TEMP" = 5000000) /datum/gas_reaction/nobliumformation/react(datum/gas_mixture/air) - var/nob_formed = min(max(air.get_moles(/datum/gas/bz), 1) * (log(air.return_temperature())**2), air.get_moles(/datum/gas/tritium)/10, air.get_moles(/datum/gas/nitrogen)/20) - var/old_heat_capacity = air.heat_capacity() - var/energy_taken = nob_formed*(NOBLIUM_FORMATION_ENERGY/(max(air.get_moles(/datum/gas/bz),1))) - air.adjust_moles(/datum/gas/tritium, -10*nob_formed) - air.adjust_moles(/datum/gas/nitrogen, -20*nob_formed) - air.adjust_moles(/datum/gas/hypernoblium, nob_formed) + var/initial_trit = air.get_moles(GAS_TRITIUM) + var/initial_n2 = air.get_moles(GAS_N2) + var/initial_bz = air.get_moles(GAS_BZ) + + var/nob_formed = min(max(initial_bz, 1) * (log(air.return_temperature())**2), initial_trit / 10, initial_n2 / 20) + + var/old_thermal_energy = air.thermal_energy() + + var/energy_taken = nob_formed*(NOBLIUM_FORMATION_ENERGY/(max(initial_bz,1))) + air.adjust_moles(GAS_TRITIUM, -10*nob_formed) + air.adjust_moles(GAS_N2, -20*nob_formed) + air.adjust_moles(GAS_HYPERNOB, nob_formed) SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, clamp(nob_formed*NOBLIUM_RESEARCH_AMOUNT, 0.01, NOBLIUM_RESEARCH_MAX_AMOUNT)) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(max(((air.return_temperature()*old_heat_capacity - energy_taken)/new_heat_capacity),TCMB)) + air.set_temperature(max(((old_thermal_energy - energy_taken)/new_heat_capacity),TCMB)) return REACTING /datum/gas_reaction/miaster //dry heat sterilization: clears out pathogens in the air - priority = -10 //after all the heating from fires etc. is done + priority = MIASTER //after all the heating from fires etc. is done name = "Dry Heat Sterilization" id = "sterilization" /datum/gas_reaction/miaster/init_reqs() min_requirements = list( "TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST+70, - /datum/gas/miasma = MINIMUM_MOLE_COUNT + GAS_MIASMA = MINIMUM_MOLE_COUNT ) /datum/gas_reaction/miaster/react(datum/gas_mixture/air, datum/holder) // As the name says it, it needs to be dry - if(air.get_moles(/datum/gas/water_vapor)/air.total_moles() > 0.1) // Yogs --Fixes runtime in Sterilization + if(air.get_moles(GAS_H2O)/air.total_moles() > 0.1) // Yogs --Fixes runtime in Sterilization return NO_REACT //Replace miasma with oxygen - var/cleaned_air = min(air.get_moles(/datum/gas/miasma), 20 + (air.return_temperature() - FIRE_MINIMUM_TEMPERATURE_TO_EXIST - 70) / 20) - air.adjust_moles(/datum/gas/miasma, -cleaned_air) - air.adjust_moles(/datum/gas/oxygen, cleaned_air) + var/cleaned_air = min(air.get_moles(GAS_MIASMA), 20 + (air.return_temperature() - FIRE_MINIMUM_TEMPERATURE_TO_EXIST - 70) / 20) + air.adjust_moles(GAS_MIASMA, -cleaned_air) + air.adjust_moles(GAS_O2, cleaned_air) //Possibly burning a bit of organic matter through maillard reaction, so a *tiny* bit more heat would be understandable air.set_temperature(air.return_temperature() + cleaned_air * 0.002) SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, clamp(cleaned_air*MIASMA_RESEARCH_AMOUNT,0.01, MIASMA_RESEARCH_MAX_AMOUNT))//Turns out the burning of miasma is kinda interesting to scientists return REACTING - + /datum/gas_reaction/nitro_ball - priority = 7 + priority = NITROBALL name ="Nitrium Energy Ball" - id = "nitro_ball" + id = "nitroball" /datum/gas_reaction/nitro_ball/init_reqs() min_requirements = list( - /datum/gas/pluoxium = NITRO_BALL_MOLES_REQUIRED, - /datum/gas/nitrium = NITRO_BALL_MOLES_REQUIRED, - /datum/gas/plasma = NITRO_BALL_MOLES_REQUIRED, + GAS_PLUOXIUM = NITRO_BALL_MOLES_REQUIRED, + GAS_NITRIUM = NITRO_BALL_MOLES_REQUIRED, + GAS_PLASMA = NITRO_BALL_MOLES_REQUIRED, "TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST ) /// Reaction that burns nitrium and plouxium into radballs and partial constituent gases, but also catalyzes the combustion of plasma. /datum/gas_reaction/nitro_ball/react(datum/gas_mixture/air, datum/holder) - var/turf/location - var/old_heat_capacity = air.heat_capacity() - if(istype(holder,/datum/pipeline)) //Find the tile the reaction is occuring on, or a random part of the network if it's a pipenet. - var/datum/pipeline/pipenet = holder - location = get_turf(pick(pipenet.members)) - else - location = get_turf(holder) - var/reaction_rate = min(NITRO_BALL_MAX_REACT_RATE, air.get_moles(/datum/gas/pluoxium), air.get_moles(/datum/gas/nitrium), air.get_moles(/datum/gas/plasma)) - var/balls_shot = round(reaction_rate/NITRO_BALL_MOLES_REQUIRED) + var/turf/open/location = get_holder_turf(holder) + if(!location) + return NO_REACTION + + var/old_thermal_energy = air.thermal_energy() + + var/initial_pluox = air.get_moles(GAS_PLUOXIUM) + var/initial_nitrium = air.get_moles(GAS_NITRIUM) + var/initial_plas = air.get_moles(GAS_PLASMA) + + var/reaction_rate = min(NITRO_BALL_MAX_REACT_RATE, initial_plas, initial_pluox, initial_nitrium) + var/balls_shot = round(reaction_rate / NITRO_BALL_MOLES_REQUIRED) + //A percentage of plasma is burned during the reaction that is converted into energy and radballs, though mostly pure heat. - var/plasma_burned = QUANTIZE((air.get_moles(/datum/gas/plasma) + 5*reaction_rate)*NITRO_BALL_PLASMA_COEFFICIENT) + var/plasma_burned = QUANTIZE((initial_plas + 5 * reaction_rate) * NITRO_BALL_PLASMA_COEFFICIENT) //Nitrium has a lot of stored energy, and breaking it up releases some of it. Plasma is also partially converted into energy in the process. - var/energy_released = (reaction_rate*NITRO_BALL_HEAT_SCALE) + (plasma_burned*NITRO_BALL_PLASMA_ENERGY) - air.adjust_moles(/datum/gas/nitrium, -reaction_rate) - air.adjust_moles(/datum/gas/pluoxium, -reaction_rate) - air.adjust_moles(/datum/gas/antinoblium, reaction_rate) // an actual purpose for this reaction other than bombs and flamethrowers - air.adjust_moles(/datum/gas/plasma, -plasma_burned) + var/energy_released = (reaction_rate * NITRO_BALL_HEAT_SCALE) + (plasma_burned * NITRO_BALL_PLASMA_ENERGY) + + air.adjust_moles(GAS_PLUOXIUM, -reaction_rate) + air.adjust_moles(GAS_NITRIUM, -reaction_rate) + air.adjust_moles(GAS_ANTINOB, reaction_rate) // an actual purpose for this reaction other than bombs and flamethrowers + air.adjust_moles(GAS_PLASMA, -plasma_burned) + if(balls_shot && !isnull(location)) var/angular_increment = 360/balls_shot var/random_starting_angle = rand(0,360) for(var/i in 1 to balls_shot) - location.fire_nuclear_particle((i*angular_increment+random_starting_angle)) + location.fire_nuclear_particle((i * angular_increment + random_starting_angle)) + if(energy_released) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(clamp((air.return_temperature()*old_heat_capacity + energy_released)/new_heat_capacity, TCMB, INFINITY)) + air.set_temperature(clamp((old_thermal_energy + energy_released) / new_heat_capacity, TCMB, INFINITY)) return REACTING //freon reaction (is not a fire yet) /datum/gas_reaction/freonfire - priority = -5 + priority = FREONFIRE name = "Freon combustion" id = "freonfire" /datum/gas_reaction/freonfire/init_reqs() min_requirements = list( - /datum/gas/oxygen = MINIMUM_MOLE_COUNT, - /datum/gas/freon = MINIMUM_MOLE_COUNT, + GAS_O2 = MINIMUM_MOLE_COUNT, + GAS_FREON = MINIMUM_MOLE_COUNT, "TEMP" = FREON_LOWER_TEMPERATURE, "MAX_TEMP" = FREON_MAXIMUM_BURN_TEMPERATURE ) /datum/gas_reaction/freonfire/react(datum/gas_mixture/air, datum/holder) - var/energy_released = 0 - var/old_heat_capacity = air.heat_capacity() - var/temperature = air.return_temperature() - if(!isturf(holder)) + if(!isopenturf(holder)) return NO_REACTION var/turf/open/location = holder + var/energy_released = 0 + var/old_thermal_energy = air.thermal_energy() + var/temperature = air.return_temperature() + var/initial_o2 = air.get_moles(GAS_O2) + var/initial_freon = air.get_moles(GAS_FREON) //Handle freon burning (only reaction now) var/freon_burn_rate = 0 @@ -571,16 +599,16 @@ nobliumformation = 1001 temperature_scale = (FREON_MAXIMUM_BURN_TEMPERATURE - temperature) / (FREON_MAXIMUM_BURN_TEMPERATURE - FREON_LOWER_TEMPERATURE) //calculate the scale based on the temperature if(temperature_scale >= 0) oxygen_burn_rate = OXYGEN_BURN_RATE_BASE - temperature_scale - if(air.get_moles(/datum/gas/oxygen) > air.get_moles(/datum/gas/freon) * FREON_OXYGEN_FULLBURN) - freon_burn_rate = (air.get_moles(/datum/gas/freon) * temperature_scale) / FREON_BURN_RATE_DELTA + if(initial_o2 > initial_freon * FREON_OXYGEN_FULLBURN) + freon_burn_rate = (initial_freon * temperature_scale) / FREON_BURN_RATE_DELTA else - freon_burn_rate = (temperature_scale * (air.get_moles(/datum/gas/oxygen) / FREON_OXYGEN_FULLBURN)) / FREON_BURN_RATE_DELTA + freon_burn_rate = (temperature_scale * (initial_o2 / FREON_OXYGEN_FULLBURN)) / FREON_BURN_RATE_DELTA if(freon_burn_rate > MINIMUM_HEAT_CAPACITY) - freon_burn_rate = min(freon_burn_rate, air.get_moles(/datum/gas/freon), air.get_moles(/datum/gas/oxygen) / oxygen_burn_rate) //Ensures matter is conserved properly - air.adjust_moles(/datum/gas/freon, -freon_burn_rate) - air.adjust_moles(/datum/gas/oxygen, -(freon_burn_rate * oxygen_burn_rate)) - air.adjust_moles(/datum/gas/carbon_dioxide, freon_burn_rate) + freon_burn_rate = min(freon_burn_rate, initial_freon, initial_o2 / oxygen_burn_rate) //Ensures matter is conserved properly + air.adjust_moles(GAS_FREON, -freon_burn_rate) + air.adjust_moles(GAS_O2, -(freon_burn_rate * oxygen_burn_rate)) + air.adjust_moles(GAS_CO2, freon_burn_rate) if(temperature < 160 && temperature > 120 && prob(2)) new /obj/item/stack/sheet/hot_ice(location) @@ -590,34 +618,34 @@ nobliumformation = 1001 if(energy_released < 0) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature((temperature * old_heat_capacity + energy_released) / new_heat_capacity) + air.set_temperature((old_thermal_energy + energy_released) / new_heat_capacity) /datum/gas_reaction/h2fire - priority = -3 //fire should ALWAYS be last, but tritium fires happen before plasma fires + priority = H2FIRE //fire should ALWAYS be last, but tritium fires happen before plasma fires name = "Hydrogen Combustion" id = "h2fire" /datum/gas_reaction/h2fire/init_reqs() min_requirements = list( "TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST, - /datum/gas/hydrogen = MINIMUM_MOLE_COUNT, - /datum/gas/oxygen = MINIMUM_MOLE_COUNT + GAS_H2 = MINIMUM_MOLE_COUNT, + GAS_O2 = MINIMUM_MOLE_COUNT ) /datum/gas_reaction/h2fire/react(datum/gas_mixture/air, datum/holder) - var/old_heat_capacity = air.heat_capacity() - //this speeds things up because accessing datum vars is slow + var/old_thermal_energy = air.thermal_energy() + //this speeds things up because accessing datum vars is slow var/temperature = air.return_temperature() var/list/cached_results = air.reaction_results cached_results["fire"] = 0 var/turf/open/location = isturf(holder) ? holder : null - var/burned_fuel = min(air.get_moles(/datum/gas/hydrogen), air.get_moles(/datum/gas/oxygen)) / HYDROGEN_BURN_H2_FACTOR + var/burned_fuel = min(air.get_moles(GAS_H2), air.get_moles(GAS_O2)) / HYDROGEN_BURN_H2_FACTOR if(burned_fuel <= 0) return NO_REACTION - air.adjust_moles(/datum/gas/hydrogen, -burned_fuel) // Yogs - see trit burn - air.adjust_moles(/datum/gas/oxygen, -burned_fuel / 2) - air.adjust_moles(/datum/gas/water_vapor, burned_fuel) + air.adjust_moles(GAS_H2, -burned_fuel) // Yogs - see trit burn + air.adjust_moles(GAS_O2, -burned_fuel / 2) + air.adjust_moles(GAS_H2O, burned_fuel) var/energy_released = (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel * HYDROGEN_BURN_H2_FACTOR) // Yogs -- burns twice as fast with half the energy cached_results["fire"] += burned_fuel @@ -625,7 +653,7 @@ nobliumformation = 1001 if(energy_released > 0) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature((temperature*old_heat_capacity + energy_released) / new_heat_capacity) + air.set_temperature((old_thermal_energy + energy_released) / new_heat_capacity) //let the floor know a fire is happening if(istype(location)) @@ -641,284 +669,299 @@ nobliumformation = 1001 /datum/gas_reaction/hexane_formation - priority = 13 + priority = HEXANEFORMATION name = "Hexane formation" id = "hexane_formation" /datum/gas_reaction/hexane_formation/init_reqs() min_requirements = list( - /datum/gas/bz = MINIMUM_MOLE_COUNT, - /datum/gas/hydrogen = MINIMUM_MOLE_COUNT, + GAS_BZ = MINIMUM_MOLE_COUNT, + GAS_H2 = MINIMUM_MOLE_COUNT, "TEMP" = 450, "MAX_TEMP" = 465 ) /datum/gas_reaction/hexane_formation/react(datum/gas_mixture/air, datum/holder) var/temperature = air.return_temperature() - var/old_heat_capacity = air.heat_capacity() - var/heat_efficency = min(temperature * 0.01, air.get_moles(/datum/gas/hydrogen), air.get_moles(/datum/gas/bz)) + var/old_thermal_energy = air.thermal_energy() + var/initial_h2 = air.get_moles(GAS_H2) + var/initial_bz = air.get_moles(GAS_BZ) + var/heat_efficency = min(temperature * 0.01, initial_h2, initial_bz) var/energy_used = heat_efficency * 600 - if (air.get_moles(/datum/gas/hydrogen) - (heat_efficency * 5) < 0 || air.get_moles(/datum/gas/bz) - (heat_efficency * 0.25) < 0) //Shouldn't produce gas from nothing. + if (initial_h2 - (heat_efficency * 5) < 0 || initial_bz - (heat_efficency * 0.25) < 0) //Shouldn't produce gas from nothing. return NO_REACTION - air.adjust_moles(/datum/gas/hydrogen, -(heat_efficency * 5)) - air.adjust_moles(/datum/gas/bz, -(heat_efficency * 0.25)) - air.adjust_moles(/datum/gas/hexane, (heat_efficency * 5.25)) + air.adjust_moles(GAS_H2, -(heat_efficency * 5)) + air.adjust_moles(GAS_BZ, -(heat_efficency * 0.25)) + air.adjust_moles(GAS_HEXANE, (heat_efficency * 5.25)) if(energy_used) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(max(((temperature * old_heat_capacity - energy_used) / new_heat_capacity), TCMB)) + air.set_temperature(max(((old_thermal_energy - energy_used) / new_heat_capacity), TCMB)) return REACTING /datum/gas_reaction/metalhydrogen - priority = 17 + priority = METALHYDROGEN name = "Metal Hydrogen formation" id = "metalhydrogen" /datum/gas_reaction/metalhydrogen/init_reqs() min_requirements = list( - /datum/gas/hydrogen = 300, //same crystallizer recipe - /datum/gas/bz = 50, + GAS_H2 = 300, + GAS_BZ = 50, "TEMP" = METAL_HYDROGEN_MINIMUM_HEAT ) /datum/gas_reaction/metalhydrogen/react(datum/gas_mixture/air, datum/holder) - var/temperature = air.return_temperature() - var/old_heat_capacity = air.heat_capacity() - if(!isturf(holder)) + if(!isopenturf(holder)) return NO_REACTION var/turf/open/location = holder + var/temperature = air.return_temperature() + var/old_thermal_energy = air.thermal_energy() ///the more heat you use the higher is this factor var/increase_factor = min(log(10 , (temperature / METAL_HYDROGEN_MINIMUM_HEAT)), 5) //e7-e12 range ///the more moles you use and the higher the heat, the higher is the efficiency - var/heat_efficency = air.get_moles(/datum/gas/hydrogen)* 0.01 * increase_factor //This variable name is dumb but I can't be assed to change it + var/heat_efficency = air.get_moles(GAS_H2)* 0.01 * increase_factor //This variable name is dumb but I can't be assed to change it var/pressure = air.return_pressure() var/energy_used = heat_efficency * METAL_HYDROGEN_FORMATION_ENERGY if(pressure >= METAL_HYDROGEN_MINIMUM_PRESSURE && temperature >= METAL_HYDROGEN_MINIMUM_HEAT) - air.adjust_moles(/datum/gas/bz, -(heat_efficency)) //About 70% the amount of BZ requirement consumed + air.adjust_moles(GAS_BZ, -(heat_efficency)) if (prob(25 * increase_factor)) - air.adjust_moles(/datum/gas/hydrogen, -(heat_efficency * 10)) //Still consume about 70% of the hydrogen present + air.adjust_moles(GAS_H2, -(heat_efficency * 10)) new /obj/item/stack/sheet/mineral/metal_hydrogen(location) SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, min((heat_efficency * increase_factor * 0.5), METAL_HYDROGEN_RESEARCH_MAX_AMOUNT)) if(energy_used > 0) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(max(((temperature * old_heat_capacity - energy_used) / new_heat_capacity), TCMB)) + air.set_temperature(max(((old_thermal_energy - energy_used) / new_heat_capacity), TCMB)) return REACTING /datum/gas_reaction/freonformation - priority = 5 + priority = FREONFORMATION name = "Freon formation" id = "freonformation" /datum/gas_reaction/freonformation/init_reqs() //minimum requirements for freon formation min_requirements = list( - /datum/gas/plasma = 40, - /datum/gas/carbon_dioxide = 20, - /datum/gas/bz = 20, + GAS_PLASMA = 40, + GAS_CO2 = 20, + GAS_BZ = 20, "TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST + 100 ) /datum/gas_reaction/freonformation/react(datum/gas_mixture/air) var/temperature = air.return_temperature() - var/old_heat_capacity = air.heat_capacity() - var/heat_efficency = min(temperature / (FIRE_MINIMUM_TEMPERATURE_TO_EXIST * 10), air.get_moles(/datum/gas/plasma), air.get_moles(/datum/gas/carbon_dioxide), air.get_moles(/datum/gas/bz)) + var/old_thermal_energy = air.thermal_energy() + var/initial_plas = air.get_moles(GAS_PLASMA) + var/initial_co2 = air.get_moles(GAS_CO2) + var/initial_bz = air.get_moles(GAS_BZ) + var/heat_efficency = min(temperature / (FIRE_MINIMUM_TEMPERATURE_TO_EXIST * 10), initial_plas, initial_co2, initial_bz) var/energy_used = heat_efficency * 100 - if ((air.get_moles(/datum/gas/plasma) - heat_efficency * 1.5 < 0 ) || (air.get_moles(/datum/gas/carbon_dioxide) - heat_efficency * 0.75 < 0) || (air.get_moles(/datum/gas/bz) - heat_efficency * 0.25 < 0)) //Shouldn't produce gas from nothing. + if ((initial_plas - heat_efficency * 1.5 < 0 ) || (initial_co2 - heat_efficency * 0.75 < 0) || (initial_bz - heat_efficency * 0.25 < 0)) //Shouldn't produce gas from nothing. return NO_REACTION - air.adjust_moles(/datum/gas/plasma, -(heat_efficency * 1.5)) - air.adjust_moles(/datum/gas/carbon_dioxide, -(heat_efficency * 0.75)) - air.adjust_moles(/datum/gas/bz, -(heat_efficency * 0.25)) - air.adjust_moles(/datum/gas/freon, (heat_efficency * 2.5)) + air.adjust_moles(GAS_PLASMA, -(heat_efficency * 1.5)) + air.adjust_moles(GAS_CO2, -(heat_efficency * 0.75)) + air.adjust_moles(GAS_BZ, -(heat_efficency * 0.25)) + air.adjust_moles(GAS_FREON, (heat_efficency * 2.5)) if(energy_used > 0) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(max(((temperature * old_heat_capacity - energy_used)/new_heat_capacity), TCMB)) + air.set_temperature(max(((old_thermal_energy - energy_used)/new_heat_capacity), TCMB)) return REACTING - /datum/gas_reaction/halon_formation - priority = 12 + priority = HALONFORMATION name = "Halon formation" id = "halon_formation" /datum/gas_reaction/halon_formation/init_reqs() min_requirements = list( - /datum/gas/bz = MINIMUM_MOLE_COUNT, - /datum/gas/tritium = MINIMUM_MOLE_COUNT, + GAS_BZ = MINIMUM_MOLE_COUNT, + GAS_TRITIUM = MINIMUM_MOLE_COUNT, "TEMP" = 30, "MAX_TEMP" = 55 ) /datum/gas_reaction/halon_formation/react(datum/gas_mixture/air, datum/holder) var/temperature = air.return_temperature() - var/old_heat_capacity = air.heat_capacity() - var/heat_efficency = min(temperature * 0.01, air.get_moles(/datum/gas/tritium), air.get_moles(/datum/gas/bz)) + var/old_thermal_energy = air.thermal_energy() + var/initial_bz = air.get_moles(GAS_BZ) + var/initial_trit = air.get_moles(GAS_TRITIUM) + var/heat_efficency = min(temperature * 0.01, initial_trit, initial_bz) var/energy_used = heat_efficency * 300 - if ((air.get_moles(/datum/gas/tritium) - heat_efficency * 4 < 0 ) || (air.get_moles(/datum/gas/bz) - heat_efficency * 0.25 < 0)) //Shouldn't produce gas from nothing. + if ((initial_trit - heat_efficency * 4 < 0 ) || (initial_bz - heat_efficency * 0.25 < 0)) //Shouldn't produce gas from nothing. return NO_REACTION - air.adjust_moles(/datum/gas/tritium, -(heat_efficency * 4)) - air.adjust_moles(/datum/gas/bz, -(heat_efficency * 0.25)) - air.adjust_moles(/datum/gas/halon, (heat_efficency * 4.25)) + air.adjust_moles(GAS_TRITIUM, -(heat_efficency * 4)) + air.adjust_moles(GAS_BZ, -(heat_efficency * 0.25)) + air.adjust_moles(GAS_HALON, (heat_efficency * 4.25)) if(energy_used) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(max(((temperature * old_heat_capacity + energy_used) / new_heat_capacity), TCMB)) + air.set_temperature(max(((old_thermal_energy + energy_used) / new_heat_capacity), TCMB)) return REACTING /datum/gas_reaction/healium_formation - priority = 9 + priority = HEALIUMFORMATION name = "Healium formation" id = "healium_formation" /datum/gas_reaction/healium_formation/init_reqs() min_requirements = list( - /datum/gas/bz = MINIMUM_MOLE_COUNT, - /datum/gas/freon = MINIMUM_MOLE_COUNT, + GAS_BZ = MINIMUM_MOLE_COUNT, + GAS_FREON = MINIMUM_MOLE_COUNT, "TEMP" = 25, "MAX_TEMP" = 300 ) /datum/gas_reaction/healium_formation/react(datum/gas_mixture/air, datum/holder) var/temperature = air.return_temperature() - var/old_heat_capacity = air.heat_capacity() - var/heat_efficency = min(temperature * 0.3, air.get_moles(/datum/gas/freon), air.get_moles(/datum/gas/bz)) + var/old_thermal_energy = air.thermal_energy() + var/initial_freon = air.get_moles(GAS_FREON) + var/initial_bz = air.get_moles(GAS_BZ) + var/heat_efficency = min(temperature * 0.3, initial_freon, initial_bz) var/energy_used = heat_efficency * 9000 - if ((air.get_moles(/datum/gas/freon) - heat_efficency * 2.75 < 0 ) || (air.get_moles(/datum/gas/bz) - heat_efficency * 0.25 < 0)) //Shouldn't produce gas from nothing. + if ((initial_freon - heat_efficency * 2.75 < 0 ) || (initial_bz - heat_efficency * 0.25 < 0)) //Shouldn't produce gas from nothing. return NO_REACTION - air.adjust_moles(/datum/gas/freon, -(heat_efficency * 2.75)) - air.adjust_moles(/datum/gas/bz, -(heat_efficency * 0.25)) - air.adjust_moles(/datum/gas/healium, (heat_efficency * 3)) + air.adjust_moles(GAS_FREON, -(heat_efficency * 2.75)) + air.adjust_moles(GAS_BZ, -(heat_efficency * 0.25)) + air.adjust_moles(GAS_HEALIUM, (heat_efficency * 3)) if(energy_used) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(max(((temperature * old_heat_capacity + energy_used) / new_heat_capacity), TCMB)) + air.set_temperature(max(((old_thermal_energy + energy_used) / new_heat_capacity), TCMB)) return REACTING /datum/gas_reaction/pluonium_formation - priority = 10 + priority = PLUONIUMFORMATION name = "Pluonium formation" id = "pluonium_formation" /datum/gas_reaction/pluonium_formation/init_reqs() min_requirements = list( - /datum/gas/pluoxium = MINIMUM_MOLE_COUNT, - /datum/gas/hydrogen = MINIMUM_MOLE_COUNT, + GAS_PLUOXIUM = MINIMUM_MOLE_COUNT, + GAS_H2 = MINIMUM_MOLE_COUNT, "TEMP" = 5000, "MAX_TEMP" = 10000 ) /datum/gas_reaction/pluonium_formation/react(datum/gas_mixture/air, datum/holder) var/temperature = air.return_temperature() - var/old_heat_capacity = air.heat_capacity() - var/heat_efficency = min(temperature * 0.005, air.get_moles(/datum/gas/pluoxium), air.get_moles(/datum/gas/hydrogen)) + var/old_thermal_energy = air.thermal_energy() + var/initial_pluox = air.get_moles(GAS_PLUOXIUM) + var/initial_h2 = air.get_moles(GAS_H2) + var/heat_efficency = min(temperature * 0.005, initial_pluox, initial_h2) var/energy_used = heat_efficency * 650 - if ((air.get_moles(/datum/gas/pluoxium) - heat_efficency * 0.2 < 0 ) || (air.get_moles(/datum/gas/hydrogen) - heat_efficency * 2 < 0)) //Shouldn't produce gas from nothing. + if ((initial_pluox - heat_efficency * 0.2 < 0 ) || (initial_h2 - heat_efficency * 2 < 0)) //Shouldn't produce gas from nothing. return NO_REACTION - air.adjust_moles(/datum/gas/hydrogen, -(heat_efficency * 2)) - air.adjust_moles(/datum/gas/pluoxium, -(heat_efficency * 0.2)) - air.adjust_moles(/datum/gas/pluonium, (heat_efficency * 2.2)) + air.adjust_moles(GAS_H2, -(heat_efficency * 2)) + air.adjust_moles(GAS_PLUOXIUM, -(heat_efficency * 0.2)) + air.adjust_moles(GAS_PLUONIUM, (heat_efficency * 2.2)) if(energy_used > 0) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(max(((temperature * old_heat_capacity + energy_used) / new_heat_capacity), TCMB)) + air.set_temperature(max(((old_thermal_energy + energy_used) / new_heat_capacity), TCMB)) return REACTING /datum/gas_reaction/zauker_formation - priority = 11 + priority = ZAUKERFORMATION name = "Zauker formation" id = "zauker_formation" /datum/gas_reaction/zauker_formation/init_reqs() min_requirements = list( - /datum/gas/hypernoblium = MINIMUM_MOLE_COUNT, - /datum/gas/nitrium = MINIMUM_MOLE_COUNT, + GAS_HYPERNOB = MINIMUM_MOLE_COUNT, + GAS_NITRIUM = MINIMUM_MOLE_COUNT, "TEMP" = 50000, "MAX_TEMP" = 75000 ) /datum/gas_reaction/zauker_formation/react(datum/gas_mixture/air, datum/holder) var/temperature = air.return_temperature() - var/old_heat_capacity = air.heat_capacity() - var/heat_efficency = min(temperature * 0.000005, air.get_moles(/datum/gas/hypernoblium), air.get_moles(/datum/gas/nitrium)) + var/old_thermal_energy = air.thermal_energy() + + var/initial_nob = air.get_moles(GAS_HYPERNOB) + var/initial_nitrium = air.get_moles(GAS_NITRIUM) + + var/heat_efficency = min(temperature * 0.000005, initial_nob, initial_nitrium) var/energy_used = heat_efficency * 5000 - if ((air.get_moles(/datum/gas/hypernoblium) - heat_efficency * 0.01 < 0 ) || (air.get_moles(/datum/gas/nitrium) - heat_efficency * 0.5 < 0)) //Shouldn't produce gas from nothing. + if ((initial_nob - heat_efficency * 0.01 < 0 ) || (initial_nitrium - heat_efficency * 0.5 < 0)) //Shouldn't produce gas from nothing. return NO_REACTION - air.adjust_moles(/datum/gas/hypernoblium, -(heat_efficency * 0.01)) - air.adjust_moles(/datum/gas/nitrium, -(heat_efficency * 0.5)) - air.adjust_moles(/datum/gas/zauker, (heat_efficency * 0.5)) + + air.adjust_moles(GAS_HYPERNOB, -(heat_efficency * 0.01)) + air.adjust_moles(GAS_NITRIUM, -(heat_efficency * 0.5)) + air.adjust_moles(GAS_ZAUKER, (heat_efficency * 0.5)) if(energy_used) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(max(((temperature * old_heat_capacity - energy_used) / new_heat_capacity), TCMB)) + air.set_temperature(max(((old_thermal_energy - energy_used) / new_heat_capacity), TCMB)) return REACTING /datum/gas_reaction/halon_o2removal - priority = -1 + priority = HALONO2REMOVAL name = "Halon o2 removal" id = "halon_o2removal" /datum/gas_reaction/halon_o2removal/init_reqs() min_requirements = list( - /datum/gas/halon = MINIMUM_MOLE_COUNT, - /datum/gas/oxygen = MINIMUM_MOLE_COUNT, + GAS_HALON = MINIMUM_MOLE_COUNT, + GAS_O2 = MINIMUM_MOLE_COUNT, "TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST ) /datum/gas_reaction/halon_o2removal/react(datum/gas_mixture/air, datum/holder) var/temperature = air.return_temperature() - var/old_heat_capacity = air.heat_capacity() - var/heat_efficency = min(temperature / ( FIRE_MINIMUM_TEMPERATURE_TO_EXIST * 10), air.get_moles(/datum/gas/halon), air.get_moles(/datum/gas/oxygen)) + var/old_thermal_energy = air.thermal_energy() + var/initial_o2 = air.get_moles(GAS_O2) + var/initial_halon = air.get_moles(GAS_HALON) + var/heat_efficency = min(temperature / ( FIRE_MINIMUM_TEMPERATURE_TO_EXIST * 10), initial_halon, initial_o2) var/energy_used = heat_efficency * 2500 - if ((air.get_moles(/datum/gas/halon) - heat_efficency < 0 ) || (air.get_moles(/datum/gas/oxygen) - heat_efficency * 20 < 0)) //Shouldn't produce gas from nothing. + if ((initial_halon - heat_efficency < 0 ) || (initial_o2 - heat_efficency * 20 < 0)) //Shouldn't produce gas from nothing. return NO_REACTION - air.adjust_moles(/datum/gas/halon, -(heat_efficency)) - air.adjust_moles(/datum/gas/oxygen, -(heat_efficency * 20)) - air.adjust_moles(/datum/gas/carbon_dioxide, (heat_efficency * 5)) + air.adjust_moles(GAS_HALON, -(heat_efficency)) + air.adjust_moles(GAS_O2, -(heat_efficency * 20)) + air.adjust_moles(GAS_CO2, (heat_efficency * 5)) if(energy_used) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(max(((temperature * old_heat_capacity - energy_used) / new_heat_capacity), TCMB)) + air.set_temperature(max(((old_thermal_energy - energy_used) / new_heat_capacity), TCMB)) return REACTING /datum/gas_reaction/zauker_decomp - priority = 8 + priority = ZAUKERDECOMP name = "Zauker decomposition" id = "zauker_decomp" /datum/gas_reaction/zauker_decomp/init_reqs() min_requirements = list( - /datum/gas/nitrogen = MINIMUM_MOLE_COUNT, - /datum/gas/zauker = MINIMUM_MOLE_COUNT + GAS_N2 = MINIMUM_MOLE_COUNT, + GAS_ZAUKER = MINIMUM_MOLE_COUNT, ) /datum/gas_reaction/zauker_decomp/react(datum/gas_mixture/air, datum/holder) var/energy_released = 0 - var/old_heat_capacity = air.heat_capacity() - //this speeds things up because accessing datum vars is slow - var/temperature = air.return_temperature() - var/burned_fuel = 0 - burned_fuel = min(20, air.get_moles(/datum/gas/nitrogen), air.get_moles(/datum/gas/zauker)) - if(air.get_moles(/datum/gas/zauker) - burned_fuel < 0) + var/old_thermal_energy = air.thermal_energy() + var/initial_zauker = air.get_moles(GAS_ZAUKER) + var/burned_fuel = min(20, air.get_moles(GAS_N2), initial_zauker) + if(initial_zauker - burned_fuel < 0) return NO_REACTION - air.adjust_moles(/datum/gas/zauker, -burned_fuel) + air.adjust_moles(GAS_ZAUKER, -burned_fuel) if(burned_fuel) energy_released += (460 * burned_fuel) - air.adjust_moles(/datum/gas/oxygen, (burned_fuel * 0.3)) - air.adjust_moles(/datum/gas/nitrogen, (burned_fuel * 0.7)) + air.adjust_moles(GAS_O2, (burned_fuel * 0.3)) + air.adjust_moles(GAS_N2, (burned_fuel * 0.7)) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(max((temperature * old_heat_capacity + energy_released) / new_heat_capacity, TCMB)) + air.set_temperature(max((old_thermal_energy + energy_released) / new_heat_capacity, TCMB)) return REACTING return NO_REACTION @@ -928,105 +971,132 @@ nobliumformation = 1001 * Breaks BZ down into nitrogen and plasma in the presence of pluonium. */ /datum/gas_reaction/pluonium_bz_response - priority = 14 + priority = PLUONIUMBZRESPONSE name = "Pluonium bz response" id = "pluonium_bz_response" /datum/gas_reaction/pluonium_bz_response/init_reqs() min_requirements = list( - /datum/gas/pluonium = MINIMUM_MOLE_COUNT, - /datum/gas/bz = MINIMUM_MOLE_COUNT, + GAS_PLUONIUM = MINIMUM_MOLE_COUNT, + GAS_BZ = MINIMUM_MOLE_COUNT, "TEMP" = 260, "MAX_TEMP" = 280 ) /datum/gas_reaction/pluonium_bz_response/react(datum/gas_mixture/air, datum/holder) var/old_temperature = air.return_temperature() - var/consumed_amount = min(old_temperature / 2240 * air.get_moles(/datum/gas/bz) * air.get_moles(/datum/gas/pluonium) / (air.get_moles(/datum/gas/bz) + air.get_moles(/datum/gas/pluonium)), air.get_moles(/datum/gas/bz), air.get_moles(/datum/gas/pluonium)) - if (consumed_amount <= 0 || air.get_moles(/datum/gas/bz) - consumed_amount < 0) + var/old_thermal_energy = air.thermal_energy() + + var/initial_bz = air.get_moles(GAS_BZ) + var/initial_pluon = air.get_moles(GAS_PLUONIUM) + + var/consumed_amount = min(old_temperature / 2240 * initial_bz * initial_pluon / (initial_bz + initial_pluon), initial_bz, initial_pluon) + if(consumed_amount <= 0 || initial_bz - consumed_amount < 0) return NO_REACTION - var/old_heat_capacity = air.heat_capacity() - air.adjust_moles(/datum/gas/bz, -consumed_amount) - air.adjust_moles(/datum/gas/nitrogen, consumed_amount * 0.5) - air.adjust_moles(/datum/gas/plasma, consumed_amount * 1) - - var/turf/open/location - if(istype(holder, /datum/pipeline)) //Find the tile the reaction is occuring on, or a random part of the network if it's a pipenet. - var/datum/pipeline/pipenet = holder - location = get_turf(pick(pipenet.members)) - else - location = get_turf(holder) + air.adjust_moles(GAS_BZ, -consumed_amount) + air.adjust_moles(GAS_N2, consumed_amount * 0.5) + air.adjust_moles(GAS_PLASMA, consumed_amount * 1) var/energy_released = consumed_amount * 2 - + + var/turf/open/location = get_holder_turf(holder) if (location) radiation_pulse(location, consumed_amount * 2, 2.5, TRUE, FALSE) for(var/mob/living/carbon/L in location) - L.adjust_hallucinations(air.get_moles(/datum/gas/bz) * 0.7) // Yogs -- fixed accidental "path * number" + L.adjust_hallucinations(air.get_moles(GAS_BZ) * 0.7) // Yogs -- fixed accidental "path * number" energy_released += 100 if(energy_released) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(max((old_temperature * old_heat_capacity + energy_released) / new_heat_capacity, TCMB)) + air.set_temperature(max((old_thermal_energy + energy_released) / new_heat_capacity, TCMB)) return REACTING /datum/gas_reaction/pluonium_tritium_response - priority = 15 + priority = PLUONIUMTRITRESPONSE name = "Pluonium tritium response" id = "pluonium_tritium_response" /datum/gas_reaction/pluonium_tritium_response/init_reqs() min_requirements = list( - /datum/gas/pluonium = MINIMUM_MOLE_COUNT, - /datum/gas/tritium = MINIMUM_MOLE_COUNT, + GAS_PLUONIUM = MINIMUM_MOLE_COUNT, + GAS_TRITIUM = MINIMUM_MOLE_COUNT, "TEMP" = 150, "MAX_TEMP" = 340 ) /datum/gas_reaction/pluonium_tritium_response/react(datum/gas_mixture/air, datum/holder) var/energy_released = 0 - var/old_heat_capacity = air.heat_capacity() - var/temperature = air.return_temperature() - var/turf/open/location = isturf(holder) ? holder : null - var produced_amount = min(5, air.get_moles(/datum/gas/tritium), air.get_moles(/datum/gas/pluonium)) - if(air.get_moles(/datum/gas/tritium) - produced_amount < 0 || air.get_moles(/datum/gas/pluonium) - produced_amount * 0.01 < 0) + var/old_thermal_energy = air.thermal_energy() + var/initial_pluon = air.get_moles(GAS_PLUONIUM) + var/initial_trit = air.get_moles(GAS_TRITIUM) + var/produced_amount = min(5, initial_trit, initial_pluon) + if(initial_trit - produced_amount < 0 || initial_pluon - produced_amount * 0.01 < 0) return NO_REACTION - location.rad_act(produced_amount * 2.4) - air.adjust_moles(/datum/gas/tritium, -produced_amount) - air.adjust_moles(/datum/gas/hydrogen, produced_amount) - air.adjust_moles(/datum/gas/pluonium, -(produced_amount * 0.01)) + if(isopenturf(holder)) + var/turf/open/location = holder + location.rad_act(produced_amount * 2.4) + air.adjust_moles(GAS_TRITIUM, -produced_amount) + air.adjust_moles(GAS_H2, produced_amount) + air.adjust_moles(GAS_PLUONIUM, -(produced_amount * 0.01)) energy_released += 50 if(energy_released) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(max((temperature * old_heat_capacity + energy_released) / new_heat_capacity, TCMB)) + air.set_temperature(max((old_thermal_energy + energy_released) / new_heat_capacity, TCMB)) return REACTING /datum/gas_reaction/pluonium_hydrogen_response - priority = 16 + priority = PLUONIUMH2RESPONSE name = "Pluonium hydrogen response" id = "pluonium_hydrogen_response" /datum/gas_reaction/pluonium_hydrogen_response/init_reqs() min_requirements = list( - /datum/gas/pluonium = MINIMUM_MOLE_COUNT, - /datum/gas/hydrogen = 150, + GAS_PLUONIUM = MINIMUM_MOLE_COUNT, + GAS_H2 = 150, ) /datum/gas_reaction/pluonium_hydrogen_response/react(datum/gas_mixture/air, datum/holder) var/energy_released = 0 - var/old_heat_capacity = air.heat_capacity() - var/temperature = air.return_temperature() - var produced_amount = min(5, air.get_moles(/datum/gas/hydrogen), air.adjust_moles(/datum/gas/pluonium)) - if(air.get_moles(/datum/gas/hydrogen) - produced_amount < 0) + var/old_thermal_energy = air.thermal_energy() + var/initial_h2 = air.get_moles(GAS_H2) + var/initial_pluon = air.get_moles(GAS_PLUONIUM) + var/produced_amount = min(5, initial_h2, initial_pluon) + if(initial_h2 - produced_amount < 0) return NO_REACTION - air.adjust_moles(/datum/gas/hydrogen, -produced_amount) - air.adjust_moles(/datum/gas/pluonium, (produced_amount * 0.5)) + air.adjust_moles(GAS_H2, -produced_amount) + air.adjust_moles(GAS_PLUONIUM, (produced_amount * 0.5)) energy_released = produced_amount * 2500 if(energy_released) var/new_heat_capacity = air.heat_capacity() if(new_heat_capacity > MINIMUM_HEAT_CAPACITY) - air.set_temperature(max((temperature * old_heat_capacity - energy_released) / new_heat_capacity, TCMB)) + air.set_temperature(max((old_thermal_energy - energy_released) / new_heat_capacity, TCMB)) return REACTING +#undef MIASTER +#undef FREONFIRE +#undef PLASMAFIRE +#undef H2FIRE +#undef TRITFIRE +#undef HALONO2REMOVAL +#undef NITROUSDECOMP +#undef WATERVAPOR +#undef FUSION +#undef COLDFUSION +#undef NITRIUMFORMATION +#undef BZFORMATION +#undef FREONFORMATION +#undef NITROBALL +#undef ZAUKERDECOMP +#undef HEALIUMFORMATION +#undef PLUONIUMFORMATION +#undef ZAUKERFORMATION +#undef HALONFORMATION +#undef HEXANEFORMATION +#undef PLUONIUMBZRESPONSE +#undef PLUONIUMTRITRESPONSE +#undef PLUONIUMH2RESPONSE +#undef METALHYDROGEN +#undef NOBLIUMSUPPRESSION +#undef NOBLIUMFORMATION diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm index fad5b1886cd2..f7dc8a79e3ec 100644 --- a/code/modules/atmospherics/machinery/airalarm.dm +++ b/code/modules/atmospherics/machinery/airalarm.dm @@ -99,80 +99,77 @@ var/list/TLV = list( // Breathable air. "pressure" = new/datum/tlv(ONE_ATMOSPHERE * 0.8, ONE_ATMOSPHERE* 0.9, ONE_ATMOSPHERE * 1.1, ONE_ATMOSPHERE * 1.2), // kPa. Values are min2, min1, max1, max2 "temperature" = new/datum/tlv(T0C, T0C+10, T0C+40, T0C+66), - /datum/gas/oxygen = new/datum/tlv(16, 19, 135, 140), // Partial pressure, kpa - /datum/gas/nitrogen = new/datum/tlv(-1, -1, 1000, 1000), - /datum/gas/carbon_dioxide = new/datum/tlv(-1, -1, 5, 10), - /datum/gas/miasma = new/datum/tlv/(-1, -1, 15, 30), - /datum/gas/plasma = new/datum/tlv/dangerous, - /datum/gas/nitrous_oxide = new/datum/tlv/dangerous, - /datum/gas/bz = new/datum/tlv/dangerous, - /datum/gas/hypernoblium = new/datum/tlv(-1, -1, 1000, 1000), // Hyper-Noblium is inert and nontoxic - /datum/gas/water_vapor = new/datum/tlv/dangerous, - /datum/gas/tritium = new/datum/tlv/dangerous, - /datum/gas/nitrium = new/datum/tlv/dangerous, - /datum/gas/dilithium = new/datum/tlv/dangerous,//Yogs -- Dilithium - /datum/gas/pluoxium = new/datum/tlv(-1, -1, 1000, 1000), // Unlike oxygen, pluoxium does not fuel plasma/tritium fires - /datum/gas/freon = new/datum/tlv/dangerous, - /datum/gas/hydrogen = new/datum/tlv/dangerous, - /datum/gas/healium = new/datum/tlv/dangerous, - /datum/gas/pluonium = new/datum/tlv/dangerous, - /datum/gas/zauker = new/datum/tlv/dangerous, - /datum/gas/halon = new/datum/tlv/dangerous, - /datum/gas/antinoblium = new/datum/tlv/dangerous, - /datum/gas/hexane = new/datum/tlv/dangerous + GAS_O2 = new/datum/tlv(16, 19, 40, 50), // Partial pressure, kpa + GAS_N2 = new/datum/tlv(-1, -1, 1000, 1000), + GAS_CO2 = new/datum/tlv(-1, -1, 5, 10), + GAS_MIASMA = new/datum/tlv/(-1, -1, 15, 30), + GAS_PLASMA = new/datum/tlv/dangerous, + GAS_NITROUS = new/datum/tlv/dangerous, + GAS_BZ = new/datum/tlv/dangerous, + GAS_HYPERNOB = new/datum/tlv(-1, -1, 1000, 1000), // Hyper-Noblium is inert and nontoxic + GAS_H2O = new/datum/tlv/dangerous, + GAS_TRITIUM = new/datum/tlv/dangerous, + GAS_NITRIUM = new/datum/tlv/dangerous, + GAS_DILITHIUM = new/datum/tlv/dangerous,//Yogs -- Dilithium + GAS_PLUOXIUM = new/datum/tlv(-1, -1, 5, 6), // Unlike oxygen, pluoxium does not fuel plasma/tritium fires + GAS_FREON = new/datum/tlv/dangerous, + GAS_H2 = new/datum/tlv/dangerous, + GAS_HEALIUM = new/datum/tlv/dangerous, + GAS_PLUONIUM = new/datum/tlv/dangerous, + GAS_ZAUKER = new/datum/tlv/dangerous, + GAS_HALON = new/datum/tlv/dangerous, + GAS_HEXANE = new/datum/tlv/dangerous, ) /obj/machinery/airalarm/server // No checks here. TLV = list( "pressure" = new/datum/tlv/no_checks, "temperature" = new/datum/tlv/no_checks, - /datum/gas/oxygen = new/datum/tlv/no_checks, - /datum/gas/nitrogen = new/datum/tlv/no_checks, - /datum/gas/carbon_dioxide = new/datum/tlv/no_checks, - /datum/gas/miasma = new/datum/tlv/no_checks, - /datum/gas/plasma = new/datum/tlv/no_checks, - /datum/gas/nitrous_oxide = new/datum/tlv/no_checks, - /datum/gas/bz = new/datum/tlv/no_checks, - /datum/gas/hypernoblium = new/datum/tlv/no_checks, - /datum/gas/water_vapor = new/datum/tlv/no_checks, - /datum/gas/tritium = new/datum/tlv/no_checks, - /datum/gas/nitrium = new/datum/tlv/no_checks, - /datum/gas/dilithium = new/datum/tlv/no_checks,//Yogs -- Dilithium - /datum/gas/pluoxium = new/datum/tlv/no_checks, - /datum/gas/freon = new/datum/tlv/no_checks, - /datum/gas/hydrogen = new/datum/tlv/no_checks, - /datum/gas/healium = new/datum/tlv/dangerous, - /datum/gas/pluonium = new/datum/tlv/dangerous, - /datum/gas/halon = new/datum/tlv/dangerous, - /datum/gas/antinoblium = new/datum/tlv/dangerous, - /datum/gas/hexane = new/datum/tlv/dangerous + GAS_O2 = new/datum/tlv/no_checks, + GAS_N2 = new/datum/tlv/no_checks, + GAS_CO2 = new/datum/tlv/no_checks, + GAS_MIASMA = new/datum/tlv/no_checks, + GAS_PLASMA = new/datum/tlv/no_checks, + GAS_NITROUS = new/datum/tlv/no_checks, + GAS_BZ = new/datum/tlv/no_checks, + GAS_HYPERNOB = new/datum/tlv/no_checks, + GAS_H2O = new/datum/tlv/no_checks, + GAS_TRITIUM = new/datum/tlv/no_checks, + GAS_NITRIUM = new/datum/tlv/no_checks, + GAS_DILITHIUM = new/datum/tlv/no_checks,//Yogs -- Dilithium + GAS_PLUOXIUM = new/datum/tlv/no_checks, + GAS_FREON = new/datum/tlv/no_checks, + GAS_H2 = new/datum/tlv/no_checks, + GAS_HEALIUM = new/datum/tlv/dangerous, + GAS_PLUONIUM = new/datum/tlv/dangerous, + GAS_HALON = new/datum/tlv/dangerous, + GAS_HEXANE = new/datum/tlv/dangerous, ) /obj/machinery/airalarm/kitchen_cold_room // Kitchen cold rooms start off at -80°C or 193.15°K. TLV = list( "pressure" = new/datum/tlv(ONE_ATMOSPHERE * 0.8, ONE_ATMOSPHERE* 0.9, ONE_ATMOSPHERE * 1.1, ONE_ATMOSPHERE * 1.2), // kPa "temperature" = new/datum/tlv(T0C-273.15, T0C-100, T0C-60, T0C), - /datum/gas/oxygen = new/datum/tlv(16, 19, 135, 140), // Partial pressure, kpa - /datum/gas/nitrogen = new/datum/tlv(-1, -1, 1000, 1000), - /datum/gas/carbon_dioxide = new/datum/tlv(-1, -1, 5, 10), - /datum/gas/miasma = new/datum/tlv/(-1, -1, 2, 5), - /datum/gas/plasma = new/datum/tlv/dangerous, - /datum/gas/nitrous_oxide = new/datum/tlv/dangerous, - /datum/gas/bz = new/datum/tlv/dangerous, - /datum/gas/hypernoblium = new/datum/tlv(-1, -1, 1000, 1000), // Hyper-Noblium is inert and nontoxic - /datum/gas/water_vapor = new/datum/tlv/dangerous, - /datum/gas/tritium = new/datum/tlv/dangerous, - /datum/gas/nitrium = new/datum/tlv/dangerous, - /datum/gas/dilithium = new/datum/tlv/dangerous,//Yogs -- Dilithium - /datum/gas/pluoxium = new/datum/tlv(-1, -1, 1000, 1000), // Unlike oxygen, pluoxium does not fuel plasma/tritium fires - /datum/gas/freon = new/datum/tlv/dangerous, - /datum/gas/hydrogen = new/datum/tlv/dangerous, - /datum/gas/healium = new/datum/tlv/dangerous, - /datum/gas/pluonium = new/datum/tlv/dangerous, - /datum/gas/zauker = new/datum/tlv/dangerous, - /datum/gas/halon = new/datum/tlv/dangerous, - /datum/gas/antinoblium = new/datum/tlv/dangerous, - /datum/gas/hexane = new/datum/tlv/dangerous + GAS_O2 = new/datum/tlv(16, 19, 135, 140), // Partial pressure, kpa + GAS_N2 = new/datum/tlv(-1, -1, 1000, 1000), + GAS_CO2 = new/datum/tlv(-1, -1, 5, 10), + GAS_MIASMA = new/datum/tlv/(-1, -1, 2, 5), + GAS_PLASMA = new/datum/tlv/dangerous, + GAS_NITROUS = new/datum/tlv/dangerous, + GAS_BZ = new/datum/tlv/dangerous, + GAS_HYPERNOB = new/datum/tlv(-1, -1, 1000, 1000), // Hyper-Noblium is inert and nontoxic + GAS_H2O = new/datum/tlv/dangerous, + GAS_TRITIUM = new/datum/tlv/dangerous, + GAS_NITRIUM = new/datum/tlv/dangerous, + GAS_DILITHIUM = new/datum/tlv/dangerous,//Yogs -- Dilithium + GAS_PLUOXIUM = new/datum/tlv(-1, -1, 1000, 1000), // Unlike oxygen, pluoxium does not fuel plasma/tritium fires + GAS_FREON = new/datum/tlv/dangerous, + GAS_H2 = new/datum/tlv/dangerous, + GAS_HEALIUM = new/datum/tlv/dangerous, + GAS_PLUONIUM = new/datum/tlv/dangerous, + GAS_ZAUKER = new/datum/tlv/dangerous, + GAS_HALON = new/datum/tlv/dangerous, + GAS_HEXANE = new/datum/tlv/dangerous, ) /obj/machinery/airalarm/unlocked @@ -298,11 +295,11 @@ data["fire_alarm"] = A.fire var/turf/T = get_turf(src) - var/datum/gas_mixture/environment = T.return_air() + var/datum/gas_mixture/environment = T?.return_air() var/datum/tlv/cur_tlv data["environment_data"] = list() - var/pressure = environment.return_pressure() + var/pressure = environment?.return_pressure() cur_tlv = TLV["pressure"] data["environment_data"] += list(list( "name" = "Pressure", @@ -310,7 +307,7 @@ "unit" = "kPa", "danger_level" = cur_tlv.get_danger_level(pressure) )) - var/temperature = environment.return_temperature() + var/temperature = environment?.return_temperature() cur_tlv = TLV["temperature"] data["environment_data"] += list(list( "name" = "Temperature", @@ -318,14 +315,14 @@ "unit" = "K ([round(temperature - T0C, 0.1)]C)", "danger_level" = cur_tlv.get_danger_level(temperature) )) - var/total_moles = environment.total_moles() - var/partial_pressure = R_IDEAL_GAS_EQUATION * environment.return_temperature() / environment.return_volume() - for(var/gas_id in environment.get_gases()) + var/total_moles = environment?.total_moles() + var/partial_pressure = R_IDEAL_GAS_EQUATION * environment?.return_temperature() / environment?.return_volume() + for(var/gas_id in environment?.get_gases()) if(!(gas_id in TLV)) // We're not interested in this gas, it seems. continue cur_tlv = TLV[gas_id] data["environment_data"] += list(list( - "name" = GLOB.meta_gas_info[gas_id][META_GAS_NAME], + "name" = GLOB.gas_data.names[gas_id], "value" = environment.get_moles(gas_id) / total_moles * 100, "unit" = "%", "danger_level" = cur_tlv.get_danger_level(environment.get_moles(gas_id) * partial_pressure) @@ -394,11 +391,11 @@ thresholds[thresholds.len]["settings"] += list(list("env" = "temperature", "val" = "max1", "selected" = selected.max1)) thresholds[thresholds.len]["settings"] += list(list("env" = "temperature", "val" = "max2", "selected" = selected.max2)) - for(var/gas_id in GLOB.meta_gas_info) + for(var/gas_id in GLOB.gas_data.names) if(!(gas_id in TLV)) // We're not interested in this gas, it seems. continue selected = TLV[gas_id] - thresholds += list(list("name" = GLOB.meta_gas_info[gas_id][META_GAS_NAME], "settings" = list())) + thresholds += list(list("name" = GLOB.gas_data.names[gas_id], "settings" = list())) thresholds[thresholds.len]["settings"] += list(list("env" = gas_id, "val" = "min2", "selected" = selected.min2)) thresholds[thresholds.len]["settings"] += list(list("env" = gas_id, "val" = "min1", "selected" = selected.min1)) thresholds[thresholds.len]["settings"] += list(list("env" = gas_id, "val" = "max1", "selected" = selected.max1)) @@ -539,7 +536,7 @@ for(var/device_id in A.air_scrub_names) send_signal(device_id, list( "power" = 1, - "set_filters" = list(/datum/gas/carbon_dioxide), + "set_filters" = list(GAS_CO2), "scrubbing" = 1, "widenet" = 0 ), signal_source) @@ -554,25 +551,24 @@ send_signal(device_id, list( "power" = 1, "set_filters" = list( - /datum/gas/carbon_dioxide, - /datum/gas/miasma, - /datum/gas/plasma, - /datum/gas/water_vapor, - /datum/gas/hypernoblium, - /datum/gas/nitrous_oxide, - /datum/gas/nitrium, - /datum/gas/tritium, - /datum/gas/bz, - /datum/gas/pluoxium, - /datum/gas/dilithium,//Yogs -- Adds Dilithium - /datum/gas/freon, - /datum/gas/hydrogen, - /datum/gas/healium, - /datum/gas/pluonium, - /datum/gas/zauker, - /datum/gas/halon, - /datum/gas/antinoblium, - /datum/gas/hexane + GAS_CO2, + GAS_MIASMA, + GAS_PLASMA, + GAS_H2O, + GAS_HYPERNOB, + GAS_NITROUS, + GAS_NITRIUM, + GAS_TRITIUM, + GAS_BZ, + GAS_PLUOXIUM,//yogs comma + GAS_DILITHIUM,//Yogs -- Adds Dilithium + GAS_FREON, + GAS_H2, + GAS_HEALIUM, + GAS_PLUONIUM, + GAS_ZAUKER, + GAS_HALON, + GAS_HEXANE ), "scrubbing" = 1, "widenet" = 1 @@ -671,13 +667,16 @@ post_alert(0) return - var/turf/location = get_turf(src) - if(!location) + if(!isopenturf(get_turf(src))) return var/datum/tlv/cur_tlv - var/datum/gas_mixture/environment = location.return_air() + var/datum/gas_mixture/environment = return_air() + + if(!environment) + return + var/partial_pressure = R_IDEAL_GAS_EQUATION * environment.return_temperature() / environment.return_volume() cur_tlv = TLV["pressure"] diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm index c61fdc65c383..73f2b391ca04 100644 --- a/code/modules/atmospherics/machinery/atmosmachinery.dm +++ b/code/modules/atmospherics/machinery/atmosmachinery.dm @@ -23,6 +23,10 @@ GLOBAL_LIST_EMPTY(pipeimages) resistance_flags = FIRE_PROOF max_integrity = 200 obj_flags = CAN_BE_HIT | ON_BLUEPRINTS + ///Is the thing being rebuilt by SSair or not. Prevents list bloat + var/rebuilding = FALSE + ///If we should init and immediately start processing + var/init_processing = FALSE var/can_unwrench = 0 var/initialize_directions = 0 var/pipe_color @@ -53,19 +57,21 @@ GLOBAL_LIST_EMPTY(pipeimages) nodes = new(device_type) if (!armor) armor = list(MELEE = 25, BULLET = 10, LASER = 10, ENERGY = 100, BOMB = 0, BIO = 100, RAD = 100, FIRE = 100, ACID = 70) + init_processing = process ..() - if(process) - SSair.atmos_machinery += src - SetInitDirections() + set_init_directions() + +/obj/machinery/atmospherics/Initialize(mapload) + if(init_processing) + SSair_machinery.start_processing_machine(src) + return ..() /obj/machinery/atmospherics/Destroy() for(var/i in 1 to device_type) - nullifyNode(i) - - SSair.atmos_machinery -= src - if(SSair.currentpart == SSAIR_ATMOSMACHINERY) - SSair.currentrun -= src - SSair.pipenets_needing_rebuilt -= src + nullify_node(i) + + SSair_machinery.stop_processing_machine(src) + SSair.rebuild_queue -= src dropContents() if(pipe_vision_img) @@ -77,27 +83,36 @@ GLOBAL_LIST_EMPTY(pipeimages) /obj/machinery/atmospherics/proc/destroy_network() return -/obj/machinery/atmospherics/proc/build_network() - // Called to build a network from this node +/obj/machinery/atmospherics/proc/rebuild_pipes() + var/list/targets = get_rebuild_targets() + rebuilding = FALSE + for(var/datum/pipeline/build_off as anything in targets) + build_off.build_pipeline(src) //This'll add to the expansion queue + +/obj/machinery/atmospherics/proc/get_rebuild_targets() return -/obj/machinery/atmospherics/proc/nullifyNode(i) - if(nodes[i]) - var/obj/machinery/atmospherics/N = nodes[i] - N.disconnect(src) - nodes[i] = null +/obj/machinery/atmospherics/proc/nullify_node(i) + if(!nodes[i]) + return + var/obj/machinery/atmospherics/N = nodes[i] + N.disconnect(src) + nodes[i] = null -/obj/machinery/atmospherics/proc/getNodeConnects() +/obj/machinery/atmospherics/proc/get_node_connects() var/list/node_connects = list() node_connects.len = device_type + var/init_directions = get_init_directions() for(var/i in 1 to device_type) - for(var/D in GLOB.cardinals) - if(D & GetInitDirections()) - if(D in node_connects) - continue - node_connects[i] = D - break + for(var/direction in GLOB.cardinals) + if(!(direction & init_directions)) + continue + if(direction in node_connects) + continue + node_connects[i] = direction + break + return node_connects /obj/machinery/atmospherics/proc/normalize_cardinal_directions() @@ -108,9 +123,9 @@ GLOBAL_LIST_EMPTY(pipeimages) setDir(EAST) //this is called just after the air controller sets up turfs -/obj/machinery/atmospherics/proc/atmosinit(list/node_connects) +/obj/machinery/atmospherics/proc/atmos_init(list/node_connects) if(!node_connects) //for pipes where order of nodes doesn't matter - node_connects = getNodeConnects() + node_connects = get_node_connects() for(var/i in 1 to device_type) for(var/obj/machinery/atmospherics/target in get_step(src,node_connects[i])) @@ -119,7 +134,7 @@ GLOBAL_LIST_EMPTY(pipeimages) break update_appearance(UPDATE_ICON) -/obj/machinery/atmospherics/proc/setPipingLayer(new_layer) +/obj/machinery/atmospherics/proc/set_piping_layer(new_layer) piping_layer = (pipe_flags & PIPING_DEFAULT_LAYER_ONLY) ? PIPING_LAYER_DEFAULT : new_layer update_appearance(UPDATE_ICON) @@ -131,43 +146,54 @@ GLOBAL_LIST_EMPTY(pipeimages) return connection_check(target, piping_layer) //Find a connecting /obj/machinery/atmospherics in specified direction -/obj/machinery/atmospherics/proc/findConnecting(direction, prompted_layer) - for(var/obj/machinery/atmospherics/target in get_step(src, direction)) - if(target.initialize_directions & get_dir(target,src)) - if(connection_check(target, prompted_layer)) - return target +/obj/machinery/atmospherics/proc/find_connecting(direction, prompted_layer) + for(var/obj/machinery/atmospherics/target in get_step_multiz(src, direction)) + if(!(target.initialize_directions & get_dir(target,src))) + continue + if(connection_check(target, prompted_layer)) + return target /obj/machinery/atmospherics/proc/connection_check(obj/machinery/atmospherics/target, given_layer) - if(isConnectable(target, given_layer) && target.isConnectable(src, given_layer) && (target.initialize_directions & get_dir(target,src))) - return TRUE - return FALSE + if(!((initialize_directions & get_dir(src, target)) && (target.initialize_directions & get_dir(target, src)))) + return FALSE + + if(!is_connectable(target, given_layer) || !target.is_connectable(src, given_layer)) + return FALSE + + return TRUE -/obj/machinery/atmospherics/proc/isConnectable(obj/machinery/atmospherics/target, given_layer) + +/obj/machinery/atmospherics/proc/is_connectable(obj/machinery/atmospherics/target, given_layer) if(isnull(given_layer)) given_layer = piping_layer + + if(target.loc == loc) + return FALSE + if((target.piping_layer == given_layer) || (target.pipe_flags & PIPING_ALL_LAYER)) return TRUE + return FALSE /obj/machinery/atmospherics/proc/pipeline_expansion() return nodes -/obj/machinery/atmospherics/proc/SetInitDirections() +/obj/machinery/atmospherics/proc/set_init_directions() return -/obj/machinery/atmospherics/proc/GetInitDirections() +/obj/machinery/atmospherics/proc/get_init_directions() return initialize_directions -/obj/machinery/atmospherics/proc/returnPipenet() +/obj/machinery/atmospherics/proc/return_pipenet() return -/obj/machinery/atmospherics/proc/returnPipenetAir() +/obj/machinery/atmospherics/proc/return_pipenet_airs() return -/obj/machinery/atmospherics/proc/setPipenet() +/obj/machinery/atmospherics/proc/set_pipenet() return -/obj/machinery/atmospherics/proc/replacePipenet() +/obj/machinery/atmospherics/proc/replace_pipenet() return /obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference) @@ -181,7 +207,7 @@ GLOBAL_LIST_EMPTY(pipeimages) if(istype(W, /obj/item/pipe)) //lets you autodrop var/obj/item/pipe/pipe = W if(user.dropItemToGround(pipe)) - pipe.setPipingLayer(piping_layer) //align it with us + pipe.set_piping_layer(piping_layer) //align it with us return TRUE else return ..() @@ -265,13 +291,13 @@ GLOBAL_LIST_EMPTY(pipeimages) if(!(flags_1 & NODECONSTRUCT_1)) if(can_unwrench) var/obj/item/pipe/stored = new construction_type(loc, null, dir, src) - stored.setPipingLayer(piping_layer) + stored.set_piping_layer(piping_layer) if(!disassembled) stored.obj_integrity = stored.max_integrity * 0.5 transfer_fingerprints_to(stored) ..() -/obj/machinery/atmospherics/proc/getpipeimage(iconset, iconstate, direction, col=rgb(255,255,255), piping_layer=3, trinary = FALSE) +/obj/machinery/atmospherics/proc/get_pipe_image(iconset, iconstate, direction, col=rgb(255,255,255), piping_layer=3, trinary = FALSE) //Add identifiers for the iconset if(GLOB.iconsetids[iconset] == null) @@ -292,15 +318,15 @@ GLOBAL_LIST_EMPTY(pipeimages) if(can_unwrench) add_atom_colour(obj_color, FIXED_COLOUR_PRIORITY) pipe_color = obj_color - setPipingLayer(set_layer) + set_piping_layer(set_layer) var/turf/T = get_turf(src) level = T.intact ? 2 : 1 - atmosinit() + atmos_init() var/list/nodes = pipeline_expansion() for(var/obj/machinery/atmospherics/A in nodes) - A.atmosinit() - A.addMember(src) - build_network() + A.atmos_init() + A.add_member(src) + SSair.add_to_rebuild_queue(src) /obj/machinery/atmospherics/Entered(atom/movable/AM) if(istype(AM, /mob/living)) @@ -323,7 +349,7 @@ GLOBAL_LIST_EMPTY(pipeimages) if(user in buckled_mobs)// fixes buckle ventcrawl edgecase fuck bug return - var/obj/machinery/atmospherics/target_move = findConnecting(direction, user.ventcrawl_layer) + var/obj/machinery/atmospherics/target_move = find_connecting(direction, user.ventcrawl_layer) if(target_move) if(target_move.can_crawl_through()) if(is_type_in_typecache(target_move, GLOB.ventcrawl_machinery)) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/binary_devices.dm b/code/modules/atmospherics/machinery/components/binary_devices/binary_devices.dm index 5e1428559345..5f3741f24519 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/binary_devices.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/binary_devices.dm @@ -6,7 +6,7 @@ device_type = BINARY layer = GAS_PUMP_LAYER -/obj/machinery/atmospherics/components/binary/SetInitDirections() +/obj/machinery/atmospherics/components/binary/set_init_directions() switch(dir) if(NORTH, SOUTH) initialize_directions = NORTH|SOUTH @@ -17,7 +17,7 @@ update_appearance(UPDATE_ICON) ..() -/obj/machinery/atmospherics/components/binary/getNodeConnects() +/obj/machinery/atmospherics/components/binary/get_node_connects() return list(turn(dir, 180), dir) ///Used by binary devices to set what the offset will be for each layer diff --git a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm index 9c9a7203f343..a309095d2716 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm @@ -76,7 +76,6 @@ last_pressure_delta = 0 /obj/machinery/atmospherics/components/binary/circulator/process_atmos() - ..() update_icon_nopipes() /obj/machinery/atmospherics/components/binary/circulator/update_overlays() @@ -86,11 +85,11 @@ for(var/direction in GLOB.cardinals) if(!(direction & initialize_directions)) continue - var/obj/machinery/atmospherics/node = findConnecting(direction) + var/obj/machinery/atmospherics/node = find_connecting(direction) var/image/cap if(node) - cap = getpipeimage(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer) + cap = get_pipe_image(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer) . += cap @@ -164,37 +163,37 @@ if(node1) node1.disconnect(src) nodes[1] = null - nullifyPipenet(parents[1]) + nullify_pipenet(parents[1]) if(node2) node2.disconnect(src) nodes[2] = null - nullifyPipenet(parents[2]) + nullify_pipenet(parents[2]) if(anchored) - SetInitDirections() - atmosinit() + set_init_directions() + atmos_init() node1 = nodes[1] if(node1) - node1.atmosinit() - node1.addMember(src) + node1.atmos_init() + node1.add_member(src) node2 = nodes[2] if(node2) - node2.atmosinit() - node2.addMember(src) + node2.atmos_init() + node2.add_member(src) SSair.add_to_rebuild_queue(src) update_appearance(UPDATE_ICON) return TRUE -/obj/machinery/atmospherics/components/binary/circulator/SetInitDirections() +/obj/machinery/atmospherics/components/binary/circulator/set_init_directions() switch(dir) if(NORTH, SOUTH) initialize_directions = EAST|WEST if(EAST, WEST) initialize_directions = NORTH|SOUTH -/obj/machinery/atmospherics/components/binary/circulator/getNodeConnects() +/obj/machinery/atmospherics/components/binary/circulator/get_node_connects() if(flipped) return list(turn(dir, 270), turn(dir, 90)) return list(turn(dir, 90), turn(dir, 270)) @@ -255,7 +254,7 @@ generator.update_appearance(UPDATE_ICON) generator = null -/obj/machinery/atmospherics/components/binary/circulator/setPipingLayer(new_layer) +/obj/machinery/atmospherics/components/binary/circulator/set_piping_layer(new_layer) ..() pixel_x = 0 pixel_y = 0 diff --git a/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm index 607797d55d5a..d82bde6274b8 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/dp_vent_pump.dm @@ -42,7 +42,7 @@ /obj/machinery/atmospherics/components/binary/dp_vent_pump/update_icon_nopipes() cut_overlays() if(showpipe) - var/image/cap = getpipeimage(icon, "dpvent_cap", dir, piping_layer = piping_layer) + var/image/cap = get_pipe_image(icon, "dpvent_cap", dir, piping_layer = piping_layer) add_overlay(cap) if(!on || !is_operational()) @@ -51,8 +51,8 @@ icon_state = pump_direction ? "vent_out" : "vent_in" /obj/machinery/atmospherics/components/binary/dp_vent_pump/process_atmos() - ..() - + if(welded || !is_operational() || !isopenturf(loc)) + return FALSE if(!on) return var/datum/gas_mixture/air1 = airs[1] @@ -73,19 +73,14 @@ if(air1.return_temperature() > 0) var/transfer_moles = pressure_delta*environment.return_volume()/(air1.return_temperature() * R_IDEAL_GAS_EQUATION) - var/datum/gas_mixture/removed = air1.remove(transfer_moles) - //Removed can be null if there is no atmosphere in air1 - if(!removed) - return + loc.assume_air_moles(air1, transfer_moles) - loc.assume_air(removed) - air_update_turf() + var/datum/pipeline/parent1 = parents[1] - parent1.update = 1 + parent1.update = PIPENET_UPDATE_STATUS_RECONCILE_NEEDED else //external -> output - if(environment.return_pressure() > 0) var/our_multiplier = air2.return_volume() / (environment.return_temperature() * R_IDEAL_GAS_EQUATION) var/moles_delta = 10000 * our_multiplier @@ -93,20 +88,15 @@ moles_delta = min(moles_delta, (environment_pressure - output_pressure_max) * environment.return_volume() / (environment.return_temperature() * R_IDEAL_GAS_EQUATION)) if(pressure_checks&INPUT_MIN) moles_delta = min(moles_delta, (input_pressure_min - air2.return_pressure()) * our_multiplier) - - if(moles_delta > 0) - var/datum/gas_mixture/removed = loc.remove_air(moles_delta) - if (isnull(removed)) // in space - return - air2.merge(removed) - air_update_turf() + if(moles_delta > 0) + loc.transfer_air(air2, moles_delta) + var/datum/pipeline/parent2 = parents[2] - parent2.update = 1 - - //Radio remote control + parent2.update = PIPENET_UPDATE_STATUS_RECONCILE_NEEDED +//Radio remote control /obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/set_frequency(new_frequency) SSradio.remove_object(src, frequency) frequency = new_frequency @@ -130,7 +120,7 @@ )) radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA) -/obj/machinery/atmospherics/components/binary/dp_vent_pump/atmosinit() +/obj/machinery/atmospherics/components/binary/dp_vent_pump/atmos_init() ..() if(frequency) set_frequency(frequency) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm index 01ec68fa1c20..774eeaa8a0cf 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm @@ -55,35 +55,15 @@ Passive gate is similar to the regular pump except: cut_overlays() icon_state = "passgate_off-[set_overlay_offset(piping_layer)]" if(on) - add_overlay(getpipeimage(icon, "passgate_on-[set_overlay_offset(piping_layer)]")) + add_overlay(get_pipe_image(icon, "passgate_on-[set_overlay_offset(piping_layer)]")) /obj/machinery/atmospherics/components/binary/passive_gate/process_atmos() - ..() if(!on) return var/datum/gas_mixture/air1 = airs[1] var/datum/gas_mixture/air2 = airs[2] - - var/output_starting_pressure = air2.return_pressure() - var/input_starting_pressure = air1.return_pressure() - - if(output_starting_pressure >= min(target_pressure,input_starting_pressure-10)) - //No need to pump gas if target is already reached or input pressure is too low - //Need at least 10 KPa difference to overcome friction in the mechanism - return - - //Calculate necessary moles to transfer using PV = nRT - if((air1.total_moles() > 0) && (air1.return_temperature()>0)) - var/pressure_delta = min(target_pressure - output_starting_pressure, (input_starting_pressure - output_starting_pressure)/2) - //Can not have a pressure delta that would cause output_pressure > input_pressure - - var/transfer_moles = pressure_delta*air2.return_volume()/(air1.return_temperature() * R_IDEAL_GAS_EQUATION) - - //Actually transfer the gas - var/datum/gas_mixture/removed = air1.remove(transfer_moles) - air2.merge(removed) - + if(air1.release_gas_to(air2, target_pressure)) update_parents() @@ -150,7 +130,7 @@ Passive gate is similar to the regular pump except: investigate_log(msg, INVESTIGATE_SUPERMATTER) // yogs - make supermatter invest useful update_appearance(UPDATE_ICON) -/obj/machinery/atmospherics/components/binary/passive_gate/atmosinit() +/obj/machinery/atmospherics/components/binary/passive_gate/atmos_init() ..() if(frequency) set_frequency(frequency) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm b/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm index 7d3c7949b7d7..2556d9917447 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm @@ -119,7 +119,7 @@ investigate_log("was set to [target_pressure] kPa by [key_name(usr)]", INVESTIGATE_ATMOS) update_appearance(UPDATE_ICON) -/obj/machinery/atmospherics/components/binary/pressure_valve/atmosinit() +/obj/machinery/atmospherics/components/binary/pressure_valve/atmos_init() . = ..() if(frequency) set_frequency(frequency) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm index 76f2b98782d7..be8c8dbdb6e2 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm @@ -53,27 +53,21 @@ icon_state = (on && is_operational()) ? "pump_on-[set_overlay_offset(piping_layer)]" : "pump_off-[set_overlay_offset(piping_layer)]" /obj/machinery/atmospherics/components/binary/pump/process_atmos() -// ..() if(!on || !is_operational()) return var/datum/gas_mixture/air1 = airs[1] var/datum/gas_mixture/air2 = airs[2] - var/output_starting_pressure = air2.return_pressure() - if((target_pressure - output_starting_pressure) < 0.01) //No need to pump gas if target is already reached! return - //Calculate necessary moles to transfer using PV=nRT if((air1.total_moles() > 0) && (air1.return_temperature()>0)) var/pressure_delta = target_pressure - output_starting_pressure var/transfer_moles = pressure_delta*air2.return_volume()/(air1.return_temperature() * R_IDEAL_GAS_EQUATION) - //Actually transfer the gas - var/datum/gas_mixture/removed = air1.remove(transfer_moles) - air2.merge(removed) + air1.transfer_to(air2,transfer_moles) update_parents() @@ -139,7 +133,7 @@ investigate_log(msg, INVESTIGATE_SUPERMATTER) // yogs - makes supermatter invest useful update_appearance(UPDATE_ICON) -/obj/machinery/atmospherics/components/binary/pump/atmosinit() +/obj/machinery/atmospherics/components/binary/pump/atmos_init() ..() if(frequency) set_frequency(frequency) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.dm index 3a489e3821af..25d30312fc03 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.dm @@ -33,7 +33,7 @@ icon_state = "tpump_[on && is_operational() ? "on" : "off"]-[set_overlay_offset(piping_layer)]" /obj/machinery/atmospherics/components/binary/temperature_pump/process_atmos() - ..() + if(!on || !is_operational()) return @@ -42,7 +42,6 @@ if(!QUANTIZE(air_input.total_moles()) || !QUANTIZE(air_output.total_moles())) //Don't transfer if there's no gas return - var/datum/gas_mixture/remove_input = air_input.remove_ratio(0.9) var/datum/gas_mixture/remove_output = air_output.remove_ratio(0.9) @@ -50,7 +49,7 @@ if(coolant_temperature_delta > 0) var/input_capacity = remove_input.heat_capacity() - var/output_capacity = remove_output.heat_capacity() + var/output_capacity = air_output.heat_capacity() var/cooling_heat_amount = (heat_transfer_rate * 0.01) * coolant_temperature_delta * (input_capacity * output_capacity / (input_capacity + output_capacity)) remove_input.set_temperature(max(remove_input.return_temperature() - (cooling_heat_amount / input_capacity), TCMB)) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm index 89e9b7b2a43a..86449e9eb00b 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm @@ -14,6 +14,8 @@ It's like a regular ol' straight pipe, but you can turn it on and off. interaction_flags_machine = INTERACT_MACHINE_OFFLINE | INTERACT_MACHINE_OPEN //Intentionally no allow_silicon flag pipe_flags = PIPING_CARDINAL_AUTONORMALIZE + custom_reconcilation = TRUE + var/frequency = 0 var/id = null @@ -24,6 +26,26 @@ It's like a regular ol' straight pipe, but you can turn it on and off. var/switching = FALSE + +/obj/machinery/atmospherics/components/binary/valve/Destroy() + //Should only happen on extreme circumstances + if(on) + //Let's give presumably now-severed pipenets a chance to scramble for what's happening at next SSair fire() + if(parents[1]) + parents[1].update = PIPENET_UPDATE_STATUS_RECONCILE_NEEDED + if(parents[2]) + parents[2].update = PIPENET_UPDATE_STATUS_RECONCILE_NEEDED + . = ..() + +// This is what handles the actual functionality of combining 2 pipenets when the valve is open +// Basically when a pipenet updates it will consider both sides to be the same for the purpose of the gas update +/obj/machinery/atmospherics/components/binary/valve/return_pipenets_for_reconcilation(datum/pipeline/requester) + . = ..() + if(!on) + return + . |= parents[1] + . |= parents[2] + /obj/machinery/atmospherics/components/binary/valve/update_icon_nopipes(animation = FALSE) normalize_cardinal_directions() if(animation) diff --git a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm index 9092deda1252..74c6be7c3f26 100644 --- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm +++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm @@ -55,7 +55,6 @@ icon_state = on && is_operational() ? "volpump_on-[set_overlay_offset(piping_layer)]" : "volpump_off-[set_overlay_offset(piping_layer)]" /obj/machinery/atmospherics/components/binary/volume_pump/process_atmos() -// ..() if(!on || !is_operational()) return @@ -73,19 +72,15 @@ if(overclocked && (output_starting_pressure-input_starting_pressure > 1000))//Overclocked pumps can only force gas a certain amount. return - - var/transfer_ratio = transfer_rate / air1.return_volume() - - var/datum/gas_mixture/removed = air1.remove_ratio(transfer_ratio) - if(overclocked)//Some of the gas from the mixture leaks to the environment when overclocked var/turf/open/T = loc if(istype(T)) - var/datum/gas_mixture/leaked = removed.remove_ratio(VOLUME_PUMP_LEAK_AMOUNT) + var/datum/gas_mixture/leaked = air1.remove_ratio(VOLUME_PUMP_LEAK_AMOUNT) T.assume_air(leaked) - T.air_update_turf() - air2.merge(removed) + var/transfer_ratio = transfer_rate / air1.return_volume() + + air1.transfer_ratio_to(air2,transfer_ratio) update_parents() @@ -126,7 +121,7 @@ data["max_rate"] = round(MAX_TRANSFER_RATE) return data -/obj/machinery/atmospherics/components/binary/volume_pump/atmosinit() +/obj/machinery/atmospherics/components/binary/volume_pump/atmos_init() ..() set_frequency(frequency) diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm index 95ca4b666034..2f1863532f74 100644 --- a/code/modules/atmospherics/machinery/components/components_base.dm +++ b/code/modules/atmospherics/machinery/components/components_base.dm @@ -6,10 +6,14 @@ var/showpipe = TRUE var/shift_underlay_only = TRUE //Layering only shifts underlay? + var/update_parents_after_rebuild = FALSE + var/list/datum/pipeline/parents var/list/datum/gas_mixture/airs var/startingvolume = 200 + var/custom_reconcilation = FALSE + /obj/machinery/atmospherics/components/New() parents = new(device_type) airs = new(device_type) @@ -17,8 +21,11 @@ ..() for(var/i in 1 to device_type) - var/datum/gas_mixture/A = new(startingvolume) - airs[i] = A + if(airs[i]) + continue + var/datum/gas_mixture/component_mixture = new + component_mixture.set_volume(startingvolume) + airs[i] = component_mixture // Iconnery @@ -54,52 +61,73 @@ /obj/machinery/atmospherics/components/proc/get_pipe_underlay(state, dir, color = null) if(color) - . = getpipeimage('icons/obj/atmospherics/components/binary_devices.dmi', state, dir, color, piping_layer = shift_underlay_only ? piping_layer : 3) + . = get_pipe_image('icons/obj/atmospherics/components/binary_devices.dmi', state, dir, color, piping_layer = shift_underlay_only ? piping_layer : 3) else - . = getpipeimage('icons/obj/atmospherics/components/binary_devices.dmi', state, dir, piping_layer = shift_underlay_only ? piping_layer : 3) + . = get_pipe_image('icons/obj/atmospherics/components/binary_devices.dmi', state, dir, piping_layer = shift_underlay_only ? piping_layer : 3) // Pipenet stuff; housekeeping -/obj/machinery/atmospherics/components/nullifyNode(i) - if(nodes[i]) - nullifyPipenet(parents[i]) - QDEL_NULL(airs[i]) - ..() +/obj/machinery/atmospherics/components/nullify_node(i) + if(parents[i]) + nullify_pipenet(parents[i]) + airs[i] = null + return ..() /obj/machinery/atmospherics/components/on_construction() ..() update_parents() -/obj/machinery/atmospherics/components/build_network() +/obj/machinery/atmospherics/components/rebuild_pipes() + . = ..() + if(update_parents_after_rebuild) + update_parents() + +/obj/machinery/atmospherics/components/get_rebuild_targets() + var/list/to_return = list() for(var/i in 1 to device_type) - if(!parents[i]) - parents[i] = new /datum/pipeline() - var/datum/pipeline/P = parents[i] - P.build_pipeline(src) + if(parents[i]) + continue + parents[i] = new /datum/pipeline() + to_return += parents[i] + return to_return -/obj/machinery/atmospherics/components/proc/nullifyPipenet(datum/pipeline/reference) +/obj/machinery/atmospherics/components/proc/nullify_pipenet(datum/pipeline/reference) if(!reference) - CRASH("nullifyPipenet(null) called by [type] on [COORD(src)]") - var/i = parents.Find(reference) - reference.other_airs -= airs[i] - reference.other_atmosmch -= src - parents[i] = null + CRASH("nullify_pipenet(null) called by [type] on [COORD(src)]") + + for (var/i in 1 to parents.len) + if (parents[i] == reference) + reference.other_airs -= airs[i] // Disconnects from the pipeline side + parents[i] = null // Disconnects from the machinery side. + + reference.other_atmos_machines -= src + + if(!length(reference.other_atmos_machines) && !length(reference.members)) + if(QDESTROYING(reference)) + CRASH("nullify_pipenet() called on qdeleting [reference]") + qdel(reference) -/obj/machinery/atmospherics/components/returnPipenetAir(datum/pipeline/reference) - return airs[parents.Find(reference)] +// We should return every air sharing a parent +/obj/machinery/atmospherics/components/return_pipenet_airs(datum/pipeline/reference) + var/list/returned_air = list() + + for (var/i in 1 to parents.len) + if (parents[i] == reference) + returned_air += airs[i] + return returned_air /obj/machinery/atmospherics/components/pipeline_expansion(datum/pipeline/reference) if(reference) return list(nodes[parents.Find(reference)]) return ..() -/obj/machinery/atmospherics/components/setPipenet(datum/pipeline/reference, obj/machinery/atmospherics/A) +/obj/machinery/atmospherics/components/set_pipenet(datum/pipeline/reference, obj/machinery/atmospherics/A) parents[nodes.Find(A)] = reference -/obj/machinery/atmospherics/components/returnPipenet(obj/machinery/atmospherics/A = nodes[1]) //returns parents[1] if called without argument +/obj/machinery/atmospherics/components/return_pipenet(obj/machinery/atmospherics/A = nodes[1]) //returns parents[1] if called without argument return parents[nodes.Find(A)] -/obj/machinery/atmospherics/components/replacePipenet(datum/pipeline/Old, datum/pipeline/New) +/obj/machinery/atmospherics/components/replace_pipenet(datum/pipeline/Old, datum/pipeline/New) parents[parents.Find(Old)] = New /obj/machinery/atmospherics/components/unsafe_pressure_release(mob/user, pressures) @@ -117,15 +145,9 @@ times_lost++ var/shared_loss = lost/times_lost - var/datum/gas_mixture/to_release for(var/i in 1 to device_type) var/datum/gas_mixture/air = airs[i] - if(!to_release) - to_release = air.remove(shared_loss) - continue - to_release.merge(air.remove(shared_loss)) - T.assume_air(to_release) - air_update_turf(1) + T.assume_air_moles(air, shared_loss) /obj/machinery/atmospherics/components/proc/safe_input(title, text, default_set) var/new_value = input(usr,text,title,default_set) as num @@ -136,6 +158,11 @@ // Helpers /obj/machinery/atmospherics/components/proc/update_parents() + if(!SSair.initialized) + return + if(rebuilding) + update_parents_after_rebuild = TRUE + return for(var/i in 1 to device_type) var/datum/pipeline/parent = parents[i] if(!parent) @@ -147,7 +174,13 @@ /obj/machinery/atmospherics/components/return_pipenets() . = list() for(var/i in 1 to device_type) - . += returnPipenet(nodes[i]) + . += return_pipenet(nodes[i]) + +/obj/machinery/atmospherics/components/proc/return_pipenets_for_reconcilation(datum/pipeline/requester) + return list() + +/obj/machinery/atmospherics/components/proc/return_airs_for_reconcilation(datum/pipeline/requester) + return list() // UI Stuff @@ -159,5 +192,30 @@ // Tool acts +/obj/machinery/atmospherics/components/proc/disconnect_nodes() + for(var/i in 1 to device_type) + var/obj/machinery/atmospherics/node = nodes[i] + if(node) + if(src in node.nodes) //Only if it's actually connected. On-pipe version would is one-sided. + node.disconnect(src) + nodes[i] = null + if(parents[i]) + nullify_pipenet(parents[i]) + +/obj/machinery/atmospherics/components/proc/connect_nodes() + atmos_init() + for(var/i in 1 to device_type) + var/obj/machinery/atmospherics/node = nodes[i] + if(node) + node.atmos_init() + node.add_member(src) + SSair.add_to_rebuild_queue(src) + +/obj/machinery/atmospherics/components/proc/change_nodes_connection(disconnect) + if(disconnect) + disconnect_nodes() + return + connect_nodes() + /obj/machinery/atmospherics/components/return_analyzable_air() return airs diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_fuel_datums.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_fuel_datums.dm index 54a4e005704d..f9dd6525ecfb 100644 --- a/code/modules/atmospherics/machinery/components/fusion/hfr_fuel_datums.dm +++ b/code/modules/atmospherics/machinery/components/fusion/hfr_fuel_datums.dm @@ -50,9 +50,9 @@ GLOBAL_LIST_INIT(hfr_fuels_list, hfr_fuels_create_list()) fuel_consumption_multiplier = 3.3 gas_production_multiplier = 1.4 temperature_change_multiplier = 0.6 - requirements = list(/datum/gas/plasma, /datum/gas/oxygen) - primary_products = list(/datum/gas/carbon_dioxide, /datum/gas/water_vapor) - secondary_products = list(/datum/gas/carbon_dioxide, /datum/gas/freon, /datum/gas/tritium, /datum/gas/hydrogen, /datum/gas/pluoxium, /datum/gas/halon) + requirements = list(GAS_PLASMA, GAS_O2) + primary_products = list(GAS_CO2, GAS_H2O) + secondary_products = list(GAS_CO2, GAS_FREON, GAS_TRITIUM, GAS_H2, GAS_PLUOXIUM, GAS_HALON) meltdown_flags = HYPERTORUS_FLAG_BASE_EXPLOSION | HYPERTORUS_FLAG_MINIMUM_SPREAD /datum/hfr_fuel/hydrogen_oxy_fuel @@ -64,9 +64,9 @@ GLOBAL_LIST_INIT(hfr_fuels_list, hfr_fuels_create_list()) fuel_consumption_multiplier = 1.1 gas_production_multiplier = 0.9 temperature_change_multiplier = 0.75 - requirements = list(/datum/gas/hydrogen, /datum/gas/oxygen) - primary_products = list(/datum/gas/nitrogen) - secondary_products = list(/datum/gas/plasma, /datum/gas/freon, /datum/gas/bz, /datum/gas/healium, /datum/gas/pluoxium, /datum/gas/hypernoblium) + requirements = list(GAS_H2, GAS_O2) + primary_products = list(GAS_N2) + secondary_products = list(GAS_PLASMA, GAS_FREON, GAS_BZ, GAS_HEALIUM, GAS_PLUOXIUM, GAS_HYPERNOB) meltdown_flags = HYPERTORUS_FLAG_BASE_EXPLOSION | HYPERTORUS_FLAG_EMP | HYPERTORUS_FLAG_MEDIUM_SPREAD /datum/hfr_fuel/tritium_oxy_fuel @@ -78,9 +78,9 @@ GLOBAL_LIST_INIT(hfr_fuels_list, hfr_fuels_create_list()) fuel_consumption_multiplier = 1.2 gas_production_multiplier = 0.8 temperature_change_multiplier = 0.8 - requirements = list(/datum/gas/tritium, /datum/gas/oxygen) - primary_products = list(/datum/gas/pluoxium) - secondary_products = list(/datum/gas/plasma, /datum/gas/pluoxium, /datum/gas/healium, /datum/gas/hydrogen, /datum/gas/halon, /datum/gas/hypernoblium) + requirements = list(GAS_TRITIUM, GAS_O2) + primary_products = list(GAS_PLUOXIUM) + secondary_products = list(GAS_PLASMA, GAS_PLUOXIUM, GAS_HEALIUM, GAS_H2, GAS_HALON, GAS_HYPERNOB) meltdown_flags = HYPERTORUS_FLAG_BASE_EXPLOSION | HYPERTORUS_FLAG_RADIATION_PULSE | HYPERTORUS_FLAG_MEDIUM_SPREAD /datum/hfr_fuel/hydrogen_tritium_fuel @@ -92,9 +92,9 @@ GLOBAL_LIST_INIT(hfr_fuels_list, hfr_fuels_create_list()) fuel_consumption_multiplier = 1 gas_production_multiplier = 1 temperature_change_multiplier = 0.85 - requirements = list(/datum/gas/hydrogen, /datum/gas/tritium) - primary_products = list(/datum/gas/pluoxium) - secondary_products = list(/datum/gas/nitrogen, /datum/gas/healium, /datum/gas/dilithium, /datum/gas/hexane, /datum/gas/hypernoblium, /datum/gas/antinoblium) + requirements = list(GAS_H2, GAS_TRITIUM) + primary_products = list(GAS_PLUOXIUM) + secondary_products = list(GAS_N2, GAS_HEALIUM, GAS_DILITHIUM, GAS_HEXANE, GAS_HYPERNOB, GAS_ANTINOB) meltdown_flags = HYPERTORUS_FLAG_MEDIUM_EXPLOSION | HYPERTORUS_FLAG_RADIATION_PULSE | HYPERTORUS_FLAG_EMP | HYPERTORUS_FLAG_MEDIUM_SPREAD /datum/hfr_fuel/hypernob_hydrogen_fuel @@ -106,9 +106,9 @@ GLOBAL_LIST_INIT(hfr_fuels_list, hfr_fuels_create_list()) fuel_consumption_multiplier = 0.55 gas_production_multiplier = 1.4 temperature_change_multiplier = 0.9 - requirements = list(/datum/gas/hypernoblium, /datum/gas/hydrogen) - primary_products = list(/datum/gas/antinoblium) - secondary_products = list(/datum/gas/antinoblium, /datum/gas/healium, /datum/gas/pluoxium, /datum/gas/pluonium, /datum/gas/zauker, /datum/gas/nitrium) + requirements = list(GAS_HYPERNOB, GAS_H2) + primary_products = list(GAS_ANTINOB) + secondary_products = list(GAS_ANTINOB, GAS_HEALIUM, GAS_PLUOXIUM, GAS_PLUONIUM, GAS_ZAUKER, GAS_NITRIUM) meltdown_flags = HYPERTORUS_FLAG_DEVASTATING_EXPLOSION | HYPERTORUS_FLAG_RADIATION_PULSE | HYPERTORUS_FLAG_EMP | HYPERTORUS_FLAG_BIG_SPREAD /datum/hfr_fuel/hypernob_trit_fuel @@ -120,9 +120,9 @@ GLOBAL_LIST_INIT(hfr_fuels_list, hfr_fuels_create_list()) fuel_consumption_multiplier = 0.45 gas_production_multiplier = 1.7 temperature_change_multiplier = 0.95 - requirements = list(/datum/gas/hypernoblium, /datum/gas/tritium) - primary_products = list(/datum/gas/antinoblium) - secondary_products = list(/datum/gas/antinoblium, /datum/gas/healium, /datum/gas/pluonium, /datum/gas/zauker, /datum/gas/nitrium, /datum/gas/miasma) + requirements = list(GAS_HYPERNOB, GAS_TRITIUM) + primary_products = list(GAS_ANTINOB) + secondary_products = list(GAS_ANTINOB, GAS_HEALIUM, GAS_PLUONIUM, GAS_ZAUKER, GAS_NITRIUM, GAS_MIASMA) meltdown_flags = HYPERTORUS_FLAG_DEVASTATING_EXPLOSION | HYPERTORUS_FLAG_RADIATION_PULSE | HYPERTORUS_FLAG_EMP | HYPERTORUS_FLAG_BIG_SPREAD /datum/hfr_fuel/hypernob_antinob_fuel @@ -134,7 +134,7 @@ GLOBAL_LIST_INIT(hfr_fuels_list, hfr_fuels_create_list()) fuel_consumption_multiplier = 0.01 gas_production_multiplier = 3 temperature_change_multiplier = 1 - requirements = list(/datum/gas/hypernoblium, /datum/gas/antinoblium) - primary_products = list(/datum/gas/zauker, /datum/gas/miasma) - secondary_products = list(/datum/gas/oxygen, /datum/gas/nitrium, /datum/gas/bz, /datum/gas/pluonium, /datum/gas/hexane, /datum/gas/healium) + requirements = list(GAS_HYPERNOB, GAS_ANTINOB) + primary_products = list(GAS_ZAUKER, GAS_MIASMA) + secondary_products = list(GAS_O2, GAS_NITRIUM, GAS_BZ, GAS_PLUONIUM, GAS_HEXANE, GAS_HEALIUM) meltdown_flags = HYPERTORUS_FLAG_DEVASTATING_EXPLOSION | HYPERTORUS_FLAG_RADIATION_PULSE | HYPERTORUS_FLAG_EMP | HYPERTORUS_FLAG_MASSIVE_SPREAD | HYPERTORUS_FLAG_CRITICAL_MELTDOWN diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_main_processes.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_main_processes.dm index 3a6a3e8f85b4..fb230d697e7c 100644 --- a/code/modules/atmospherics/machinery/components/fusion/hfr_main_processes.dm +++ b/code/modules/atmospherics/machinery/components/fusion/hfr_main_processes.dm @@ -101,9 +101,9 @@ //Calculation of the gas power, only for theoretical instability calculations var/gas_power = 0 for (var/gas_id in internal_fusion.get_gases()) - gas_power += (GLOB.meta_gas_info[gas_id][META_GAS_FUSION_POWER] * internal_fusion.get_moles(gas_id)) + gas_power += (GLOB.gas_data.fusion_powers[gas_id] * internal_fusion.get_moles(gas_id)) for (var/gas_id in moderator_internal.get_gases()) - gas_power += (GLOB.meta_gas_info[gas_id][META_GAS_FUSION_POWER] * moderator_internal.get_moles(gas_id) * 0.75) + gas_power += (GLOB.gas_data.fusion_powers[gas_id] * moderator_internal.get_moles(gas_id) * 0.75) instability = MODULUS((gas_power * INSTABILITY_GAS_POWER_FACTOR_HFR)**2, toroidal_size) + (current_damper * 0.01) - iron_content * 0.05 //Effective reaction instability (determines if the energy is used/released) @@ -118,37 +118,37 @@ */ ///Those are the scaled gases that gets consumed and adjust energy // Gases that increase the amount of energy - var/energy_modifiers = scaled_moderator_list[/datum/gas/nitrogen] * 0.35 + \ - scaled_moderator_list[/datum/gas/carbon_dioxide] * 0.55 + \ - scaled_moderator_list[/datum/gas/nitrous_oxide] * 0.95 + \ - scaled_moderator_list[/datum/gas/zauker] * 1.55 + \ - scaled_moderator_list[/datum/gas/antinoblium] * 20 + var/energy_modifiers = scaled_moderator_list[GAS_N2] * 0.35 + \ + scaled_moderator_list[GAS_CO2] * 0.55 + \ + scaled_moderator_list[GAS_NITROUS] * 0.95 + \ + scaled_moderator_list[GAS_ZAUKER] * 1.55 + \ + scaled_moderator_list[GAS_ANTINOB] * 20 // Gases that decrease the amount of energy - energy_modifiers -= scaled_moderator_list[/datum/gas/hypernoblium] * 10 + \ - scaled_moderator_list[/datum/gas/water_vapor] * 0.75 + \ - scaled_moderator_list[/datum/gas/nitrium] * 0.15 + \ - scaled_moderator_list[/datum/gas/healium] * 0.45 + \ - scaled_moderator_list[/datum/gas/freon] * 1.15 + energy_modifiers -= scaled_moderator_list[GAS_HYPERNOB] * 10 + \ + scaled_moderator_list[GAS_H2O] * 0.75 + \ + scaled_moderator_list[GAS_NITRIUM] * 0.15 + \ + scaled_moderator_list[GAS_HEALIUM] * 0.45 + \ + scaled_moderator_list[GAS_FREON] * 1.15 ///Between 0.25 and 100, this value is used to modify the behaviour of the internal energy and the core temperature based on the gases present in the mix - var/power_modifier = scaled_moderator_list[/datum/gas/oxygen] * 0.55 + \ - scaled_moderator_list[/datum/gas/carbon_dioxide] * 0.95 + \ - scaled_moderator_list[/datum/gas/nitrium] * 1.45 + \ - scaled_moderator_list[/datum/gas/zauker] * 5.55 + \ - scaled_moderator_list[/datum/gas/plasma] * 0.05 - \ - scaled_moderator_list[/datum/gas/nitrous_oxide] * 0.05 - \ - scaled_moderator_list[/datum/gas/freon] * 0.75 + var/power_modifier = scaled_moderator_list[GAS_O2] * 0.55 + \ + scaled_moderator_list[GAS_CO2] * 0.95 + \ + scaled_moderator_list[GAS_NITRIUM] * 1.45 + \ + scaled_moderator_list[GAS_ZAUKER] * 5.55 + \ + scaled_moderator_list[GAS_PLASMA] * 0.05 - \ + scaled_moderator_list[GAS_NITROUS] * 0.05 - \ + scaled_moderator_list[GAS_FREON] * 0.75 ///Minimum 0.25, this value is used to modify the behaviour of the energy emission based on the gases present in the mix - var/heat_modifier = scaled_moderator_list[/datum/gas/plasma] * 1.25 - \ - scaled_moderator_list[/datum/gas/nitrogen] * 0.75 - \ - scaled_moderator_list[/datum/gas/nitrous_oxide] * 1.45 - \ - scaled_moderator_list[/datum/gas/freon] * 0.95 + var/heat_modifier = scaled_moderator_list[GAS_PLASMA] * 1.25 - \ + scaled_moderator_list[GAS_N2] * 0.75 - \ + scaled_moderator_list[GAS_NITROUS] * 1.45 - \ + scaled_moderator_list[GAS_FREON] * 0.95 ///Between 0.005 and 1000, this value modify the radiation emission of the reaction, higher values increase the emission - var/radiation_modifier = scaled_moderator_list[/datum/gas/freon] * 1.15 - \ - scaled_moderator_list[/datum/gas/nitrogen] * 0.45 - \ - scaled_moderator_list[/datum/gas/plasma] * 0.95 + \ - scaled_moderator_list[/datum/gas/bz] * 1.9 + \ - scaled_moderator_list[/datum/gas/pluonium] * 0.1 + \ - scaled_moderator_list[/datum/gas/antinoblium] * 10 + var/radiation_modifier = scaled_moderator_list[GAS_FREON] * 1.15 - \ + scaled_moderator_list[GAS_N2] * 0.45 - \ + scaled_moderator_list[GAS_PLASMA] * 0.95 + \ + scaled_moderator_list[GAS_BZ] * 1.9 + \ + scaled_moderator_list[GAS_PLUONIUM] * 0.1 + \ + scaled_moderator_list[GAS_ANTINOB] * 10 if (selected_fuel) // These should probably be static coefficients read from a table rather than things that depend on the current recipe @@ -267,80 +267,80 @@ /obj/machinery/atmospherics/components/unary/hypertorus/core/proc/moderator_common_process(delta_time, scaled_production, datum/gas_mixture/internal_output, moderator_list, dirty_production_rate, heat_output, radiation_modifier) switch(power_level) if(1) - if(moderator_list[/datum/gas/plasma] > 100) - internal_output.adjust_moles(/datum/gas/nitrous_oxide, scaled_production * 0.5) - moderator_internal.adjust_moles(/datum/gas/plasma, -min(moderator_internal.get_moles(/datum/gas/plasma), scaled_production * 0.85)) - if(moderator_list[/datum/gas/bz] > 150) - internal_output.adjust_moles(/datum/gas/halon, scaled_production * 0.55) - moderator_internal.adjust_moles(/datum/gas/bz, -min(moderator_internal.get_moles(/datum/gas/bz), scaled_production * 0.95)) + if(moderator_list[GAS_PLASMA] > 100) + internal_output.adjust_moles(GAS_NITROUS, scaled_production * 0.5) + moderator_internal.adjust_moles(GAS_PLASMA, -min(moderator_internal.get_moles(GAS_PLASMA), scaled_production * 0.85)) + if(moderator_list[GAS_BZ] > 150) + internal_output.adjust_moles(GAS_HALON, scaled_production * 0.55) + moderator_internal.adjust_moles(GAS_BZ, -min(moderator_internal.get_moles(GAS_BZ), scaled_production * 0.95)) if(2) - if(moderator_list[/datum/gas/plasma] > 50) - internal_output.adjust_moles(/datum/gas/bz, scaled_production * 1.8) - moderator_internal.adjust_moles(/datum/gas/plasma, -min(moderator_internal.get_moles(/datum/gas/plasma), scaled_production * 1.75)) - if(moderator_list[/datum/gas/pluonium] > 20) + if(moderator_list[GAS_PLASMA] > 50) + internal_output.adjust_moles(GAS_BZ, scaled_production * 1.8) + moderator_internal.adjust_moles(GAS_PLASMA, -min(moderator_internal.get_moles(GAS_PLASMA), scaled_production * 1.75)) + if(moderator_list[GAS_PLUONIUM] > 20) radiation *= 1.55 heat_output *= 1.025 - moderator_internal.adjust_moles(/datum/gas/pluonium, -min(moderator_internal.get_moles(/datum/gas/pluonium), scaled_production * 1.35)) + moderator_internal.adjust_moles(GAS_PLUONIUM, -min(moderator_internal.get_moles(GAS_PLUONIUM), scaled_production * 1.35)) if(3, 4) - if(moderator_list[/datum/gas/plasma] > 10) - internal_output.adjust_moles(/datum/gas/freon, scaled_production * 0.15) - moderator_internal.adjust_moles(/datum/gas/plasma, -min(moderator_internal.get_moles(/datum/gas/plasma), scaled_production * 0.45)) - if(moderator_list[/datum/gas/freon] > 50) + if(moderator_list[GAS_PLASMA] > 10) + internal_output.adjust_moles(GAS_FREON, scaled_production * 0.15) + moderator_internal.adjust_moles(GAS_PLASMA, -min(moderator_internal.get_moles(GAS_PLASMA), scaled_production * 0.45)) + if(moderator_list[GAS_FREON] > 50) heat_output *= 0.9 radiation *= 0.8 - if(moderator_list[/datum/gas/pluonium]> 15) - internal_output.adjust_moles(/datum/gas/halon, scaled_production * 1.15) - moderator_internal.adjust_moles(/datum/gas/pluonium, -min(moderator_internal.get_moles(/datum/gas/pluonium), scaled_production * 1.55)) + if(moderator_list[GAS_PLUONIUM]> 15) + internal_output.adjust_moles(GAS_HALON, scaled_production * 1.15) + moderator_internal.adjust_moles(GAS_PLUONIUM, -min(moderator_internal.get_moles(GAS_PLUONIUM), scaled_production * 1.55)) radiation *= 1.95 heat_output *= 1.25 - if(moderator_list[/datum/gas/bz] > 100) - internal_output.adjust_moles(/datum/gas/pluonium, scaled_production * 1.5) - internal_output.adjust_moles(/datum/gas/healium, scaled_production * 1.5) + if(moderator_list[GAS_BZ] > 100) + internal_output.adjust_moles(GAS_PLUONIUM, scaled_production * 1.5) + internal_output.adjust_moles(GAS_HEALIUM, scaled_production * 1.5) induce_hallucination(50 * power_level, delta_time) if(5) - if(moderator_list[/datum/gas/plasma] > 15) - internal_output.adjust_moles(/datum/gas/freon, scaled_production * 0.25) - moderator_internal.adjust_moles(/datum/gas/plasma, -min(moderator_internal.get_moles(/datum/gas/plasma), scaled_production * 1.45)) - if(moderator_list[/datum/gas/freon] > 500) + if(moderator_list[GAS_PLASMA] > 15) + internal_output.adjust_moles(GAS_FREON, scaled_production * 0.25) + moderator_internal.adjust_moles(GAS_PLASMA, -min(moderator_internal.get_moles(GAS_PLASMA), scaled_production * 1.45)) + if(moderator_list[GAS_FREON] > 500) heat_output *= 0.5 radiation *= 0.2 - if(moderator_list[/datum/gas/pluonium] > 50) - internal_output.adjust_moles(/datum/gas/pluoxium, scaled_production) - moderator_internal.adjust_moles(/datum/gas/pluonium, -min(moderator_internal.get_moles(/datum/gas/pluonium), scaled_production * 1.35)) + if(moderator_list[GAS_PLUONIUM] > 50) + internal_output.adjust_moles(GAS_PLUOXIUM, scaled_production) + moderator_internal.adjust_moles(GAS_PLUONIUM, -min(moderator_internal.get_moles(GAS_PLUONIUM), scaled_production * 1.35)) radiation *= 1.95 heat_output *= 1.25 - if(moderator_list[/datum/gas/bz] > 100) - internal_output.adjust_moles(/datum/gas/healium, scaled_production) + if(moderator_list[GAS_BZ] > 100) + internal_output.adjust_moles(GAS_HEALIUM, scaled_production) induce_hallucination(500, delta_time) - internal_output.adjust_moles(/datum/gas/freon, scaled_production * 1.15) - if(moderator_list[/datum/gas/healium] > 100) + internal_output.adjust_moles(GAS_FREON, scaled_production * 1.15) + if(moderator_list[GAS_HEALIUM] > 100) if(critical_threshold_proximity > 400) - critical_threshold_proximity = max(critical_threshold_proximity - (moderator_list[/datum/gas/healium] / 100 * delta_time ), 0) - moderator_internal.adjust_moles(/datum/gas/healium, -min(moderator_internal.get_moles(/datum/gas/healium), scaled_production * 20)) - if(moderator_internal.return_temperature() < 1e7 || (moderator_list[/datum/gas/plasma] > 100 && moderator_list[/datum/gas/bz] > 50)) - internal_output.adjust_moles(/datum/gas/antinoblium, dirty_production_rate * 0.9 / 0.065 * delta_time) + critical_threshold_proximity = max(critical_threshold_proximity - (moderator_list[GAS_HEALIUM] / 100 * delta_time ), 0) + moderator_internal.adjust_moles(GAS_HEALIUM, -min(moderator_internal.get_moles(GAS_HEALIUM), scaled_production * 20)) + if(moderator_internal.return_temperature() < 1e7 || (moderator_list[GAS_PLASMA] > 100 && moderator_list[GAS_BZ] > 50)) + internal_output.adjust_moles(GAS_ANTINOB, dirty_production_rate * 0.9 / 0.065 * delta_time) if(6) - if(moderator_list[/datum/gas/plasma] > 30) - internal_output.adjust_moles(/datum/gas/bz, scaled_production * 1.15) - moderator_internal.adjust_moles(/datum/gas/plasma, -min(moderator_internal.get_moles(/datum/gas/plasma), scaled_production * 1.45)) - if(moderator_list[/datum/gas/pluonium]) - internal_output.adjust_moles(/datum/gas/zauker, scaled_production * 5.35) - internal_output.adjust_moles(/datum/gas/nitrium, scaled_production * 2.15) - moderator_internal.adjust_moles(/datum/gas/pluonium, -min(moderator_internal.get_moles(/datum/gas/pluonium), scaled_production * 3.35)) + if(moderator_list[GAS_PLASMA] > 30) + internal_output.adjust_moles(GAS_BZ, scaled_production * 1.15) + moderator_internal.adjust_moles(GAS_PLASMA, -min(moderator_internal.get_moles(GAS_PLASMA), scaled_production * 1.45)) + if(moderator_list[GAS_PLUONIUM]) + internal_output.adjust_moles(GAS_ZAUKER, scaled_production * 5.35) + internal_output.adjust_moles(GAS_NITRIUM, scaled_production * 2.15) + moderator_internal.adjust_moles(GAS_PLUONIUM, -min(moderator_internal.get_moles(GAS_PLUONIUM), scaled_production * 3.35)) radiation *= 2 heat_output *= 2.25 - if(moderator_list[/datum/gas/bz]) + if(moderator_list[GAS_BZ]) induce_hallucination(900, delta_time, force=TRUE) - internal_output.adjust_moles(/datum/gas/antinoblium, clamp(dirty_production_rate / 0.045, 0, 10) * delta_time) - if(moderator_list[/datum/gas/healium] > 100) + internal_output.adjust_moles(GAS_ANTINOB, clamp(dirty_production_rate / 0.045, 0, 10) * delta_time) + if(moderator_list[GAS_HEALIUM] > 100) if(critical_threshold_proximity > 400) - critical_threshold_proximity = max(critical_threshold_proximity - (moderator_list[/datum/gas/healium] / 100 * delta_time ), 0) - moderator_internal.adjust_moles(/datum/gas/healium, -min(moderator_internal.get_moles(/datum/gas/healium), scaled_production * 20)) - internal_fusion.adjust_moles(/datum/gas/antinoblium, dirty_production_rate * 0.01 / 0.095 * delta_time) + critical_threshold_proximity = max(critical_threshold_proximity - (moderator_list[GAS_HEALIUM] / 100 * delta_time ), 0) + moderator_internal.adjust_moles(GAS_HEALIUM, -min(moderator_internal.get_moles(GAS_HEALIUM), scaled_production * 20)) + internal_fusion.adjust_moles(GAS_ANTINOB, dirty_production_rate * 0.01 / 0.095 * delta_time) //Modifies the internal_fusion temperature with the amount of heat output var/temperature_modifier = selected_fuel.temperature_change_multiplier @@ -364,12 +364,12 @@ check_lightning_arcs(moderator_list) // Oxygen burns away iron content rapidly - if(moderator_list[/datum/gas/oxygen] > 150) + if(moderator_list[GAS_O2] > 150) if(iron_content > 0) var/max_iron_removable = IRON_OXYGEN_HEAL_PER_SECOND var/iron_removed = min(max_iron_removable * delta_time, iron_content) iron_content -= iron_removed - moderator_internal.adjust_moles(/datum/gas/oxygen, -(iron_removed * OXYGEN_MOLES_CONSUMED_PER_IRON_HEAL)) + moderator_internal.adjust_moles(GAS_O2, -(iron_removed * OXYGEN_MOLES_CONSUMED_PER_IRON_HEAL)) check_gravity_pulse(delta_time) @@ -435,7 +435,7 @@ if(power_level < 4) return - if(moderator_list[/datum/gas/bz] < (150 / power_level)) + if(moderator_list[GAS_BZ] < (150 / power_level)) return var/obj/machinery/hypertorus/corner/picked_corner = pick(corners) @@ -444,7 +444,7 @@ /obj/machinery/atmospherics/components/unary/hypertorus/core/proc/check_lightning_arcs(moderator_list) if(power_level < 4) return - if(moderator_list[/datum/gas/antinoblium] <= 50 && critical_threshold_proximity <= 500) + if(moderator_list[GAS_ANTINOB] <= 50 && critical_threshold_proximity <= 500) return var/zap_number = power_level - 2 diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm index d62493a59090..6b9a974ce788 100644 --- a/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm +++ b/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm @@ -58,18 +58,18 @@ /obj/machinery/atmospherics/components/unary/hypertorus/default_change_direction_wrench(mob/user, obj/item/I) . = ..() if(.) - SetInitDirections() + set_init_directions() var/obj/machinery/atmospherics/node = nodes[1] if(node) node.disconnect(src) nodes[1] = null if(parents[1]) - nullifyPipenet(parents[1]) - atmosinit() + nullify_pipenet(parents[1]) + atmos_init() node = nodes[1] if(node) - node.atmosinit() - node.addMember(src) + node.atmos_init() + node.add_member(src) SSair.add_to_rebuild_queue(src) /obj/machinery/atmospherics/components/unary/hypertorus/update_icon_state() @@ -202,15 +202,6 @@ else to_chat(user, span_notice("Activate the machine first by using a multitool on the interface.")) -/obj/machinery/hypertorus/interface/proc/gas_list_to_gasid_list(list/gas_list) - var/list/gasid_list = list() - for(var/gas_type in gas_list) - var/datum/gas/gas = gas_type - gasid_list += initial(gas.id) - return gasid_list - - - /obj/machinery/hypertorus/interface/ui_static_data() var/data = list() data["base_max_temperature"] = FUSION_MAXIMUM_TEMPERATURE @@ -221,9 +212,9 @@ data["selectable_fuel"] += list(list( "name" = recipe.name, "id" = recipe.id, - "requirements" = gas_list_to_gasid_list(recipe.requirements), - "fusion_byproducts" = gas_list_to_gasid_list(recipe.primary_products), - "product_gases" = gas_list_to_gasid_list(recipe.secondary_products), + "requirements" = recipe.requirements, + "fusion_byproducts" = recipe.primary_products, + "product_gases" = recipe.secondary_products, "recipe_cooling_multiplier" = recipe.negative_temperature_multiplier, "recipe_heating_multiplier" = recipe.positive_temperature_multiplier, "energy_loss_multiplier" = recipe.energy_concentration_multiplier, @@ -231,6 +222,13 @@ "gas_production_multiplier" = recipe.gas_production_multiplier, "temperature_multiplier" = recipe.temperature_change_multiplier, )) + + data["gas_colors"] = list() + for(var/gas_id in GLOB.gas_data.ids) + data["gas_colors"] += list(list( + "id" = gas_id, + "ui_color" = GLOB.gas_data.ui_colors[gas_id], + )) return data /obj/machinery/hypertorus/interface/ui_data() @@ -244,35 +242,35 @@ //Internal Fusion gases var/list/fusion_gasdata = list() if(connected_core.internal_fusion.total_moles()) - for(var/gas_type in connected_core.internal_fusion.get_gases()) - var/datum/gas/gas = gas_type + for(var/gas_id in connected_core.internal_fusion.get_gases()) fusion_gasdata.Add(list(list( - "id"= initial(gas.id), - "amount" = round(connected_core.internal_fusion.get_moles(gas), 0.01), + "id"= initial(gas_id), + "amount" = round(connected_core.internal_fusion.get_moles(gas_id), 0.01), + "color" = GLOB.gas_data.ui_colors[gas_id], ))) else - for(var/gas_type in connected_core.internal_fusion.get_gases()) - var/datum/gas/gas = gas_type + for(var/gas_id in connected_core.internal_fusion.get_gases()) fusion_gasdata.Add(list(list( - "id"= initial(gas.id), + "id"= initial(gas_id), "amount" = 0, - ))) + "color" = GLOB.gas_data.ui_colors[gas_id], + ))) //Moderator gases var/list/moderator_gasdata = list() if(connected_core.moderator_internal.total_moles()) - for(var/gas_type in connected_core.moderator_internal.get_gases()) - var/datum/gas/gas = gas_type + for(var/gas_id in connected_core.moderator_internal.get_gases()) moderator_gasdata.Add(list(list( - "id"= initial(gas.id), - "amount" = round(connected_core.moderator_internal.get_moles(gas), 0.01), + "id"= initial(gas_id), + "amount" = round(connected_core.moderator_internal.get_moles(gas_id), 0.01), + "color" = GLOB.gas_data.ui_colors[gas_id] ))) else - for(var/gas_type in connected_core.moderator_internal.get_gases()) - var/datum/gas/gas = gas_type + for(var/gas_id in connected_core.moderator_internal.get_gases()) moderator_gasdata.Add(list(list( - "id"= initial(gas.id), + "id"= initial(gas_id), "amount" = 0, - ))) + "color" = GLOB.gas_data.ui_colors[gas_id], + ))) data["fusion_gases"] = fusion_gasdata data["moderator_gases"] = moderator_gasdata @@ -314,9 +312,8 @@ data["waste_remove"] = connected_core.waste_remove data["fuel_remove"] = connected_core.fuel_remove data["filter_types"] = list() - for(var/path in GLOB.meta_gas_info) - var/list/gas = GLOB.meta_gas_info[path] - data["filter_types"] += list(list("gas_id" = gas[META_GAS_ID], "gas_name" = gas[META_GAS_NAME], "enabled" = (path in connected_core.moderator_scrubbing))) + for(var/id in GLOB.gas_data.ids) + data["filter_types"] += list(list("gas_id" = id, "gas_name" = GLOB.gas_data.names[id], "enabled" = (id in connected_core.moderator_scrubbing))) data["cooling_volume"] = connected_core.airs[1].return_volume() data["mod_filtering_rate"] = connected_core.moderator_filtering_rate @@ -374,7 +371,9 @@ connected_core.fuel_remove = !connected_core.fuel_remove . = TRUE if("filter") - connected_core.moderator_scrubbing ^= gas_id2path(params["mode"]) + var/gas = params["mode"] + if(gas in GLOB.gas_data.names) + connected_core.moderator_scrubbing ^= gas . = TRUE if("mod_filtering_rate") var/mod_filtering_rate = text2num(params["mod_filtering_rate"]) diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_procs.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_procs.dm index 70469590ed12..e1603bc97663 100644 --- a/code/modules/atmospherics/machinery/components/fusion/hfr_procs.dm +++ b/code/modules/atmospherics/machinery/components/fusion/hfr_procs.dm @@ -173,13 +173,13 @@ /obj/machinery/atmospherics/components/unary/hypertorus/core/proc/update_temperature_status(delta_time) fusion_temperature_archived = fusion_temperature - fusion_temperature = internal_fusion.return_temperature() + fusion_temperature = internal_fusion.total_moles() == 0 ? 0 : internal_fusion.return_temperature() moderator_temperature_archived = moderator_temperature - moderator_temperature = moderator_internal.return_temperature() + moderator_temperature = moderator_internal.total_moles() == 0 ? 0 : moderator_internal.return_temperature() coolant_temperature_archived = coolant_temperature - coolant_temperature = airs[1].return_temperature() + coolant_temperature = airs[1].total_moles() == 0 ? 0 : airs[1].return_temperature() output_temperature_archived = output_temperature - output_temperature = linked_output.airs[1].return_temperature() + output_temperature = linked_output.airs[1].total_moles() == 0 ? 0 : linked_output.airs[1].return_temperature() temperature_period = delta_time //Set the power level of the fusion process diff --git a/code/modules/atmospherics/machinery/components/gas_recipe_machines/atmos_machines_recipes.dm b/code/modules/atmospherics/machinery/components/gas_recipe_machines/atmos_machines_recipes.dm index ef482c77ca06..46b8e98b9566 100644 --- a/code/modules/atmospherics/machinery/components/gas_recipe_machines/atmos_machines_recipes.dm +++ b/code/modules/atmospherics/machinery/components/gas_recipe_machines/atmos_machines_recipes.dm @@ -42,7 +42,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) min_temp = 50000 max_temp = 150000 energy_release = -2500000 - requirements = list(/datum/gas/hydrogen = 300, /datum/gas/bz = 50) + requirements = list(GAS_H2 = 300, GAS_BZ = 50) products = list(/obj/item/stack/sheet/mineral/metal_hydrogen = 1) /datum/gas_recipe/crystallizer/supermatter_extraction_tongs @@ -51,7 +51,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) min_temp = 50000 max_temp = 150000 energy_release = -150000 - requirements = list(/datum/gas/hydrogen = 100, /datum/gas/hypernoblium = 5, /datum/gas/bz = 5) + requirements = list(GAS_H2 = 100, GAS_HYPERNOB = 5, GAS_BZ = 5) products = list(/obj/item/hemostat/supermatter = 1) /datum/gas_recipe/crystallizer/supermatter_base_structure @@ -60,7 +60,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) min_temp = 50000 max_temp = 150000 energy_release = -200000 - requirements = list(/datum/gas/hydrogen = 1000, /datum/gas/bz = 100, /datum/gas/hypernoblium = 10) + requirements = list(GAS_H2 = 1000, GAS_BZ = 100, GAS_HYPERNOB = 10) products = list(/obj/structure/supermatter_base_structure = 1) /datum/gas_recipe/crystallizer/healium_grenade @@ -69,7 +69,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) min_temp = 200 max_temp = 400 energy_release = -2000000 - requirements = list(/datum/gas/healium = 100, /datum/gas/freon = 120, /datum/gas/plasma = 50) + requirements = list(GAS_HEALIUM = 100, GAS_FREON = 120, GAS_PLASMA = 50) products = list(/obj/item/grenade/gas_crystal/healium_crystal = 1) /datum/gas_recipe/crystallizer/pluonium_grenade @@ -78,7 +78,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) min_temp = 200 max_temp = 400 energy_release = 1500000 - requirements = list(/datum/gas/pluonium = 100, /datum/gas/nitrogen = 80, /datum/gas/oxygen = 80) + requirements = list(GAS_PLUONIUM = 100, GAS_N2 = 80, GAS_O2 = 80) products = list(/obj/item/grenade/gas_crystal/pluonium_crystal = 1) /datum/gas_recipe/crystallizer/hot_ice @@ -87,7 +87,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) min_temp = 15 max_temp = 35 energy_release = -3000000 - requirements = list(/datum/gas/freon = 60, /datum/gas/plasma = 160, /datum/gas/oxygen = 80) + requirements = list(GAS_FREON = 60, GAS_PLASMA = 160, GAS_O2 = 80) products = list(/obj/item/stack/sheet/hot_ice = 1) /datum/gas_recipe/crystallizer/ammonia_crystal @@ -96,7 +96,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) min_temp = 200 max_temp = 240 energy_release = 950000 - requirements = list(/datum/gas/hydrogen = 50, /datum/gas/nitrogen = 40) + requirements = list(GAS_H2 = 50, GAS_N2 = 40) products = list(/obj/item/stack/ammonia_crystals = 2) /datum/gas_recipe/crystallizer/tesla @@ -106,7 +106,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) max_temp = 12000 energy_release = -350000 dangerous = TRUE - requirements = list(/datum/gas/nitrium = 500, /datum/gas/freon = 500, /datum/gas/tritium = 500) + requirements = list(GAS_TRITIUM = 500, GAS_FREON = 500, GAS_NITRIUM = 500) products = list(/obj/machinery/the_singularitygen/tesla = 1) /datum/gas_recipe/crystallizer/supermatter_silver @@ -116,7 +116,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) max_temp = 200000 energy_release = -250000 dangerous = TRUE - requirements = list(/datum/gas/bz = 100, /datum/gas/hypernoblium = 125, /datum/gas/tritium = 250, /datum/gas/plasma = 750) + requirements = list(GAS_BZ = 100, GAS_HYPERNOB = 125, GAS_TRITIUM = 250, GAS_PLASMA = 750) products = list(/obj/item/nuke_core/supermatter_sliver = 1) /datum/gas_recipe/crystallizer/n2o_crystal @@ -125,7 +125,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) min_temp = 50 max_temp = 350 energy_release = 3500000 - requirements = list(/datum/gas/nitrous_oxide = 100, /datum/gas/bz = 5) + requirements = list(GAS_NITROUS = 100, GAS_BZ = 5) products = list(/obj/item/grenade/gas_crystal/nitrous_oxide_crystal = 1) /datum/gas_recipe/crystallizer/diamond @@ -134,7 +134,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) min_temp = 10000 max_temp = 30000 energy_release = -9500000 - requirements = list(/datum/gas/carbon_dioxide = 10000) + requirements = list(GAS_CO2 = 10000) products = list(/obj/item/stack/sheet/mineral/diamond = 1) /datum/gas_recipe/crystallizer/uranium @@ -143,7 +143,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) min_temp = 1000 max_temp = 5000 energy_release = -2500000 - requirements = list(/datum/gas/tritium = 200, /datum/gas/hypernoblium = 50) + requirements = list(GAS_TRITIUM = 200, GAS_HYPERNOB = 50) products = list(/obj/item/stack/sheet/mineral/uranium = 1) /datum/gas_recipe/crystallizer/plasma_sheet @@ -152,7 +152,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) min_temp = 10 max_temp = 20 energy_release = 3500000 - requirements = list(/datum/gas/plasma = 450) + requirements = list(GAS_PLASMA = 450) products = list(/obj/item/stack/sheet/mineral/plasma = 1) /datum/gas_recipe/crystallizer/crystal_cell @@ -161,7 +161,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) min_temp = 50 max_temp = 90 energy_release = -800000 - requirements = list(/datum/gas/plasma = 800, /datum/gas/healium = 100, /datum/gas/bz = 50) + requirements = list(GAS_PLASMA = 800, GAS_HEALIUM = 100, GAS_BZ = 50) products = list(/obj/item/stock_parts/cell/crystal_cell = 1) /datum/gas_recipe/crystallizer/zaukerite @@ -170,7 +170,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) min_temp = 5 max_temp = 20 energy_release = 2900000 - requirements = list(/datum/gas/hypernoblium = 5, /datum/gas/zauker = 10, /datum/gas/bz = 7.5) + requirements = list(GAS_HYPERNOB = 5, GAS_ZAUKER = 10, GAS_BZ = 7.5) products = list(/obj/item/stack/sheet/mineral/zaukerite = 2) /datum/gas_recipe/crystallizer/hypernoblium_crystal @@ -179,7 +179,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) min_temp = 100000 max_temp = 200000 energy_release = 2800000 - requirements = list(/datum/gas/bz = 100, /datum/gas/hypernoblium = 100, /datum/gas/oxygen = 1000) + requirements = list(GAS_BZ = 100, GAS_HYPERNOB = 100, GAS_O2 = 1000) products = list(/obj/item/stack/hypernoblium_crystal = 1) /datum/gas_recipe/crystallizer/antinoblium_crystal @@ -188,7 +188,7 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) min_temp = TCMB max_temp = TCMB + 20 energy_release = 2800000 - requirements = list(/datum/gas/antinoblium = 100, /datum/gas/bz = 30, /datum/gas/plasma = 100) + requirements = list(GAS_ANTINOB = 100, GAS_BZ = 30, GAS_PLASMA = 100) products = list(/obj/item/stack/antinoblium_crystal = 1) /datum/gas_recipe/crystallizer/crystallized_nitrium @@ -197,5 +197,5 @@ GLOBAL_LIST_INIT(gas_recipe_meta, gas_recipes_list()) min_temp = 10 max_temp = 25 energy_release = 45000 - requirements = list(/datum/gas/nitrium = 150, /datum/gas/oxygen = 70, /datum/gas/bz = 50) + requirements = list(GAS_NITRIUM = 150, GAS_O2 = 70, GAS_BZ = 50) products = list(/obj/item/nitrium_crystal = 1) diff --git a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm b/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm index 6c50495de769..f60149ae6115 100644 --- a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm +++ b/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm @@ -50,7 +50,7 @@ . = ..() if(!.) return FALSE - SetInitDirections() + set_init_directions() var/obj/machinery/atmospherics/node1 = nodes[1] var/obj/machinery/atmospherics/node2 = nodes[2] if(node1) @@ -63,27 +63,27 @@ nodes[2] = null if(parents[1]) - nullifyPipenet(parents[1]) + nullify_pipenet(parents[1]) if(parents[2]) - nullifyPipenet(parents[2]) + nullify_pipenet(parents[2]) - atmosinit() + atmos_init() node1 = nodes[1] if(node1) - node1.atmosinit() - node1.addMember(src) + node1.atmos_init() + node1.add_member(src) node2 = nodes[2] if(node2) - node2.atmosinit() - node2.addMember(src) + node2.atmos_init() + node2.add_member(src) SSair.add_to_rebuild_queue(src) return TRUE /obj/machinery/atmospherics/components/binary/crystallizer/update_overlays() . = ..() cut_overlays() - . += getpipeimage(icon, "pipe", dir, COLOR_LIME, piping_layer) - . += getpipeimage(icon, "pipe", turn(dir, 180), COLOR_RED, piping_layer) + . += get_pipe_image(icon, "pipe", dir, COLOR_LIME, piping_layer) + . += get_pipe_image(icon, "pipe", turn(dir, 180), COLOR_RED, piping_layer) /obj/machinery/atmospherics/components/binary/crystallizer/update_icon_state() . = ..() @@ -275,14 +275,16 @@ if(internal.total_moles()) for(var/gasid in internal.get_gases()) internal_gas_data.Add(list(list( - "name"= GLOB.meta_gas_info[gasid][META_GAS_NAME], + "name"= GLOB.gas_data.names[gasid], "amount" = round(internal.get_moles(gasid), 0.01), + "color" = GLOB.gas_data.ui_colors[gasid], ))) else for(var/gasid in internal.get_gases()) internal_gas_data.Add(list(list( - "name"= GLOB.meta_gas_info[gasid][META_GAS_NAME], + "name"= GLOB.gas_data.names[gasid], "amount" = 0, + "color" = GLOB.gas_data.ui_colors[gasid], ))) data["internal_gas_data"] = internal_gas_data @@ -292,9 +294,8 @@ else requirements = list("To create [selected_recipe.name] you will need:") for(var/gas_type in selected_recipe.requirements) - var/datum/gas/gas_required = gas_type var/amount_consumed = selected_recipe.requirements[gas_type] - requirements += "-[amount_consumed] moles of [initial(gas_required.name)]" + requirements += "-[amount_consumed] moles of [initial(gas_type)]" requirements += "In a temperature range between [selected_recipe.min_temp] K and [selected_recipe.max_temp] K" requirements += "The crystallization reaction will be [selected_recipe.energy_release ? (selected_recipe.energy_release > 0 ? "exothermic" : "endothermic") : "thermally neutral"]" data["requirements"] = requirements.Join("\n") diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm index 077d38c368b5..3f3e7eb2d2f4 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm @@ -49,13 +49,13 @@ for(var/direction in GLOB.cardinals) if(!(direction & initialize_directions)) continue - var/obj/machinery/atmospherics/node = findConnecting(direction) + var/obj/machinery/atmospherics/node = find_connecting(direction) var/image/cap if(node) - cap = getpipeimage(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer, trinary = TRUE) + cap = get_pipe_image(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer, trinary = TRUE) else - cap = getpipeimage(icon, "cap", direction, piping_layer = piping_layer, trinary = TRUE) + cap = get_pipe_image(icon, "cap", direction, piping_layer = piping_layer, trinary = TRUE) . += cap @@ -64,7 +64,6 @@ icon_state = "filter_[on_state ? "on" : "off"]-[set_overlay_offset(piping_layer)][flipped ? "_f" : ""]" /obj/machinery/atmospherics/components/trinary/filter/process_atmos() - ..() if(!on || !(nodes[1] && nodes[2] && nodes[3]) || !is_operational()) return @@ -128,7 +127,7 @@ update_parents() -/obj/machinery/atmospherics/components/trinary/filter/atmosinit() +/obj/machinery/atmospherics/components/trinary/filter/atmos_init() set_frequency(frequency) return ..() @@ -145,9 +144,8 @@ data["max_rate"] = round(MAX_TRANSFER_RATE) data["filter_types"] = list() - for(var/path in GLOB.meta_gas_info) - var/list/gas = GLOB.meta_gas_info[path] - data["filter_types"] += list(list("name" = gas[META_GAS_NAME], "gas_id" = gas[META_GAS_ID], "enabled" = (path in filter_type))) + for(var/id in GLOB.gas_data.ids) + data["filter_types"] += list(list("name" = GLOB.gas_data.names[id], "gas_id" = id, "enabled" = (id in filter_type))) return data @@ -179,16 +177,15 @@ investigate_log(msg, INVESTIGATE_ATMOS) investigate_log(msg, INVESTIGATE_SUPERMATTER) // yogs - make supermatter invest useful if("toggle_filter") - if(!gas_id2path(params["val"])) - return TRUE - filter_type ^= gas_id2path(params["val"]) + var/gas = params["val"] + if(gas in GLOB.gas_data.names) + filter_type ^= gas var/change - if(gas_id2path(params["val"]) in filter_type) + if(gas in filter_type) change = "added" else change = "removed" - var/gas_name = GLOB.meta_gas_info[gas_id2path(params["val"])][META_GAS_NAME] - var/msg = "[key_name(usr)] [change] [gas_name] from the filter type." + var/msg = "[key_name(usr)] [change] [gas] from the filter type." investigate_log(msg, INVESTIGATE_ATMOS) investigate_log(msg, INVESTIGATE_SUPERMATTER) // yogs - make supermatter invest useful . = TRUE @@ -247,38 +244,38 @@ icon_state = "filter_on-0" /obj/machinery/atmospherics/components/trinary/filter/atmos/n2 name = "Nitrogen filter (N2)" - filter_type = list(/datum/gas/nitrogen) + filter_type = list(GAS_N2) /obj/machinery/atmospherics/components/trinary/filter/atmos/o2 name = "Oxygen filter (O2)" - filter_type = list(/datum/gas/oxygen) + filter_type = list(GAS_O2) /obj/machinery/atmospherics/components/trinary/filter/atmos/co2 name = "Carbon dioxide filter (CO2)" - filter_type = list(/datum/gas/carbon_dioxide) + filter_type = list(GAS_CO2) /obj/machinery/atmospherics/components/trinary/filter/atmos/n2o name = "Nitrous oxide filter (N2O)" - filter_type = list(/datum/gas/nitrous_oxide) + filter_type = list(GAS_NITROUS) /obj/machinery/atmospherics/components/trinary/filter/atmos/plasma name = "Plasma filter" - filter_type = list(/datum/gas/plasma) + filter_type = list(GAS_PLASMA) /obj/machinery/atmospherics/components/trinary/filter/atmos/flipped //This feels wrong, I know icon_state = "filter_on-0_f" flipped = TRUE /obj/machinery/atmospherics/components/trinary/filter/atmos/flipped/n2 name = "Nitrogen filter (N2)" - filter_type = list(/datum/gas/nitrogen) + filter_type = list(GAS_N2) /obj/machinery/atmospherics/components/trinary/filter/atmos/flipped/o2 name = "Oxygen filter (O2)" - filter_type = list(/datum/gas/oxygen) + filter_type = list(GAS_O2) /obj/machinery/atmospherics/components/trinary/filter/atmos/flipped/co2 name = "Carbon dioxide filter (CO2)" - filter_type = list(/datum/gas/carbon_dioxide) + filter_type = list(GAS_CO2) /obj/machinery/atmospherics/components/trinary/filter/atmos/flipped/n2o name = "Nitrous oxide filter (N2O)" - filter_type = list(/datum/gas/nitrous_oxide) + filter_type = list(GAS_NITROUS) /obj/machinery/atmospherics/components/trinary/filter/atmos/flipped/plasma name = "Plasma filter" - filter_type = list(/datum/gas/plasma) + filter_type = list(GAS_PLASMA) // These two filter types have critical_machine flagged to on and thus causes the area they are in to be exempt from the Grid Check event. diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm index 8863b9431f49..b04219514e37 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm @@ -36,13 +36,13 @@ for(var/direction in GLOB.cardinals) if(!(direction & initialize_directions)) continue - var/obj/machinery/atmospherics/node = findConnecting(direction) + var/obj/machinery/atmospherics/node = find_connecting(direction) var/image/cap if(node) - cap = getpipeimage(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer, trinary = TRUE) + cap = get_pipe_image(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer, trinary = TRUE) else - cap = getpipeimage(icon, "cap", direction, piping_layer = piping_layer, trinary = TRUE) + cap = get_pipe_image(icon, "cap", direction, piping_layer = piping_layer, trinary = TRUE) . += cap @@ -57,7 +57,6 @@ airs[3] = air3 /obj/machinery/atmospherics/components/trinary/mixer/process_atmos() - ..() if(!on || !(nodes[1] && nodes[2] && nodes[3]) && !is_operational()) return @@ -109,19 +108,17 @@ //Actually transfer the gas if(transfer_moles1) - var/datum/gas_mixture/removed1 = air1.remove(transfer_moles1) - air3.merge(removed1) + air1.transfer_to(air3, transfer_moles1) var/datum/pipeline/parent1 = parents[1] - parent1.update = TRUE + parent1.update = PIPENET_UPDATE_STATUS_RECONCILE_NEEDED if(transfer_moles2) - var/datum/gas_mixture/removed2 = air2.remove(transfer_moles2) - air3.merge(removed2) + air2.transfer_to(air3, transfer_moles2) var/datum/pipeline/parent2 = parents[2] - parent2.update = TRUE + parent2.update = PIPENET_UPDATE_STATUS_RECONCILE_NEEDED var/datum/pipeline/parent3 = parents[3] - parent3.update = TRUE + parent3.update = PIPENET_UPDATE_STATUS_RECONCILE_NEEDED /obj/machinery/atmospherics/components/trinary/mixer/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) @@ -255,7 +252,7 @@ on = TRUE icon_state = "t_mixer_on-0" -/obj/machinery/atmospherics/components/trinary/mixer/t_mixer/SetInitDirections() +/obj/machinery/atmospherics/components/trinary/mixer/t_mixer/set_init_directions() switch(dir) if(NORTH) initialize_directions = EAST|NORTH|WEST @@ -266,7 +263,7 @@ if(WEST) initialize_directions = WEST|NORTH|SOUTH -/obj/machinery/atmospherics/components/trinary/mixer/t_mixer/getNodeConnects() +/obj/machinery/atmospherics/components/trinary/mixer/t_mixer/get_node_connects() var/node1_connect = turn(dir, -90) var/node2_connect = turn(dir, 90) var/node3_connect = dir diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm b/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm index c587b1b1b630..d711d65ec4d4 100644 --- a/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm +++ b/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm @@ -9,7 +9,7 @@ var/flipped = FALSE -/obj/machinery/atmospherics/components/trinary/SetInitDirections() +/obj/machinery/atmospherics/components/trinary/set_init_directions() switch(dir) if(NORTH) initialize_directions = EAST|NORTH|SOUTH @@ -24,7 +24,7 @@ Housekeeping and pipe network stuff */ -/obj/machinery/atmospherics/components/trinary/getNodeConnects() +/obj/machinery/atmospherics/components/trinary/get_node_connects() //Mixer: //1 and 2 is input diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm index 5eb2f8366c76..7e9740b47a36 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm @@ -257,28 +257,29 @@ GLOBAL_VAR_INIT(cryo_overlay_cover_off, mutable_appearance('icons/obj/cryogenics if(reagent_transfer == 0) // Magically transfer reagents. Because cryo magic. beaker.reagents.trans_to(occupant, 1, efficiency * 0.25) // Transfer reagents. beaker.reagents.reaction(occupant, VAPOR) - if(air1.get_moles(/datum/gas/pluoxium) > 5 )//Use pluoxium over oxygen - air1.adjust_moles(/datum/gas/pluoxium, -max(0,air1.get_moles(/datum/gas/pluoxium) - 0.5 / efficiency)) - else - air1.adjust_moles(/datum/gas/oxygen, -max(0,air1.get_moles(/datum/gas/oxygen) - 2 / efficiency)) //Let's use gas for this + if(air1.get_moles(GAS_PLUOXIUM) > 5 )//Use pluoxium over oxygen + air1.adjust_moles(GAS_PLUOXIUM, -max(0,air1.get_moles(GAS_PLUOXIUM) - 0.5 / efficiency)) + else + air1.adjust_moles(GAS_O2, -max(0,air1.get_moles(GAS_O2) - 2 / efficiency)) //Let's use gas for this if(occupant.reagents.get_reagent_amount(/datum/reagent/medicine/cryoxadone) >= 100) //prevent cryoxadone overdose occupant.reagents.del_reagent(/datum/reagent/medicine/cryoxadone) occupant.reagents.add_reagent(/datum/reagent/medicine/cryoxadone, 99) reagent_transfer += 0.5 * delta_time if(reagent_transfer >= 10 * efficiency) // Throttle reagent transfer (higher efficiency will transfer the same amount but consume less from the beaker). reagent_transfer = 0 - + if(air1.get_moles(GAS_HEALIUM) > 1) //healium check, if theres enough we get some extra healing from our favorite pink gas. + var/existing = mob_occupant.reagents.get_reagent_amount(/datum/reagent/healium) + mob_occupant.reagents.add_reagent(/datum/reagent/healium, 1 - existing) + air1.set_moles(GAS_HEALIUM, -max(0, air1.get_moles(GAS_HEALIUM) - 0.1 / efficiency)) return 1 -/obj/machinery/atmospherics/components/unary/cryo_cell/process_atmos(delta_time) - ..() - +/obj/machinery/atmospherics/components/unary/cryo_cell/process_atmos() if(!on) return var/datum/gas_mixture/air1 = airs[1] - if(!nodes[1] || !airs[1] || (air1.get_moles(/datum/gas/oxygen) < 5 && air1.get_moles(/datum/gas/pluoxium) < 5)) // Turn off if the machine won't work. + if(!nodes[1] || !airs[1] || (air1.get_moles(GAS_O2) < 5 && air1.get_moles(GAS_PLUOXIUM) < 5)) // Turn off if the machine won't work. set_on(FALSE) return @@ -299,10 +300,10 @@ GLOBAL_VAR_INIT(cryo_overlay_cover_off, mutable_appearance('icons/obj/cryogenics air1.set_temperature(max(air1.return_temperature() - heat / air_heat_capacity, TCMB)) mob_occupant.adjust_bodytemperature(heat / heat_capacity, TCMB) - if(air1.get_moles(/datum/gas/pluoxium) > 5) //use pluoxium over oxygen - air1.set_moles(/datum/gas/pluoxium, max(0,air1.get_moles(/datum/gas/pluoxium) - 0.125 / efficiency)) - else - air1.set_moles(/datum/gas/oxygen, max(0,air1.get_moles(/datum/gas/oxygen) - 0.5 / efficiency)) // Magically consume gas? Why not, we run on cryo magic. + if(air1.get_moles(GAS_PLUOXIUM) > 5) //use pluoxium over oxygen + air1.set_moles(GAS_PLUOXIUM, max(0,air1.get_moles(GAS_PLUOXIUM) - 0.125 / efficiency)) + else + air1.set_moles(GAS_O2, max(0,air1.get_moles(GAS_O2) - 0.5 / efficiency)) // Magically consume gas? Why not, we run on cryo magic. if(air1.return_temperature() > 2000) take_damage(clamp((air1.return_temperature())/200, 10, 20), BURN) @@ -512,17 +513,18 @@ GLOBAL_VAR_INIT(cryo_overlay_cover_off, mutable_appearance('icons/obj/cryogenics /obj/machinery/atmospherics/components/unary/cryo_cell/default_change_direction_wrench(mob/user, obj/item/wrench/W) . = ..() if(.) - SetInitDirections() + set_init_directions() var/obj/machinery/atmospherics/node = nodes[1] if(node) node.disconnect(src) nodes[1] = null - nullifyPipenet(parents[1]) - atmosinit() + if(parents[1]) + nullify_pipenet(parents[1]) + atmos_init() node = nodes[1] if(node) - node.atmosinit() - node.addMember(src) + node.atmos_init() + node.add_member(src) SSair.add_to_rebuild_queue(src) #undef MAX_TEMPERATURE diff --git a/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm b/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm index 1ca74980ddd4..becd13ed0927 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm @@ -33,7 +33,7 @@ icon_state = "he0" PIPING_LAYER_SHIFT(src, piping_layer) -/obj/machinery/atmospherics/components/unary/heat_exchanger/atmosinit() +/obj/machinery/atmospherics/components/unary/heat_exchanger/atmos_init() var/obj/machinery/atmospherics/components/unary/heat_exchanger/partner = partner_ref?.resolve() if(!partner) partner_ref = null diff --git a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm index 368e9274af67..40d7ebc0af8c 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm @@ -47,7 +47,7 @@ cut_overlays() if(showpipe) // everything is already shifted so don't shift the cap - add_overlay(getpipeimage(icon, "inje_cap", initialize_directions)) + add_overlay(get_pipe_image(icon, "inje_cap", initialize_directions)) if(!nodes[1] || !on || !is_operational()) icon_state = "inje_off" @@ -55,7 +55,6 @@ icon_state = "inje_on" /obj/machinery/atmospherics/components/unary/outlet_injector/process_atmos() - ..() injecting = 0 @@ -65,13 +64,7 @@ var/datum/gas_mixture/air_contents = airs[1] if(air_contents.return_temperature() > 0) - var/transfer_moles = (air_contents.return_pressure()) * volume_rate / (air_contents.return_temperature() * R_IDEAL_GAS_EQUATION) - - var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) - - loc.assume_air(removed) - air_update_turf() - + loc.assume_air_ratio(air_contents, volume_rate / air_contents.return_volume()) update_parents() /obj/machinery/atmospherics/components/unary/outlet_injector/proc/inject() @@ -84,9 +77,7 @@ injecting = 1 if(air_contents.return_temperature() > 0) - var/transfer_moles = (air_contents.return_pressure())*volume_rate/(air_contents.return_temperature() * R_IDEAL_GAS_EQUATION) - var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) - loc.assume_air(removed) + loc.assume_air_ratio(air_contents, volume_rate / air_contents.return_volume()) update_parents() flick("inje_inject", src) @@ -112,7 +103,7 @@ )) radio_connection.post_signal(src, signal) -/obj/machinery/atmospherics/components/unary/outlet_injector/atmosinit() +/obj/machinery/atmospherics/components/unary/outlet_injector/atmos_init() set_frequency(frequency) broadcast_status() ..() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm b/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm index b511f3ff624a..8a44fb2bcb61 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm @@ -2,7 +2,6 @@ icon_state = "passive_vent_map-3" name = "passive vent" desc = "It is an open vent." - can_unwrench = TRUE layer = GAS_SCRUBBER_LAYER shift_underlay_only = FALSE @@ -12,7 +11,7 @@ /obj/machinery/atmospherics/components/unary/passive_vent/update_icon_nopipes() cut_overlays() if(showpipe) - var/image/cap = getpipeimage(icon, "vent_cap", initialize_directions) + var/image/cap = get_pipe_image(icon, "vent_cap", initialize_directions) add_overlay(cap) icon_state = "passive_vent" @@ -21,11 +20,20 @@ if(isclosedturf(location)) return + var/active = FALSE var/datum/gas_mixture/external = location.return_air() var/datum/gas_mixture/internal = airs[1] + var/external_pressure = external.return_pressure() + var/internal_pressure = internal.return_pressure() + var/pressure_delta = abs(external_pressure - internal_pressure) + + if(pressure_delta > 0.5) + equalize_all_gases_in_list(list(internal,external)) + active = TRUE + + active = internal.temperature_share(external, OPEN_HEAT_TRANSFER_COEFFICIENT) || active - if(internal.equalize(external)) - air_update_turf() + if(active) update_parents() /obj/machinery/atmospherics/components/unary/passive_vent/can_crawl_through() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm b/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm index 782bbe2e4064..a5d1fe5b0a29 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm @@ -11,6 +11,7 @@ pipe_state = "connector" piping_layer = 3 showpipe = TRUE + custom_reconcilation = TRUE var/obj/machinery/portable_atmospherics/connected_device @@ -24,11 +25,22 @@ connected_device.disconnect() return ..() +/obj/machinery/atmospherics/components/unary/portables_connector/return_airs_for_reconcilation(datum/pipeline/requester) + . = ..() + if(!connected_device) + return + if(istype(connected_device, /obj/mecha)) + var/obj/mecha/connected_mech = connected_device + if(connected_mech.internal_tank) + . += connected_mech.internal_tank.return_air() + else + . += connected_device.return_air() + /obj/machinery/atmospherics/components/unary/portables_connector/update_icon_nopipes() icon_state = "connector" if(showpipe) cut_overlays() - var/image/cap = getpipeimage(icon, "connector_cap", initialize_directions) + var/image/cap = get_pipe_image(icon, "connector_cap", initialize_directions) add_overlay(cap) /obj/machinery/atmospherics/components/unary/portables_connector/process_atmos() diff --git a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm index c52bd69bb205..de6de198bf09 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm @@ -14,58 +14,57 @@ var/volume = 10000 //in liters var/gas_type = 0 -/obj/machinery/atmospherics/components/unary/tank/New() - ..() +/obj/machinery/atmospherics/components/unary/tank/Initialize(mapload) + . = ..() var/datum/gas_mixture/air_contents = airs[1] air_contents.set_volume(volume) air_contents.set_temperature(T20C) if(gas_type) - air_contents.set_moles(AIR_CONTENTS) - name = "[name] ([GLOB.meta_gas_info[gas_type][META_GAS_NAME]])" - setPipingLayer(piping_layer) - + air_contents.set_moles(gas_type, AIR_CONTENTS) + name = "[name] ([GLOB.gas_data.names[gas_type]])" + set_piping_layer(piping_layer) /obj/machinery/atmospherics/components/unary/tank/air icon_state = "grey" name = "pressure tank (Air)" -/obj/machinery/atmospherics/components/unary/tank/air/New() - ..() +/obj/machinery/atmospherics/components/unary/tank/air/Initialize(mapload) + . = ..() var/datum/gas_mixture/air_contents = airs[1] - air_contents.set_moles(/datum/gas/oxygen, AIR_CONTENTS * 0.2) - air_contents.set_moles(/datum/gas/nitrogen, AIR_CONTENTS * 0.8) + air_contents.set_moles(GAS_O2, AIR_CONTENTS * 0.2) + air_contents.set_moles(GAS_N2, AIR_CONTENTS * 0.8) /obj/machinery/atmospherics/components/unary/tank/carbon_dioxide - gas_type = /datum/gas/carbon_dioxide + gas_type = GAS_CO2 -/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide/New() - ..() +/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide/Initialize(mapload) + . = ..() var/datum/gas_mixture/air_contents = airs[1] - air_contents.set_moles(/datum/gas/carbon_dioxide, AIR_CONTENTS) + air_contents.set_moles(GAS_CO2, AIR_CONTENTS) /obj/machinery/atmospherics/components/unary/tank/toxins icon_state = "orange" - gas_type = /datum/gas/plasma + gas_type = GAS_PLASMA -/obj/machinery/atmospherics/components/unary/tank/toxins/New() - ..() +/obj/machinery/atmospherics/components/unary/tank/toxins/Initialize(mapload) + . = ..() var/datum/gas_mixture/air_contents = airs[1] - air_contents.set_moles(/datum/gas/plasma, AIR_CONTENTS) + air_contents.set_moles(GAS_PLASMA, AIR_CONTENTS) /obj/machinery/atmospherics/components/unary/tank/oxygen icon_state = "blue" - gas_type = /datum/gas/oxygen + gas_type = GAS_O2 -/obj/machinery/atmospherics/components/unary/tank/oxygen/New() - ..() +/obj/machinery/atmospherics/components/unary/tank/oxygen/Initialize(mapload) + . = ..() var/datum/gas_mixture/air_contents = airs[1] - air_contents.set_moles(/datum/gas/oxygen, AIR_CONTENTS) + air_contents.set_moles(GAS_O2, AIR_CONTENTS) /obj/machinery/atmospherics/components/unary/tank/nitrogen icon_state = "red" - gas_type = /datum/gas/nitrogen + gas_type = GAS_N2 -/obj/machinery/atmospherics/components/unary/tank/nitrogen/New() - ..() +/obj/machinery/atmospherics/components/unary/tank/nitrogen/Initialize(mapload) + . = ..() var/datum/gas_mixture/air_contents = airs[1] - air_contents.set_moles(/datum/gas/nitrogen, AIR_CONTENTS) \ No newline at end of file + air_contents.set_moles(GAS_N2, AIR_CONTENTS) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm index 9a6d2231040b..bad3de341d73 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm @@ -82,7 +82,7 @@ /obj/machinery/atmospherics/components/unary/thermomachine/update_overlays() . = ..() - . += getpipeimage(icon, "pipe", dir, , piping_layer) + . += get_pipe_image(icon, "pipe", dir, , piping_layer) /obj/machinery/atmospherics/components/unary/thermomachine/AltClick(mob/living/user) if(!can_interact(user)) @@ -99,7 +99,7 @@ /obj/machinery/atmospherics/components/unary/thermomachine/update_icon_nopipes() cut_overlays() if(showpipe) - add_overlay(getpipeimage(icon, "scrub_cap", initialize_directions)) + add_overlay(get_pipe_image(icon, "scrub_cap", initialize_directions)) /obj/machinery/atmospherics/components/unary/thermomachine/examine(mob/user) . = ..() @@ -116,7 +116,6 @@ return ..() /obj/machinery/atmospherics/components/unary/thermomachine/process_atmos() - ..() if(!on || !nodes[1]) return var/datum/gas_mixture/air_contents = airs[1] @@ -140,6 +139,7 @@ /obj/machinery/atmospherics/components/unary/thermomachine/attackby(obj/item/I, mob/user, params) if(!on) if(default_deconstruction_screwdriver(user, icon_state_open, icon_state_off, I)) + change_pipe_connection(panel_open) return if(default_change_direction_wrench(user, I)) return @@ -150,21 +150,8 @@ /obj/machinery/atmospherics/components/unary/thermomachine/default_change_direction_wrench(mob/user, obj/item/I) if(!..()) return FALSE - SetInitDirections() - var/obj/machinery/atmospherics/node = nodes[1] - if(node) - if(src in node.nodes) //Only if it's actually connected. On-pipe version would is one-sided. - node.disconnect(src) - nodes[1] = null - if(parents[1]) - nullifyPipenet(parents[1]) - - atmosinit() - node = nodes[1] - if(node) - node.atmosinit() - node.addMember(src) - SSair.add_to_rebuild_queue(src) + set_init_directions() + update_icon(UPDATE_ICON) return TRUE /obj/machinery/atmospherics/components/unary/thermomachine/ui_status(mob/user) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm b/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm index db73b2ea8a45..b61cc02b516e 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm @@ -13,7 +13,7 @@ pipe_interference_group = "atmos-[piping_layer]"\ ) -/obj/machinery/atmospherics/components/unary/SetInitDirections() +/obj/machinery/atmospherics/components/unary/set_init_directions() initialize_directions = dir /obj/machinery/atmospherics/components/unary/on_construction() @@ -27,3 +27,27 @@ /obj/machinery/atmospherics/components/unary/proc/assign_uid_vents() uid = num2text(gl_uid++) return uid + +/obj/machinery/atmospherics/components/unary/proc/change_pipe_connection(disconnect) + if(disconnect) + disconnect_pipes() + return + connect_pipes() + +/obj/machinery/atmospherics/components/unary/proc/connect_pipes() + var/obj/machinery/atmospherics/node1 = nodes[1] + atmos_init() + node1 = nodes[1] + if(node1) + node1.atmos_init() + node1.add_member(src) + SSair.add_to_rebuild_queue(src) + +/obj/machinery/atmospherics/components/unary/proc/disconnect_pipes() + var/obj/machinery/atmospherics/node1 = nodes[1] + if(node1) + if(src in node1.nodes) //Only if it's actually connected. On-pipe version would is one-sided. + node1.disconnect(src) + nodes[1] = null + if(parents[1]) + nullify_pipenet(parents[1]) diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm index bc6b484c6dd2..18c8cc194bfb 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm @@ -67,7 +67,7 @@ /obj/machinery/atmospherics/components/unary/vent_pump/update_icon_nopipes() cut_overlays() if(showpipe) - var/image/cap = getpipeimage(icon, "vent_cap", initialize_directions) + var/image/cap = get_pipe_image(icon, "vent_cap", initialize_directions) add_overlay(cap) else PIPING_LAYER_SHIFT(src, PIPING_LAYER_DEFAULT) @@ -111,8 +111,7 @@ icon_state = "vent_in" /obj/machinery/atmospherics/components/unary/vent_pump/process_atmos() - ..() - if(!is_operational()) + if(!is_operational() || !isopenturf(loc)) last_moles_added = 0 return if(space_shutoff_ticks > 0) @@ -128,6 +127,10 @@ var/datum/gas_mixture/air_contents = airs[1] var/datum/gas_mixture/environment = loc.return_air() + + if(!environment) + return + var/environment_pressure = environment.return_pressure() var/environment_moles = environment.total_moles() var/last_moles_real_added = environment_moles - last_moles @@ -161,11 +164,7 @@ var/transfer_moles = pressure_delta*environment.return_volume()/(air_contents.return_temperature() * R_IDEAL_GAS_EQUATION) last_moles_added = transfer_moles - - var/datum/gas_mixture/removed = air_contents.remove(transfer_moles) - - loc.assume_air(removed) - air_update_turf() + loc.assume_air_moles(air_contents, transfer_moles) else // external -> internal last_moles_added = 0 @@ -178,12 +177,7 @@ moles_delta = min(moles_delta, (internal_pressure_bound - air_contents.return_pressure()) * our_multiplier) if(moles_delta > 0) - var/datum/gas_mixture/removed = loc.remove_air(moles_delta) - if (isnull(removed)) // in space - return - - air_contents.merge(removed) - air_update_turf() + loc.transfer_air(air_contents, moles_delta) last_moles = environment_moles update_parents() @@ -222,7 +216,7 @@ radio_connection.post_signal(src, signal, radio_filter_out) -/obj/machinery/atmospherics/components/unary/vent_pump/atmosinit() +/obj/machinery/atmospherics/components/unary/vent_pump/atmos_init() //some vents work his own spesial way radio_filter_in = frequency==FREQ_ATMOS_CONTROL?(RADIO_FROM_AIRALARM):null radio_filter_out = frequency==FREQ_ATMOS_CONTROL?(RADIO_TO_AIRALARM):null @@ -496,6 +490,14 @@ name = "air mix tank output inlet" id_tag = ATMOS_GAS_MONITOR_OUTPUT_AIR +/obj/machinery/atmospherics/components/unary/vent_pump/siphon/on/server + name = "server vent" + +/obj/machinery/atmospherics/components/unary/vent_pump/on/server + name = "server vent" + external_pressure_bound = 4000 + internal_pressure_bound = 0 + #undef INT_BOUND #undef EXT_BOUND #undef NO_BOUND diff --git a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm index 2729cb4f456a..5edc380cb20c 100644 --- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm +++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm @@ -15,10 +15,11 @@ layer = GAS_SCRUBBER_LAYER shift_underlay_only = FALSE showpipe = FALSE + var/id_tag = null var/scrubbing = SCRUBBING //0 = siphoning, 1 = scrubbing - var/filter_types = list(/datum/gas/carbon_dioxide) + var/filter_types = list(GAS_CO2) var/volume_rate = 200 var/widenet = 0 //is this scrubber acting on the 3x3 area around it. var/list/turf/adjacent_turfs = list() @@ -35,11 +36,6 @@ if(!id_tag) id_tag = assign_uid_vents() - for(var/f in filter_types) - if(istext(f)) - filter_types -= f - filter_types += gas_id2path(f) - /obj/machinery/atmospherics/components/unary/vent_scrubber/Destroy() var/area/A = get_area(src) if (A) @@ -70,7 +66,7 @@ /obj/machinery/atmospherics/components/unary/vent_scrubber/update_icon_nopipes() cut_overlays() if(showpipe) - var/image/cap = getpipeimage(icon, "scrub_cap", initialize_directions) + var/image/cap = get_pipe_image(icon, "scrub_cap", initialize_directions) add_overlay(cap) else PIPING_LAYER_SHIFT(src, PIPING_LAYER_DEFAULT) @@ -101,9 +97,8 @@ return FALSE var/list/f_types = list() - for(var/path in GLOB.meta_gas_info) - var/list/gas = GLOB.meta_gas_info[path] - f_types += list(list("gas_id" = gas[META_GAS_ID], "gas_name" = gas[META_GAS_NAME], "enabled" = (path in filter_types))) + for(var/id in GLOB.gas_data.ids) + f_types += list(list("gas_id" = id, "gas_name" = GLOB.gas_data.names[id], "enabled" = (id in filter_types))) var/datum/signal/signal = new(list( "tag" = id_tag, @@ -127,7 +122,7 @@ return TRUE -/obj/machinery/atmospherics/components/unary/vent_scrubber/atmosinit() +/obj/machinery/atmospherics/components/unary/vent_scrubber/atmos_init() radio_filter_in = frequency==initial(frequency)?(RADIO_FROM_AIRALARM):null radio_filter_out = frequency==initial(frequency)?(RADIO_TO_AIRALARM):null if(frequency) @@ -137,7 +132,6 @@ ..() /obj/machinery/atmospherics/components/unary/vent_scrubber/process_atmos() - ..() if(welded || !is_operational()) return FALSE if(!nodes[1] || !on) @@ -149,39 +143,23 @@ scrub(tile) return TRUE -/obj/machinery/atmospherics/components/unary/vent_scrubber/proc/scrub(turf/tile) +/obj/machinery/atmospherics/components/unary/vent_scrubber/proc/scrub(turf/open/tile) if(!istype(tile)) return FALSE var/datum/gas_mixture/environment = tile.return_air() var/datum/gas_mixture/air_contents = airs[1] + if(!environment) + return FALSE + if(air_contents.return_pressure() >= 50 * ONE_ATMOSPHERE) return FALSE if(scrubbing & SCRUBBING) - var/transfer_moles = min(1, volume_rate / environment.return_volume()) * environment.total_moles() - - //Take a gas sample - var/datum/gas_mixture/removed = tile.remove_air(transfer_moles) - - //Nothing left to remove from the tile - if(isnull(removed)) - return FALSE - - removed.scrub_into(air_contents, filter_types) - - //Remix the resulting gases - tile.assume_air(removed) - tile.air_update_turf() + environment.scrub_into(air_contents, volume_rate/environment.return_volume(), filter_types) else //Just siphoning all air - - var/transfer_moles = environment.total_moles() * (volume_rate / environment.return_volume()) - - var/datum/gas_mixture/removed = tile.remove_air(transfer_moles) - - air_contents.merge(removed) - tile.air_update_turf() + environment.transfer_ratio_to(air_contents, volume_rate/environment.return_volume()) update_parents() @@ -227,12 +205,12 @@ investigate_log(" was toggled to [scrubbing ? "scrubbing" : "siphon"] mode by [key_name(signal_sender)]",INVESTIGATE_ATMOS) if("toggle_filter" in signal.data) - filter_types ^= gas_id2path(signal.data["toggle_filter"]) + filter_types ^= signal.data["toggle_filter"] if("set_filters" in signal.data) filter_types = list() for(var/gas in signal.data["set_filters"]) - filter_types += gas_id2path(gas) + filter_types += gas if("init" in signal.data) name = signal.data["init"] diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm index 2836c6199e60..e5a2eb7addff 100644 --- a/code/modules/atmospherics/machinery/datum_pipeline.dm +++ b/code/modules/atmospherics/machinery/datum_pipeline.dm @@ -3,134 +3,164 @@ var/list/datum/gas_mixture/other_airs var/list/obj/machinery/atmospherics/pipe/members - var/list/obj/machinery/atmospherics/components/other_atmosmch + var/list/obj/machinery/atmospherics/components/other_atmos_machines var/update = TRUE + var/building = FALSE + /datum/pipeline/New() other_airs = list() members = list() - other_atmosmch = list() + other_atmos_machines = list() SSair.networks += src /datum/pipeline/Destroy() SSair.networks -= src + if(building) + SSair.remove_from_expansion(src) if(air && air.return_volume()) temporarily_store_air() - for(var/obj/machinery/atmospherics/pipe/P in members) - P.parent = null - for(var/obj/machinery/atmospherics/components/C in other_atmosmch) - C.nullifyPipenet(src) + for(var/obj/machinery/atmospherics/pipe/considered_pipe in members) + considered_pipe.parent = null + if(QDELETED(considered_pipe)) + continue + SSair.add_to_rebuild_queue(considered_pipe) + for(var/obj/machinery/atmospherics/components/considered_component in other_atmos_machines) + considered_component.nullify_pipenet(src) return ..() /datum/pipeline/process() - if(update) - update = FALSE - reconcile_air() + if(!update || building) + return + update = FALSE + reconcile_air() update = air.react(src) /datum/pipeline/proc/build_pipeline(obj/machinery/atmospherics/base) + building = TRUE var/volume = 0 if(istype(base, /obj/machinery/atmospherics/pipe)) - var/obj/machinery/atmospherics/pipe/E = base - volume = E.volume - members += E - if(E.air_temporary) - air = E.air_temporary - E.air_temporary = null + var/obj/machinery/atmospherics/pipe/considered_pipe = base + volume = considered_pipe.volume + members += considered_pipe + if(considered_pipe.air_temporary) + air = considered_pipe.air_temporary + considered_pipe.air_temporary = null else - addMachineryMember(base) + add_machinery_member(base) + if(!air) + air = new + air.set_volume(volume) + SSair.add_to_expansion(src, base) + +///Has the same effect as build_pipeline(), but this doesn't queue its work, so overrun abounds. It's useful for the pregame +/datum/pipeline/proc/build_pipeline_blocking(obj/machinery/atmospherics/base) + var/volume = 0 + if(istype(base, /obj/machinery/atmospherics/pipe)) + var/obj/machinery/atmospherics/pipe/considered_pipe = base + volume = considered_pipe.volume + members += considered_pipe + if(considered_pipe.air_temporary) + air = considered_pipe.air_temporary + considered_pipe.air_temporary = null + else + add_machinery_member(base) + if(!air) air = new var/list/possible_expansions = list(base) while(possible_expansions.len) for(var/obj/machinery/atmospherics/borderline in possible_expansions) var/list/result = borderline.pipeline_expansion(src) - if(result && result.len) - for(var/obj/machinery/atmospherics/P in result) - if(istype(P, /obj/machinery/atmospherics/pipe)) - var/obj/machinery/atmospherics/pipe/item = P - if(!members.Find(item)) - - if(item.parent) - var/static/pipenetwarnings = 100 - if(pipenetwarnings > 0) - log_mapping("build_pipeline(): [item.type] added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf) around [AREACOORD(item)].") - pipenetwarnings-- - if(pipenetwarnings == 0) - log_mapping("build_pipeline(): further messages about pipenets will be suppressed") - members += item - possible_expansions += item - - volume += item.volume - item.parent = src - - if(item.air_temporary) - air.merge(item.air_temporary) - item.air_temporary = null - else - P.setPipenet(src, borderline) - addMachineryMember(P) + if(!result?.len) + possible_expansions -= borderline + continue + for(var/obj/machinery/atmospherics/considered_device in result) + if(!istype(considered_device, /obj/machinery/atmospherics/pipe)) + considered_device.set_pipenet(src, borderline) + add_machinery_member(considered_device) + continue + var/obj/machinery/atmospherics/pipe/item = considered_device + if(members.Find(item)) + continue + if(item.parent) + var/static/pipenetwarnings = 10 + if(pipenetwarnings > 0) + log_mapping("build_pipeline(): [item.type] added to a pipenet while still having one. (pipes leading to the same spot stacking in one turf) around [AREACOORD(item)].") + pipenetwarnings-- + if(pipenetwarnings == 0) + log_mapping("build_pipeline(): further messages about pipenets will be suppressed") + + members += item + possible_expansions += item + + volume += item.volume + item.parent = src + + if(item.air_temporary) + air.merge(item.air_temporary) + item.air_temporary = null possible_expansions -= borderline air.set_volume(volume) -/datum/pipeline/proc/addMachineryMember(obj/machinery/atmospherics/components/C) - other_atmosmch |= C - var/datum/gas_mixture/G = C.returnPipenetAir(src) - if(!G) - stack_trace("addMachineryMember: Null gasmix added to pipeline datum from [C] which is of type [C.type]. Nearby: ([C.x], [C.y], [C.z])") - other_airs |= G - -/datum/pipeline/proc/addMember(obj/machinery/atmospherics/A, obj/machinery/atmospherics/N) - if(istype(A, /obj/machinery/atmospherics/pipe)) - var/obj/machinery/atmospherics/pipe/P = A - if(P.parent) - merge(P.parent) - P.parent = src - var/list/adjacent = P.pipeline_expansion() - for(var/obj/machinery/atmospherics/pipe/I in adjacent) - if(I.parent == src) - continue - var/datum/pipeline/E = I.parent - merge(E) - if(!members.Find(P)) - members += P - air.set_volume(air.return_volume() + P.volume) +/datum/pipeline/proc/add_machinery_member(obj/machinery/atmospherics/components/considered_component) + other_atmos_machines |= considered_component + var/list/returned_airs = considered_component.return_pipenet_airs(src) + if (!length(returned_airs) || (null in returned_airs)) + stack_trace("addMachineryMember: Nonexistent (empty list) or null machinery gasmix added to pipeline datum from [considered_component] \ + which is of type [considered_component.type]. Nearby: ([considered_component.x], [considered_component.y], [considered_component.z])") + other_airs |= returned_airs + +/datum/pipeline/proc/add_member(obj/machinery/atmospherics/reference_device, obj/machinery/atmospherics/device_to_add) + if(!istype(reference_device, /obj/machinery/atmospherics/pipe)) + reference_device.set_pipenet(src, device_to_add) + add_machinery_member(reference_device) else - A.setPipenet(src, N) - addMachineryMember(A) - -/datum/pipeline/proc/merge(datum/pipeline/E) - if(E == src) + var/obj/machinery/atmospherics/pipe/reference_pipe = reference_device + if(reference_pipe.parent) + merge(reference_pipe.parent) + reference_pipe.parent = src + var/list/adjacent = reference_pipe.pipeline_expansion() + for(var/obj/machinery/atmospherics/pipe/adjacent_pipe in adjacent) + if(adjacent_pipe.parent == src) + continue + var/datum/pipeline/parent_pipeline = adjacent_pipe.parent + merge(parent_pipeline) + if(!members.Find(reference_pipe)) + members += reference_pipe + air.set_volume(air.return_volume() + reference_pipe.volume) + +/datum/pipeline/proc/merge(datum/pipeline/parent_pipeline) + if(parent_pipeline == src) return - air.set_volume(air.return_volume() + E.air.return_volume()) - members.Add(E.members) - for(var/obj/machinery/atmospherics/pipe/S in E.members) - S.parent = src - air.merge(E.air) - for(var/obj/machinery/atmospherics/components/C in E.other_atmosmch) - C.replacePipenet(E, src) - other_atmosmch.Add(E.other_atmosmch) - other_airs.Add(E.other_airs) - E.members.Cut() - E.other_atmosmch.Cut() + air.set_volume(air.return_volume() + parent_pipeline.air.return_volume()) + members.Add(parent_pipeline.members) + for(var/obj/machinery/atmospherics/pipe/reference_pipe in parent_pipeline.members) + reference_pipe.parent = src + air.merge(parent_pipeline.air) + for(var/obj/machinery/atmospherics/components/reference_component in parent_pipeline.other_atmos_machines) + reference_component.replace_pipenet(parent_pipeline, src) + other_atmos_machines |= parent_pipeline.other_atmos_machines + other_airs |= parent_pipeline.other_airs + parent_pipeline.members.Cut() + parent_pipeline.other_atmos_machines.Cut() update = TRUE - qdel(E) + qdel(parent_pipeline) -/obj/machinery/atmospherics/proc/addMember(obj/machinery/atmospherics/A) +/obj/machinery/atmospherics/proc/add_member(obj/machinery/atmospherics/considered_device) return -/obj/machinery/atmospherics/pipe/addMember(obj/machinery/atmospherics/A) - parent.addMember(A, src) - -/obj/machinery/atmospherics/components/addMember(obj/machinery/atmospherics/A) - var/datum/pipeline/P = returnPipenet(A) - if(!P) - CRASH("null.addMember() called by [type] on [COORD(src)]") - P.addMember(A, src) +/obj/machinery/atmospherics/pipe/add_member(obj/machinery/atmospherics/considered_device) + parent.add_member(considered_device, src) +/obj/machinery/atmospherics/components/add_member(obj/machinery/atmospherics/considered_device) + var/datum/pipeline/device_pipeline = return_pipenet(considered_device) + if(!device_pipeline) + CRASH("null.add_member() called by [type] on [COORD(src)]") + device_pipeline.add_member(considered_device, src) /datum/pipeline/proc/temporarily_store_air() //Update individual gas_mixtures by volume ratio @@ -186,13 +216,13 @@ else return 1 - air.set_temperature(air.return_temperature() + self_temperature_delta); + air.set_temperature(air.return_temperature() + self_temperature_delta) modeled_location.TakeTemperature(sharer_temperature_delta) else if((target.heat_capacity>0) && (partial_heat_capacity>0)) - var/delta_temperature = air.return_temperature() - target.temperature + var/delta_temperature = air.return_temperature() - target.return_temperature() var/heat = thermal_conductivity*delta_temperature* \ (partial_heat_capacity*target.heat_capacity/(partial_heat_capacity+target.heat_capacity)) @@ -205,43 +235,28 @@ if(listclearnulls(.)) stack_trace("[src] has one or more null gas mixtures, which may cause bugs. Null mixtures will not be considered in reconcile_air().") -/datum/pipeline/proc/reconcile_air() - var/list/datum/gas_mixture/GL = list() - var/list/datum/pipeline/PL = list() - PL += src +/datum/pipeline/proc/empty() + for(var/datum/gas_mixture/GM as anything in get_all_connected_airs()) + GM?.clear() - for(var/i = 1; i <= PL.len; i++) //can't do a for-each here because we may add to the list within the loop - var/datum/pipeline/P = PL[i] - if(!P) - continue - GL += P.other_airs - GL += P.air - for(var/atmosmch in P.other_atmosmch) - if (istype(atmosmch, /obj/machinery/atmospherics/components/binary/valve)) - var/obj/machinery/atmospherics/components/binary/valve/V = atmosmch - if(V.on) - PL |= V.parents[1] - PL |= V.parents[2] - else if (istype(atmosmch, /obj/machinery/atmospherics/components/unary/portables_connector)) - var/obj/machinery/atmospherics/components/unary/portables_connector/C = atmosmch - if(C.connected_device) - GL += C.connected_device.air_contents - - var/datum/gas_mixture/total_gas_mixture = new(0) - var/total_volume = 0 - - for(var/i in GL) - if(!i) +/datum/pipeline/proc/get_all_connected_airs() + var/list/datum/gas_mixture/gas_mixture_list = list() + var/list/datum/pipeline/pipeline_list = list() + pipeline_list += src + + for(var/i = 1; i <= pipeline_list.len; i++) //can't do a for-each here because we may add to the list within the loop + var/datum/pipeline/pipeline = pipeline_list[i] + if(!pipeline) continue - var/datum/gas_mixture/G = i - total_gas_mixture.merge(G) - total_volume += G.return_volume() - - if(total_volume > 0) - //Update individual gas_mixtures by volume ratio - for(var/i in GL) - if(!i) + gas_mixture_list += pipeline.other_airs + gas_mixture_list += pipeline.air + for(var/obj/machinery/atmospherics/components/atmos_machine in pipeline.other_atmos_machines) + if(!atmos_machine.custom_reconcilation) continue - var/datum/gas_mixture/G = i - G.copy_from(total_gas_mixture) - G.multiply(G.return_volume()/total_volume) + pipeline_list |= atmos_machine.return_pipenets_for_reconcilation(src) + gas_mixture_list |= atmos_machine.return_airs_for_reconcilation(src) + return gas_mixture_list + +/datum/pipeline/proc/reconcile_air() + var/list/datum/gas_mixture/GL = get_all_connected_airs() + equalize_all_gases_in_list(GL) diff --git a/code/modules/atmospherics/machinery/other/meter.dm b/code/modules/atmospherics/machinery/other/meter.dm index e05e29c009d4..3e511d438366 100644 --- a/code/modules/atmospherics/machinery/other/meter.dm +++ b/code/modules/atmospherics/machinery/other/meter.dm @@ -32,14 +32,14 @@ id_tag = ATMOS_GAS_MONITOR_LOOP_DISTRIBUTION /obj/machinery/meter/Destroy() - SSair.atmos_machinery -= src + SSair_machinery.stop_processing_machine(src) target = null return ..() /obj/machinery/meter/Initialize(mapload, new_piping_layer) if(!isnull(new_piping_layer)) target_layer = new_piping_layer - SSair.atmos_machinery += src + SSair_machinery.start_processing_machine(src) if(!target) reattach_to_layer() return ..() diff --git a/code/modules/atmospherics/machinery/other/miner.dm b/code/modules/atmospherics/machinery/other/miner.dm index 2a6a583ab6de..78c154084256 100644 --- a/code/modules/atmospherics/machinery/other/miner.dm +++ b/code/modules/atmospherics/machinery/other/miner.dm @@ -117,24 +117,23 @@ on_overlay.color = overlay_color . += on_overlay -/obj/machinery/atmospherics/miner/process(delta_time) +/obj/machinery/atmospherics/miner/process_atmos() update_power() check_operation() if(active && !broken) if(isnull(spawn_id)) return FALSE if(do_use_power(active_power_usage)) - mine_gas(delta_time) + mine_gas() -/obj/machinery/atmospherics/miner/proc/mine_gas(delta_time = 2) +/obj/machinery/atmospherics/miner/proc/mine_gas() var/turf/open/O = get_turf(src) if(!isopenturf(O)) return FALSE var/datum/gas_mixture/merger = new - merger.set_moles(spawn_id, (spawn_mol * delta_time)) + merger.set_moles(spawn_id, spawn_mol) merger.set_temperature(spawn_temp) O.assume_air(merger) - O.air_update_turf(TRUE) /obj/machinery/atmospherics/miner/attack_ai(mob/living/silicon/user) if(broken) @@ -144,39 +143,39 @@ /obj/machinery/atmospherics/miner/n2o name = "\improper N2O Gas Miner" overlay_color = "#FFCCCC" - spawn_id = /datum/gas/nitrous_oxide + spawn_id = GAS_NITROUS /obj/machinery/atmospherics/miner/nitrogen name = "\improper N2 Gas Miner" overlay_color = "#CCFFCC" - spawn_id = /datum/gas/nitrogen + spawn_id = GAS_N2 /obj/machinery/atmospherics/miner/oxygen name = "\improper O2 Gas Miner" overlay_color = "#007FFF" - spawn_id = /datum/gas/oxygen + spawn_id = GAS_O2 /obj/machinery/atmospherics/miner/hydrogen name = "\improper H2 Gas Miner" overlay_color = "#ff0000" - spawn_id = /datum/gas/hydrogen + spawn_id = GAS_H2 /obj/machinery/atmospherics/miner/toxins name = "\improper Plasma Gas Miner" overlay_color = "#ff6600" - spawn_id = /datum/gas/plasma + spawn_id = GAS_PLASMA /obj/machinery/atmospherics/miner/carbon_dioxide name = "\improper CO2 Gas Miner" overlay_color = "#CDCDCD" - spawn_id = /datum/gas/carbon_dioxide + spawn_id = GAS_CO2 /obj/machinery/atmospherics/miner/bz name = "\improper BZ Gas Miner" overlay_color = "#FAFF00" - spawn_id = /datum/gas/bz + spawn_id = GAS_BZ /obj/machinery/atmospherics/miner/water_vapor name = "\improper Water Vapor Gas Miner" overlay_color = "#99928E" - spawn_id = /datum/gas/water_vapor + spawn_id = GAS_H2O diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm index 40db098a78ac..43721f5de7b1 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm @@ -11,7 +11,7 @@ . = ..() add_atom_colour("#404040", FIXED_COLOUR_PRIORITY) -/obj/machinery/atmospherics/pipe/heat_exchanging/isConnectable(obj/machinery/atmospherics/pipe/heat_exchanging/target, given_layer, HE_type_check = TRUE) +/obj/machinery/atmospherics/pipe/heat_exchanging/is_connectable(obj/machinery/atmospherics/pipe/heat_exchanging/target, given_layer, HE_type_check = TRUE) if(istype(target, /obj/machinery/atmospherics/pipe/heat_exchanging) != HE_type_check) return FALSE . = ..() diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/junction.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/junction.dm index 90f2cc47bf89..54eeb02d9425 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/junction.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/junction.dm @@ -15,17 +15,17 @@ construction_type = /obj/item/pipe/directional pipe_state = "junction" -/obj/machinery/atmospherics/pipe/heat_exchanging/junction/SetInitDirections() +/obj/machinery/atmospherics/pipe/heat_exchanging/junction/set_init_directions() switch(dir) if(NORTH, SOUTH) initialize_directions = SOUTH|NORTH if(EAST, WEST) initialize_directions = WEST|EAST -/obj/machinery/atmospherics/pipe/heat_exchanging/junction/getNodeConnects() +/obj/machinery/atmospherics/pipe/heat_exchanging/junction/get_node_connects() return list(turn(dir, 180), dir) -/obj/machinery/atmospherics/pipe/heat_exchanging/junction/isConnectable(obj/machinery/atmospherics/target, given_layer, he_type_check) +/obj/machinery/atmospherics/pipe/heat_exchanging/junction/is_connectable(obj/machinery/atmospherics/target, given_layer, he_type_check) if(dir == get_dir(target, src)) return ..(target, given_layer, FALSE) //we want a normal pipe instead return ..(target, given_layer, TRUE) diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm index 0078cedfeaf7..ada7a478f4c5 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm @@ -15,11 +15,12 @@ construction_type = /obj/item/pipe/trinary pipe_state = "he_manifold" -/obj/machinery/atmospherics/pipe/heat_exchanging/manifold/New() + +/obj/machinery/atmospherics/pipe/heat_exchanging/manifold/New(mapload) icon_state = "" return ..() -/obj/machinery/atmospherics/pipe/heat_exchanging/manifold/SetInitDirections() +/obj/machinery/atmospherics/pipe/heat_exchanging/manifold/set_init_directions() initialize_directions = ALL_CARDINALS initialize_directions &= ~dir @@ -33,7 +34,7 @@ //Add non-broken pieces for(var/i in 1 to device_type) if(nodes[i]) - . += getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) + . += get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) update_layer() update_alpha() diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm index 73f05668f576..72f6a61c6371 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm @@ -18,7 +18,7 @@ icon_state = "" return ..() -/obj/machinery/atmospherics/pipe/heat_exchanging/manifold4w/SetInitDirections() +/obj/machinery/atmospherics/pipe/heat_exchanging/manifold4w/set_init_directions() initialize_directions = initial(initialize_directions) /obj/machinery/atmospherics/pipe/heat_exchanging/manifold4w/update_overlays() @@ -30,7 +30,7 @@ //Add non-broken pieces for(var/i in 1 to device_type) if(nodes[i]) - . += getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) + . += get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) update_layer() update_alpha() diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm index f3f472efb7e1..18879f86da1e 100644 --- a/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm +++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm @@ -14,7 +14,7 @@ construction_type = /obj/item/pipe/binary/bendable pipe_state = "he" -/obj/machinery/atmospherics/pipe/heat_exchanging/simple/SetInitDirections() +/obj/machinery/atmospherics/pipe/heat_exchanging/simple/set_init_directions() if(dir in GLOB.diagonals) initialize_directions = dir return diff --git a/code/modules/atmospherics/machinery/pipes/layermanifold.dm b/code/modules/atmospherics/machinery/pipes/layermanifold.dm index 4044ebc99fd2..d979f42c53a0 100644 --- a/code/modules/atmospherics/machinery/pipes/layermanifold.dm +++ b/code/modules/atmospherics/machinery/pipes/layermanifold.dm @@ -68,21 +68,21 @@ // Uses pipe-3 because we don't want the vertical shifting if(p_color) - new_overlay = getpipeimage(icon, "pipe-3", p_dir, p_color, piping_layer = p_layer) + new_overlay = get_pipe_image(icon, "pipe-3", p_dir, p_color, piping_layer = p_layer) else - new_overlay = getpipeimage(icon, "pipe-3", p_dir, piping_layer = p_layer) + new_overlay = get_pipe_image(icon, "pipe-3", p_dir, piping_layer = p_layer) new_overlay.layer = layer - 0.01 return new_overlay -/obj/machinery/atmospherics/pipe/layer_manifold/SetInitDirections() +/obj/machinery/atmospherics/pipe/layer_manifold/set_init_directions() switch(dir) if(NORTH, SOUTH) initialize_directions = NORTH|SOUTH if(EAST, WEST) initialize_directions = EAST|WEST -/obj/machinery/atmospherics/pipe/layer_manifold/isConnectable(obj/machinery/atmospherics/target, given_layer) +/obj/machinery/atmospherics/pipe/layer_manifold/is_connectable(obj/machinery/atmospherics/target, given_layer) if(!given_layer) return TRUE . = ..() @@ -92,8 +92,8 @@ back_nodes = list() var/list/new_nodes = list() for(var/iter in PIPING_LAYER_MIN to PIPING_LAYER_MAX) - var/obj/machinery/atmospherics/foundfront = findConnecting(dir, iter) - var/obj/machinery/atmospherics/foundback = findConnecting(turn(dir, 180), iter) + var/obj/machinery/atmospherics/foundfront = find_connecting(dir, iter) + var/obj/machinery/atmospherics/foundback = find_connecting(turn(dir, 180), iter) front_nodes += foundfront back_nodes += foundback if(foundfront && !QDELETED(foundfront)) @@ -103,13 +103,13 @@ update_appearance(UPDATE_ICON) return new_nodes -/obj/machinery/atmospherics/pipe/layer_manifold/atmosinit() +/obj/machinery/atmospherics/pipe/layer_manifold/atmos_init() normalize_cardinal_directions() findAllConnections() var/turf/T = loc // hide if turf is not intact hide(T.intact) -/obj/machinery/atmospherics/pipe/layer_manifold/setPipingLayer() +/obj/machinery/atmospherics/pipe/layer_manifold/set_piping_layer() piping_layer = PIPING_LAYER_DEFAULT /obj/machinery/atmospherics/pipe/layer_manifold/pipeline_expansion() diff --git a/code/modules/atmospherics/machinery/pipes/manifold.dm b/code/modules/atmospherics/machinery/pipes/manifold.dm index 81060821e445..af37701d74ef 100644 --- a/code/modules/atmospherics/machinery/pipes/manifold.dm +++ b/code/modules/atmospherics/machinery/pipes/manifold.dm @@ -24,11 +24,11 @@ * in the mapping subsystem init before Initialize(mapload) is called in the atoms subsystem init. * This is true for the other manifolds (the 4 ways and the heat exchanges) too. */ -/obj/machinery/atmospherics/pipe/manifold/New() +/obj/machinery/atmospherics/pipe/manifold/New(mapload) icon_state = "" return ..() -/obj/machinery/atmospherics/pipe/manifold/SetInitDirections() +/obj/machinery/atmospherics/pipe/manifold/set_init_directions() initialize_directions = ALL_CARDINALS initialize_directions &= ~dir @@ -43,7 +43,7 @@ //Add non-broken pieces for(var/i in 1 to device_type) if(nodes[i]) - . += getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) + . += get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) update_layer() update_alpha() diff --git a/code/modules/atmospherics/machinery/pipes/manifold4w.dm b/code/modules/atmospherics/machinery/pipes/manifold4w.dm index 68c89c4a9b50..35d3f68ce1e7 100644 --- a/code/modules/atmospherics/machinery/pipes/manifold4w.dm +++ b/code/modules/atmospherics/machinery/pipes/manifold4w.dm @@ -19,11 +19,11 @@ pipe_interference_group = "atmos-[piping_layer]"\ ) -/obj/machinery/atmospherics/pipe/manifold4w/New() +/obj/machinery/atmospherics/pipe/manifold4w/New(mapload) icon_state = "" return ..() -/obj/machinery/atmospherics/pipe/manifold4w/SetInitDirections() +/obj/machinery/atmospherics/pipe/manifold4w/set_init_directions() initialize_directions = initial(initialize_directions) /obj/machinery/atmospherics/pipe/manifold4w/update_overlays() @@ -35,7 +35,7 @@ //Add non-broken pieces for(var/i in 1 to device_type) if(nodes[i]) - . += getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) + . += get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) update_layer() update_alpha() diff --git a/code/modules/atmospherics/machinery/pipes/pipes.dm b/code/modules/atmospherics/machinery/pipes/pipes.dm index bf36ad6a1740..e14ef7818dab 100644 --- a/code/modules/atmospherics/machinery/pipes/pipes.dm +++ b/code/modules/atmospherics/machinery/pipes/pipes.dm @@ -18,26 +18,27 @@ ),\ ) -/obj/machinery/atmospherics/pipe/New() +/obj/machinery/atmospherics/pipe/New(mapload) add_atom_colour(pipe_color, FIXED_COLOUR_PRIORITY) volume = 35 * device_type - ..() + return ..() -/obj/machinery/atmospherics/pipe/nullifyNode(i) - var/obj/machinery/atmospherics/oldN = nodes[i] - ..() - if(oldN) - SSair.add_to_rebuild_queue(oldN) +/obj/machinery/atmospherics/pipe/nullify_node(i) + var/obj/machinery/atmospherics/old_node = nodes[i] + . = ..() + if(old_node) + SSair.add_to_rebuild_queue(old_node) /obj/machinery/atmospherics/pipe/destroy_network() QDEL_NULL(parent) -/obj/machinery/atmospherics/pipe/build_network() - if(QDELETED(parent)) - parent = new - parent.build_pipeline(src) +/obj/machinery/atmospherics/pipe/get_rebuild_targets() + if(!QDELETED(parent)) + return + parent = new + return list(parent) -/obj/machinery/atmospherics/pipe/atmosinit() +/obj/machinery/atmospherics/pipe/atmos_init() var/turf/T = loc // hide if turf is not intact hide(T.intact) ..() @@ -51,19 +52,26 @@ if(air_temporary) var/turf/T = loc T.assume_air(air_temporary) - air_update_turf() /obj/machinery/atmospherics/pipe/return_air() - if(parent) - return parent.air + if(air_temporary) + return air_temporary + return parent.air /obj/machinery/atmospherics/pipe/return_analyzable_air() - if(parent) - return parent.air + if(air_temporary) + return air_temporary + return parent.air /obj/machinery/atmospherics/pipe/remove_air(amount) - if(parent) - return parent.air.remove(amount) + if(air_temporary) + return air_temporary.remove(amount) + return parent.air.remove(amount) + +/obj/machinery/atmospherics/pipe/remove_air_ratio(ratio) + if(air_temporary) + return air_temporary.remove_ratio(ratio) + return parent.air.remove_ratio(ratio) /obj/machinery/atmospherics/pipe/attackby(obj/item/W, mob/user, params) if(istype(W, /obj/item/pipe_meter)) @@ -78,10 +86,10 @@ analyzer_act(user, src) return ..() -/obj/machinery/atmospherics/pipe/returnPipenet() +/obj/machinery/atmospherics/pipe/return_pipenet() return parent -/obj/machinery/atmospherics/pipe/setPipenet(datum/pipeline/P) +/obj/machinery/atmospherics/pipe/set_pipenet(datum/pipeline/P) parent = P /obj/machinery/atmospherics/pipe/Destroy() diff --git a/code/modules/atmospherics/machinery/pipes/simple.dm b/code/modules/atmospherics/machinery/pipes/simple.dm index 3ac2daf18e06..538ebc89bb64 100644 --- a/code/modules/atmospherics/machinery/pipes/simple.dm +++ b/code/modules/atmospherics/machinery/pipes/simple.dm @@ -22,7 +22,7 @@ pipe_interference_group = "atmos-[piping_layer]"\ ) -/obj/machinery/atmospherics/pipe/simple/SetInitDirections() +/obj/machinery/atmospherics/pipe/simple/set_init_directions() if(dir in GLOB.diagonals) initialize_directions = dir return diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm index 4b56e08552e7..1e7c2c6b3148 100644 --- a/code/modules/atmospherics/machinery/portable/canister.dm +++ b/code/modules/atmospherics/machinery/portable/canister.dm @@ -25,7 +25,7 @@ integrity_failure = 100 pressure_resistance = 7 * ONE_ATMOSPHERE var/temperature_resistance = 1000 + T0C - var/starter_temp + var/starter_temp = T20C // Prototype vars var/prototype = FALSE var/valve_timer = null @@ -88,37 +88,37 @@ name = "Nitrogen canister" desc = "Nitrogen gas. Reportedly useful for something." icon_state = "nitrogen" - gas_type = /datum/gas/nitrogen + gas_type = GAS_N2 /obj/machinery/portable_atmospherics/canister/oxygen name = "Oxygen canister" desc = "Oxygen. Necessary for human life." icon_state = "oxygen" - gas_type = /datum/gas/oxygen + gas_type = GAS_O2 /obj/machinery/portable_atmospherics/canister/carbon_dioxide name = "Carbon dioxide canister" desc = "Carbon dioxide. What the fuck is carbon dioxide?" icon_state = "carbon" - gas_type = /datum/gas/carbon_dioxide + gas_type = GAS_CO2 /obj/machinery/portable_atmospherics/canister/toxins name = "Plasma canister" desc = "Plasma gas. The reason YOU are here. Highly toxic." icon_state = "plasma" - gas_type = /datum/gas/plasma + gas_type = GAS_PLASMA /obj/machinery/portable_atmospherics/canister/bz name = "\improper BZ canister" desc = "BZ, a powerful hallucinogenic nerve agent." icon_state = "bz" - gas_type = /datum/gas/bz + gas_type = GAS_BZ /obj/machinery/portable_atmospherics/canister/nitrous_oxide name = "Nitrous oxide canister" desc = "Nitrous oxide gas. Known to cause drowsiness." icon_state = "nitrous" - gas_type = /datum/gas/nitrous_oxide + gas_type = GAS_NITROUS /obj/machinery/portable_atmospherics/canister/air name = "Air canister" @@ -129,100 +129,100 @@ name = "Tritium canister" desc = "Tritium. Inhalation might cause irradiation." icon_state = "tritium" - gas_type = /datum/gas/tritium + gas_type = GAS_TRITIUM /obj/machinery/portable_atmospherics/canister/nob name = "Hyper-noblium canister" desc = "Hyper-Noblium. More noble than all other gases." icon_state = "hypno" - gas_type = /datum/gas/hypernoblium + gas_type = GAS_HYPERNOB /obj/machinery/portable_atmospherics/canister/nitrium name = "Nitrium canister" desc = "Nitrium gas. Feels great 'til the acid eats your lungs." icon_state = "nitrium" - gas_type = /datum/gas/nitrium + gas_type = GAS_NITRIUM /obj/machinery/portable_atmospherics/canister/pluoxium name = "Pluoxium canister" desc = "Pluoxium. Like oxygen, but more bang for your buck." icon_state = "pluoxium" - gas_type = /datum/gas/pluoxium + gas_type = GAS_PLUOXIUM /obj/machinery/portable_atmospherics/canister/water_vapor name = "Water vapor canister" desc = "Water vapor. We get it, you vape." icon_state = "water" - gas_type = /datum/gas/water_vapor + gas_type = GAS_H2O filled = 1 /obj/machinery/portable_atmospherics/canister/miasma name = "Miasma canister" desc = "Foul miasma. Even the canister reeks of fetid refuse." icon_state = "miasma" - gas_type = /datum/gas/miasma + gas_type = GAS_MIASMA filled = 1 /obj/machinery/portable_atmospherics/canister/dilithium name = "Dilithium canister" desc = "A gas produced from dilithium crystal." icon_state = "dilithium" - gas_type = /datum/gas/dilithium + gas_type = GAS_DILITHIUM /obj/machinery/portable_atmospherics/canister/freon name = "Freon canister" desc = "Freon. Can absorb heat" icon_state = "freon" - gas_type = /datum/gas/freon + gas_type = GAS_FREON filled = 1 /obj/machinery/portable_atmospherics/canister/hydrogen name = "Hydrogen canister" desc = "Hydrogen, highly flammable" icon_state = "h2" - gas_type = /datum/gas/hydrogen + gas_type = GAS_H2 filled = 1 /obj/machinery/portable_atmospherics/canister/healium name = "Healium canister" desc = "Healium, causes deep sleep" icon_state = "healium" - gas_type = /datum/gas/healium + gas_type = GAS_HEALIUM filled = 1 /obj/machinery/portable_atmospherics/canister/pluonium name = "Pluonium canister" desc = "Pluonium, reacts differently with various gases" icon_state = "pluonium" - gas_type = /datum/gas/pluonium + gas_type = GAS_PLUONIUM filled = 1 /obj/machinery/portable_atmospherics/canister/halon name = "Halon canister" desc = "Halon, remove oxygen from high temperature fires and cool down the area" icon_state = "halon" - gas_type = /datum/gas/halon + gas_type = GAS_HALON filled = 1 /obj/machinery/portable_atmospherics/canister/hexane name = "Hexane canister" desc = "hexane, highly flammable." icon_state = "hexane" - gas_type = /datum/gas/hexane + gas_type = GAS_HEXANE filled = 1 /obj/machinery/portable_atmospherics/canister/zauker name = "Zauker canister" desc = "Zauker, highly toxic" icon_state = "zauker" - gas_type = /datum/gas/zauker + gas_type = GAS_ZAUKER filled = 1 /obj/machinery/portable_atmospherics/canister/antinoblium name = "Antinoblium canister" desc = "Antinoblium, we still don't know what it does, but it sells for a lot" icon_state = "antino" - gas_type = /datum/gas/antinoblium + gas_type = GAS_ANTINOB filled = 1 /obj/machinery/portable_atmospherics/canister/proc/get_time_left() @@ -255,13 +255,13 @@ /obj/machinery/portable_atmospherics/canister/proto/default/oxygen name = "prototype canister" desc = "A prototype canister for a prototype bike, what could go wrong?" - gas_type = /datum/gas/oxygen + gas_type = GAS_O2 filled = 1 release_pressure = ONE_ATMOSPHERE*2 -/obj/machinery/portable_atmospherics/canister/New(loc, datum/gas_mixture/existing_mixture) - ..() +/obj/machinery/portable_atmospherics/canister/Initialize(mapload, datum/gas_mixture/existing_mixture) + . = ..() if(existing_mixture) air_contents.copy_from(existing_mixture) else @@ -284,13 +284,21 @@ if(gas_type) if(starter_temp) air_contents.set_temperature(starter_temp) - air_contents.set_moles(gas_type, (maximum_pressure * filled) * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature())) + if(air_contents.return_volume() == 0) + CRASH("Air content volume is zero, this shouldn't be the case volume is: [volume]!") + if(air_contents.return_temperature() == 0) + CRASH("Air content temperature is zero, this shouldn't be the case!") + if (gas_type) + air_contents.set_moles(gas_type, (maximum_pressure * filled) * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature())) /obj/machinery/portable_atmospherics/canister/air/create_gas() - if(starter_temp) - air_contents.set_temperature(starter_temp) - air_contents.set_moles(/datum/gas/oxygen, (O2STANDARD * maximum_pressure * filled) * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature())) - air_contents.set_moles(/datum/gas/nitrogen, (N2STANDARD * maximum_pressure * filled) * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature())) + if(air_contents.return_volume() == 0) + CRASH("Air content volume is zero, this shouldn't be the case volume is: [volume]!") + if(air_contents.return_temperature() == 0) + CRASH("Air content temperature is zero, this shouldn't be the case!") + air_contents.set_temperature(starter_temp) + air_contents.set_moles(GAS_O2, (O2STANDARD * maximum_pressure * filled) * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature())) + air_contents.set_moles(GAS_N2, (N2STANDARD * maximum_pressure * filled) * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature())) /obj/machinery/portable_atmospherics/canister/update_icon_state() if(stat & BROKEN) @@ -374,7 +382,6 @@ var/datum/gas_mixture/expelled_gas = air_contents.remove(air_contents.total_moles()) var/turf/T = get_turf(src) T.assume_air(expelled_gas) - air_update_turf() obj_break() density = FALSE @@ -402,21 +409,16 @@ if(timing && valve_timer < world.time) valve_open = !valve_open timing = FALSE + + // Handle gas transfer. if(valve_open) var/turf/T = get_turf(src) - pump.airs[1] = air_contents - pump.airs[2] = holding ? holding.air_contents : T.return_air() - pump.target_pressure = release_pressure - - pump.process_atmos() // Pump gas. - if(!holding) - air_update_turf() // Update the environment if needed. - else - pump.airs[1] = null - pump.airs[2] = null + var/datum/gas_mixture/target_air = holding ? holding.air_contents : T.return_air() + air_contents.release_gas_to(target_air, release_pressure) update_appearance(UPDATE_ICON) + /obj/machinery/portable_atmospherics/canister/ui_state(mob/user) return GLOB.physical_state @@ -514,11 +516,10 @@ if(!holding) var/list/danger = list() for(var/id in air_contents.get_gases()) - if(!GLOB.meta_gas_info[id][META_GAS_DANGER]) + if(!(GLOB.gas_data.flags[id] & GAS_FLAG_DANGEROUS)) continue - if(air_contents.get_moles(id) > (GLOB.meta_gas_info[id][META_GAS_MOLES_VISIBLE] || MOLES_GAS_VISIBLE)) //if moles_visible is undefined, default to default visibility - danger[GLOB.meta_gas_info[id][META_GAS_NAME]] = air_contents.get_moles(id) //ex. "plasma" = 20 - + if(air_contents.get_moles(id) > (GLOB.gas_data.visibility[id] || MOLES_GAS_VISIBLE)) //if moles_visible is undefined, default to default visibility + danger[GLOB.gas_data.names[id]] = air_contents.get_moles(id) //ex. "plasma" = 20 if(danger.len) message_admins("[ADMIN_LOOKUPFLW(usr)] opened a canister that contains the following at [ADMIN_VERBOSEJMP(src)]:") log_admin("[key_name(usr)] opened a canister that contains the following at [AREACOORD(src)]:") @@ -576,10 +577,10 @@ desc = "This should never be spawned in game." icon_state = "danger" /obj/machinery/portable_atmospherics/canister/fusion_test/create_gas() - air_contents.set_moles(/datum/gas/tritium, 10) - air_contents.set_moles(/datum/gas/plasma, 500) - air_contents.set_moles(/datum/gas/hydrogen, 500) - air_contents.set_moles(/datum/gas/nitrous_oxide, 100) + air_contents.set_moles(GAS_TRITIUM, 10) + air_contents.set_moles(GAS_PLASMA, 500) + air_contents.set_moles(GAS_H2, 500) + air_contents.set_moles(GAS_NITROUS, 100) air_contents.set_temperature(10000) /// Canister 1 Kelvin below the fusion point. Contains far too much plasma. Only good for adding more fuel to ongoing fusion reactions. @@ -588,10 +589,10 @@ desc = "This should never be spawned in game." icon_state = "danger" /obj/machinery/portable_atmospherics/canister/fusion_test_2/create_gas() - air_contents.set_moles(/datum/gas/tritium, 10) - air_contents.set_moles(/datum/gas/plasma, 15000) - air_contents.set_moles(/datum/gas/carbon_dioxide, 1500) - air_contents.set_moles(/datum/gas/nitrous_oxide, 100) + air_contents.set_moles(GAS_TRITIUM, 10) + air_contents.set_moles(GAS_PLASMA, 15000) + air_contents.set_moles(GAS_CO2, 1500) + air_contents.set_moles(GAS_NITROUS, 100) air_contents.set_temperature(9999) /// Canister at the perfect conditions to start and continue fusion for a long time. @@ -600,9 +601,9 @@ desc = "This should never be spawned in game." icon_state = "danger" /obj/machinery/portable_atmospherics/canister/fusion_test_3/create_gas() - air_contents.set_moles(/datum/gas/tritium, 1000) - air_contents.set_moles(/datum/gas/plasma, 4500) - air_contents.set_moles(/datum/gas/carbon_dioxide, 1500) + air_contents.set_moles(GAS_TRITIUM, 1000) + air_contents.set_moles(GAS_PLASMA, 4500) + air_contents.set_moles(GAS_CO2, 1500) air_contents.set_temperature(1000000) /** Canister for testing dilithium based cold fusion. Use fusion_test_3 if you don't know what you are doing. @@ -612,10 +613,10 @@ desc = "This should never be spawned in game. Contains dilithium for cold fusion." icon_state = "danger" /obj/machinery/portable_atmospherics/canister/fusion_test_4/create_gas() - air_contents.set_moles(/datum/gas/tritium, 1000) - air_contents.set_moles(/datum/gas/plasma, 4500) - air_contents.set_moles(/datum/gas/carbon_dioxide, 1500) - air_contents.set_moles(/datum/gas/dilithium, 2000) + air_contents.set_moles(GAS_TRITIUM, 1000) + air_contents.set_moles(GAS_PLASMA, 4500) + air_contents.set_moles(GAS_CO2, 1500) + air_contents.set_moles(GAS_DILITHIUM, 2000) air_contents.set_temperature(10000) /// A canister that is 1 Kelvin away from doing the stimball reaction. @@ -624,7 +625,7 @@ desc = "This should never be spawned in game except for testing purposes." icon_state = "danger" /obj/machinery/portable_atmospherics/canister/stimball_test/create_gas() - air_contents.set_moles(/datum/gas/nitrium, 1000) - air_contents.set_moles(/datum/gas/plasma, 1000) - air_contents.set_moles(/datum/gas/pluoxium, 1000) + air_contents.set_moles(GAS_NITRIUM, 1000) + air_contents.set_moles(GAS_PLASMA, 1000) + air_contents.set_moles(GAS_PLUOXIUM, 1000) air_contents.set_temperature(FIRE_MINIMUM_TEMPERATURE_TO_EXIST-1) diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm index 53764eb0bc1a..156ade34ddab 100644 --- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm +++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm @@ -14,20 +14,17 @@ var/maximum_pressure = 90 * ONE_ATMOSPHERE -/obj/machinery/portable_atmospherics/New() - ..() - SSair.atmos_machinery += src +/obj/machinery/portable_atmospherics/Initialize(mapload) + . = ..() + SSair_machinery.start_processing_machine(src) air_contents = new(volume) air_contents.set_temperature(T20C) - return 1 - /obj/machinery/portable_atmospherics/Destroy() + SSair_machinery.stop_processing_machine(src) disconnect() QDEL_NULL(air_contents) - SSair.atmos_machinery -= src - return ..() /obj/machinery/portable_atmospherics/ex_act(severity, target) @@ -38,12 +35,11 @@ //This explosion will destroy the can, release its air. var/turf/T = get_turf(src) T.assume_air(air_contents) - T.air_update_turf() return ..() /obj/machinery/portable_atmospherics/process_atmos() - if(!connected_port) // Pipe network handles reactions if connected. + if(!connected_port && air_contents != null && src != null) // Pipe network handles reactions if connected. air_contents.react(src) /obj/machinery/portable_atmospherics/return_air() @@ -64,8 +60,7 @@ //Perform the connection connected_port = new_port connected_port.connected_device = src - var/datum/pipeline/connected_port_parent = connected_port.parents[1] - connected_port_parent.reconcile_air() + connected_port.parents[1].update = PIPENET_UPDATE_STATUS_RECONCILE_NEEDED anchored = TRUE //Prevent movement pixel_x = new_port.pixel_x diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm index b2224cf9cad8..b2950139282a 100644 --- a/code/modules/atmospherics/machinery/portable/pump.dm +++ b/code/modules/atmospherics/machinery/portable/pump.dm @@ -25,7 +25,6 @@ /obj/machinery/portable_atmospherics/pump/Destroy() var/turf/T = get_turf(src) T.assume_air(air_contents) - air_update_turf() QDEL_NULL(pump) return ..() @@ -57,8 +56,6 @@ pump.airs[2] = holding ? holding.air_contents : air_contents pump.process_atmos() // Pump gas. - if(!holding) - air_update_turf() // Update the environment if needed. /obj/machinery/portable_atmospherics/pump/emp_act(severity) . = ..() @@ -115,8 +112,8 @@ if("power") on = !on if(on && !holding) - var/plasma = air_contents.get_moles(/datum/gas/plasma) - var/n2o = air_contents.get_moles(/datum/gas/nitrous_oxide) + var/plasma = air_contents.get_moles(GAS_PLASMA) + var/n2o = air_contents.get_moles(GAS_NITROUS) if(n2o || plasma) message_admins("[ADMIN_LOOKUPFLW(usr)] turned on a pump that contains [n2o ? "N2O" : ""][n2o && plasma ? " & " : ""][plasma ? "Plasma" : ""] at [ADMIN_VERBOSEJMP(src)]") log_admin("[key_name(usr)] turned on a pump that contains [n2o ? "N2O" : ""][n2o && plasma ? " & " : ""][plasma ? "Plasma" : ""] at [AREACOORD(src)]") diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm index f0d132d6fe71..168942ac0483 100644 --- a/code/modules/atmospherics/machinery/portable/scrubber.dm +++ b/code/modules/atmospherics/machinery/portable/scrubber.dm @@ -9,31 +9,25 @@ volume = 1000 var/list/scrubbing = list( - /datum/gas/plasma, - /datum/gas/carbon_dioxide, - /datum/gas/nitrous_oxide, - /datum/gas/miasma, - /datum/gas/bz, - /datum/gas/nitrium, - /datum/gas/tritium, - /datum/gas/hypernoblium, - /datum/gas/dilithium, - /datum/gas/freon, - /datum/gas/hydrogen, - /datum/gas/water_vapor, - /datum/gas/healium, - /datum/gas/pluoxium, - /datum/gas/pluonium, - /datum/gas/halon, - /datum/gas/zauker, - /datum/gas/antinoblium, - /datum/gas/hexane, + GAS_PLASMA, + GAS_CO2, + GAS_NITROUS, + GAS_BZ, + GAS_NITRIUM, + GAS_TRITIUM, + GAS_HYPERNOB, + GAS_FREON, + GAS_H2O, + GAS_HEALIUM, + GAS_PLUONIUM, + GAS_HALON, + GAS_ZAUKER, + GAS_HEXANE, ) /obj/machinery/portable_atmospherics/scrubber/Destroy() var/turf/T = get_turf(src) T.assume_air(air_contents) - air_update_turf() return ..() /obj/machinery/portable_atmospherics/scrubber/update_icon_state() @@ -63,17 +57,7 @@ if(air_contents.return_pressure() >= overpressure_m * ONE_ATMOSPHERE) return - var/transfer_moles = min(1, volume_rate / mixture.return_volume()) * mixture.total_moles() - - var/datum/gas_mixture/filtering = mixture.remove(transfer_moles) // Remove part of the mixture to filter. - if(!filtering) - return - - filtering.scrub_into(air_contents, scrubbing) - - mixture.merge(filtering) // Returned the cleaned gas. - if(!holding) - air_update_turf() + mixture.scrub_into(air_contents, volume_rate / mixture.return_volume(), scrubbing) /obj/machinery/portable_atmospherics/scrubber/emp_act(severity) . = ..() @@ -84,11 +68,16 @@ on = !on update_appearance(UPDATE_ICON) + +/obj/machinery/portable_atmospherics/scrubber/ui_state(mob/user) + return GLOB.physical_state + /obj/machinery/portable_atmospherics/scrubber/ui_interact(mob/user, datum/tgui/ui) ui = SStgui.try_update_ui(user, src, ui) if(!ui) - ui = new(user, src, "PortableScrubber", name) + ui = new(user, src, "PortableScrubber") ui.open() + ui.set_autoupdate(TRUE) // Air pressure, tank pressure /obj/machinery/portable_atmospherics/scrubber/ui_data() var/data = list() @@ -98,9 +87,8 @@ data["id_tag"] = -1 //must be defined in order to reuse code between portable and vent scrubbers data["filter_types"] = list() - for(var/path in GLOB.meta_gas_info) - var/list/gas = GLOB.meta_gas_info[path] - data["filter_types"] += list(list("gas_id" = gas[META_GAS_ID], "gas_name" = gas[META_GAS_NAME], "enabled" = (path in scrubbing))) + for(var/id in GLOB.gas_data.ids) + data["filter_types"] += list(list("gas_id" = id, "gas_name" = GLOB.gas_data.names[id], "enabled" = (id in scrubbing))) if(holding) data["holding"] = list() @@ -118,7 +106,7 @@ on = FALSE update_appearance(UPDATE_ICON) else if(on && holding) - investigate_log("[key_name(user)] started a transfer into [holding].
", INVESTIGATE_ATMOS) + investigate_log("[key_name(user)] started a transfer into [holding].", INVESTIGATE_ATMOS) /obj/machinery/portable_atmospherics/scrubber/ui_act(action, params) if(..()) @@ -132,9 +120,10 @@ replace_tank(usr, FALSE) . = TRUE if("toggle_filter") - scrubbing ^= gas_id2path(params["val"]) + scrubbing ^= params["val"] . = TRUE - update_appearance(UPDATE_ICON) + if(.) + update_appearance(UPDATE_ICON) /obj/machinery/portable_atmospherics/scrubber/huge name = "huge air scrubber" diff --git a/code/modules/awaymissions/mission_code/snowdin.dm b/code/modules/awaymissions/mission_code/snowdin.dm index 0f09fe7b60b2..9a58051c044c 100644 --- a/code/modules/awaymissions/mission_code/snowdin.dm +++ b/code/modules/awaymissions/mission_code/snowdin.dm @@ -151,8 +151,8 @@ /turf/open/floor/plasteel/dark/snowdin initial_gas_mix = FROZEN_ATMOS - planetary_atmos = 1 - temperature = 180 + planetary_atmos = TRUE + initial_temperature = 180 /turf/open/lava/plasma name = "liquid plasma" diff --git a/code/modules/cargo/bounties/engineering.dm b/code/modules/cargo/bounties/engineering.dm index a2dad0de195f..921a1c71d056 100644 --- a/code/modules/cargo/bounties/engineering.dm +++ b/code/modules/cargo/bounties/engineering.dm @@ -13,61 +13,61 @@ name = "Full Tank of Pluoxium" description = "CentCom RnD is researching extra compact internals. Ship us a tank full of Pluoxium and you'll be compensated. (20 Moles)" reward = 2500 - gas_type = /datum/gas/pluoxium + gas_type = GAS_PLUOXIUM /datum/bounty/item/atmos/simple/nitrium_tank name = "Full Tank of Nitrium" description = "The non-human staff of Station 88 has been volunteered to test performance enhancing drugs. Ship them a tank full of Nitrium so they can get started. (20 Moles)" reward = 12000 - gas_type = /datum/gas/nitrium + gas_type = GAS_NITRIUM /datum/bounty/item/atmos/simple/tritium_tank name = "Full Tank of Tritium" description = "Station 49 is looking to kickstart their research program. Ship them a tank full of Tritium. (20 Moles)" reward = 3500 - gas_type = /datum/gas/tritium + gas_type = GAS_TRITIUM /datum/bounty/item/atmos/simple/freon_tank name = "Full Tank of Freon" description = "The Supermatter of station 33 has started the delamination process. Deliver a tank of Freon gas to help them stop it! (20 Moles)" reward = 4500 - gas_type = /datum/gas/freon + gas_type = GAS_FREON /datum/bounty/item/atmos/simple/healium_tank name = "Full Tank of Healium" description = "Station 42's medical staff are working on an experimental cryogenics setup. They need a tank of Healium. (20 Moles)" reward = 8000 - gas_type = /datum/gas/healium + gas_type = GAS_HEALIUM /datum/bounty/item/atmos/complex/zauker_tank name = "Full Tank of Zauker" description = "The main planet of \[REDACTED] has been chosen as testing grounds for the new weapon that uses Zauker gas. Ship us a tank full of it. (20 Moles)" reward = 25000 - gas_type = /datum/gas/zauker + gas_type = GAS_ZAUKER /datum/bounty/item/atmos/complex/hypernob_tank name = "Full Tank of Hypernoblium" description = "Station 26's atmospheric division has had a mishap with an experimental fusion mix. Some Hyper-Noblium would be appreciated. (20 Moles)" reward = 15000 - gas_type = /datum/gas/hypernoblium + gas_type = GAS_HYPERNOB /datum/bounty/item/h2metal/metallic_hydrogen_armor - name = "Metallic Hydrogen Armors" - description = "Nanotrasen is requiring new armor to be made. Ship them some metallic hydrogen armors." + name = "Metallic Hydrogen Armor" + description = "Nanotrasen is requiring new armor to be made. Ship them 1 metallic hydrogen armor." reward = 8000 required_count = 1 wanted_types = list(/obj/item/clothing/suit/armor/elder_atmosian) /datum/bounty/item/h2metal/metallic_hydrogen_helmet - name = "Metallic Hydrogen Armors" - description = "Nanotrasen is requiring new helmet to be made. Ship them some metallic hydrogen helmets." + name = "Metallic Hydrogen Helmet" + description = "Nanotrasen is requiring new helmet to be made. Ship them 1 metallic hydrogen helmet." reward = 7000 required_count = 1 wanted_types = list(/obj/item/clothing/head/helmet/elder_atmosian) /datum/bounty/item/h2metal/metallic_hydrogen_axe name = "Metallic Hydrogen Axes" - description = "Nanotrasen is requiring new axes to be made. Ship them some metallic hydrogen helmets." + description = "Nanotrasen is requiring new axes to be made. Ship them 3 metallic hydrogen axes." reward = 7500 required_count = 3 wanted_types = list(/obj/item/fireaxe/metal_h2_axe) diff --git a/code/modules/events/alien_infestation.dm b/code/modules/events/alien_infestation.dm index 15b3fbb981a2..803c07e84431 100644 --- a/code/modules/events/alien_infestation.dm +++ b/code/modules/events/alien_infestation.dm @@ -53,7 +53,7 @@ continue//no parent vent //Stops Aliens getting stuck in small networks. //See: Security, Virology - if(temp_vent_parent.other_atmosmch.len > 20) + if(temp_vent_parent.other_atmos_machines.len > 20) vents += temp_vent if(!vents.len) diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm index 81dbd9c0b9d9..c6dcda3ad61a 100644 --- a/code/modules/events/spacevine.dm +++ b/code/modules/events/spacevine.dm @@ -176,7 +176,7 @@ var/turf/open/floor/T = holder.loc if(istype(T)) var/datum/gas_mixture/GM = T.air - GM.set_moles(/datum/gas/oxygen, max(GM.get_moles(/datum/gas/oxygen) - severity * holder.energy, 0)) + GM.set_moles(GAS_O2, max(GM.get_moles(GAS_O2) - severity * holder.energy, 0)) /datum/spacevine_mutation/nitro_eater name = "nitrogen consuming" @@ -188,7 +188,7 @@ var/turf/open/floor/T = holder.loc if(istype(T)) var/datum/gas_mixture/GM = T.air - GM.set_moles(/datum/gas/nitrogen, max(GM.get_moles(/datum/gas/nitrogen) - severity * holder.energy, 0)) + GM.set_moles(GAS_N2, max(GM.get_moles(GAS_N2) - severity * holder.energy, 0)) /datum/spacevine_mutation/carbondioxide_eater name = "CO2 consuming" @@ -200,7 +200,7 @@ var/turf/open/floor/T = holder.loc if(istype(T)) var/datum/gas_mixture/GM = T.air - GM.set_moles(/datum/gas/carbon_dioxide, max(GM.get_moles(/datum/gas/carbon_dioxide) - severity * holder.energy, 0)) + GM.set_moles(GAS_CO2, max(GM.get_moles(GAS_CO2) - severity * holder.energy, 0)) /datum/spacevine_mutation/plasma_eater name = "toxins consuming" @@ -212,7 +212,7 @@ var/turf/open/floor/T = holder.loc if(istype(T)) var/datum/gas_mixture/GM = T.air - GM.set_moles(/datum/gas/plasma, max(GM.get_moles(/datum/gas/plasma) - severity * holder.energy, 0)) + GM.set_moles(GAS_PLASMA, max(GM.get_moles(GAS_PLASMA) - severity * holder.energy, 0)) /datum/spacevine_mutation/thorns name = "thorny" diff --git a/code/modules/events/spider_infestation.dm b/code/modules/events/spider_infestation.dm index 5a60c6337406..dfb572c42a10 100644 --- a/code/modules/events/spider_infestation.dm +++ b/code/modules/events/spider_infestation.dm @@ -27,7 +27,7 @@ continue if(is_station_level(temp_vent.loc.z) && !temp_vent.welded) var/datum/pipeline/temp_vent_parent = temp_vent.parents[1] - if(temp_vent_parent.other_atmosmch.len > 20) + if(temp_vent_parent.other_atmos_machines.len > 20) vents += temp_vent while((spawncount >= 1) && vents.len) diff --git a/code/modules/goals/station_goals/dna_vault.dm b/code/modules/goals/station_goals/dna_vault.dm index 903124d5e87a..15c0fb761cd2 100644 --- a/code/modules/goals/station_goals/dna_vault.dm +++ b/code/modules/goals/station_goals/dna_vault.dm @@ -261,8 +261,7 @@ to_chat(H, span_notice("You feel resistant to toxins.")) if(locate(/obj/item/organ/lungs) in H.internal_organs) var/obj/item/organ/lungs/L = H.internal_organs_slot[ORGAN_SLOT_LUNGS] - L.tox_breath_dam_min = 0 - L.tox_breath_dam_max = 0 + L.gas_max -= GAS_PLASMA ADD_TRAIT(H, TRAIT_VIRUSIMMUNE, "dna_vault") P.tox_mod *= 0.2 H.dna.species.acidmod *= 0.2 //Remind me to move this to physiolgy later - Mqiib diff --git a/code/modules/holiday/pride.dm b/code/modules/holiday/pride.dm index 212a45aaf1fa..6cee794b5f56 100644 --- a/code/modules/holiday/pride.dm +++ b/code/modules/holiday/pride.dm @@ -10,7 +10,7 @@ /datum/holiday/pride/proc/become_gay_destroyer_of_worlds() for(var/i in 1 to FACTOR_GAS_VISIBLE_MAX) //I DON'T LIKE EM PUTTING CHEMICALS IN THE GAS THAT TURN THE FRIGGIN PLASMA GAY! - var/obj/effect/overlay/gas/G = GLOB.meta_gas_info[/datum/gas/plasma][META_GAS_OVERLAY][i] + var/obj/effect/overlay/gas/G = GLOB.gas_data.overlays[GAS_PLASMA][i] G.icon_state = "pridesma" animate(G, color = rgb(255, 0, 0), time = 5, loop = -1) animate(color = rgb(0, 255, 0), time = 5, loop = -1) diff --git a/code/modules/holodeck/area_copy.dm b/code/modules/holodeck/area_copy.dm index c063330a60a1..cc92d7637050 100644 --- a/code/modules/holodeck/area_copy.dm +++ b/code/modules/holodeck/area_copy.dm @@ -67,7 +67,7 @@ copiedobjs += SM.get_all_contents() for(var/V in T.vars - GLOB.duplicate_forbidden_vars) - if(V == "air") + if(V == "air" && SSair.initialized) var/turf/open/O1 = B var/turf/open/O2 = T O1.air.copy_from(O2.return_air()) @@ -77,8 +77,6 @@ if(toupdate.len) for(var/turf/T1 in toupdate) - CALCULATE_ADJACENT_TURFS(T1) - SSair.add_to_active(T1,1) - + T1.ImmediateCalculateAdjacentTurfs() return copiedobjs diff --git a/code/modules/holodeck/holo_effect.dm b/code/modules/holodeck/holo_effect.dm index a85d20bbeed6..3baa3e10ceea 100644 --- a/code/modules/holodeck/holo_effect.dm +++ b/code/modules/holodeck/holo_effect.dm @@ -61,7 +61,7 @@ var/datum/effect_system/spark_spread/s = new s.set_up(3, 1, T) s.start() - T.temperature = 5000 + T.set_temperature(5000) T.hotspot_expose(50000,50000,1) diff --git a/code/modules/hydroponics/grown/misc.dm b/code/modules/hydroponics/grown/misc.dm index 9c72886a82d4..4efa0c1a92aa 100644 --- a/code/modules/hydroponics/grown/misc.dm +++ b/code/modules/hydroponics/grown/misc.dm @@ -57,10 +57,9 @@ return var/datum/gas_mixture/stank = new - stank.set_moles(/datum/gas/miasma, (yield + 6) * 3.5 * MIASMA_CORPSE_MOLES * delta_time) // this process is only being called about 2/7 as much as corpses so this is 12-32 times a corpses + stank.set_moles(GAS_MIASMA, (yield + 6) * 3.5 * MIASMA_CORPSE_MOLES * delta_time) // this process is only being called about 2/7 as much as corpses so this is 12-32 times a corpses stank.set_temperature(T20C) // without this the room would eventually freeze and miasma mining would be easier T.assume_air(stank) - T.air_update_turf() //Galaxy Thistle /obj/item/seeds/galaxythistle diff --git a/code/modules/hydroponics/grown/towercap.dm b/code/modules/hydroponics/grown/towercap.dm index 2de2723478c7..9bf186af6b50 100644 --- a/code/modules/hydroponics/grown/towercap.dm +++ b/code/modules/hydroponics/grown/towercap.dm @@ -231,7 +231,7 @@ if(isopenturf(loc)) var/turf/open/O = loc if(O.air) - if(O.air.get_moles(/datum/gas/oxygen) > 13) + if(O.air.get_moles(GAS_O2) > 13) return TRUE return FALSE diff --git a/code/modules/mapping/map_template.dm b/code/modules/mapping/map_template.dm index 3d0a0d2d11cf..7a5695b82748 100644 --- a/code/modules/mapping/map_template.dm +++ b/code/modules/mapping/map_template.dm @@ -102,7 +102,7 @@ ) ) for(var/turf/affected_turf as anything in template_and_bordering_turfs) - affected_turf.air_update_turf(TRUE, TRUE) + affected_turf.ImmediateCalculateAdjacentTurfs() affected_turf.levelupdate() /datum/map_template/proc/load_new_z(secret = FALSE) diff --git a/code/modules/mining/equipment/survival_pod.dm b/code/modules/mining/equipment/survival_pod.dm index 60b0461a89f0..6ac39cf910ad 100644 --- a/code/modules/mining/equipment/survival_pod.dm +++ b/code/modules/mining/equipment/survival_pod.dm @@ -275,7 +275,7 @@ /obj/structure/fans/Initialize(mapload) . = ..() - air_update_turf(1) + air_update_turf() //Inivisible, indestructible fans /obj/structure/fans/tiny/invisible diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm index 91d423d199f4..b468e9223cdc 100644 --- a/code/modules/mob/living/carbon/alien/life.dm +++ b/code/modules/mob/living/carbon/alien/life.dm @@ -15,20 +15,20 @@ var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.return_temperature())/BREATH_VOLUME //Partial pressure of the toxins in our breath - var/Toxins_pp = (breath.get_moles(/datum/gas/plasma)/breath.total_moles())*breath_pressure + var/Toxins_pp = (breath.get_moles(GAS_PLASMA)/breath.total_moles())*breath_pressure if(Toxins_pp > tox_detect_threshold) // Detect toxins in air - adjustPlasma(breath.get_moles(/datum/gas/plasma)*250) + adjustPlasma(breath.get_moles(GAS_PLASMA)*250) throw_alert("alien_tox", /atom/movable/screen/alert/alien_tox) - toxins_used = breath.get_moles(/datum/gas/plasma) + toxins_used = breath.get_moles(GAS_PLASMA) else clear_alert("alien_tox") //Breathe in toxins and out oxygen - breath.adjust_moles(/datum/gas/plasma, -toxins_used) - breath.adjust_moles(/datum/gas/oxygen, toxins_used) + breath.adjust_moles(GAS_PLASMA, -toxins_used) + breath.adjust_moles(GAS_O2, 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 571facfad919..4a8513f0d559 100644 --- a/code/modules/mob/living/carbon/human/species.dm +++ b/code/modules/mob/living/carbon/human/species.dm @@ -1973,8 +1973,8 @@ GLOBAL_LIST_EMPTY(features_by_species) if(istype(human_loc, /obj/machinery/atmospherics/components/unary/cryo_cell)) return - if(environment.get_moles(/datum/gas/water_vapor) > 10)//water vapour above a certain amount makes you wet - if(environment.get_moles(/datum/gas/water_vapor) > 40)//if there's a lot of water vapour, preterni ded + if(environment.get_moles(GAS_H2O) > 10)//water vapour above a certain amount makes you wet + if(environment.get_moles(GAS_H2O) > 40)//if there's a lot of water vapour, preterni ded H.adjust_wet_stacks(3) else H.adjust_wet_stacks(2) diff --git a/code/modules/mob/living/carbon/human/species_types/plasmamen.dm b/code/modules/mob/living/carbon/human/species_types/plasmamen.dm index 81adae64a74e..c1e0798cd2d2 100644 --- a/code/modules/mob/living/carbon/human/species_types/plasmamen.dm +++ b/code/modules/mob/living/carbon/human/species_types/plasmamen.dm @@ -47,7 +47,7 @@ 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.total_moles()) - if(environment.get_moles(/datum/gas/oxygen) >= 1) //Same threshhold that extinguishes fire + if(environment.get_moles(GAS_O2) >= 1) //Same threshhold that extinguishes fire H.adjust_fire_stacks(0.5) if(!H.on_fire && H.fire_stacks > 0) H.visible_message(span_danger("[H]'s body reacts with the atmosphere and bursts into flames!"),span_userdanger("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 1cb873615047..0d36713e6a8b 100644 --- a/code/modules/mob/living/carbon/life.dm +++ b/code/modules/mob/living/carbon/life.dm @@ -113,21 +113,22 @@ breath = loc_as_obj.handle_internal_lifeform(src, BREATH_VOLUME) else if(isturf(loc)) //Breathe from loc as turf - var/breath_moles = 0 + var/breath_ratio = 0 if(environment) - breath_moles = environment.total_moles()*BREATH_PERCENTAGE + breath_ratio = BREATH_VOLUME/environment.return_volume() - breath = loc.remove_air(breath_moles) + breath = loc.remove_air_ratio(breath_ratio) else //Breathe from loc as obj again if(istype(loc, /obj/)) var/obj/loc_as_obj = loc loc_as_obj.handle_internal_lifeform(src,0) + if(breath) + breath.set_volume(BREATH_VOLUME) check_breath(breath) if(breath) loc.assume_air(breath) - air_update_turf() /mob/living/carbon/proc/has_smoke_protection() if(HAS_TRAIT(src, TRAIT_NOBREATH)) @@ -162,11 +163,13 @@ var/SA_para_min = 1 var/SA_sleep_min = 5 var/oxygen_used = 0 - var/breath_pressure = (breath.total_moles()*R_IDEAL_GAS_EQUATION*breath.return_temperature())/BREATH_VOLUME + var/moles = breath.total_moles() - var/O2_partialpressure = (breath.get_moles(/datum/gas/oxygen)/breath.total_moles())*breath_pressure - var/Toxins_partialpressure = (breath.get_moles(/datum/gas/plasma)/breath.total_moles())*breath_pressure - var/CO2_partialpressure = (breath.get_moles(/datum/gas/carbon_dioxide)/breath.total_moles())*breath_pressure + + var/breath_pressure = (moles*R_IDEAL_GAS_EQUATION*breath.return_temperature())/BREATH_VOLUME + var/O2_partialpressure = ((breath.get_moles(GAS_O2)/moles)*breath_pressure) + (((breath.get_moles(GAS_PLUOXIUM)*8)/moles)*breath_pressure) + var/Toxins_partialpressure = (breath.get_moles(GAS_PLASMA)/moles)*breath_pressure + var/CO2_partialpressure = (breath.get_moles(GAS_CO2)/moles)*breath_pressure //OXYGEN @@ -177,7 +180,7 @@ var/ratio = 1 - O2_partialpressure/safe_oxy_min adjustOxyLoss(min(5*ratio, 3)) failed_last_breath = 1 - oxygen_used = breath.get_moles(/datum/gas/oxygen)*ratio + oxygen_used = breath.get_moles(GAS_O2)*ratio else adjustOxyLoss(3) failed_last_breath = 1 @@ -187,11 +190,11 @@ failed_last_breath = 0 if(health >= crit_threshold) adjustOxyLoss(-5) - oxygen_used = breath.get_moles(/datum/gas/oxygen) + oxygen_used = breath.get_moles(GAS_O2) clear_alert("not_enough_oxy") - breath.adjust_moles(/datum/gas/oxygen, -oxygen_used) - breath.adjust_moles(/datum/gas/carbon_dioxide, oxygen_used) + breath.adjust_moles(GAS_O2, -oxygen_used) + breath.adjust_moles(GAS_CO2, oxygen_used) //CARBON DIOXIDE if(CO2_partialpressure > safe_co2_max) @@ -210,15 +213,15 @@ //TOXINS/PLASMA if(Toxins_partialpressure > safe_tox_max) - var/ratio = (breath.get_moles(/datum/gas/plasma)/safe_tox_max) * 10 + var/ratio = (breath.get_moles(GAS_PLASMA)/safe_tox_max) * 10 adjustToxLoss(clamp(ratio, MIN_TOXIC_GAS_DAMAGE, MAX_TOXIC_GAS_DAMAGE)) throw_alert("too_much_tox", /atom/movable/screen/alert/too_much_tox) else clear_alert("too_much_tox") //NITROUS OXIDE - if(breath.get_moles(/datum/gas/nitrous_oxide)) - var/SA_partialpressure = (breath.get_moles(/datum/gas/nitrous_oxide)/breath.total_moles())*breath_pressure + if(breath.get_moles(GAS_NITROUS)) + var/SA_partialpressure = (breath.get_moles(GAS_NITROUS)/breath.total_moles())*breath_pressure if(SA_partialpressure > SA_para_min) Unconscious(60) if(SA_partialpressure > SA_sleep_min) @@ -232,8 +235,8 @@ //yogs start -- Adds Nitrogen Narcosis https://en.wikipedia.org/wiki/Nitrogen_narcosis //NITROGEN - if(breath.get_moles(/datum/gas/nitrogen)) - var/SA_partialpressure = (breath.get_moles(/datum/gas/nitrogen)/breath.total_moles())*breath_pressure + if(breath.get_moles(GAS_N2)) + var/SA_partialpressure = (breath.get_moles(GAS_N2)/breath.total_moles())*breath_pressure if(SA_partialpressure > NITROGEN_NARCOSIS_PRESSURE_LOW) // Giggles if(prob(20)) emote(pick("giggle","laugh")) @@ -244,8 +247,8 @@ adjust_hallucinations(5 SECONDS) //yogs end //BZ (Facepunch port of their Agent B) - if(breath.get_moles(/datum/gas/bz)) - var/bz_partialpressure = (breath.get_moles(/datum/gas/bz)/breath.total_moles())*breath_pressure + if(breath.get_moles(GAS_BZ)) + var/bz_partialpressure = (breath.get_moles(GAS_BZ)/breath.total_moles())*breath_pressure /* Yogs comment-out: Smoothed BZ hallucination levels if(bz_partialpressure > 1) adjust_hallucinations(10 SECONDS) @@ -255,18 +258,18 @@ adjust_hallucinations(round(BZ_MAX_HALLUCINATION * (1 - NUM_E ** (-BZ_LAMBDA * bz_partialpressure)))) // Yogs -- Better BZ hallucination values. Keep in mind that hallucination has to be an integer value, due to how it's handled in handle_hallucination() //TRITIUM - if(breath.get_moles(/datum/gas/tritium)) - var/tritium_partialpressure = (breath.get_moles(/datum/gas/tritium)/breath.total_moles())*breath_pressure + if(breath.get_moles(GAS_TRITIUM)) + var/tritium_partialpressure = (breath.get_moles(GAS_TRITIUM)/breath.total_moles())*breath_pressure radiation += tritium_partialpressure/10 //FREON - if(breath.get_moles(/datum/gas/freon)) - var/freon_partialpressure = (breath.get_moles(/datum/gas/freon)/breath.total_moles())*breath_pressure + if(breath.get_moles(GAS_FREON)) + var/freon_partialpressure = (breath.get_moles(GAS_FREON)/breath.total_moles())*breath_pressure adjustFireLoss(freon_partialpressure * 0.25) //MIASMA - if(breath.get_moles(/datum/gas/miasma)) - var/miasma_partialpressure = (breath.get_moles(/datum/gas/miasma)/breath.total_moles())*breath_pressure + if(breath.get_moles(GAS_MIASMA)) + var/miasma_partialpressure = (breath.get_moles(GAS_MIASMA)/breath.total_moles())*breath_pressure if(prob(1 * miasma_partialpressure)) var/datum/disease/advance/miasma_disease = new /datum/disease/advance/random(2,3) diff --git a/code/modules/mob/living/living.dm b/code/modules/mob/living/living.dm index 120de23ca684..89c0bb786fc8 100644 --- a/code/modules/mob/living/living.dm +++ b/code/modules/mob/living/living.dm @@ -941,7 +941,7 @@ loc_temp = obj_temp else if(isspaceturf(get_turf(src))) var/turf/heat_turf = get_turf(src) - loc_temp = heat_turf.temperature + loc_temp = heat_turf.return_temperature() return loc_temp /mob/living/proc/get_standard_pixel_x_offset(lying = 0) diff --git a/code/modules/mob/living/silicon/ai/decentralized/_ai_machinery.dm b/code/modules/mob/living/silicon/ai/decentralized/_ai_machinery.dm index 785606f8b3f2..51dea1064c3a 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/_ai_machinery.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/_ai_machinery.dm @@ -8,30 +8,36 @@ icon = 'icons/obj/machines/research.dmi' icon_state = "RD-server-on" density = TRUE + ///Temperature of the ai core itself, this will share with air in the enviroment + var/core_temp = 193.15 /obj/machinery/ai/Initialize(mapload) . = ..() - - SSair.atmos_machinery += src + START_PROCESSING(SSmachines, src) + SSair_machinery.start_processing_machine(src) + +//Cooling happens here +/obj/machinery/ai/process_atmos() + var/turf/T = get_turf(src) + if(!T) + return + if(isspaceturf(T)) + return + var/datum/gas_mixture/env = T.return_air() + if(!env) + return + var/new_temp = env.temperature_share(AI_HEATSINK_COEFF, core_temp, AI_HEATSINK_CAPACITY) + core_temp = new_temp /obj/machinery/ai/Destroy() . = ..() - - SSair.atmos_machinery -= src + SSair_machinery.stop_processing_machine(src) + STOP_PROCESSING(SSmachines, src) /obj/machinery/ai/proc/valid_holder() if(stat & (BROKEN|EMPED) || !has_power()) return FALSE - - var/turf/T = get_turf(src) - var/datum/gas_mixture/env = T.return_air() - if(!env) - return FALSE - var/total_moles = env.total_moles() - if(istype(T, /turf/open/space) || total_moles < 10) - return FALSE - - if(env.return_temperature() > GLOB.ai_os.get_temp_limit() || !env.heat_capacity()) + if(core_temp > GLOB.ai_os.get_temp_limit()) return FALSE return TRUE @@ -41,15 +47,6 @@ /obj/machinery/ai/proc/get_holder_status() if(stat & (BROKEN|NOPOWER|EMPED)) return FALSE - - var/turf/T = get_turf(src) - var/datum/gas_mixture/env = T.return_air() - if(!env) - return AI_MACHINE_NO_MOLES - var/total_moles = env.total_moles() - if(istype(T, /turf/open/space) || total_moles < 10) - return AI_MACHINE_NO_MOLES - - if(env.return_temperature() > GLOB.ai_os.get_temp_limit() || !env.heat_capacity()) + if(core_temp > GLOB.ai_os.get_temp_limit()) return AI_MACHINE_TOO_HOT \ No newline at end of file diff --git a/code/modules/mob/living/silicon/ai/decentralized/ai_data_core.dm b/code/modules/mob/living/silicon/ai/decentralized/ai_data_core.dm index e2dc2308877f..cd77f9b70ad8 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/ai_data_core.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/ai_data_core.dm @@ -59,8 +59,42 @@ GLOBAL_VAR_INIT(primary_data_core, null) power_modifier = new_power_mod active_power_usage = AI_DATA_CORE_POWER_USAGE * power_modifier -/obj/machinery/ai/data_core/process_atmos() - calculate_validity() +/obj/machinery/ai/data_core/process() + valid_ticks = clamp(valid_ticks, 0, MAX_AI_DATA_CORE_TICKS) + + if(valid_holder()) + valid_ticks++ + if(valid_ticks == 1) + update_icon() + use_power = ACTIVE_POWER_USE + if((stat & NOPOWER)) + integrated_battery.use(active_power_usage * CELL_POWERUSE_MULTIPLIER) + warning_sent = FALSE + else + valid_ticks-- + if(valid_ticks <= 0) + use_power = IDLE_POWER_USE + update_icon() + for(var/mob/living/silicon/ai/AI in contents) + if(!AI.is_dying) + AI.relocate() + if(!warning_sent && COOLDOWN_FINISHED(src, warning_cooldown)) + warning_sent = TRUE + COOLDOWN_START(src, warning_cooldown, AI_DATA_CORE_WARNING_COOLDOWN) + var/list/send_to = GLOB.ai_list.Copy() + for(var/mob/living/silicon/ai/AI in send_to) + if(AI.is_dying) + continue + if(!AI.mind && AI.deployed_shell.mind) + to_chat(AI.deployed_shell, span_userdanger("Data core in [get_area(src)] is on the verge of failing! Immediate action required to prevent failure.")) + else + to_chat(AI, span_userdanger("Data core in [get_area(src)] is on the verge of failing! Immediate action required to prevent failure.")) + AI.playsound_local(AI, 'sound/machines/engine_alert2.ogg', 30) + + if(!(stat & (BROKEN|EMPED)) && has_power() && !disableheat) + var/temp_active_usage = stat & NOPOWER ? active_power_usage * CELL_POWERUSE_MULTIPLIER : active_power_usage + var/temperature_increase = (temp_active_usage / AI_HEATSINK_CAPACITY) * heat_modifier //1 CPU = 1000W. Heat capacity = somewhere around 3000-4000. Aka we generate 0.25 - 0.33 K per second, per CPU. + core_temp += temperature_increase * AI_TEMPERATURE_MULTIPLIER /obj/machinery/ai/data_core/Destroy() GLOB.data_cores -= src @@ -126,6 +160,7 @@ GLOBAL_VAR_INIT(primary_data_core, null) . += span_warning("Machinery non-functional. Reason: [holder_status]") if(!isobserver(user)) return + . += "Core temperature: [core_temp] K" . += "Networked AI Laws:" for(var/mob/living/silicon/ai/AI in GLOB.ai_list) var/active_status = "(Core: [FOLLOW_LINK(user, AI.loc)], Eye: [FOLLOW_LINK(user, AI.eyeobj)])" diff --git a/code/modules/mob/living/silicon/ai/decentralized/management/ai_dashboard.dm b/code/modules/mob/living/silicon/ai/decentralized/management/ai_dashboard.dm index 8aa136fe96b1..8a4d7bc023cd 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/management/ai_dashboard.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/management/ai_dashboard.dm @@ -87,8 +87,8 @@ data["location_name"] = get_area(current_turf) data["location_coords"] = "[current_turf.x], [current_turf.y], [current_turf.z]" - var/datum/gas_mixture/env = current_turf.return_air() - data["temperature"] = env.return_temperature() + var/obj/machinery/ai/current_machine = owner.loc + data["temperature"] = current_machine.core_temp ? current_machine.core_temp : 0 for(var/datum/ai_project/AP as anything in available_projects) data["available_projects"] += list(list("name" = AP.name, "description" = AP.description, "ram_required" = AP.ram_required, "available" = AP.canResearch(), "research_cost" = AP.research_cost, "research_progress" = AP.research_progress, diff --git a/code/modules/mob/living/silicon/ai/decentralized/server_cabinet.dm b/code/modules/mob/living/silicon/ai/decentralized/server_cabinet.dm index 64b2fca5cd33..5f283cdda954 100644 --- a/code/modules/mob/living/silicon/ai/decentralized/server_cabinet.dm +++ b/code/modules/mob/living/silicon/ai/decentralized/server_cabinet.dm @@ -64,18 +64,14 @@ GLOBAL_LIST_EMPTY(server_cabinets) idle_power_usage = initial(idle_power_usage) * power_modifier -/obj/machinery/ai/server_cabinet/process_atmos() +/obj/machinery/ai/server_cabinet/process() valid_ticks = clamp(valid_ticks, 0, MAX_AI_EXPANSION_TICKS) if(valid_holder()) var/total_usage = (cached_power_usage * power_modifier) use_power(total_usage) - var/turf/T = get_turf(src) - var/datum/gas_mixture/env = T.return_air() - if(env.heat_capacity()) - var/temperature_increase = (total_usage / env.heat_capacity()) * heat_modifier - env.set_temperature(env.return_temperature() + temperature_increase * AI_TEMPERATURE_MULTIPLIER) //assume all input power is dissipated - T.air_update_turf() + var/temperature_increase = (total_usage / AI_HEATSINK_CAPACITY)* heat_modifier + core_temp += temperature_increase * AI_TEMPERATURE_MULTIPLIER valid_ticks++ if(!was_valid_holder) diff --git a/code/modules/mob/living/silicon/pai/software.dm b/code/modules/mob/living/silicon/pai/software.dm index a54c85a9c65c..2a80f54cd220 100644 --- a/code/modules/mob/living/silicon/pai/software.dm +++ b/code/modules/mob/living/silicon/pai/software.dm @@ -573,7 +573,7 @@ for(var/id in environment.get_gases()) var/gas_level = environment.get_moles(id)/total_moles if(gas_level > 0.01) - dat += "[GLOB.meta_gas_info[id][META_GAS_NAME]]: [round(gas_level*100)]%
" + dat += "[GLOB.gas_data.names[id]]: [round(gas_level*100)]%
" dat += "Temperature: [round(environment.return_temperature()-T0C)]°C
" dat += "Refresh Reading
" dat += "
" diff --git a/code/modules/mob/living/simple_animal/bot/atmosbot.dm b/code/modules/mob/living/simple_animal/bot/atmosbot.dm index 8f08df2f4041..6c5ad5917052 100644 --- a/code/modules/mob/living/simple_animal/bot/atmosbot.dm +++ b/code/modules/mob/living/simple_animal/bot/atmosbot.dm @@ -136,7 +136,7 @@ return ATMOSBOT_CHECK_BREACH //Too little oxygen or too little pressure var/partial_pressure = R_IDEAL_GAS_EQUATION * gas_mix.return_temperature() / gas_mix.return_volume() - var/oxygen_moles = gas_mix.get_moles(/datum/gas/oxygen) * partial_pressure + var/oxygen_moles = gas_mix.get_moles(GAS_O2) * partial_pressure if(oxygen_moles < 20 || gas_mix.return_pressure() < WARNING_LOW_PRESSURE) return ATMOSBOT_LOW_OXYGEN diff --git a/code/modules/mob/living/simple_animal/bot/mulebot.dm b/code/modules/mob/living/simple_animal/bot/mulebot.dm index bbdc13985fc1..e5ab5179cd00 100644 --- a/code/modules/mob/living/simple_animal/bot/mulebot.dm +++ b/code/modules/mob/living/simple_animal/bot/mulebot.dm @@ -726,6 +726,11 @@ else return null +/mob/living/simple_animal/bot/mulebot/remove_air_ratio(ratio) + if(loc) + return loc.remove_air_ratio(ratio) + return null + /mob/living/simple_animal/bot/mulebot/resist() ..() if(load) diff --git a/code/modules/mob/living/simple_animal/hostile/regalrat.dm b/code/modules/mob/living/simple_animal/hostile/regalrat.dm index c117420b0f4d..8aee2da1ca0e 100644 --- a/code/modules/mob/living/simple_animal/hostile/regalrat.dm +++ b/code/modules/mob/living/simple_animal/hostile/regalrat.dm @@ -72,9 +72,9 @@ /mob/living/simple_animal/hostile/regalrat/handle_environment(datum/gas_mixture/environment) . = ..() - if(stat == DEAD || !environment || !environment.get_moles(/datum/gas/miasma)) + if(stat == DEAD || !environment || !environment.get_moles(GAS_MIASMA)) return - var/miasma_percentage = environment.get_moles(/datum/gas/miasma)/environment.total_moles() + var/miasma_percentage = environment.get_moles(GAS_MIASMA)/environment.total_moles() if(miasma_percentage>=0.25) heal_bodypart_damage(1) diff --git a/code/modules/mob/living/simple_animal/hostile/tree.dm b/code/modules/mob/living/simple_animal/hostile/tree.dm index a96caddca1a5..09c283adafe2 100644 --- a/code/modules/mob/living/simple_animal/hostile/tree.dm +++ b/code/modules/mob/living/simple_animal/hostile/tree.dm @@ -46,12 +46,12 @@ if(isopenturf(loc)) var/turf/open/T = src.loc if(T.air) - var/co2 = T.air.get_moles(/datum/gas/carbon_dioxide) + var/co2 = T.air.get_moles(GAS_CO2) if(co2 > 0) if(prob(25)) var/amt = min(co2, 9) - T.air.adjust_moles(/datum/gas/carbon_dioxide, -amt) - T.atmos_spawn_air("o2=[amt]") + T.air.adjust_moles(GAS_CO2, -amt) + T.atmos_spawn_air("o2=[amt];TEMP=293.15") /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 f8739d65a3d1..2294a6799169 100644 --- a/code/modules/mob/living/simple_animal/simple_animal.dm +++ b/code/modules/mob/living/simple_animal/simple_animal.dm @@ -227,10 +227,10 @@ var/turf/open/ST = src.loc if(ST.air) - var/tox = ST.air.get_moles(/datum/gas/plasma) - var/oxy = ST.air.get_moles(/datum/gas/oxygen) - var/n2 = ST.air.get_moles(/datum/gas/nitrogen) - var/co2 = ST.air.get_moles(/datum/gas/carbon_dioxide) + var/tox = ST.air.get_moles(GAS_PLASMA) + var/oxy = ST.air.get_moles(GAS_O2) + var/n2 = ST.air.get_moles(GAS_N2) + var/co2 = ST.air.get_moles(GAS_CO2) if(atmos_requirements["min_oxy"] && oxy < atmos_requirements["min_oxy"]) . = FALSE diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm index e6986611d0cd..51d9095a115f 100644 --- a/code/modules/mob/living/simple_animal/slime/life.dm +++ b/code/modules/mob/living/simple_animal/slime/life.dm @@ -134,7 +134,7 @@ Tempstun = 0 if(stat != DEAD) - var/bz_percentage = environment.total_moles() ? (environment.get_moles(/datum/gas/bz) / environment.total_moles()) : 0 + var/bz_percentage = environment.total_moles() ? (environment.get_moles(GAS_BZ) / environment.total_moles()) : 0 var/stasis = (bz_percentage >= 0.05 && bodytemperature < (T0C + 100)) || force_stasis if(stat == CONSCIOUS && stasis) diff --git a/code/modules/mob/living/ventcrawling.dm b/code/modules/mob/living/ventcrawling.dm index 33e5cc3d4d90..370d71ff8850 100644 --- a/code/modules/mob/living/ventcrawling.dm +++ b/code/modules/mob/living/ventcrawling.dm @@ -46,7 +46,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, typecacheof(list( if(vent_found) var/datum/pipeline/vent_found_parent = vent_found.parents[1] - if(vent_found_parent && (vent_found_parent.members.len || vent_found_parent.other_atmosmch)) + if(vent_found_parent && (vent_found_parent.members.len || vent_found_parent.other_atmos_machines)) visible_message(span_notice("[src] begins climbing into the ventilation system...") ,span_notice("You begin climbing into the ventilation system...")) if(!do_after(src, 2.5 SECONDS, vent_found)) @@ -97,7 +97,7 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, typecacheof(list( for(var/datum/pipeline/P in starting_machine.return_pipenets()) totalMembers += P.members - totalMembers += P.other_atmosmch + totalMembers += P.other_atmos_machines if(!totalMembers.len) return diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm index c93719de7ff2..399aa3e7786d 100644 --- a/code/modules/mob/mob.dm +++ b/code/modules/mob/mob.dm @@ -176,7 +176,7 @@ t += span_danger("Temperature: [environment.return_temperature()] \n") for(var/id in environment.get_gases()) if(environment.get_moles(id)) - t+=span_notice("[GLOB.meta_gas_info[id][META_GAS_NAME]]: [environment.get_moles(id)] \n") + t+=span_notice("[GLOB.gas_data.names[id]]: [environment.get_moles(id)] \n") to_chat(usr, t) diff --git a/code/modules/modular_computers/file_system/programs/engineering/atmosscan.dm b/code/modules/modular_computers/file_system/programs/engineering/atmosscan.dm index eafb14402b45..753057bc9c33 100644 --- a/code/modules/modular_computers/file_system/programs/engineering/atmosscan.dm +++ b/code/modules/modular_computers/file_system/programs/engineering/atmosscan.dm @@ -34,7 +34,7 @@ var/moles = environment.get_moles(id) var/gas_level = moles/total_moles if(gas_level > 0) - airlist += list(list("name" = "[GLOB.meta_gas_info[id][META_GAS_NAME]]", "percentage" = round(gas_level*100, 0.01))) + airlist += list(list("name" = "[GLOB.gas_data.names[id]]", "percentage" = round(gas_level*100, 0.01))) data["AirData"] = airlist else data["AirPressure"] = 0 diff --git a/code/modules/modular_computers/file_system/programs/engineering/sm_monitor.dm b/code/modules/modular_computers/file_system/programs/engineering/sm_monitor.dm index c4afd769d205..c302d0d4e580 100644 --- a/code/modules/modular_computers/file_system/programs/engineering/sm_monitor.dm +++ b/code/modules/modular_computers/file_system/programs/engineering/sm_monitor.dm @@ -154,17 +154,17 @@ for(var/gasid in air.get_gases()) if(data_corrupted) gasdata.Add(list(list( - "name"= GLOB.meta_gas_info[gasid][META_GAS_NAME], + "name"= GLOB.gas_data.names[gasid], "amount" = round(rand()*100,0.01)))) else gasdata.Add(list(list( - "name"= GLOB.meta_gas_info[gasid][META_GAS_NAME], + "name"= GLOB.gas_data.names[gasid], "amount" = round(100*air.get_moles(gasid)/air.total_moles(),0.01)))) else for(var/gasid in air.get_gases()) gasdata.Add(list(list( - "name"= GLOB.meta_gas_info[gasid][META_GAS_NAME], + "name"= GLOB.gas_data.names[gasid], "amount" = 0))) data["gases"] = gasdata diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm index 5fdb7e9646cf..43f7e4347f63 100644 --- a/code/modules/power/generator.dm +++ b/code/modules/power/generator.dm @@ -21,14 +21,16 @@ . = ..() find_circs() connect_to_network() - SSair.atmos_machinery += src + SSair_machinery.start_processing_machine(src) + START_PROCESSING(SSmachines, src) update_appearance(UPDATE_ICON) component_parts = list(new /obj/item/circuitboard/machine/generator) AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS ) /obj/machinery/power/generator/Destroy() kill_circs() - SSair.atmos_machinery -= src + SSair_machinery.stop_processing_machine(src) + STOP_PROCESSING(SSmachines, src) return ..() /obj/machinery/power/generator/update_icon_state() @@ -120,7 +122,8 @@ lastgenlev = power_output lastgen -= power_output lastgen = max(lastgen, 0) - ..() + update_icon() + src.updateDialog() /obj/machinery/power/generator/proc/get_menu(include_link = TRUE) var/t = "" diff --git a/code/modules/power/reactor/reactor.dm b/code/modules/power/reactor/reactor.dm index 5874490f5f25..e0a8597112e2 100644 --- a/code/modules/power/reactor/reactor.dm +++ b/code/modules/power/reactor/reactor.dm @@ -307,14 +307,14 @@ if(active && moderator_input.total_moles() >= minimum_coolant_level) // Fuel types: increases power and K var/total_fuel_moles = 0 - total_fuel_moles += moderator_input.get_moles(/datum/gas/plasma) * PLASMA_FUEL_POWER - total_fuel_moles += moderator_input.get_moles(/datum/gas/tritium) * TRITIUM_FUEL_POWER - total_fuel_moles += moderator_input.get_moles(/datum/gas/antinoblium) * ANTINOBLIUM_FUEL_POWER + total_fuel_moles += moderator_input.get_moles(GAS_PLASMA) * PLASMA_FUEL_POWER + total_fuel_moles += moderator_input.get_moles(GAS_TRITIUM) * TRITIUM_FUEL_POWER + total_fuel_moles += moderator_input.get_moles(GAS_ANTINOB) * ANTINOBLIUM_FUEL_POWER // Power modifier types: increases fuel effectiveness var/power_mod_moles = 0 - power_mod_moles += moderator_input.get_moles(/datum/gas/oxygen) * OXYGEN_POWER_MOD - power_mod_moles += moderator_input.get_moles(/datum/gas/hydrogen) * HYDROGEN_POWER_MOD + power_mod_moles += moderator_input.get_moles(GAS_O2) * OXYGEN_POWER_MOD + power_mod_moles += moderator_input.get_moles(GAS_H2) * HYDROGEN_POWER_MOD // Now make some actual power! if(total_fuel_moles >= minimum_coolant_level) //You at least need SOME fuel. @@ -322,39 +322,39 @@ var/power_modifier = max(power_mod_moles * 10 / moderator_input.total_moles(), 1) //You can never have negative IPM. For now. power_produced = max(0,((fuel_power*power_modifier)*moderator_input.total_moles())) / delta_time if(active) - coolant_output.adjust_moles(/datum/gas/pluonium, total_fuel_moles/20) //Shove out pluonium into the air when it's fuelled. You need to filter this off, or you're gonna have a bad time. + coolant_output.adjust_moles(GAS_PLUONIUM, total_fuel_moles/20) //Shove out pluonium into the air when it's fuelled. You need to filter this off, or you're gonna have a bad time. // Control types: increases control of K var/total_control_moles = 0 - total_control_moles += moderator_input.get_moles(/datum/gas/nitrogen) * NITROGEN_CONTROL_MOD - total_control_moles += moderator_input.get_moles(/datum/gas/carbon_dioxide) * CARBON_CONTROL_MOD - total_control_moles += moderator_input.get_moles(/datum/gas/pluoxium) * PLUOXIUM_CONTROL_MOD + total_control_moles += moderator_input.get_moles(GAS_N2) * NITROGEN_CONTROL_MOD + total_control_moles += moderator_input.get_moles(GAS_CO2) * CARBON_CONTROL_MOD + total_control_moles += moderator_input.get_moles(GAS_PLUOXIUM) * PLUOXIUM_CONTROL_MOD if(total_control_moles >= minimum_coolant_level) var/control_bonus = total_control_moles / REACTOR_CONTROL_FACTOR //1 mol of n2 -> 0.002 bonus control rod effectiveness, if you want a super controlled reaction, you'll have to sacrifice some power. control_rod_effectiveness = initial(control_rod_effectiveness) + control_bonus // Permeability types: increases cooling efficiency var/total_permeability_moles = 0 - total_permeability_moles += moderator_input.get_moles(/datum/gas/bz) * BZ_PERMEABILITY_MOD - total_permeability_moles += moderator_input.get_moles(/datum/gas/water_vapor) * WATER_PERMEABILITY_MOD - total_permeability_moles += moderator_input.get_moles(/datum/gas/hypernoblium) * NOBLIUM_PERMEABILITY_MOD + total_permeability_moles += moderator_input.get_moles(GAS_BZ) * BZ_PERMEABILITY_MOD + total_permeability_moles += moderator_input.get_moles(GAS_H2O) * WATER_PERMEABILITY_MOD + total_permeability_moles += moderator_input.get_moles(GAS_HYPERNOB) * NOBLIUM_PERMEABILITY_MOD if(total_permeability_moles >= minimum_coolant_level) gas_absorption_effectiveness = clamp(gas_absorption_constant + (total_permeability_moles / REACTOR_PERMEABILITY_FACTOR), 0, 1) // Radiation types: increases radiation - radioactivity_spice_multiplier += moderator_input.get_moles(/datum/gas/nitrogen) * NITROGEN_RAD_MOD //An example setup of 50 moles of n2 (for dealing with spent fuel) leaves us with a radioactivity spice multiplier of 3. - radioactivity_spice_multiplier += moderator_input.get_moles(/datum/gas/carbon_dioxide) * CARBON_RAD_MOD - radioactivity_spice_multiplier += moderator_input.get_moles(/datum/gas/hydrogen) * HYDROGEN_RAD_MOD - radioactivity_spice_multiplier += moderator_input.get_moles(/datum/gas/tritium) * TRITIUM_RAD_MOD - radioactivity_spice_multiplier += moderator_input.get_moles(/datum/gas/antinoblium) * ANTINOBLIUM_RAD_MOD + radioactivity_spice_multiplier += moderator_input.get_moles(GAS_N2) * NITROGEN_RAD_MOD //An example setup of 50 moles of n2 (for dealing with spent fuel) leaves us with a radioactivity spice multiplier of 3. + radioactivity_spice_multiplier += moderator_input.get_moles(GAS_CO2) * CARBON_RAD_MOD + radioactivity_spice_multiplier += moderator_input.get_moles(GAS_H2) * HYDROGEN_RAD_MOD + radioactivity_spice_multiplier += moderator_input.get_moles(GAS_TRITIUM) * TRITIUM_RAD_MOD + radioactivity_spice_multiplier += moderator_input.get_moles(GAS_ANTINOB) * ANTINOBLIUM_RAD_MOD // Integrity modification - var/healium_moles = moderator_input.get_moles(/datum/gas/healium) + var/healium_moles = moderator_input.get_moles(GAS_HEALIUM) if(healium_moles > minimum_coolant_level) integrity_restoration = max((2400-max(TCMB, temperature))/300) * delta_time //At 1800K integrity_restoration should be around 1, which then it cant keep up with the heat damage (around 1.1 maximum in temp_damage) to restore integrity // Degradation types: degrades the fuel rods - var/total_degradation_moles = moderator_input.get_moles(/datum/gas/pluonium) //Because it's quite hard to get. + var/total_degradation_moles = moderator_input.get_moles(GAS_PLUONIUM) //Because it's quite hard to get. if(total_degradation_moles >= minimum_coolant_level) //I'll be nice. depletion_modifier += total_degradation_moles / 15 //Oops! All depletion. This causes your fuel rods to get SPICY. if(prob(total_degradation_moles)) // don't spam the sound so much please @@ -568,7 +568,7 @@ //Results: Engineering becomes unusable and your engine irreparable /obj/machinery/atmospherics/components/trinary/nuclear_reactor/proc/meltdown() set waitfor = FALSE - SSair.atmos_machinery -= src //Annd we're now just a useless brick. + SSair_machinery.stop_processing_machine(src) vessel_integrity = null // this makes it show up weird on the monitor to even further emphasize something's gone horribly wrong slagged = TRUE color = null diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm index 9110802e69de..10bd9e90bbe5 100644 --- a/code/modules/power/singularity/collector.dm +++ b/code/modules/power/singularity/collector.dm @@ -36,9 +36,9 @@ /// What is it producing var/mode = POWER /// What gasses are we using - var/list/using = list(/datum/gas/plasma) + var/list/using = list(GAS_PLASMA) /// Gasses we give - var/list/giving = list(/datum/gas/tritium = 1) + var/list/giving = list(GAS_TRITIUM = 1) /// Last output used to calculate per minute var/last_output = 0 // Higher machine tier will give more power @@ -118,11 +118,7 @@ toggle_power() user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \ span_notice("You turn the [src.name] [active? "on":"off"].")) - //yogs start -- fixes runtime with empty rad collectors - var/fuel = 0 - if(loaded_tank) - fuel = loaded_tank.air_contents.get_moles(/datum/gas/plasma) - //yogs end + var/fuel = loaded_tank?.air_contents?.get_moles(GAS_PLASMA) investigate_log("turned [active?"on":"off"] by [key_name(user)]. [loaded_tank?"Fuel: [round(fuel/0.29)]%":"It is empty"].", INVESTIGATE_SINGULO) investigate_log("turned [active?"on":"off"] by [key_name(user)]. [loaded_tank?"Fuel: [round(fuel/0.29)]%":"It is empty"].", INVESTIGATE_SUPERMATTER) // yogs - so supermatter investigate is useful return @@ -234,23 +230,23 @@ to_chat(user, "[src] isn't connected to a powernet!") return mode = POWER - using = list(/datum/gas/plasma) - giving = list(/datum/gas/tritium = 1) + using = list(GAS_PLASMA) + giving = list(GAS_TRITIUM = 1) if(SCIENCE) if(!is_station_level(z) && !SSresearch.science_tech) to_chat(user, "[src] isn't linked to a research system!") return // Dont switch over mode = SCIENCE - using = list(/datum/gas/tritium, /datum/gas/oxygen) - giving = list(/datum/gas/carbon_dioxide = 2) // Conservation of mass + using = list(GAS_TRITIUM, GAS_O2) + giving = list(GAS_CO2 = 2) // Conservation of mass if(MONEY) var/datum/bank_account/D = SSeconomy.get_dep_account(ACCOUNT_CAR) if(!D) to_chat(user, "[src] couldn't find the cargo budget!") return // Dont switch over mode = MONEY - using = list(/datum/gas/plasma) - giving = list(/datum/gas/tritium = 0.5) // money + using = list(GAS_PLASMA) + giving = list(GAS_TRITIUM = 0.5) // money to_chat(user, "You set the [src] mode to [mode] production.") diff --git a/code/modules/power/singularity/emitter.dm b/code/modules/power/singularity/emitter.dm index 1b9b7950433f..2fb1abeaadbf 100644 --- a/code/modules/power/singularity/emitter.dm +++ b/code/modules/power/singularity/emitter.dm @@ -442,10 +442,10 @@ if(!tank || !tank.air_contents) return var/datum/gas_mixture/fuel = tank.air_contents - if(fuel.get_moles(/datum/gas/tritium) < fuel_consumption) + if(fuel.get_moles(GAS_TRITIUM) < fuel_consumption) return - fuel.adjust_moles(/datum/gas/tritium, -fuel_consumption) - fuel.adjust_moles(/datum/gas/hydrogen, fuel_consumption) + fuel.adjust_moles(GAS_TRITIUM, -fuel_consumption) + fuel.adjust_moles(GAS_H2, fuel_consumption) if(obj_flags & EMAGGED) // radioactive if emagged radiation_pulse(get_turf(src), fuel_consumption * FIRE_HYDROGEN_ENERGY_RELEASED / TRITIUM_BURN_RADIOACTIVITY_FACTOR) return ..() @@ -466,7 +466,7 @@ /obj/machinery/power/emitter/particle/update_icon_state() . = ..() if(active) - icon_state = (tank?.air_contents?.get_moles(/datum/gas/tritium) >= fuel_consumption) ? icon_state_on : icon_state_underpowered + icon_state = (tank?.air_contents?.get_moles(GAS_TRITIUM) >= fuel_consumption) ? icon_state_on : icon_state_underpowered else icon_state = initial(icon_state) diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm index 6c221869adf2..a9102c23adbf 100644 --- a/code/modules/power/supermatter/supermatter.dm +++ b/code/modules/power/supermatter/supermatter.dm @@ -222,7 +222,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) /obj/machinery/power/supermatter_crystal/Initialize(mapload) . = ..() uid = gl_uid++ - SSair.atmos_machinery += src + SSair_machinery.start_processing_machine(src) countdown = new(src) countdown.start() GLOB.poi_list |= src @@ -238,7 +238,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) /obj/machinery/power/supermatter_crystal/Destroy() investigate_log("has been destroyed.", INVESTIGATE_SUPERMATTER) - SSair.atmos_machinery -= src + SSair_machinery.stop_processing_machine(src) QDEL_NULL(radio) GLOB.poi_list -= src QDEL_NULL(countdown) @@ -456,24 +456,24 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) // Calculate the gas mix ratio combined_gas = max(removed.total_moles(), 0) - var/plasmacomp = max(removed.get_moles(/datum/gas/plasma)/combined_gas, 0) - var/o2comp = max(removed.get_moles(/datum/gas/oxygen)/combined_gas, 0) - var/co2comp = max(removed.get_moles(/datum/gas/carbon_dioxide)/combined_gas, 0) - var/n2ocomp = max(removed.get_moles(/datum/gas/nitrous_oxide)/combined_gas, 0) - var/n2comp = max(removed.get_moles(/datum/gas/nitrogen)/combined_gas, 0) - var/pluoxiumcomp = max(removed.get_moles(/datum/gas/pluoxium)/combined_gas, 0) - var/tritiumcomp = max(removed.get_moles(/datum/gas/tritium)/combined_gas, 0) - var/h2comp = max(removed.get_moles(/datum/gas/hydrogen)/combined_gas, 0) - var/h2ocomp = max(removed.get_moles(/datum/gas/water_vapor)/combined_gas, 0) - var/bzcomp = max(removed.get_moles(/datum/gas/bz)/combined_gas, 0) - var/pluoniumcomp = max(removed.get_moles(/datum/gas/pluonium)/combined_gas, 0) - var/healcomp = max(removed.get_moles(/datum/gas/healium)/combined_gas, 0) - var/zaukcomp = max(removed.get_moles(/datum/gas/zauker)/combined_gas, 0) - var/haloncomp = max(removed.get_moles(/datum/gas/halon)/combined_gas, 0) - var/nobliumcomp = max(removed.get_moles(/datum/gas/hypernoblium)/combined_gas, 0) - var/antinobliumcomp = max(removed.get_moles(/datum/gas/antinoblium)/combined_gas, 0) - var/nitriumcomp = max(removed.get_moles(/datum/gas/nitrium)/combined_gas, 0) - var/miasmacomp = max(removed.get_moles(/datum/gas/miasma)/combined_gas, 0) + var/plasmacomp = max(removed.get_moles(GAS_PLASMA)/combined_gas, 0) + var/o2comp = max(removed.get_moles(GAS_O2)/combined_gas, 0) + var/co2comp = max(removed.get_moles(GAS_CO2)/combined_gas, 0) + var/n2ocomp = max(removed.get_moles(GAS_NITROUS)/combined_gas, 0) + var/n2comp = max(removed.get_moles(GAS_N2)/combined_gas, 0) + var/pluoxiumcomp = max(removed.get_moles(GAS_PLUOXIUM)/combined_gas, 0) + var/tritiumcomp = max(removed.get_moles(GAS_TRITIUM)/combined_gas, 0) + var/bzcomp = max(removed.get_moles(GAS_BZ)/combined_gas, 0) + var/h2ocomp = max(removed.get_moles(GAS_H2O)/combined_gas, 0) + var/h2comp = max(removed.get_moles(GAS_H2)/combined_gas, 0) + var/pluoniumcomp = max(removed.get_moles(GAS_PLUONIUM)/combined_gas, 0) + var/healcomp = max(removed.get_moles(GAS_HEALIUM)/combined_gas, 0) + var/zaukcomp = max(removed.get_moles(GAS_ZAUKER)/combined_gas, 0) + var/haloncomp = max(removed.get_moles(GAS_HALON)/combined_gas, 0) + var/nobliumcomp = max(removed.get_moles(GAS_HYPERNOB)/combined_gas, 0) + var/antinobliumcomp = max(removed.get_moles(GAS_ANTINOB)/combined_gas, 0) + var/nitriumcomp = max(removed.get_moles(GAS_NITRIUM)/combined_gas, 0) + var/miasmacomp = max(removed.get_moles(GAS_MIASMA)/combined_gas, 0) if (healcomp >= 0.1) heal_mod = (healcomp * HEALIUM_HEAL_MOD) + 1 //Increases healing and healing cap @@ -486,10 +486,10 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) damage_mod = 1 // Mole releated calculations - var/bzmol = max(removed.get_moles(/datum/gas/bz), 0) - var/nitriummol = max(removed.get_moles(/datum/gas/nitrium), 0) - var/antinobmol = max(removed.get_moles(/datum/gas/antinoblium), 0) - var/miasmol = max(removed.get_moles(/datum/gas/miasma), 0) + var/bzmol = max(removed.get_moles(GAS_BZ), 0) + var/nitriummol = max(removed.get_moles(GAS_NITRIUM), 0) + var/antinobmol = max(removed.get_moles(GAS_ANTINOB), 0) + var/miasmol = max(removed.get_moles(GAS_MIASMA), 0) // Power of the gas. Scale of 0 to 1 gasmix_power_ratio = clamp(plasmacomp + o2comp + co2comp + tritiumcomp + bzcomp + nitriumcomp + antinobliumcomp - pluoxiumcomp - n2comp, 0, 1) @@ -532,7 +532,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) if(prob(50)) //1 + (tritRad + pluoxDampen * bzDampen * o2Rad * plasmaRad / (10 - bzrads)) - last_rads = power * (1 + (tritiumcomp * TRITIUM_RADIOACTIVITY_MODIFIER) + ((pluoxiumcomp * PLUOXIUM_RADIOACTIVITY_MODIFIER) * pluoxiumcomp) * (power_transmission_bonus/(10-(bzcomp * BZ_RADIOACTIVITY_MODIFIER)))) * radmodifier + last_rads = power * (1 + (tritiumcomp * TRITIUM_RADIOACTIVITY_MODIFIER) + (((pluoxiumcomp ** 2) * PLUOXIUM_RADIOACTIVITY_MODIFIER)) * (power_transmission_bonus/(10-(bzcomp * BZ_RADIOACTIVITY_MODIFIER)))) * radmodifier radiation_pulse(src, max(last_rads)) if(nitriummol > NITRO_BALL_MOLES_REQUIRED) // haha funny particles go brrrrr @@ -540,7 +540,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) var/starting_angle = rand(0, 360) for(var/i = 0 to balls_shot) // fires particles in a ring, with some random variation in the angle src.fire_nuclear_particle(starting_angle + rand(-180/balls_shot, 180/balls_shot) + (i * 360 / balls_shot)) - removed.set_moles(/datum/gas/nitrium, max(nitriummol - (balls_shot * NITRO_BALL_MOLES_REQUIRED), 0)) //converts nitrium into radballs + removed.set_moles(GAS_NITRIUM, max(nitriummol - (balls_shot * NITRO_BALL_MOLES_REQUIRED), 0)) //converts stimulum into radballs if(bzcomp >= 0.4 && prob(50 * bzcomp)) src.fire_nuclear_particle() // Start to emit radballs at a maximum of 50% chance per tick @@ -587,18 +587,17 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal) //Calculate how much gas to release, antinoblium seeded SM produces much more gas if(antinoblium_attached || supermatter_blob) - removed.adjust_moles(/datum/gas/plasma, max(((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER) * (1+(100-support_integrity)/25), 0)) - removed.adjust_moles(/datum/gas/oxygen, max((((device_energy + removed.return_temperature() * dynamic_heat_modifier) - T0C) / OXYGEN_RELEASE_MODIFIER) * (1+(100-support_integrity)/25), 0)) + removed.adjust_moles(GAS_PLASMA, max(((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER) * (1+(100-support_integrity)/25), 0)) + removed.adjust_moles(GAS_O2, max((((device_energy + removed.return_temperature() * dynamic_heat_modifier) - T0C) / OXYGEN_RELEASE_MODIFIER) * (1+(100-support_integrity)/25), 0)) else if(haloncomp >= 0.15) - removed.adjust_moles(/datum/gas/plasma, max((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER, 0)) - removed.adjust_moles(/datum/gas/oxygen, max(((device_energy + removed.return_temperature() * dynamic_heat_modifier) - T0C) / PLASMA_RELEASE_MODIFIER, 0)) // Supresses Oxygen Generation + removed.adjust_moles(GAS_PLASMA, max((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER, 0)) + removed.adjust_moles(GAS_O2, max(((device_energy + removed.return_temperature() * dynamic_heat_modifier) - T0C) / PLASMA_RELEASE_MODIFIER, 0)) // Supresses Oxygen Generation else - removed.adjust_moles(/datum/gas/plasma, max((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER, 0)) - removed.adjust_moles(/datum/gas/oxygen, max(((device_energy + removed.return_temperature() * dynamic_heat_modifier) - T0C) / OXYGEN_RELEASE_MODIFIER, 0)) + removed.adjust_moles(GAS_PLASMA, max((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER, 0)) + removed.adjust_moles(GAS_O2, max(((device_energy + removed.return_temperature() * dynamic_heat_modifier) - T0C) / OXYGEN_RELEASE_MODIFIER, 0)) if(produces_gas) env.merge(removed) - air_update_turf() for(var/mob/living/carbon/human/l in view(src, HALLUCINATION_RANGE(power))) // If they can see it without mesons on. Bad on them. if((!HAS_TRAIT(l, TRAIT_MESONS)) || corruptor_attached) diff --git a/code/modules/power/turbine.dm b/code/modules/power/turbine.dm index 0cdf68ad3a3a..e551f28c6d25 100644 --- a/code/modules/power/turbine.dm +++ b/code/modules/power/turbine.dm @@ -44,7 +44,7 @@ var/intake_ratio = 0.1 // might add a way to adjust this in-game later /obj/machinery/power/compressor/Destroy() - SSair.atmos_machinery.Remove(src) + SSair_machinery.stop_processing_machine(src) if (turbine && turbine.compressor == src) turbine.compressor = null var/turf/T = get_turf(src) @@ -72,7 +72,7 @@ var/productivity = 1 /obj/machinery/power/turbine/Destroy() - SSair.atmos_machinery.Remove(src) + SSair_machinery.stop_processing_machine(src) if (compressor && compressor.turbine == src) compressor.turbine = null compressor = null @@ -91,7 +91,7 @@ /obj/machinery/power/compressor/Initialize(mapload) . = ..() - SSair.atmos_machinery += src + SSair_machinery.start_processing_machine(src) // The inlet of the compressor is the direction it faces gas_contained = new inturf = get_step(src, dir) @@ -189,7 +189,7 @@ /obj/machinery/power/turbine/Initialize(mapload) . = ..() - SSair.atmos_machinery += src + SSair_machinery.start_processing_machine(src) // The outlet is pointed at the direction of the turbine component outturf = get_step(src, dir) locate_machinery() diff --git a/code/modules/procedural_mapping/mapGeneratorModules/helpers.dm b/code/modules/procedural_mapping/mapGeneratorModules/helpers.dm index 00dba2d00014..18607b919aba 100644 --- a/code/modules/procedural_mapping/mapGeneratorModules/helpers.dm +++ b/code/modules/procedural_mapping/mapGeneratorModules/helpers.dm @@ -10,12 +10,13 @@ if(!mother) return var/list/map = mother.map - for(var/turf/T in map) - SSair.remove_from_active(T) for(var/turf/open/T in map) if(T.air) - T.air.copy_from_turf(T) - SSair.add_to_active(T) + if(T.initial_gas_mix) + T.air.parse_gas_string(T.initial_gas_mix) + T.set_temperature(T.air.return_temperature()) + else + T.air.copy_from_turf(T) /datum/mapGeneratorModule/bottomLayer/massdelete spawnableAtoms = list() diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm index 8e67b9a4c82f..b7af79856259 100644 --- a/code/modules/reagents/chemistry/reagents/food_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm @@ -475,10 +475,9 @@ T.MakeSlippery(TURF_WET_LUBE, min_wet_time = 10 SECONDS, wet_time_to_add = reac_volume*2 SECONDS) var/obj/effect/hotspot/hotspot = (locate(/obj/effect/hotspot) in T) if(hotspot) - var/datum/gas_mixture/lowertemp = T.remove_air(T.air.total_moles()) - lowertemp.set_temperature(max( min(lowertemp.return_temperature()-2000,lowertemp.return_temperature() / 2) ,0)) + var/datum/gas_mixture/lowertemp = T.return_air() + lowertemp.set_temperature(max( min(lowertemp.return_temperature()-2000,lowertemp.return_temperature() / 2) ,TCMB)) lowertemp.react(src) - T.assume_air(lowertemp) qdel(hotspot) /datum/reagent/consumable/enzyme diff --git a/code/modules/reagents/chemistry/recipes/slime_extracts.dm b/code/modules/reagents/chemistry/recipes/slime_extracts.dm index 1eba0a7713dc..d93d2cc81af0 100644 --- a/code/modules/reagents/chemistry/recipes/slime_extracts.dm +++ b/code/modules/reagents/chemistry/recipes/slime_extracts.dm @@ -291,8 +291,7 @@ if(holder && holder.my_atom) var/turf/open/T = get_turf(holder.my_atom) if(istype(T)) - var/datum/gas/gastype = /datum/gas/nitrogen - T.atmos_spawn_air("[initial(gastype.id)]=50;TEMP=2.7") + T.atmos_spawn_air("n2=50;TEMP=2.7") /datum/chemical_reaction/slime/slimefireproof name = "Slime Fireproof" diff --git a/code/modules/recycling/disposal/bin.dm b/code/modules/recycling/disposal/bin.dm index 4203c4f99a16..e2b70279b436 100644 --- a/code/modules/recycling/disposal/bin.dm +++ b/code/modules/recycling/disposal/bin.dm @@ -68,10 +68,13 @@ /obj/machinery/disposal/LateInitialize() //this will get a copy of the air turf and take a SEND PRESSURE amount of air from it var/atom/L = loc + var/datum/gas_mixture/loc_air = L.return_air() var/datum/gas_mixture/env = new - env.copy_from(L.return_air()) - var/datum/gas_mixture/removed = env.remove(SEND_PRESSURE + 1) - air_contents.merge(removed) + if(loc_air) + env.copy_from(loc_air) + var/datum/gas_mixture/removed = env.remove(SEND_PRESSURE + 1) + if(removed) + air_contents.merge(removed) trunk_check() /obj/machinery/disposal/attackby(obj/item/I, mob/user, params) @@ -416,14 +419,12 @@ var/datum/gas_mixture/env = L.return_air() var/pressure_delta = (SEND_PRESSURE*1.01) - air_contents.return_pressure() - if(env.return_temperature() > 0) + if(env?.return_temperature() > 0) var/transfer_moles = 0.05 * delta_time * pressure_delta*air_contents.return_volume()/(env.return_temperature() * R_IDEAL_GAS_EQUATION) //Actually transfer the gas var/datum/gas_mixture/removed = env.remove(transfer_moles) air_contents.merge(removed) - air_update_turf() - //if full enough, switch to ready mode if(air_contents.return_pressure() >= SEND_PRESSURE) diff --git a/code/modules/recycling/disposal/holder.dm b/code/modules/recycling/disposal/holder.dm index 9fb68ed63de1..faff4adf8df9 100644 --- a/code/modules/recycling/disposal/holder.dm +++ b/code/modules/recycling/disposal/holder.dm @@ -122,7 +122,6 @@ // called to vent all gas in holder to a location /obj/structure/disposalholder/proc/vent_gas(turf/T) T.assume_air(gas) - T.air_update_turf() /obj/structure/disposalholder/AllowDrop() return TRUE diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm index 8f6fb3455382..fef83d18d055 100644 --- a/code/modules/research/experimentor.dm +++ b/code/modules/research/experimentor.dm @@ -407,15 +407,7 @@ autoexperiment = 0 visible_message(span_warning("[src] malfunctions, melting [exp_on] and leaking hot air!")) var/datum/gas_mixture/env = loc.return_air() - var/transfer_moles = 0.25 * env.total_moles() - var/datum/gas_mixture/removed = env.remove(transfer_moles) - if(removed) - var/heat_capacity = removed.heat_capacity() - if(heat_capacity == 0 || heat_capacity == null) - heat_capacity = 1 - removed.set_temperature(min((removed.return_temperature()*heat_capacity + 100000)/heat_capacity, 1000)) - env.merge(removed) - air_update_turf() + env.adjust_heat(100000) investigate_log("Experimentor has released hot air.", INVESTIGATE_EXPERIMENTOR) ejectItem(TRUE) else if(prob(EFFECT_PROB_MEDIUM-badThingCoeff)) @@ -457,15 +449,7 @@ autoexperiment = 0 visible_message(span_warning("[src] malfunctions, shattering [exp_on] and leaking cold air!")) var/datum/gas_mixture/env = loc.return_air() - var/transfer_moles = 0.25 * env.total_moles() - var/datum/gas_mixture/removed = env.remove(transfer_moles) - if(removed) - var/heat_capacity = removed.heat_capacity() - if(heat_capacity == 0 || heat_capacity == null) - heat_capacity = 1 - removed.set_temperature((removed.return_temperature()*heat_capacity - 75000)/heat_capacity) - env.merge(removed) - air_update_turf() + env.adjust_heat(-75000) investigate_log("Experimentor has released cold air.", INVESTIGATE_EXPERIMENTOR) ejectItem(TRUE) else if(prob(EFFECT_PROB_MEDIUM-badThingCoeff)) diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm index 66f20944c3ad..0cc6164d976d 100644 --- a/code/modules/research/server.dm +++ b/code/modules/research/server.dm @@ -22,7 +22,7 @@ var/server_id = 0 var/base_mining_income = 2 var/current_temp = 0 - var/heat_gen = 100 + var/heat_gen = 1 var/heating_power = 40000 var/delay = 5 var/temp_tolerance_low = 0 @@ -48,7 +48,7 @@ var/tot_rating = 0 for(var/obj/item/stock_parts/SP in src) tot_rating += SP.rating - heat_gen /= max(1, tot_rating) + heat_gen = initial(src.heat_gen) / max(1, tot_rating) /obj/machinery/rnd/server/update_icon_state() . = ..() @@ -71,6 +71,24 @@ . = ..() refresh_working() +/obj/machinery/rnd/server/process() + if(!working) + current_temp = -1 + return + var/turf/L = get_turf(src) + var/datum/gas_mixture/env + if(istype(L)) + env = L.return_air() + // This is from the RD server code. It works well enough but I need to move over the + // sspace heater code so we can caculate power used per tick as well and making this both + // exothermic and an endothermic component + if(env) + var/perc = max((get_env_temp() - temp_tolerance_high), 0) * temp_penalty_coefficient / base_mining_income + + env.adjust_heat(heating_power * perc * heat_gen) + else + current_temp = env ? env.return_temperature() : -1 + /obj/machinery/rnd/server/proc/refresh_working() if(stat & EMPED || research_disabled || stat & NOPOWER) working = FALSE @@ -103,30 +121,9 @@ /obj/machinery/rnd/server/proc/get_env_temp() var/turf/L = loc if(isturf(L)) - return L.temperature + return L.return_temperature() return 0 -/obj/machinery/rnd/server/proc/produce_heat(heat_amt) - if(!(stat & (NOPOWER|BROKEN))) //Blatently stolen from space heater. - var/turf/L = loc - if(istype(L)) - var/datum/gas_mixture/env = L.return_air() - if(env.return_temperature() < (heat_amt+T0C)) - - var/transfer_moles = 0.25 * env.total_moles() - - var/datum/gas_mixture/removed = env.remove(transfer_moles) - - if(removed) - - var/heat_capacity = removed.heat_capacity() - if(heat_capacity == 0 || heat_capacity == null) - heat_capacity = 1 - removed.set_temperature(min((removed.return_temperature()*heat_capacity + heating_power)/heat_capacity, 1000)) - - env.merge(removed) - air_update_turf() - /proc/fix_noid_research_servers() var/list/no_id_servers = list() var/list/server_ids = list() diff --git a/code/modules/research/xenobiology/crossbreeding/_structures.dm b/code/modules/research/xenobiology/crossbreeding/_structures.dm index 32243aeb67a1..b10ef0549a87 100644 --- a/code/modules/research/xenobiology/crossbreeding/_structures.dm +++ b/code/modules/research/xenobiology/crossbreeding/_structures.dm @@ -145,7 +145,6 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals) return var/datum/gas_mixture/gas = T.return_air() gas.set_temperature(T0C + 200) - T.air_update_turf() /obj/structure/slime_crystal/purple colour = "purple" @@ -185,7 +184,6 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals) continue var/datum/gas_mixture/gas = T.return_air() gas.parse_gas_string(OPENTURF_DEFAULT_ATMOS) - T.air_update_turf() /obj/structure/slime_crystal/metal colour = "metal" @@ -232,8 +230,8 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals) return var/turf/open/open_turf = T var/datum/gas_mixture/air = open_turf.return_air() - if(air.get_moles(/datum/gas/plasma) > 15) - air.adjust_moles(/datum/gas/plasma, -15) + if(air.get_moles(GAS_PLASMA) > 15) + air.adjust_moles(GAS_PLASMA, -15) new /obj/item/stack/sheet/mineral/plasma(open_turf) /obj/structure/slime_crystal/darkpurple/Destroy() diff --git a/code/modules/research/xenobiology/crossbreeding/chilling.dm b/code/modules/research/xenobiology/crossbreeding/chilling.dm index 6a8b00f734d7..16c1bc5b90e8 100644 --- a/code/modules/research/xenobiology/crossbreeding/chilling.dm +++ b/code/modules/research/xenobiology/crossbreeding/chilling.dm @@ -107,9 +107,8 @@ Chilling extracts: for(var/turf/open/T in A) var/datum/gas_mixture/G = T.air if(istype(G)) - G.set_moles(/datum/gas/plasma, 0) + G.set_moles(GAS_PLASMA, 0) filtered = TRUE - T.air_update_turf() if(filtered) user.visible_message(span_notice("Cracks spread throughout [src], and some air is sucked in!")) else diff --git a/code/modules/shuttle/docking.dm b/code/modules/shuttle/docking.dm index bcb066085045..064a424bb7d2 100644 --- a/code/modules/shuttle/docking.dm +++ b/code/modules/shuttle/docking.dm @@ -121,6 +121,7 @@ continue move_mode = moving_atom.beforeShuttleMove(newT, rotation, move_mode, src) //atoms + oldT.beforeShuttleMove(newT) move_mode = oldT.fromShuttleMove(newT, move_mode) //turfs move_mode = newT.toShuttleMove(oldT, move_mode, src) //turfs @@ -130,6 +131,7 @@ old_turfs[oldT] = move_mode /obj/docking_port/mobile/proc/takeoff(list/old_turfs, list/new_turfs, list/moved_atoms, rotation, movement_direction, old_dock, area/underlying_old_area) + for(var/i in 1 to old_turfs.len) var/turf/oldT = old_turfs[i] var/turf/newT = new_turfs[i] @@ -203,3 +205,9 @@ var/turf/oldT = moved_atoms[moved_object] moved_object.lateShuttleMove(oldT, movement_force, movement_direction) +/obj/docking_port/mobile/proc/reset_air() + var/list/turfs = return_ordered_turfs(x, y, z, dir) + for(var/i in 1 to length(turfs)) + var/turf/open/T = turfs[i] + if(istype(T)) + T.air.copy_from_turf(T) diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm index 99be3d6a1f9a..2a02cd5503a7 100644 --- a/code/modules/shuttle/on_move.dm +++ b/code/modules/shuttle/on_move.dm @@ -4,6 +4,10 @@ All ShuttleMove procs go here /************************************Base procs************************************/ +/turf/proc/beforeShuttleMove(turf/newT) + clear_adjacencies() + newT.clear_adjacencies() + // Called on every turf in the shuttle region, returns a bitflag for allowed movements of that turf // returns the new move_mode (based on the old) /turf/proc/fromShuttleMove(turf/newT, move_mode) @@ -53,16 +57,7 @@ All ShuttleMove procs go here if(!shuttle_boundary) CRASH("A turf queued to move via shuttle somehow had no skipover in baseturfs. [src]([type]):[loc]") var/depth = baseturfs.len - shuttle_boundary + 1 - newT.CopyOnTop(src, 1, depth, TRUE) - //Air stuff - newT.blocks_air = TRUE - newT.air_update_turf(TRUE) - blocks_air = TRUE - air_update_turf(TRUE) - if(isopenturf(newT)) - var/turf/open/new_open = newT - new_open.copy_air_with_tile(src) - + newT.CopyOnTop(src, 1, depth, TRUE, CHANGETURF_DEFER_CHANGE) return TRUE // Called on the new turf after everything has been moved @@ -72,7 +67,7 @@ All ShuttleMove procs go here SSexplosions.wipe_turf(src) var/shuttle_boundary = baseturfs.Find(/turf/baseturf_skipover/shuttle) if(shuttle_boundary) - oldT.ScrapeAway(baseturfs.len - shuttle_boundary + 1) + oldT.ScrapeAway(baseturfs.len - shuttle_boundary + 1, CHANGETURF_DEFER_CHANGE) if(rotation) shuttleRotate(rotation) //see shuttle_rotate.dm @@ -80,11 +75,8 @@ All ShuttleMove procs go here return TRUE /turf/proc/lateShuttleMove(turf/oldT) - blocks_air = initial(blocks_air) - air_update_turf(TRUE) - oldT.blocks_air = initial(oldT.blocks_air) - oldT.air_update_turf(TRUE) - + AfterChange(CHANGETURF_RECALC_ADJACENT) + oldT.AfterChange(CHANGETURF_RECALC_ADJACENT) ///////////////////////////////////////////////////////////////////////////////////// @@ -245,17 +237,17 @@ All ShuttleMove procs go here break if(!connected) - nullifyNode(i) + nullify_node(i) if(!nodes[i]) missing_nodes = TRUE if(missing_nodes) - atmosinit() + atmos_init() for(var/obj/machinery/atmospherics/A in pipeline_expansion()) - A.atmosinit() - if(A.returnPipenet()) - A.addMember(src) + A.atmos_init() + if(A.return_pipenet()) + A.add_member(src) SSair.add_to_rebuild_queue(src) else // atmosinit() calls update_appearance(UPDATE_ICON), so we don't need to call it diff --git a/code/modules/shuttle/shuttle_rotate.dm b/code/modules/shuttle/shuttle_rotate.dm index c13af51c7769..958c9aa5c5ab 100644 --- a/code/modules/shuttle/shuttle_rotate.dm +++ b/code/modules/shuttle/shuttle_rotate.dm @@ -85,13 +85,13 @@ If ever any of these procs are useful for non-shuttles, rename it to proc/rotate /************************************Machine rotate procs************************************/ /obj/machinery/atmospherics/shuttleRotate(rotation, params) - var/list/real_node_connect = getNodeConnects() + var/list/real_node_connect = get_node_connects() for(var/i in 1 to device_type) real_node_connect[i] = angle2dir(rotation+dir2angle(real_node_connect[i])) . = ..() - SetInitDirections() - var/list/supposed_node_connect = getNodeConnects() + set_init_directions() + var/list/supposed_node_connect = get_node_connects() var/list/nodes_copy = nodes.Copy() for(var/i in 1 to device_type) diff --git a/code/modules/surgery/organs/augments_chest.dm b/code/modules/surgery/organs/augments_chest.dm index 6c7d7c292465..1818f4eb12ef 100644 --- a/code/modules/surgery/organs/augments_chest.dm +++ b/code/modules/surgery/organs/augments_chest.dm @@ -204,13 +204,8 @@ // Priority 3: use internals tank. var/obj/item/tank/I = owner.internal - if(I && I.air_contents && I.air_contents.total_moles() > num) - var/datum/gas_mixture/removed = I.air_contents.remove(num) - if(removed.total_moles() > 0.005) - T.assume_air(removed) - return 1 - else - T.assume_air(removed) + if(I && I.air_contents && I.air_contents.total_moles() >= num) + T.assume_air_moles(I.air_contents, num) toggle(silent = TRUE) return 0 diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm index a0febe43a2fb..4735d278c05f 100644 --- a/code/modules/surgery/organs/lungs.dm +++ b/code/modules/surgery/organs/lungs.dm @@ -18,36 +18,37 @@ //Breath damage - var/safe_oxygen_min = 16 // Minimum safe partial pressure of O2, in kPa - var/safe_oxygen_max = 0 - var/safe_nitro_min = 0 - var/safe_nitro_max = 0 - var/safe_co2_min = 0 - var/safe_co2_max = 10 // Yes it's an arbitrary value who cares? - var/safe_toxins_min = 0 - var/safe_toxins_max = 0.05 - var/SA_para_min = 1 //Sleeping agent - var/SA_sleep_min = 5 //Sleeping agent + var/breathing_class = BREATH_OXY // can be a gas instead of a breathing class + var/safe_breath_min = 16 + var/safe_breath_max = 50 + var/safe_breath_dam_min = MIN_TOXIC_GAS_DAMAGE + var/safe_breath_dam_max = MAX_TOXIC_GAS_DAMAGE + var/safe_damage_type = OXY + var/list/gas_min = list() + var/list/gas_max = list( + GAS_CO2 = 30, // Yes it's an arbitrary value who cares? + GAS_PLASMA = MOLES_GAS_VISIBLE, + ) + var/list/gas_damage = list( + "default" = list( + min = MIN_TOXIC_GAS_DAMAGE, + max = MAX_TOXIC_GAS_DAMAGE, + damage_type = OXY, + ), + GAS_PLASMA = list( + min = MIN_TOXIC_GAS_DAMAGE, + max = MAX_TOXIC_GAS_DAMAGE, + damage_type = TOX, + ) + ) + + var/SA_para_min = 1 //nitrous values + var/SA_sleep_min = 5 var/BZ_trip_balls_min = 1 //BZ gas var/gas_stimulation_min = 0.002 // Nitrium, Freon and Hyper-noblium - ///list of gasses that can be used in place of oxygen and the amount they are multiplied by, i.e. 1 pp pluox = 8 pp oxygen - var/list/oxygen_substitutes = list(/datum/gas/pluoxium = 8) - //Whether helium speech effects are currently active + /// Whether helium speech effects are currently active var/helium_speech = FALSE - var/oxy_breath_dam_min = MIN_TOXIC_GAS_DAMAGE - var/oxy_breath_dam_max = MAX_TOXIC_GAS_DAMAGE - var/oxy_damage_type = OXY - var/nitro_breath_dam_min = MIN_TOXIC_GAS_DAMAGE - var/nitro_breath_dam_max = MAX_TOXIC_GAS_DAMAGE - var/nitro_damage_type = OXY - var/co2_breath_dam_min = MIN_TOXIC_GAS_DAMAGE - var/co2_breath_dam_max = MAX_TOXIC_GAS_DAMAGE - var/co2_damage_type = OXY - var/tox_breath_dam_min = MIN_TOXIC_GAS_DAMAGE - var/tox_breath_dam_max = MAX_TOXIC_GAS_DAMAGE - var/tox_damage_type = TOX - var/cold_message = "your face freezing and an icicle forming" var/cold_level_1_threshold = 260 var/cold_level_2_threshold = 200 @@ -68,8 +69,26 @@ var/crit_stabilizing_reagent = /datum/reagent/medicine/epinephrine +/obj/item/organ/lungs/Initialize(mapload) + . = ..() + populate_gas_info() + +/obj/item/organ/lungs/proc/populate_gas_info() + gas_min[breathing_class] = safe_breath_min + gas_max[breathing_class] = safe_breath_max + gas_damage[breathing_class] = list( + min = safe_breath_dam_min, + max = safe_breath_dam_max, + damage_type = safe_damage_type + ) + if(ispath(breathing_class)) + var/datum/breathing_class/class = GLOB.gas_data.breathing_classes[breathing_class] + for(var/g in class.gases) + if(class.gases[g] > 0) + gas_min -= g /obj/item/organ/lungs/proc/check_breath(datum/gas_mixture/breath, mob/living/carbon/human/H) + var/breathModifier = (5-(5*(damage/maxHealth)/2)) //range 2.5 - 5 if(H.status_flags & GODMODE) return if(HAS_TRAIT(H, TRAIT_NOBREATH)) @@ -84,167 +103,131 @@ H.adjustOxyLoss(HUMAN_CRIT_MAX_OXYLOSS) H.failed_last_breath = TRUE - if(safe_oxygen_min) - if(isipc(H)) - H.throw_alert("not_enough_oxy", /atom/movable/screen/alert/not_enough_oxy/ipc) - else - H.throw_alert("not_enough_oxy", /atom/movable/screen/alert/not_enough_oxy) - else if(safe_toxins_min) - H.throw_alert("not_enough_tox", /atom/movable/screen/alert/not_enough_tox) - else if(safe_co2_min) - H.throw_alert("not_enough_co2", /atom/movable/screen/alert/not_enough_co2) - else if(safe_nitro_min) - H.throw_alert("not_enough_nitro", /atom/movable/screen/alert/not_enough_nitro) - return FALSE - - var/gas_breathed = 0 - var/eff = get_organ_efficiency() - - //Partial pressures in our breath - var/O2_pp = breath.get_breath_partial_pressure(breath.get_moles(/datum/gas/oxygen)) - for(var/i in oxygen_substitutes) - O2_pp += oxygen_substitutes[i] * breath.get_breath_partial_pressure(breath.get_moles(i)) - var/N2_pp = breath.get_breath_partial_pressure(breath.get_moles(/datum/gas/nitrogen)) - var/Toxins_pp = breath.get_breath_partial_pressure(breath.get_moles(/datum/gas/plasma)) - var/CO2_pp = breath.get_breath_partial_pressure(breath.get_moles(/datum/gas/carbon_dioxide)) - - - //-- OXY --// - - //Too much oxygen! //Yes, some species may not like it. - if(safe_oxygen_max) - if(O2_pp > safe_oxygen_max) - var/ratio = (breath.get_moles(/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.throw_alert("too_much_oxy", /atom/movable/screen/alert/too_much_oxy) - else - H.clear_alert("too_much_oxy") - - //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.get_moles(/datum/gas/oxygen)) - H.throw_alert("not_enough_oxy", /atom/movable/screen/alert/not_enough_oxy) + var/alert_category + var/alert_type + if(ispath(breathing_class)) + var/datum/breathing_class/class = GLOB.gas_data.breathing_classes[breathing_class] + alert_category = class.low_alert_category + alert_type = class.low_alert_datum else - H.failed_last_breath = FALSE - if(H.health >= H.crit_threshold) - H.adjustOxyLoss(-5 * eff) - gas_breathed = breath.get_moles(/datum/gas/oxygen) - H.clear_alert("not_enough_oxy") + var/list/breath_alert_info = GLOB.gas_data.breath_alert_info + if(breathing_class in breath_alert_info) + var/list/alert = breath_alert_info[breathing_class]["not_enough_alert"] + alert_category = alert["alert_category"] + alert_type = alert["alert_type"] + if(alert_category) + H.throw_alert(alert_category, alert_type) + return FALSE - //Exhale - breath.adjust_moles(/datum/gas/oxygen, -gas_breathed) - breath.adjust_moles(/datum/gas/carbon_dioxide, gas_breathed) - gas_breathed = 0 + #define PP_MOLES(X) ((X / total_moles) * pressure) - //-- Nitrogen --// + #define PP(air, gas) PP_MOLES(air.get_moles(gas)) - //Too much nitrogen! - if(safe_nitro_max) - if(N2_pp > safe_nitro_max) - var/ratio = (breath.get_moles(/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.throw_alert("too_much_nitro", /atom/movable/screen/alert/too_much_nitro) - else - H.clear_alert("too_much_nitro") - - //Too little nitrogen! - if(safe_nitro_min) - if(N2_pp < safe_nitro_min) - gas_breathed = handle_too_little_breath(H, N2_pp, safe_nitro_min, breath.get_moles(/datum/gas/nitrogen)) - H.throw_alert("not_enough_nitro", /atom/movable/screen/alert/not_enough_nitro) - else - H.failed_last_breath = FALSE - if(H.health >= H.crit_threshold) - H.adjustOxyLoss(-5 * eff) - gas_breathed = breath.get_moles(/datum/gas/nitrogen) - H.clear_alert("not_enough_nitro") - - //Exhale - breath.adjust_moles(/datum/gas/nitrogen, -gas_breathed) - breath.adjust_moles(/datum/gas/carbon_dioxide, gas_breathed) - gas_breathed = 0 - - //-- CO2 --// - - //CO2 does not affect failed_last_breath. So if there was enough oxygen in the air but too much co2, this will hurt you, but only once per 4 ticks, instead of once per tick. - if(safe_co2_max) - if(CO2_pp > safe_co2_max) - if(!H.co2overloadtime) // If it's the first breath with too much CO2 in it, lets start a counter, then have them pass out after 12s or so. - H.co2overloadtime = world.time - else if(world.time - H.co2overloadtime > 120) - H.Unconscious(60) - H.apply_damage_type(3, co2_damage_type) // Lets hurt em a little, let them know we mean business - if(world.time - H.co2overloadtime > 300) // They've been in here 30s now, lets start to kill them for their own good! - H.apply_damage_type(8, co2_damage_type) - H.throw_alert("too_much_co2", /atom/movable/screen/alert/too_much_co2) - if(prob(20)) // Lets give them some chance to know somethings not right though I guess. - H.emote("cough") + var/gas_breathed = 0 + var/eff = get_organ_efficiency() + var/pressure = breath.return_pressure() + var/total_moles = breath.total_moles() + var/list/breath_alert_info = GLOB.gas_data.breath_alert_info + var/list/breath_results = GLOB.gas_data.breath_results + var/list/breathing_classes = GLOB.gas_data.breathing_classes + var/list/mole_adjustments = list() + for(var/entry in gas_min) + var/required_pp = 0 + var/required_moles = 0 + var/safe_min = gas_min[entry] + var/alert_category = null + var/alert_type = null + if(ispath(entry)) + var/datum/breathing_class/class = breathing_classes[entry] + var/list/gases = class.gases + var/list/products = class.products + alert_category = class.low_alert_category + alert_type = class.low_alert_datum + for(var/gas in gases) + var/moles = breath.get_moles(gas) + var/multiplier = gases[gas] + mole_adjustments[gas] = (gas in mole_adjustments) ? mole_adjustments[gas] - moles : -moles + required_pp += PP_MOLES(moles) * multiplier + required_moles += moles + if(multiplier > 0) + var/to_add = moles * multiplier + for(var/product in products) + mole_adjustments[product] = (product in mole_adjustments) ? mole_adjustments[product] + to_add : to_add else - H.co2overloadtime = 0 - H.clear_alert("too_much_co2") - - //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.get_moles(/datum/gas/carbon_dioxide)) - H.throw_alert("not_enough_co2", /atom/movable/screen/alert/not_enough_co2) + required_moles = breath.get_moles(entry) + required_pp = PP_MOLES(required_moles) + if(entry in breath_alert_info) + var/list/alert = breath_alert_info[entry]["not_enough_alert"] + alert_category = alert["alert_category"] + alert_type = alert["alert_type"] + mole_adjustments[entry] = -required_moles + mole_adjustments[breath_results[entry]] = required_moles + if(required_pp < safe_min) + var/multiplier = handle_too_little_breath(H, required_pp, safe_min, required_moles) + if(required_moles > 0) + multiplier /= required_moles + for(var/adjustment in mole_adjustments) + mole_adjustments[adjustment] *= multiplier + if(alert_category) + H.throw_alert(alert_category, alert_type) else H.failed_last_breath = FALSE if(H.health >= H.crit_threshold) - H.adjustOxyLoss(-5 * organ_efficiency) - gas_breathed = breath.get_moles(/datum/gas/carbon_dioxide) - H.clear_alert("not_enough_co2") - - //Exhale - breath.adjust_moles(/datum/gas/carbon_dioxide, -gas_breathed) - breath.adjust_moles(/datum/gas/oxygen, gas_breathed) - gas_breathed = 0 - - - //-- TOX --// - - //Too much toxins! - if(safe_toxins_max) - if(Toxins_pp > safe_toxins_max) - var/ratio = (breath.get_moles(/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.throw_alert("too_much_tox", /atom/movable/screen/alert/too_much_tox) + H.adjustOxyLoss(-breathModifier) + if(alert_category) + H.clear_alert(alert_category) + var/list/danger_reagents = GLOB.gas_data.breath_reagents_dangerous + for(var/entry in gas_max) + var/found_pp = 0 + var/datum/breathing_class/breathing_class = entry + var/datum/reagent/danger_reagent = null + var/alert_category = null + var/alert_type = null + if(ispath(breathing_class)) + breathing_class = breathing_classes[breathing_class] + alert_category = breathing_class.high_alert_category + alert_type = breathing_class.high_alert_datum + danger_reagent = breathing_class.danger_reagent + found_pp = breathing_class.get_effective_pp(breath) else - H.clear_alert("too_much_tox") - - - //Too little toxins! - if(safe_toxins_min) - if(Toxins_pp < safe_toxins_min) - gas_breathed = handle_too_little_breath(H, Toxins_pp, safe_toxins_min, breath.get_moles(/datum/gas/plasma)) - H.throw_alert("not_enough_tox", /atom/movable/screen/alert/not_enough_tox) - else - H.failed_last_breath = FALSE - if(H.health >= H.crit_threshold) - H.adjustOxyLoss(-5 * eff) - gas_breathed = breath.get_moles(/datum/gas/plasma) - H.clear_alert("not_enough_tox") - - //Exhale - breath.adjust_moles(/datum/gas/plasma, -gas_breathed) - breath.adjust_moles(/datum/gas/carbon_dioxide, gas_breathed) - gas_breathed = 0 - + danger_reagent = danger_reagents[entry] + if(entry in breath_alert_info) + var/list/alert = breath_alert_info[entry]["too_much_alert"] + alert_category = alert["alert_category"] + alert_type = alert["alert_type"] + found_pp = PP(breath, entry) + if(found_pp > gas_max[entry]) + if(istype(danger_reagent)) + H.reagents.add_reagent(danger_reagent,1) + var/list/damage_info = (entry in gas_damage) ? gas_damage[entry] : gas_damage["default"] + var/dam = found_pp / gas_max[entry] * 10 + H.apply_damage_type(clamp(dam, damage_info["min"], damage_info["max"]), damage_info["damage_type"]) + if(alert_category && alert_type) + H.throw_alert(alert_category, alert_type) + else if(alert_category) + H.clear_alert(alert_category) + var/list/breath_reagents = GLOB.gas_data.breath_reagents + for(var/gas in breath.get_gases()) + if(gas in breath_reagents) + var/datum/reagent/R = breath_reagents[gas] + H.reagents.add_reagent(R, breath.get_moles(gas)*eff) + mole_adjustments[gas] = (gas in mole_adjustments) ? mole_adjustments[gas] - breath.get_moles(gas) : -breath.get_moles(gas) + + for(var/gas in mole_adjustments) + breath.adjust_moles(gas, mole_adjustments[gas]) //-- TRACES --// if(breath) // If there's some other shit in the air lets deal with it here. // N2O - REMOVE_TRAIT(H, TRAIT_SURGERY_PREPARED, "N2O") - var/SA_pp = breath.get_breath_partial_pressure(breath.get_moles(/datum/gas/nitrous_oxide)) + + var/SA_pp = PP(breath, GAS_NITROUS) 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! if(SA_pp > SA_sleep_min) // Enough to make us sleep as well H.Sleeping(max(H.AmountSleeping() + 40, 200)) - ADD_TRAIT(H, TRAIT_SURGERY_PREPARED, "N2O") 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)) H.emote(pick("giggle", "laugh")) @@ -255,7 +238,7 @@ // BZ - var/bz_pp = breath.get_breath_partial_pressure(breath.get_moles(/datum/gas/bz)) + var/bz_pp = PP(breath, GAS_BZ) if(bz_pp > BZ_trip_balls_min) H.adjust_hallucinations(10 SECONDS) H.reagents.add_reagent(/datum/reagent/bz_metabolites,5) @@ -266,22 +249,13 @@ H.adjust_hallucinations(5 SECONDS) H.reagents.add_reagent(/datum/reagent/bz_metabolites,1) - - // Tritium - var/trit_pp = breath.get_breath_partial_pressure(breath.get_moles(/datum/gas/tritium)) - if (trit_pp > 50) - H.radiation += trit_pp/2 //If you're breathing in half an atmosphere of radioactive gas, you fucked up. - else - H.radiation += trit_pp/10 - // Nitrium - var/nitrium_pp = breath.get_breath_partial_pressure(breath.get_moles(/datum/gas/nitrium)) + var/nitrium_pp = PP(breath, GAS_NITRIUM) // Random chance to inflict side effects, increases with pressure. if (nitrium_pp > 15 && prob(nitrium_pp)) H.adjustOrganLoss(ORGAN_SLOT_LUNGS, nitrium_pp * 0.1) to_chat(H, span_alert("You feel a burning sensation in your chest")) - - gas_breathed = breath.get_moles(/datum/gas/nitrium) + gas_breathed = breath.get_moles(GAS_NITRIUM) // Metabolize to reagents. if (gas_breathed > gas_stimulation_min) var/existing = H.reagents.get_reagent_amount(/datum/reagent/nitrium_low_metabolization) @@ -289,10 +263,10 @@ if (gas_breathed > gas_stimulation_min * 2.5) var/existing = H.reagents.get_reagent_amount(/datum/reagent/nitrium_high_metabolization) H.reagents.add_reagent(/datum/reagent/nitrium_high_metabolization, max(0, 1 - existing)) - breath.adjust_moles(/datum/gas/nitrium, -gas_breathed) + breath.adjust_moles(GAS_NITRIUM, -gas_breathed) // Freon - var/freon_pp = breath.get_breath_partial_pressure(breath.get_moles(/datum/gas/freon)) + var/freon_pp = PP(breath,GAS_FREON) if (prob(freon_pp)) to_chat(H, span_alert("Your mouth feels like it's burning!")) if (freon_pp >40) @@ -303,81 +277,80 @@ H.silent = max(H.silent, 3) else H.adjustFireLoss(freon_pp/4) - gas_breathed = breath.get_moles(/datum/gas/freon) + gas_breathed = breath.get_moles(GAS_FREON) if (gas_breathed > gas_stimulation_min) H.reagents.add_reagent(/datum/reagent/freon,1*eff) - breath.adjust_moles(/datum/gas/freon, -gas_breathed) + breath.adjust_moles(GAS_FREON, -gas_breathed) // Healium - var/healium_pp = breath.get_breath_partial_pressure(breath.get_moles(/datum/gas/healium)) + var/healium_pp = PP(breath,GAS_HEALIUM) if(healium_pp > SA_sleep_min) var/existing = H.reagents.get_reagent_amount(/datum/reagent/healium) H.reagents.add_reagent(/datum/reagent/healium,max(0, 1*eff - existing)) - gas_breathed = breath.get_moles(/datum/gas/healium) + gas_breathed = breath.get_moles(GAS_HEALIUM) if(gas_breathed > gas_stimulation_min && !helium_speech) helium_speech = TRUE RegisterSignal(owner, COMSIG_MOB_SAY, PROC_REF(handle_helium_speech)) else if (gas_breathed <= gas_stimulation_min && helium_speech) helium_speech = FALSE UnregisterSignal(owner, COMSIG_MOB_SAY) - breath.adjust_moles(/datum/gas/healium, -gas_breathed) + breath.adjust_moles(GAS_HEALIUM, -gas_breathed) // Pluonium // Inert // Zauker - var/zauker_pp = breath.get_breath_partial_pressure(breath.get_moles(/datum/gas/zauker)) - if(zauker_pp > safe_toxins_max) + var/zauker_pp = PP(breath,GAS_ZAUKER) + if(zauker_pp > safe_breath_max) H.adjustBruteLoss(25) H.adjustOxyLoss(5) H.adjustFireLoss(8) H.adjustToxLoss(8) - gas_breathed = breath.get_moles(/datum/gas/zauker) - breath.adjust_moles(/datum/gas/zauker, -gas_breathed) + gas_breathed = breath.get_moles(GAS_ZAUKER) + breath.adjust_moles(GAS_ZAUKER, -gas_breathed) // Halon - gas_breathed = breath.get_moles(/datum/gas/halon) + gas_breathed = breath.get_moles(GAS_HALON) if(gas_breathed > gas_stimulation_min) H.adjustOxyLoss(5) var/existing = H.reagents.get_reagent_amount(/datum/reagent/halon) H.reagents.add_reagent(/datum/reagent/halon,max(0, 1 - existing)) - gas_breathed = breath.get_moles(/datum/gas/halon) - breath.adjust_moles(/datum/gas/halon, -gas_breathed) + gas_breathed = breath.get_moles(GAS_HALON) + breath.adjust_moles(GAS_HALON, -gas_breathed) // Hexane - gas_breathed = breath.get_moles(/datum/gas/hexane) + gas_breathed = breath.get_moles(GAS_HEXANE) if(gas_breathed > gas_stimulation_min) H.adjust_hallucinations(50 SECONDS) H.reagents.add_reagent(/datum/reagent/hexane,5) if(prob(33)) H.adjustOrganLoss(ORGAN_SLOT_BRAIN, 3, 150) + breath.adjust_moles(GAS_HEXANE, -gas_breathed) // Hyper-noblium - gas_breathed = breath.get_moles(/datum/gas/hypernoblium) + gas_breathed = breath.get_moles(GAS_HYPERNOB) if(gas_breathed > gas_stimulation_min) var/existing = H.reagents.get_reagent_amount(/datum/reagent/hypernoblium) H.reagents.add_reagent(/datum/reagent/hypernoblium, max(0, eff - existing)) - breath.adjust_moles(/datum/gas/hypernoblium, -gas_breathed) + breath.adjust_moles(GAS_HYPERNOB, -gas_breathed) // Anti-noblium - gas_breathed = breath.get_moles(/datum/gas/antinoblium) + gas_breathed = breath.get_moles(GAS_ANTINOB) if(gas_breathed > gas_stimulation_min) var/existing = H.reagents.get_reagent_amount(/datum/reagent/antinoblium) H.reagents.add_reagent(/datum/reagent/antinoblium, max(0, eff - existing)) - breath.adjust_moles(/datum/gas/antinoblium, -gas_breathed) + breath.adjust_moles(GAS_ANTINOB, -gas_breathed) // Miasma - if (breath.get_moles(/datum/gas/miasma)) - var/miasma_pp = breath.get_breath_partial_pressure(breath.get_moles(/datum/gas/miasma)) + if (breath.get_moles(GAS_MIASMA)) + var/miasma_pp = PP(breath,GAS_MIASMA) //Miasma sickness if(prob(0.5 * miasma_pp)) - var/datum/disease/advance/miasma_disease = new /datum/disease/advance/random(min(round(max(miasma_pp/2, 1), 1), 6), min(round(max(miasma_pp, 1), 1), 8)) - if(owner.CanContractDisease(miasma_disease)) - //tl;dr the first argument chooses the smaller of miasma_pp/2 or 6(typical max virus symptoms), the second chooses the smaller of miasma_pp or 8(max virus symptom level) // - miasma_disease.name = "Unknown"//^each argument has a minimum of 1 and rounds to the nearest value. Feel free to change the pp scaling I couldn't decide on good numbers for it. - miasma_disease.try_infect(owner) + var/datum/disease/advance/miasma_disease = new /datum/disease/advance/random(2, 3) + miasma_disease.name = "Unknown" + miasma_disease.try_infect(owner) // Miasma side effects switch(miasma_pp) @@ -410,7 +383,7 @@ // Then again, this is a purely hypothetical scenario and hardly reachable owner.adjust_disgust(0.1 * miasma_pp) - breath.adjust_moles(/datum/gas/miasma, -gas_breathed) + breath.adjust_moles(GAS_MIASMA, -gas_breathed) // Clear out moods when no miasma at all else @@ -481,14 +454,9 @@ /obj/item/organ/lungs/attackby(obj/item/W, mob/user, params) if(!(organ_flags & ORGAN_SYNTHETIC) && organ_efficiency == 1 && W.tool_behaviour == TOOL_CROWBAR) user.visible_message(span_notice("[user] extends [src] with [W]!"), span_notice("You use [W] to extend [src]!"), "You hear something stretching.") - name = "extended [name]" - icon_state += "-crobar" //shh! don't tell anyone i handed you this card - safe_oxygen_min *= 2 //SCREAM LOUDER i dont know maybe eventually - safe_toxins_min *= 2 - safe_nitro_min *= 2 //BREATHE HARDER - safe_co2_min *= 2 - organ_efficiency = 2 //HOLD YOUR BREATH FOR REALLY LONG - maxHealth *= 0.5 //This procedure is not legal but i will do it for you + var/old_lung_loc = src.loc + qdel(src) + new /obj/item/organ/lungs/extended(old_lung_loc) /obj/item/organ/lungs/prepare_eat() var/obj/S = ..() @@ -498,6 +466,13 @@ /obj/item/organ/lungs/get_availability(datum/species/species) return !(TRAIT_NOBREATH in species.inherent_traits) +/obj/item/organ/lungs/extended + name = "extended lungs" + icon_state = "lungs-crobar" //shh! don't tell anyone i handed you this card + organ_efficiency = 2 //HOLD YOUR BREATH FOR REALLY LONG + maxHealth = 0.5 * STANDARD_ORGAN_THRESHOLD //This procedure is not legal but i will do it for you + breathing_class = /datum/breathing_class/oxygen_double //SCREAM LOUDER BREATHE HARDER i dont know maybe eventually + /obj/item/organ/lungs/ipc name = "cooling radiator" desc = "A radiator in the shape of a lung used to exchange heat to cool down" @@ -525,7 +500,7 @@ var/temperature = breath.return_temperature() for(var/id in breath.get_gases()) var/moles = breath.get_moles(id) - total_heat_capacity += GLOB.meta_gas_info[id][META_GAS_SPECIFIC_HEAT] * moles + total_heat_capacity += GLOB.gas_data.specific_heats[id] * moles // Normal atmos is 0.416 // 20C -> 293K // At about 50C overheating will begin @@ -556,38 +531,37 @@ desc = "A spongy rib-shaped mass for filtering plasma from the air." icon_state = "lungs-plasma" - safe_oxygen_min = 0 //We don't breath this - safe_toxins_min = 16 //We breath THIS! - safe_toxins_max = 0 + breathing_class = BREATH_PLASMA + +/obj/item/organ/lungs/plasmaman/populate_gas_info() + ..() + gas_max -= GAS_PLASMA /obj/item/organ/lungs/xeno name = "devolved plasma vessel" desc = "A lung-shaped organ vaguely similar to a plasma vessel, restructured from a storage system to a respiratory one." icon_state = "lungs-x" + breathing_class = /datum/breathing_class/oxygen_plas - safe_toxins_max = 0 //lmoa~ - oxygen_substitutes = list(/datum/gas/pluoxium = 8, /datum/gas/plasma = 1) heat_level_1_threshold = 313 heat_level_2_threshold = 353 heat_level_3_threshold = 600 -/obj/item/organ/lungs/xeno/check_breath(datum/gas_mixture/breath, mob/living/carbon/human/H) //handling this externally so I don't have to nerf pluoxium, can't handle it internally without removing perpetual pluox or requiring plasma for breathing - . = ..() - if(breath) - var/breath_amt = breath.get_moles(/datum/gas/plasma) - breath.adjust_moles(/datum/gas/plasma, -breath_amt) - breath.adjust_moles(/datum/gas/oxygen, breath_amt) +/obj/item/organ/lungs/xeno/populate_gas_info() + ..() + gas_max -= GAS_PLASMA + gas_damage -= GAS_PLASMA /obj/item/organ/lungs/slime name = "vacuole" desc = "A large organelle designed to store oxygen and other important gasses." - safe_toxins_max = 0 //We breathe this to gain POWER. - /obj/item/organ/lungs/slime/check_breath(datum/gas_mixture/breath, mob/living/carbon/human/H) . = ..() if (breath) - var/plasma_pp = breath.get_breath_partial_pressure(breath.get_moles(/datum/gas/plasma)) + var/total_moles = breath.total_moles() + var/pressure = breath.return_pressure() + var/plasma_pp = PP(breath, GAS_PLASMA) owner.blood_volume += (0.2 * plasma_pp) // 10/s when breathing literally nothing but plasma, which will suffocate you. /obj/item/organ/lungs/ghetto @@ -604,7 +578,8 @@ organ_flags = ORGAN_SYNTHETIC maxHealth = 2 * STANDARD_ORGAN_THRESHOLD organ_efficiency = 1.5 - safe_oxygen_min = 13 + safe_breath_min = 13 + safe_breath_max = 100 /obj/item/organ/lungs/cybernetic/emp_act() . = ..() @@ -616,11 +591,14 @@ name = "upgraded cybernetic lungs" desc = "A more advanced version of the stock cybernetic lungs, more efficient at, well, breathing. Features higher temperature tolerances and the ability to filter out most potentially harmful gases." icon_state = "lungs-c-u" + safe_breath_min = 4 + safe_breath_max = 250 + gas_max = list( + GAS_PLASMA = 30, + GAS_CO2 = 30 + ) maxHealth = 3 * STANDARD_ORGAN_THRESHOLD organ_efficiency = 2 - safe_oxygen_min = 10 - safe_co2_max = 20 - safe_toxins_max = 20 //Higher resistance to most harmful gasses SA_para_min = 3 SA_sleep_min = 6 BZ_trip_balls_min = 2 @@ -638,12 +616,12 @@ name = "aeration reticulum" desc = "These exotic lungs seem crunchier than most." icon_state = "lungs-ethereal" - oxygen_substitutes = list(/datum/gas/pluoxium = 8, /datum/gas/water_vapor = 1) + breathing_class = /datum/breathing_class/oxygen_vapor /obj/item/organ/lungs/ethereal/check_breath(datum/gas_mixture/breath, mob/living/carbon/human/H) . = ..() - var/electrolysis = breath.get_moles(/datum/gas/water_vapor) + var/electrolysis = breath.get_moles(GAS_H2O) if(electrolysis) - breath.adjust_moles(/datum/gas/water_vapor, -electrolysis) - breath.adjust_moles(/datum/gas/hydrogen, electrolysis) - breath.adjust_moles(/datum/gas/oxygen, electrolysis/2) + breath.adjust_moles(GAS_H2O, -electrolysis) + breath.adjust_moles(GAS_H2, electrolysis) + breath.adjust_moles(GAS_O2, electrolysis/2) diff --git a/code/modules/swarmers/swarmer_act.dm b/code/modules/swarmers/swarmer_act.dm index 92529679a759..d85d82513e6d 100644 --- a/code/modules/swarmers/swarmer_act.dm +++ b/code/modules/swarmers/swarmer_act.dm @@ -87,7 +87,7 @@ for(var/turf/T in range(1, src)) var/area/A = get_area(T) var/datum/gas_mixture/turf_air = T.return_air() - if(turf_air.get_moles(/datum/gas/hydrogen) > 1 || turf_air.get_moles(/datum/gas/tritium) > 1 || turf_air.get_moles(/datum/gas/plasma) > 1 || (locate(/obj/effect/hotspot) in T) || turf_air.return_pressure() > 500 || turf_air.return_temperature() > 750 || !turf_air.total_moles() || isspaceturf(T) || (!isonshuttle && (istype(A, /area/shuttle) || istype(A, /area/space))) || (isonshuttle && !istype(A, /area/shuttle))) + if(turf_air.get_moles(GAS_H2) > 1 || turf_air.get_moles(GAS_TRITIUM) > 1 || turf_air.get_moles(GAS_PLASMA) > 1 || (locate(/obj/effect/hotspot) in T) || turf_air.return_pressure() > 500 || turf_air.return_temperature() > 750 || !turf_air.total_moles() || isspaceturf(T) || (!isonshuttle && (istype(A, /area/shuttle) || istype(A, /area/space))) || (isonshuttle && !istype(A, /area/shuttle))) to_chat(S, span_warning("Destroying this object has the potential to cause a hull breach. Aborting.")) S.target = null return FALSE @@ -173,7 +173,7 @@ for(var/turf/T in range(1, src)) var/area/A = get_area(T) var/datum/gas_mixture/turf_air = T.return_air() - if(turf_air.get_moles(/datum/gas/hydrogen) > 1 || turf_air.get_moles(/datum/gas/tritium) > 1 || turf_air.get_moles(/datum/gas/plasma) > 1 || (locate(/obj/effect/hotspot) in T) || turf_air.return_pressure() > 500 || turf_air.return_temperature() > 750 || !turf_air.total_moles() || isspaceturf(T) || (!isonshuttle && (istype(A, /area/shuttle) || istype(A, /area/space))) || (isonshuttle && !istype(A, /area/shuttle))) + if(turf_air.get_moles(GAS_H2) > 1 || turf_air.get_moles(GAS_TRITIUM) > 1 || turf_air.get_moles(GAS_PLASMA) > 1 || (locate(/obj/effect/hotspot) in T) || turf_air.return_pressure() > 500 || turf_air.return_temperature() > 750 || !turf_air.total_moles() || isspaceturf(T) || (!isonshuttle && (istype(A, /area/shuttle) || istype(A, /area/space))) || (isonshuttle && !istype(A, /area/shuttle))) to_chat(S, span_warning("Destroying this object has the potential to cause a hull breach. Aborting.")) S.target = null return TRUE @@ -188,7 +188,7 @@ for(var/turf/adj_turf in range(1, src)) var/area/adj_area = get_area(adj_turf) var/datum/gas_mixture/turf_air = adj_turf.return_air() - if(turf_air.get_moles(/datum/gas/hydrogen) > 1 || turf_air.get_moles(/datum/gas/tritium) > 1 || turf_air.get_moles(/datum/gas/plasma) > 1 || (locate(/obj/effect/hotspot) in adj_turf) || turf_air.return_pressure() > 500 || turf_air.return_temperature() > 750 || !turf_air.total_moles() || isspaceturf(adj_turf) || (!is_on_shuttle && (istype(adj_area, /area/shuttle) || istype(adj_area, /area/space))) || (is_on_shuttle && !istype(adj_area, /area/shuttle))) + if(turf_air.get_moles(GAS_H2) > 1 || turf_air.get_moles(GAS_TRITIUM) > 1 || turf_air.get_moles(GAS_PLASMA) > 1 || (locate(/obj/effect/hotspot) in adj_turf) || turf_air.return_pressure() > 500 || turf_air.return_temperature() > 750 || !turf_air.total_moles() || isspaceturf(adj_turf) || (!is_on_shuttle && (istype(adj_area, /area/shuttle) || istype(adj_area, /area/space))) || (is_on_shuttle && !istype(adj_area, /area/shuttle))) to_chat(actor, span_warning("Destroying this object has the potential to cause a hull breach. Aborting.")) actor.target = null return TRUE diff --git a/dependencies.sh b/dependencies.sh old mode 100644 new mode 100755 index 7fa94eba3287..ceae6b6abeb8 --- a/dependencies.sh +++ b/dependencies.sh @@ -4,8 +4,8 @@ #Final authority on what's required to fully build the project # byond version -export BYOND_MAJOR=514 -export BYOND_MINOR=1589 +export BYOND_MAJOR=515 +export BYOND_MINOR=1620 #rust_g git tag export RUST_G_VERSION=1.2.0-yogs1 @@ -15,4 +15,7 @@ export NODE_VERSION=14 export NODE_VERSION_PRECISE=14.16.1 # SpacemanDMM git tag -export SPACEMAN_DMM_VERSION=suite-1.7.2 +export SPACEMAN_DMM_VERSION=suite-1.8 + +# Auxmos git tag +export AUXMOS_VERSION=434ed4ca7a0bf072f9861bd6e54552af8fb9e27f diff --git a/libauxmos.so b/libauxmos.so new file mode 100644 index 000000000000..c13f7b23a1bf Binary files /dev/null and b/libauxmos.so differ diff --git a/libbyond-extools.so b/libbyond-extools.so deleted file mode 100755 index 571c13bfea32..000000000000 Binary files a/libbyond-extools.so and /dev/null differ diff --git a/tgui/packages/tgui-dev-server/reloader.js b/tgui/packages/tgui-dev-server/reloader.js index 7b847ce0190b..c7645d7daf50 100644 --- a/tgui/packages/tgui-dev-server/reloader.js +++ b/tgui/packages/tgui-dev-server/reloader.js @@ -67,8 +67,6 @@ export const findCacheRoot = async () => { const onCacheRootFound = cacheRoot => { logger.log(`found cache at '${cacheRoot}'`); - // Plant a dummy - fs.closeSync(fs.openSync(cacheRoot + '/dummy', 'w')); }; export const reloadByondCache = async bundleDir => { @@ -93,6 +91,9 @@ export const reloadByondCache = async bundleDir => { // Clear garbage const garbage = await resolveGlob(cacheDir, './*.+(bundle|chunk|hot-update).*'); try { + // Plant a dummy browser window file, we'll be using this to avoid world topic + fs.closeSync(fs.openSync(cacheDir + '/dummy', 'w')); + for (let file of garbage) { fs.unlinkSync(file); } diff --git a/tgui/packages/tgui/constants.js b/tgui/packages/tgui/constants.js index 0d52f918e37e..5be174c16aa3 100644 --- a/tgui/packages/tgui/constants.js +++ b/tgui/packages/tgui/constants.js @@ -122,173 +122,3 @@ export const RADIO_CHANNELS = [ color: '#1ecc43', }, ]; - -const GASES = [ - { - id: 'o2', - path: '/datum/gas/oxygen', - name: 'Oxygen', - label: 'O₂', - color: 'blue', - }, - { - id: 'n2', - path: '/datum/gas/nitrogen', - name: 'Nitrogen', - label: 'N₂', - color: 'red', - }, - { - id: 'co2', - path: '/datum/gas/carbon_dioxide', - name: 'Carbon Dioxide', - label: 'CO₂', - color: 'grey', - }, - { - id: 'plasma', - path: '/datum/gas/plasma', - name: 'Plasma', - label: 'Plasma', - color: 'orange', - }, - { - id: 'water_vapor', - path: '/datum/gas/water_vapor', - name: 'Water Vapor', - label: 'H₂O', - color: 'lightsteelblue', - }, - { - id: 'nob', - path: '/datum/gas/hypernoblium', - name: 'Hyper-noblium', - label: 'Hyper-nob', - color: 'teal', - }, - { - id: 'n2o', - path: '/datum/gas/nitrous_oxide', - name: 'Nitrous Oxide', - label: 'N₂O', - color: 'bisque', - }, - { - id: 'no2', - path: '/datum/gas/nitrium', - name: 'Nitrium', - label: 'Nitrium', - color: 'brown', - }, - { - id: 'tritium', - path: '/datum/gas/tritium', - name: 'Tritium', - label: 'Tritium', - color: 'limegreen', - }, - { - id: 'bz', - path: '/datum/gas/bz', - name: 'BZ', - label: 'BZ', - color: 'mediumpurple', - }, - { - id: 'pluox', - path: '/datum/gas/pluoxium', - name: 'Pluoxium', - label: 'Pluoxium', - color: 'mediumslateblue', - }, - { - id: 'miasma', - path: '/datum/gas/miasma', - name: 'Miasma', - label: 'Miasma', - color: 'olive', - }, - { - id: 'Freon', - path: '/datum/gas/freon', - name: 'Freon', - label: 'Freon', - color: 'paleturquoise', - }, - { - id: 'hydrogen', - path: '/datum/gas/hydrogen', - name: 'Hydrogen', - label: 'H₂', - color: 'white', - }, - { - id: 'healium', - path: '/datum/gas/healium', - name: 'Healium', - label: 'Healium', - color: 'salmon', - }, - { - id: 'pluonium', - path: '/datum/gas/pluonium', - name: 'Pluonium', - label: 'Pluonium', - color: 'greenyellow', - }, - { - id: 'zauker', - path: '/datum/gas/zauker', - name: 'Zauker', - label: 'Zauker', - color: 'darkgreen', - }, - { - id: 'halon', - path: '/datum/gas/halon', - name: 'Halon', - label: 'Halon', - color: 'purple', - }, - { - id: 'antinoblium', - path: '/datum/gas/antinoblium', - name: 'Antinoblium', - label: 'Anti-nob', - color: 'maroon', - }, - { - id: 'hexane', - path: '/datum/gas/hexane', - name: 'Hexane', - label: 'Hexane', - color: 'plum', - }, - { - id: 'dilithium', - path: '/datum/gas/dilithium', - name: 'Dilithium', - label: 'Dilithium', - color: 'pink', - }, -]; - -export const getGasLabel = (gasId, fallbackValue) => { - const gasSearchString = String(gasId).toLowerCase(); - // prettier-ignore - const gas = GASES.find((gas) => ( - gas.id === gasSearchString - || gas.name.toLowerCase() === gasSearchString - )); - return (gas && gas.label) || fallbackValue || gasId; -}; - -export const getGasColor = (gasId) => { - const gasSearchString = String(gasId).toLowerCase(); - // prettier-ignore - const gas = GASES.find((gas) => ( - gas.id === gasSearchString - || gas.name.toLowerCase() === gasSearchString - )); - return gas && gas.color; -}; diff --git a/tgui/packages/tgui/interfaces/AtmosFilter.js b/tgui/packages/tgui/interfaces/AtmosFilter.js index 5ce4f13e314d..98fff7cf975d 100644 --- a/tgui/packages/tgui/interfaces/AtmosFilter.js +++ b/tgui/packages/tgui/interfaces/AtmosFilter.js @@ -1,6 +1,5 @@ import { useBackend } from '../backend'; import { Button, LabeledList, NumberInput, Section } from '../components'; -import { getGasLabel } from '../constants'; import { Window } from '../layouts'; export const AtmosFilter = (props, context) => { @@ -45,7 +44,7 @@ export const AtmosFilter = (props, context) => {