From ab198b7a17d290f79952fd6bb29c4f81e2f397d7 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Tue, 9 Jul 2024 01:59:17 +0200
Subject: [PATCH 001/114] LINDA FUCKING REFORGED
https://github.com/tgstation/tgstation/pull/55604
---
beestation.dme | 4 +-
code/__DEFINES/atmospherics.dm | 454 ++++++----
code/__DEFINES/dcs/signals/signals_turf.dm | 2 +
code/__DEFINES/flags.dm | 14 +-
code/__DEFINES/subsystems.dm | 22 +-
code/controllers/subsystem/adjacent_air.dm | 31 +-
code/controllers/subsystem/air.dm | 849 ++++++++++--------
code/datums/elements/atmos_sensitive.dm | 71 ++
code/game/atoms_movable.dm | 2 +-
code/game/machinery/doors/airlock.dm | 6 +-
code/game/machinery/doors/airlock_types.dm | 12 +-
code/game/machinery/doors/door.dm | 10 +-
code/game/machinery/doors/windowdoor.dm | 16 +-
code/game/machinery/firealarm.dm | 19 +-
code/game/machinery/shieldgen.dm | 7 +-
code/game/machinery/shuttle/shuttle_engine.dm | 2 +-
code/game/machinery/spaceheater.dm | 2 +-
.../effects/effect_system/effects_foam.dm | 28 +-
.../effects/effect_system/effects_smoke.dm | 2 +-
code/game/objects/effects/glowshroom.dm | 12 +-
code/game/objects/effects/portals.dm | 4 +-
code/game/objects/effects/spiders.dm | 20 +-
code/game/objects/items/flamethrower.dm | 12 +-
code/game/objects/items/latexballoon.dm | 9 +-
code/game/objects/items/powerfist.dm | 6 +-
.../items/stacks/sheets/mineral/materials.dm | 8 +-
.../items/stacks/sheets/organic/leather.dm | 22 +-
code/game/objects/items/tanks/tanks.dm | 2 +-
code/game/objects/structures/aliens.dm | 29 +-
code/game/objects/structures/false_walls.dm | 17 +-
code/game/objects/structures/grille.dm | 14 +-
code/game/objects/structures/holosign.dm | 3 +-
code/game/objects/structures/mineral_doors.dm | 27 +-
code/game/objects/structures/plasticflaps.dm | 8 +-
code/game/objects/structures/statues.dm | 10 +-
.../structures/transit_tubes/station.dm | 2 +-
.../objects/structures/windoor_assembly.dm | 4 +-
code/game/objects/structures/window.dm | 20 +-
code/game/turfs/change_turf.dm | 78 +-
code/game/turfs/closed/wall/mineral_walls.dm | 5 +-
code/game/turfs/open/_open.dm | 20 +-
code/game/turfs/open/floor/mineral_floor.dm | 6 +-
code/game/turfs/open/space/space.dm | 3 +
code/game/turfs/turf.dm | 4 +-
.../antagonists/blob/structures/_blob.dm | 4 +-
.../antagonists/blob/structures/shield.dm | 2 +-
code/modules/atmospherics/Atmospherics.md | 444 +++++++++
code/modules/atmospherics/auxgm/gas_types.dm | 128 ---
.../atmospherics/environmental/LINDA_fire.dm | 106 +--
.../environmental/LINDA_system.dm | 149 ++-
.../environmental/LINDA_turf_tile.dm | 699 ++++++++++----
.../modules/atmospherics/gasmixtures/auxgm.dm | 130 ---
.../atmospherics/gasmixtures/gas_mixture.dm | 707 ++++++++++-----
.../atmospherics/gasmixtures/gas_types.dm | 161 ++++
.../gasmixtures/immutable_mixtures.dm | 39 +-
.../atmospherics/gasmixtures/reactions.dm | 12 -
.../components/binary_devices/circulator.dm | 2 +-
.../components/binary_devices/dp_vent_pump.dm | 12 +-
.../components/binary_devices/volume_pump.dm | 2 +-
.../machinery/components/components_base.dm | 68 +-
.../unary_devices/outlet_injector.dm | 2 +-
.../components/unary_devices/passive_vent.dm | 2 +-
.../components/unary_devices/vent_pump.dm | 6 +-
.../components/unary_devices/vent_scrubber.dm | 4 +-
.../atmospherics/machinery/pipes/pipes.dm | 2 +-
.../machinery/portable/canister.dm | 15 +-
.../portable/portable_atmospherics.dm | 2 +-
.../atmospherics/machinery/portable/pump.dm | 4 +-
.../machinery/portable/scrubber.dm | 4 +-
code/modules/clothing/under/accessories.dm | 16 +-
code/modules/events/spacevine.dm | 12 +-
code/modules/holodeck/area_copy.dm | 2 +-
code/modules/mapping/map_template.dm | 2 +-
code/modules/mining/coins.dm | 8 +-
code/modules/mining/equipment/survival_pod.dm | 3 +-
.../living/carbon/alien/special/facehugger.dm | 13 +-
code/modules/mob/living/carbon/life.dm | 2 +-
.../mob/living/simple_animal/bot/atmosbot.dm | 2 +-
.../mob/living/simple_animal/bot/firebot.dm | 18 +-
code/modules/power/apc/apc_main.dm | 12 +
code/modules/power/lighting/light.dm | 11 +-
.../power/singularity/containment_field.dm | 1 +
.../power/singularity/field_generator.dm | 4 +-
code/modules/power/supermatter/supermatter.dm | 2 +-
.../mapGeneratorModules/helpers.dm | 7 +-
code/modules/reagents/reagent_containers.dm | 4 +-
code/modules/recycling/disposal/bin.dm | 14 +-
code/modules/recycling/disposal/holder.dm | 2 +-
code/modules/research/experimentor.dm | 4 +-
code/modules/research/server.dm | 4 +-
.../xenobiology/crossbreeding/_structures.dm | 4 +-
.../xenobiology/crossbreeding/chilling.dm | 2 +-
code/modules/shuttle/on_move.dm | 8 +-
.../loot/alien_artifact.dm | 4 +-
code/modules/vehicles/mecha/_mecha.dm | 4 +
code/modules/vehicles/mecha/mecha_defense.dm | 11 +-
.../traits/xenoartifact_malfunctions.dm | 4 +-
97 files changed, 3087 insertions(+), 1697 deletions(-)
create mode 100644 code/datums/elements/atmos_sensitive.dm
create mode 100644 code/modules/atmospherics/Atmospherics.md
delete mode 100644 code/modules/atmospherics/auxgm/gas_types.dm
delete mode 100644 code/modules/atmospherics/gasmixtures/auxgm.dm
create mode 100644 code/modules/atmospherics/gasmixtures/gas_types.dm
diff --git a/beestation.dme b/beestation.dme
index c54377035f0e6..2cf4be02cb505 100644
--- a/beestation.dme
+++ b/beestation.dme
@@ -796,6 +796,7 @@
#include "code\datums\elements\_element.dm"
#include "code\datums\elements\art.dm"
#include "code\datums\elements\atmos_requirements.dm"
+#include "code\datums\elements\atmos_sensitive.dm"
#include "code\datums\elements\basic_body_temp_sensitive.dm"
#include "code\datums\elements\bed_tucking.dm"
#include "code\datums\elements\bsa_blocker.dm"
@@ -2158,12 +2159,11 @@
#include "code\modules\asset_cache\transports\asset_transport.dm"
#include "code\modules\asset_cache\transports\webroot_transport.dm"
#include "code\modules\atmospherics\auxgm\breathing_classes.dm"
-#include "code\modules\atmospherics\auxgm\gas_types.dm"
#include "code\modules\atmospherics\environmental\LINDA_fire.dm"
#include "code\modules\atmospherics\environmental\LINDA_system.dm"
#include "code\modules\atmospherics\environmental\LINDA_turf_tile.dm"
-#include "code\modules\atmospherics\gasmixtures\auxgm.dm"
#include "code\modules\atmospherics\gasmixtures\gas_mixture.dm"
+#include "code\modules\atmospherics\gasmixtures\gas_types.dm"
#include "code\modules\atmospherics\gasmixtures\immutable_mixtures.dm"
#include "code\modules\atmospherics\gasmixtures\reactions.dm"
#include "code\modules\atmospherics\machinery\airalarm.dm"
diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm
index f508d854b1c86..351d27e3c8a52 100644
--- a/code/__DEFINES/atmospherics.dm
+++ b/code/__DEFINES/atmospherics.dm
@@ -1,58 +1,89 @@
+//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)
-#define R_IDEAL_GAS_EQUATION 8.31
+#define R_IDEAL_GAS_EQUATION 8.31
/// kPa
-#define ONE_ATMOSPHERE 101.325
+#define ONE_ATMOSPHERE 101.325
/// -270.3degC
-#define TCMB 2.7
+#define TCMB 2.7
/// -48.15degC
-#define TCRYO 225
+#define TCRYO 225
/// 0degC
-#define T0C 273.15
+#define T0C 273.15
/// 20degC
-#define T20C 293.15
+#define T20C 293.15
/// -14C - Temperature used for kitchen cold room, medical freezer, etc.
-#define COLD_ROOM_TEMP 259.15
+#define COLD_ROOM_TEMP 259.15
///moles in a 2.5 m^3 cell at 101.325 Pa and 20 degC (103 or so)
-#define MOLES_CELLSTANDARD (ONE_ATMOSPHERE*CELL_VOLUME/(T20C*R_IDEAL_GAS_EQUATION))
+#define MOLES_CELLSTANDARD (ONE_ATMOSPHERE*CELL_VOLUME/(T20C*R_IDEAL_GAS_EQUATION))
///compared against for superconductivity
-#define M_CELL_WITH_RATIO (MOLES_CELLSTANDARD * 0.005)
+#define M_CELL_WITH_RATIO (MOLES_CELLSTANDARD * 0.005)
/// percentage of oxygen in a normal mixture of air
-#define O2STANDARD 0.21
+#define O2STANDARD 0.21
/// same but for nitrogen
-#define N2STANDARD 0.79
+#define N2STANDARD 0.79
/// O2 standard value (21%)
-#define MOLES_O2STANDARD (MOLES_CELLSTANDARD*O2STANDARD)
+#define MOLES_O2STANDARD (MOLES_CELLSTANDARD*O2STANDARD)
/// N2 standard value (79%)
-#define MOLES_N2STANDARD (MOLES_CELLSTANDARD*N2STANDARD)
+#define MOLES_N2STANDARD (MOLES_CELLSTANDARD*N2STANDARD)
/// liters in a cell
-#define CELL_VOLUME 2500
+#define CELL_VOLUME 2500
+
+/// liters in a normal breath. note that breaths are taken once every 4 life ticks, which is 8 seconds
+#define BREATH_VOLUME 2
+/// Amount of air to take a from a tile
+#define BREATH_PERCENTAGE (BREATH_VOLUME/CELL_VOLUME)
-#define BREATH_VOLUME 0.5 //! liters in a normal breath
-#define BREATH_PERCENTAGE (BREATH_VOLUME/CELL_VOLUME) //! Amount of air to take a from a tile
//EXCITED GROUPS
-#define EXCITED_GROUP_BREAKDOWN_CYCLES 3 //! number of FULL air controller ticks before an excited group breaks down (averages gas contents across turfs)
-#define EXCITED_GROUP_DISMANTLE_CYCLES 15 //! number of FULL air controller ticks before an excited group dismantles and removes its turfs from active
-#define MINIMUM_AIR_RATIO_TO_SUSPEND 0.1 //! Ratio of air that must move to/from a tile to reset group processing
-#define MINIMUM_AIR_RATIO_TO_MOVE 0.05 //! Minimum ratio of air that must move to/from a tile
-#define MINIMUM_AIR_TO_SUSPEND (MOLES_CELLSTANDARD*MINIMUM_AIR_RATIO_TO_SUSPEND) //! Minimum amount of air that has to move before a group processing can be suspended
-#define MINIMUM_MOLES_DELTA_TO_MOVE (MOLES_CELLSTANDARD*MINIMUM_AIR_RATIO_TO_MOVE) //! Either this must be active or MINIMUM_TEMPERATURE_TO_MOVE
-#define MINIMUM_TEMPERATURE_TO_MOVE (T20C+100) //! Either this must be active or MINIMUM_MOLES_DELTA_TO_MOVE
-#define MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND 4 //! Minimum temperature difference before group processing is suspended
-#define MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER 1 //! Minimum temperature difference before the gas temperatures are just set to be equal
-#define MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION (T20C+10)
-#define MINIMUM_TEMPERATURE_START_SUPERCONDUCTION (T20C+200)
+/// number of FULL air controller ticks before an excited group breaks down (averages gas contents across turfs)
+#define EXCITED_GROUP_BREAKDOWN_CYCLES 4
+/// number of FULL air controller ticks before an excited group dismantles and removes its turfs from active
+#define EXCITED_GROUP_DISMANTLE_CYCLES 9 //Reset after 2 breakdowns
+/// Ratio of air that must move to/from a tile to reset group processing
+#define MINIMUM_AIR_RATIO_TO_SUSPEND 0.1
+/// Minimum ratio of air that must move to/from a tile
+#define MINIMUM_AIR_RATIO_TO_MOVE 0.001
+/// Minimum amount of air that has to move before a group processing can be suspended (Round about 10)
+#define MINIMUM_AIR_TO_SUSPEND (MOLES_CELLSTANDARD*MINIMUM_AIR_RATIO_TO_SUSPEND)
+/// Either this must be active (round about 0.1) //Might need to raise this a tad to better support space leaks. we'll see
+#define MINIMUM_MOLES_DELTA_TO_MOVE (MOLES_CELLSTANDARD*MINIMUM_AIR_RATIO_TO_MOVE)
+/// or this (or both, obviously)
+#define MINIMUM_TEMPERATURE_TO_MOVE (T20C+100)
+/// Minimum temperature difference before group processing is suspended
+#define MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND 4
+/// Minimum temperature difference before the gas temperatures are just set to be equal
+#define MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER 0.5
+#define MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION (T20C+80)
+#define MINIMUM_TEMPERATURE_START_SUPERCONDUCTION (T20C+400)
+
+//Excited Group Cleanup helper defines
+#define EX_CLEANUP_BREAKDOWN 1
+#define EX_CLEANUP_DISMANTLE 2
+#define EX_CLEANUP_TURFS 3
//HEAT TRANSFER COEFFICIENTS
//Must be between 0 and 1. Values closer to 1 equalize temperature faster
//Should not exceed 0.4 else strange heat flow occur
#define WALL_HEAT_TRANSFER_COEFFICIENT 0.0
#define OPEN_HEAT_TRANSFER_COEFFICIENT 0.4
-#define WINDOW_HEAT_TRANSFER_COEFFICIENT 0.1 //a hack for now
-#define HEAT_CAPACITY_VACUUM 7000 //a hack to help make vacuums "cold", sacrificing realism for gameplay
+/// a hack for now
+#define WINDOW_HEAT_TRANSFER_COEFFICIENT 0.1
+/// a hack to help make vacuums "cold", sacrificing realism for gameplay
+#define HEAT_CAPACITY_VACUUM 7000
//FIRE
#define FIRE_MINIMUM_TEMPERATURE_TO_SPREAD (150+T0C)
@@ -62,14 +93,31 @@
#define PLASMA_MINIMUM_BURN_TEMPERATURE (100+T0C)
#define PLASMA_UPPER_TEMPERATURE (1370+T0C)
#define PLASMA_OXYGEN_FULLBURN 10
+#define HYDROGEN_MINIMUM_BURN_TEMPERATURE (100+T0C)
+#define HYDROGEN_UPPER_TEMPERATURE (1370+T0C)
+#define HYDROGEN_OXYGEN_FULLBURN 10
+
+//COLD FIRE (this is used only for the freon-o2 reaction, there is no fire still)
+#define COLD_FIRE_MAXIMUM_TEMPERATURE_TO_SPREAD 263 //fire will spread if the temperature is -10 °C
+#define COLD_FIRE_MAXIMUM_TEMPERATURE_TO_EXIST 273 //fire will start if the temperature is 0 °C
+#define COLD_FIRE_SPREAD_RADIOSITY_SCALE 0.95
+#define COLD_FIRE_GROWTH_RATE 40000
+#define FREON_MAXIMUM_BURN_TEMPERATURE 283
+#define FREON_LOWER_TEMPERATURE 60 //minimum temperature allowed for the burn to go, we would have negative pressure otherwise
+#define FREON_OXYGEN_FULLBURN 10
//GASES
#define MIN_TOXIC_GAS_DAMAGE 1
#define MAX_TOXIC_GAS_DAMAGE 10
-#define MOLES_GAS_VISIBLE 0.25 //! Moles in a standard cell after which gases are visible
+/// Moles in a standard cell after which gases are visible
+#define MOLES_GAS_VISIBLE 0.25
-#define FACTOR_GAS_VISIBLE_MAX 20 //! moles_visible * FACTOR_GAS_VISIBLE_MAX = Moles after which gas is at maximum visibility
-#define MOLES_GAS_VISIBLE_STEP 0.25 //! Mole step for alpha updates. This means alpha can update at 0.25, 0.5, 0.75 and so on
+/// moles_visible * FACTOR_GAS_VISIBLE_MAX = Moles after which gas is at maximum visibility
+#define FACTOR_GAS_VISIBLE_MAX 20
+/// Mole step for alpha updates. This means alpha can update at 0.25, 0.5, 0.75 and so on
+#define MOLES_GAS_VISIBLE_STEP 0.25
+/// The total visible states
+#define TOTAL_VISIBLE_STATES (FACTOR_GAS_VISIBLE_MAX * (1 / MOLES_GAS_VISIBLE_STEP))
//REACTIONS
//return values for reactions (bitflags)
@@ -79,98 +127,99 @@
// Pressure limits.
/// This determins at what pressure the ultra-high pressure red icon is displayed. (This one is set as a constant)
-#define HAZARD_HIGH_PRESSURE 550
+#define HAZARD_HIGH_PRESSURE 550
/// This determins when the orange pressure icon is displayed (it is 0.7 * HAZARD_HIGH_PRESSURE)
-#define WARNING_HIGH_PRESSURE 325
+#define WARNING_HIGH_PRESSURE 325
/// This is when the gray low pressure icon is displayed. (it is 2.5 * HAZARD_LOW_PRESSURE)
-#define WARNING_LOW_PRESSURE 50
+#define WARNING_LOW_PRESSURE 50
/// This is when the black ultra-low pressure icon is displayed. (This one is set as a constant)
-#define HAZARD_LOW_PRESSURE 20
+#define HAZARD_LOW_PRESSURE 20
/// This is used in handle_temperature_damage() for humans, and in reagents that affect body temperature. Temperature damage is multiplied by this amount.
-#define TEMPERATURE_DAMAGE_COEFFICIENT 1.5
+#define TEMPERATURE_DAMAGE_COEFFICIENT 1.5
/// The natural temperature for a body
-#define BODYTEMP_NORMAL 310.15
+#define BODYTEMP_NORMAL 310.15
/// This is the divisor which handles how much of the temperature difference between the current body temperature and 310.15K (optimal temperature) humans auto-regenerate each tick. The higher the number, the slower the recovery. This is applied each tick, so long as the mob is alive.
-#define BODYTEMP_AUTORECOVERY_DIVISOR 14
+#define BODYTEMP_AUTORECOVERY_DIVISOR 14
/// Minimum amount of kelvin moved toward 310K per tick. So long as abs(310.15 - bodytemp) is more than 50.
-#define BODYTEMP_AUTORECOVERY_MINIMUM 6
+#define BODYTEMP_AUTORECOVERY_MINIMUM 6
///Similar to the BODYTEMP_AUTORECOVERY_DIVISOR, but this is the divisor which is applied at the stage that follows autorecovery. This is the divisor which comes into play when the human's loc temperature is lower than their body temperature. Make it lower to lose bodytemp faster.
-#define BODYTEMP_COLD_DIVISOR 15
+#define BODYTEMP_COLD_DIVISOR 15
/// Similar to the BODYTEMP_AUTORECOVERY_DIVISOR, but this is the divisor which is applied at the stage that follows autorecovery. This is the divisor which comes into play when the human's loc temperature is higher than their body temperature. Make it lower to gain bodytemp faster.
-#define BODYTEMP_HEAT_DIVISOR 15
+#define BODYTEMP_HEAT_DIVISOR 15
/// The maximum number of degrees that your body can cool in 1 tick, due to the environment, when in a cold area.
-#define BODYTEMP_COOLING_MAX -30
+#define BODYTEMP_COOLING_MAX -30
/// The maximum number of degrees that your body can heat up in 1 tick, due to the environment, when in a hot area.
-#define BODYTEMP_HEATING_MAX 30
-
+#define BODYTEMP_HEATING_MAX 30
/// The body temperature limit the human body can take before it starts taking damage from heat.
/// This also affects how fast the body normalises it's temperature when hot.
/// 340k is about 66c, and rather high for a human.
-#define BODYTEMP_HEAT_DAMAGE_LIMIT (BODYTEMP_NORMAL + 30)
+#define BODYTEMP_HEAT_DAMAGE_LIMIT (BODYTEMP_NORMAL + 30)
/// The body temperature limit the human body can take before it starts taking damage from cold.
/// This also affects how fast the body normalises it's temperature when cold.
/// 270k is about -3c, that is below freezing and would hurt over time.
-#define BODYTEMP_COLD_DAMAGE_LIMIT (BODYTEMP_NORMAL - 40)
+#define BODYTEMP_COLD_DAMAGE_LIMIT (BODYTEMP_NORMAL - 40)
/// The body temperature limit the human body can take before it will take wound damage.
-#define BODYTEMP_HEAT_WOUND_LIMIT (BODYTEMP_NORMAL + 90) // 400.5 k
-
-// Body temperature warning icons
-/// The temperature the red icon is displayed.
-#define BODYTEMP_HEAT_WARNING_3 (BODYTEMP_HEAT_DAMAGE_LIMIT + 360) //+700k
-/// The temperature the orange icon is displayed.
-#define BODYTEMP_HEAT_WARNING_2 (BODYTEMP_HEAT_DAMAGE_LIMIT + 120) //460K
-/// The temperature the yellow icon is displayed.
-#define BODYTEMP_HEAT_WARNING_1 (BODYTEMP_HEAT_DAMAGE_LIMIT) //340K
-/// The temperature the light green icon is displayed.
-#define BODYTEMP_COLD_WARNING_1 (BODYTEMP_COLD_DAMAGE_LIMIT) //270k
-/// The temperature the cyan icon is displayed.
-#define BODYTEMP_COLD_WARNING_2 (BODYTEMP_COLD_DAMAGE_LIMIT - 70) //200k
-/// The temperature the blue icon is displayed.
-#define BODYTEMP_COLD_WARNING_3 (BODYTEMP_COLD_DAMAGE_LIMIT - 150) //120k
-
-#define SPACE_HELM_MIN_TEMP_PROTECT 2.0 //! what min_cold_protection_temperature is set to for space-helmet quality headwear. MUST NOT BE 0.
-#define SPACE_HELM_MAX_TEMP_PROTECT 1500 //! Thermal insulation works both ways /Malkevin
-#define SPACE_SUIT_MIN_TEMP_PROTECT 2.0 //! what min_cold_protection_temperature is set to for space-suit quality jumpsuits or suits. MUST NOT BE 0.
+#define BODYTEMP_HEAT_WOUND_LIMIT (BODYTEMP_NORMAL + 90) // 400.5 k
+
+/// what min_cold_protection_temperature is set to for space-helmet quality headwear. MUST NOT BE 0.
+#define SPACE_HELM_MIN_TEMP_PROTECT 2.0
+/// Thermal insulation works both ways /Malkevin
+#define SPACE_HELM_MAX_TEMP_PROTECT 1500
+/// what min_cold_protection_temperature is set to for space-suit quality jumpsuits or suits. MUST NOT BE 0.
+#define SPACE_SUIT_MIN_TEMP_PROTECT 2.0
+/// The min cold protection of a space suit without the heater active
+#define SPACE_SUIT_MIN_TEMP_PROTECT_OFF 72
#define SPACE_SUIT_MAX_TEMP_PROTECT 1500
-#define FIRE_SUIT_MIN_TEMP_PROTECT 60 //! Cold protection for firesuits
-#define FIRE_SUIT_MAX_TEMP_PROTECT 30000 //! what max_heat_protection_temperature is set to for firesuit quality suits. MUST NOT BE 0.
-#define FIRE_HELM_MIN_TEMP_PROTECT 60 //! Cold protection for fire helmets
-#define FIRE_HELM_MAX_TEMP_PROTECT 30000 //! for fire helmet quality items (red and white hardhats)
-
-#define FIRE_IMMUNITY_MAX_TEMP_PROTECT 35000 //! what max_heat_protection_temperature is set to for firesuit quality suits and helmets. MUST NOT BE 0.
-
-//Emergency skinsuits
-#define EMERGENCY_HELM_MIN_TEMP_PROTECT 2.0 //The helmet is pressurized with air from the oxygen tank. If they don't take damage from that they won't take damage here
-#define EMERGENCY_SUIT_MIN_TEMP_PROTECT 237 //This is the approximate average temperature of Mt. Everest in the winter
-
-#define HELMET_MIN_TEMP_PROTECT 160 //For normal helmets
-#define HELMET_MAX_TEMP_PROTECT 600 //For normal helmets
-#define ARMOR_MIN_TEMP_PROTECT 160 //For armor
-#define ARMOR_MAX_TEMP_PROTECT 600 //For armor
-
-#define GLOVES_MIN_TEMP_PROTECT 2.0 //For some gloves (black and)
-#define GLOVES_MAX_TEMP_PROTECT 1500 //For some gloves
-#define SHOES_MIN_TEMP_PROTECT 2.0 //For gloves
-#define SHOES_MAX_TEMP_PROTECT 1500 //For gloves
-
-#define PRESSURE_DAMAGE_COEFFICIENT 4 //! The amount of pressure damage someone takes is equal to (pressure / HAZARD_HIGH_PRESSURE)*PRESSURE_DAMAGE_COEFFICIENT, with the maximum of MAX_PRESSURE_DAMAGE
+/// Cold protection for firesuits
+#define FIRE_SUIT_MIN_TEMP_PROTECT 60
+/// what max_heat_protection_temperature is set to for firesuit quality suits. MUST NOT BE 0.
+#define FIRE_SUIT_MAX_TEMP_PROTECT 30000
+/// Cold protection for fire helmets
+#define FIRE_HELM_MIN_TEMP_PROTECT 60
+/// for fire helmet quality items (red and white hardhats)
+#define FIRE_HELM_MAX_TEMP_PROTECT 30000
+
+/// what max_heat_protection_temperature is set to for firesuit quality suits and helmets. MUST NOT BE 0.
+#define FIRE_IMMUNITY_MAX_TEMP_PROTECT 35000
+
+/// For normal helmets
+#define HELMET_MIN_TEMP_PROTECT 160
+/// For normal helmets
+#define HELMET_MAX_TEMP_PROTECT 600
+/// For armor
+#define ARMOR_MIN_TEMP_PROTECT 160
+/// For armor
+#define ARMOR_MAX_TEMP_PROTECT 600
+
+/// For some gloves (black and)
+#define GLOVES_MIN_TEMP_PROTECT 2.0
+/// For some gloves
+#define GLOVES_MAX_TEMP_PROTECT 1500
+/// For gloves
+#define SHOES_MIN_TEMP_PROTECT 2.0
+/// For gloves
+#define SHOES_MAX_TEMP_PROTECT 1500
+
+/// The amount of pressure damage someone takes is equal to (pressure / HAZARD_HIGH_PRESSURE)*PRESSURE_DAMAGE_COEFFICIENT, with the maximum of MAX_PRESSURE_DAMAGE
+#define PRESSURE_DAMAGE_COEFFICIENT 4
#define MAX_HIGH_PRESSURE_DAMAGE 4
-#define LOW_PRESSURE_DAMAGE 4 //! The amount of damage someone takes when in a low pressure area (The pressure threshold is so low that it doesn't make sense to do any calculations, so it just applies this flat value).
+/// The amount of damage someone takes when in a low pressure area (The pressure threshold is so low that it doesn't make sense to do any calculations, so it just applies this flat value).
+#define LOW_PRESSURE_DAMAGE 4
-#define COLD_SLOWDOWN_FACTOR 20 //! Humans are slowed by the difference between bodytemp and BODYTEMP_COLD_DAMAGE_LIMIT divided by this
+/// Humans are slowed by the difference between bodytemp and BODYTEMP_COLD_DAMAGE_LIMIT divided by this
+#define COLD_SLOWDOWN_FACTOR 20
//PIPES
//Atmos pipe limits
/// (kPa) What pressure pumps and powered equipment max out at.
#define MAX_OUTPUT_PRESSURE 4500
/// (L/s) Maximum speed powered equipment can work at.
-#define MAX_TRANSFER_RATE 200
+#define MAX_TRANSFER_RATE 400
/// How many percent of the contents that an overclocked volume pumps leak into the air
-#define VOLUME_PUMP_LEAK_AMOUNT 0.1
-
+#define VOLUME_PUMP_LEAK_AMOUNT 0.2
//used for device_type vars
#define UNARY 1
#define BINARY 2
@@ -178,38 +227,46 @@
#define QUATERNARY 4
//TANKS
-#define TANK_MELT_TEMPERATURE 1000000 //! temperature in kelvins at which a tank will start to melt
-#define TANK_LEAK_PRESSURE (30.*ONE_ATMOSPHERE) //! temperature in kelvins at which a tank starts leaking
-#define TANK_RUPTURE_PRESSURE (35.*ONE_ATMOSPHERE) //! temperature in kelvins at which a tank spills all contents into atmosphere
-#define TANK_FRAGMENT_PRESSURE (40.*ONE_ATMOSPHERE) //! temperature in kelvins at which a tank creates a boom 3x3 base explosion
-#define TANK_FRAGMENT_SCALE (6.*ONE_ATMOSPHERE) //! +1 for each SCALE kPa aboe threshold
+/// temperature in kelvins at which a tank will start to melt
+#define TANK_MELT_TEMPERATURE 1000000
+/// Tank starts leaking
+#define TANK_LEAK_PRESSURE (30.*ONE_ATMOSPHERE)
+/// Tank spills all contents into atmosphere
+#define TANK_RUPTURE_PRESSURE (35.*ONE_ATMOSPHERE)
+/// Boom 3x3 base explosion
+#define TANK_FRAGMENT_PRESSURE (40.*ONE_ATMOSPHERE)
+/// +1 for each SCALE kPa aboe threshold
+#define TANK_FRAGMENT_SCALE (6.*ONE_ATMOSPHERE)
#define TANK_MAX_RELEASE_PRESSURE (ONE_ATMOSPHERE*3)
#define TANK_MIN_RELEASE_PRESSURE 0
-#define TANK_DEFAULT_RELEASE_PRESSURE 17
+#define TANK_DEFAULT_RELEASE_PRESSURE 16
//CANATMOSPASS
#define ATMOS_PASS_YES 1
#define ATMOS_PASS_NO 0
-#define ATMOS_PASS_PROC -1 //ask CanAtmosPass()
-#define ATMOS_PASS_DENSITY -2 //just check density
+/// ask CanAtmosPass()
+#define ATMOS_PASS_PROC -1
+/// just check density
+#define ATMOS_PASS_DENSITY -2
+//DO NOT USE THESE FOR ACCESSING ATMOS DATA, THEY MUTATE THINGS WHEN CALLED. I WILL BEAT YOU WITH A STICK. See the actual proc for more details
#define CANATMOSPASS(A, O) ( A.CanAtmosPass == ATMOS_PASS_PROC ? A.CanAtmosPass(O) : ( A.CanAtmosPass == ATMOS_PASS_DENSITY ? !A.density : A.CanAtmosPass ) )
#define CANVERTICALATMOSPASS(A, O) ( A.CanAtmosPassVertical == ATMOS_PASS_PROC ? A.CanAtmosPass(O, TRUE) : ( A.CanAtmosPassVertical == ATMOS_PASS_DENSITY ? !A.density : A.CanAtmosPassVertical ) )
//OPEN TURF ATMOS
/// the default air mix that open turfs spawn
-#define OPENTURF_DEFAULT_ATMOS "o2=22;n2=82;TEMP=293.15"
-#define OPENTURF_LOW_PRESSURE "o2=14;n2=30;TEMP=293.15"
+#define OPENTURF_DEFAULT_ATMOS "o2=22;n2=82;TEMP=293.15"
+#define OPENTURF_LOW_PRESSURE "o2=14;n2=30;TEMP=293.15"
/// -193,15°C telecommunications. also used for xenobiology slime killrooms
-#define TCOMMS_ATMOS "n2=100;TEMP=80"
+#define TCOMMS_ATMOS "n2=100;TEMP=80"
/// space
-#define AIRLESS_ATMOS "TEMP=2.7"
+#define AIRLESS_ATMOS "TEMP=2.7"
/// -93.15°C snow and ice turfs
-#define FROZEN_ATMOS "o2=22;n2=82;TEMP=180"
-/// -14°C kitchen coldroom, just might lose your tail; higher amount of mol to reach about 101.3 kpA
-#define KITCHEN_COLDROOM_ATMOS "o2=26;n2=97;TEMP=[COLD_ROOM_TEMP]"
+#define FROZEN_ATMOS "o2=22;n2=82;TEMP=180"
+/// -14°C kitchen coldroom, just might loss your tail; higher amount of mol to reach about 101.3 kpA
+#define KITCHEN_COLDROOM_ATMOS "o2=26;n2=97;TEMP=[COLD_ROOM_TEMP]"
/// used in the holodeck burn test program
-#define BURNMIX_ATMOS "o2=100;plasma=200;TEMP=370" //used in the holodeck burn test program
+#define BURNMIX_ATMOS "o2=2500;plasma=5000;TEMP=370"
//ATMOSPHERICS DEPARTMENT GAS TANK TURFS
#define ATMOS_TANK_N2O "n2o=6000;TEMP=293.15"
@@ -217,23 +274,40 @@
#define ATMOS_TANK_PLASMA "plasma=70000;TEMP=293.15"
#define ATMOS_TANK_O2 "o2=100000;TEMP=293.15"
#define ATMOS_TANK_N2 "n2=100000;TEMP=293.15"
+#define ATMOS_TANK_BZ "bz=100000;TEMP=293.15"
+#define ATMOS_TANK_FREON "freon=100000;TEMP=293.15"
+#define ATMOS_TANK_HALON "halon=100000;TEMP=293.15"
+#define ATMOS_TANK_HEALIUM "healium=100000;TEMP=293.15"
+#define ATMOS_TANK_H2 "hydrogen=100000;TEMP=293.15"
+#define ATMOS_TANK_HYPERNOBLIUM "nob=100000;TEMP=293.15"
+#define ATMOS_TANK_MIASMA "miasma=100000;TEMP=293.15"
+#define ATMOS_TANK_NO2 "no2=100000;TEMP=293.15"
+#define ATMOS_TANK_PLUOXIUM "pluox=100000;TEMP=293.15"
+#define ATMOS_TANK_PROTO_NITRATE "proto_nitrate=100000;TEMP=293.15"
+#define ATMOS_TANK_STIMULUM "stim=100000;TEMP=293.15"
+#define ATMOS_TANK_TRITIUM "tritium=100000;TEMP=293.15"
+#define ATMOS_TANK_H2O "water_vapor=100000;TEMP=293.15"
+#define ATMOS_TANK_ZAUKER "zauker=100000;TEMP=293.15"
+#define ATMOS_TANK_HELIUM "helium=100000;TEMP=293.15"
+#define ATMOS_TANK_ANTINOBLIUM "antinoblium=100000;TEMP=293.15"
#define ATMOS_TANK_AIRMIX "o2=2644;n2=10580;TEMP=293.15"
//LAVALAND
-#define MAXIMUM_LAVALAND_EQUIPMENT_EFFECT_PRESSURE 90 //! what pressure you have to be under to increase the effect of equipment meant for lavaland
-#define LAVALAND_DEFAULT_ATMOS "o2=14;n2=5;co2=13;TEMP=300"
+/// what pressure you have to be under to increase the effect of equipment meant for lavaland
+#define LAVALAND_EQUIPMENT_EFFECT_PRESSURE 50
//ATMOS MIX IDS
-//Lavaland used to live here. That was a mistake.
+#define LAVALAND_DEFAULT_ATMOS "LAVALAND_ATMOS"
+#define ICEMOON_DEFAULT_ATMOS "ICEMOON_ATMOS"
//ATMOSIA GAS MONITOR TAGS
#define ATMOS_GAS_MONITOR_INPUT_O2 "o2_in"
#define ATMOS_GAS_MONITOR_OUTPUT_O2 "o2_out"
#define ATMOS_GAS_MONITOR_SENSOR_O2 "o2_sensor"
-#define ATMOS_GAS_MONITOR_INPUT_PLASMA "plasma_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_PLASMA "plasma_out"
-#define ATMOS_GAS_MONITOR_SENSOR_PLASMA "plasma_sensor"
+#define ATMOS_GAS_MONITOR_INPUT_TOX "tox_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_TOX "tox_out"
+#define ATMOS_GAS_MONITOR_SENSOR_TOX "tox_sensor"
#define ATMOS_GAS_MONITOR_INPUT_AIR "air_in"
#define ATMOS_GAS_MONITOR_OUTPUT_AIR "air_out"
@@ -255,6 +329,70 @@
#define ATMOS_GAS_MONITOR_OUTPUT_CO2 "co2_out"
#define ATMOS_GAS_MONITOR_SENSOR_CO2 "co2_sensor"
+#define ATMOS_GAS_MONITOR_INPUT_BZ "bz_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_BZ "bz_out"
+#define ATMOS_GAS_MONITOR_SENSOR_BZ "bz_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_FREON "freon_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_FREON "freon_out"
+#define ATMOS_GAS_MONITOR_SENSOR_FREON "freon_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_HALON "halon_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_HALON "halon_out"
+#define ATMOS_GAS_MONITOR_SENSOR_HALON "halon_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_HEALIUM "healium_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_HEALIUM "healium_out"
+#define ATMOS_GAS_MONITOR_SENSOR_HEALIUM "healium_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_H2 "h2_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_H2 "h2_out"
+#define ATMOS_GAS_MONITOR_SENSOR_H2 "h2_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_HYPERNOBLIUM "hypernoblium_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_HYPERNOBLIUM "hypernoblium_out"
+#define ATMOS_GAS_MONITOR_SENSOR_HYPERNOBLIUM "hypernoblium_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_MIASMA "miasma_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_MIASMA "miasma_out"
+#define ATMOS_GAS_MONITOR_SENSOR_MIASMA "miasma_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_NO2 "no2_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_NO2 "no2_out"
+#define ATMOS_GAS_MONITOR_SENSOR_NO2 "no2_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_PLUOXIUM "pluoxium_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_PLUOXIUM "pluoxium_out"
+#define ATMOS_GAS_MONITOR_SENSOR_PLUOXIUM "pluoxium_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_PROTO_NITRATE "proto-nitrate_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_PROTO_NITRATE "proto-nitrate_out"
+#define ATMOS_GAS_MONITOR_SENSOR_PROTO_NITRATE "proto-nitrate_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_STIMULUM "stimulum_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_STIMULUM "stimulum_out"
+#define ATMOS_GAS_MONITOR_SENSOR_STIMULUM "stimulum_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_TRITIUM "tritium_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_TRITIUM "tritium_out"
+#define ATMOS_GAS_MONITOR_SENSOR_TRITIUM "tritium_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_H2O "h2o_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_H2O "h2o_out"
+#define ATMOS_GAS_MONITOR_SENSOR_H2O "h2o_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_ZAUKER "zauker_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_ZAUKER "zauker_out"
+#define ATMOS_GAS_MONITOR_SENSOR_ZAUKER "zauker_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_HELIUM "helium_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_HELIUM "helium_out"
+#define ATMOS_GAS_MONITOR_SENSOR_HELIUM "helium_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_ANTINOBLIUM "antinoblium_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_ANTINOBLIUM "antinoblium_out"
+#define ATMOS_GAS_MONITOR_SENSOR_ANTINOBLIUM "antinoblium_sensor"
+
#define ATMOS_GAS_MONITOR_INPUT_INCINERATOR "incinerator_in"
#define ATMOS_GAS_MONITOR_OUTPUT_INCINERATOR "incinerator_out"
#define ATMOS_GAS_MONITOR_SENSOR_INCINERATOR "incinerator_sensor"
@@ -269,18 +407,6 @@
#define ATMOS_GAS_MONITOR_WASTE_ENGINE "engine-waste_out"
#define ATMOS_GAS_MONITOR_WASTE_ATMOS "atmos-waste_out"
-#define ATMOS_GAS_MONITOR_INPUT_SM "sm_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_SM "sm_out"
-#define ATMOS_GAS_MONITOR_SENSOR_SM "sm_sense"
-
-#define ATMOS_GAS_MONITOR_INPUT_SM_WASTE "sm_waste_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_SM_WASTE "sm_waste_out"
-#define ATMOS_GAS_MONITOR_SENSOR_SM_WASTE "sm_waste_sense"
-
-#define ATMOS_GAS_MONITOR_INPUT_TOXINS_WASTE "toxins_waste_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_TOXINS_WASTE "toxins_waste_out"
-#define ATMOS_GAS_MONITOR_SENSOR_TOXINS_WASTE "toxins_waste_sense"
-
//AIRLOCK CONTROLLER TAGS
//RnD toxins burn chamber
@@ -301,6 +427,8 @@
#define INCINERATOR_ATMOS_AIRLOCK_CONTROLLER "atmos_incinerator_airlock_controller"
#define INCINERATOR_ATMOS_AIRLOCK_INTERIOR "atmos_incinerator_airlock_interior"
#define INCINERATOR_ATMOS_AIRLOCK_EXTERIOR "atmos_incinerator_airlock_exterior"
+#define TEST_ROOM_ATMOS_MAINVENT_1 "atmos_test_room_mainvent_1"
+#define TEST_ROOM_ATMOS_MAINVENT_2 "atmos_test_room_mainvent_2"
//Syndicate lavaland base incinerator (lavaland_surface_syndicate_base1.dmm)
#define INCINERATOR_SYNDICATELAVA_IGNITER "syndicatelava_igniter"
@@ -314,6 +442,7 @@
//MULTIPIPES
//IF YOU EVER CHANGE THESE CHANGE SPRITES TO MATCH.
+//layer = initial(layer) + piping_layer / 1000 in atmospherics/update_icon() to determine order of pipe overlap
#define PIPING_LAYER_MIN 1
#define PIPING_LAYER_MAX 5
#define PIPING_LAYER_DEFAULT 3
@@ -321,27 +450,14 @@
#define PIPING_LAYER_P_Y 5
#define PIPING_LAYER_LCHANGE 0.05
-#define PIPING_ALL_LAYER (1<<0) //! intended to connect with all layers, check for all instead of just one.
-#define PIPING_ONE_PER_TURF (1<<1) //! can only be built if nothing else with this flag is on the tile already.
-#define PIPING_DEFAULT_LAYER_ONLY (1<<2) //! can only exist at PIPING_LAYER_DEFAULT
-#define PIPING_CARDINAL_AUTONORMALIZE (1<<3) //! north/south east/west doesn't matter, auto normalize on build.
-
-// 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 "nob"
-#define GAS_NITROUS "n2o"
-#define GAS_NITRYL "no2"
-#define GAS_TRITIUM "tritium"
-#define GAS_BZ "bz"
-#define GAS_STIMULUM "stim"
-#define GAS_PLUOXIUM "pluox"
-
-#define GAS_FLAG_DANGEROUS (1<<0)
-#define GAS_FLAG_BREATH_PROC (1<<1)
+/// intended to connect with all layers, check for all instead of just one.
+#define PIPING_ALL_LAYER (1<<0)
+/// can only be built if nothing else with this flag is on the tile already.
+#define PIPING_ONE_PER_TURF (1<<1)
+/// can only exist at PIPING_LAYER_DEFAULT
+#define PIPING_DEFAULT_LAYER_ONLY (1<<2)
+/// north/south east/west doesn't matter, auto normalize on build.
+#define PIPING_CARDINAL_AUTONORMALIZE (1<<3)
//HELPERS
#define PIPING_LAYER_SHIFT(T, PipingLayer) \
@@ -364,15 +480,36 @@
T.pixel_x = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_X;\
T.pixel_y = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_Y;
+#define THERMAL_ENERGY(gas) (gas.temperature * gas.heat_capacity())
+
+#define ADD_GAS(gas_id, out_list)\
+ var/list/tmp_gaslist = GLOB.gaslist_cache[gas_id]; out_list[gas_id] = tmp_gaslist.Copy();
+
+#define ASSERT_GAS(gas_id, gas_mixture) if (!gas_mixture.gases[gas_id]) { ADD_GAS(gas_id, gas_mixture.gases) };
+
+//prefer this to gas_mixture/total_moles in performance critical areas
+#define TOTAL_MOLES(cached_gases, out_var)\
+ out_var = 0;\
+ for(var/total_moles_id in cached_gases){\
+ out_var += cached_gases[total_moles_id][MOLES];\
+ }
+#define NORMAL_TURF 1
+#define MAKE_ACTIVE 2
+#define KILL_EXCITED 3
#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 }
+#define CALCULATE_ADJACENT_TURFS(T, state) if (SSadjacent_air.queue[T]) { GLOB.atmos_adjacent_savings[1] += 1 } else { GLOB.atmos_adjacent_savings[2] += 1; SSadjacent_air.queue[T] = state}
#else
-#define CALCULATE_ADJACENT_TURFS(T) SSadjacent_air.queue[T] = 1
+#define CALCULATE_ADJACENT_TURFS(T, state) SSadjacent_air.queue[T] = state
#endif
-GLOBAL_LIST_INIT(pipe_paint_colors, sort_list(list(
- "amethyst" = rgb(130,43,255),
+//If you're doing spreading things related to atmos, DO NOT USE CANATMOSPASS, IT IS NOT CHEAP. use this instead, the info is cached after all. it's tweaked just a bit to allow for circular checks
+#define TURFS_CAN_SHARE(T1, T2) (LAZYACCESS(T2.atmos_adjacent_turfs, T1) || LAZYLEN(T1.atmos_adjacent_turfs & T2.atmos_adjacent_turfs))
+//Use this to see if a turf is fully blocked or not, think windows or firelocks. Fails with 1x1 non full tile windows, but it's not worth the cost.
+#define TURF_SHARES(T) (LAZYLEN(T.atmos_adjacent_turfs))
+
+GLOBAL_LIST_INIT(pipe_paint_colors, sortList(list(
+ "amethyst" = rgb(130,43,255), //supplymain
"blue" = rgb(0,0,255),
"brown" = rgb(178,100,56),
"cyan" = rgb(0,255,249),
@@ -386,14 +523,5 @@ GLOBAL_LIST_INIT(pipe_paint_colors, sort_list(list(
"yellow" = rgb(255,198,0)
)))
-//PIPENET UPDATE STATUS
-#define PIPENET_UPDATE_STATUS_DORMANT 0
-#define PIPENET_UPDATE_STATUS_REACT_NEEDED 1
-#define PIPENET_UPDATE_STATUS_RECONCILE_NEEDED 2
-
-// GAS MIXTURE STUFF (used to be in code/modules/atmospherics/gasmixtures/gas_mixture.dm)
-#define MINIMUM_HEAT_CAPACITY 0.0003
-#define MINIMUM_MOLE_COUNT 0.01
-/*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 */
-#define QUANTIZE(variable) (round(variable,0.0000001))
+#define MIASMA_CORPSE_MOLES 0.02
+#define MIASMA_GIBS_MOLES 0.005
diff --git a/code/__DEFINES/dcs/signals/signals_turf.dm b/code/__DEFINES/dcs/signals/signals_turf.dm
index bec34d81c2614..80b5e534c2f43 100644
--- a/code/__DEFINES/dcs/signals/signals_turf.dm
+++ b/code/__DEFINES/dcs/signals/signals_turf.dm
@@ -15,3 +15,5 @@
#define COMSIG_TURF_AFTER_SHUTTLE_MOVE "turf_after_shuttle_move"
/// from base of /datum/turf_reservation/proc/Release: (datum/turf_reservation/reservation)
#define COMSIG_TURF_RESERVATION_RELEASED "turf_reservation_released"
+//from /turf/open/temperature_expose(datum/gas_mixture/air, exposed_temperature)
+#define COMSIG_TURF_EXPOSE "turf_expose"
diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm
index f9aab906c789c..cc7e14e4fa632 100644
--- a/code/__DEFINES/flags.dm
+++ b/code/__DEFINES/flags.dm
@@ -56,14 +56,18 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define HTML_USE_INITAL_ICON_1 (1<<13)
/// Prevents direct access for anything in the contents of this atom.
#define NO_DIRECT_ACCESS_FROM_CONTENTS_1 (1<<14)
+/// Is this object currently processing in the atmos object list?
+#define ATMOS_IS_PROCESSING_1 (1<<15)
+/// Should this tile be cleaned up and reinserted into an excited group?
+#define EXCITED_CLEANUP_1 (1 << 16)
//turf-only flags. These use flags_1 too.
// These exist to cover /turf and /area at the same time
-#define NOJAUNT_1 (1<<15)
-#define UNUSED_RESERVATION_TURF_1 (1<<16)
-#define CAN_BE_DIRTY_1 (1<<17) //! If a turf can be made dirty at roundstart. This is also used in areas.
-#define NO_LAVA_GEN_1 (1<<18) //! Blocks lava rivers being generated on the turf
-#define NO_RUINS_1 (1<<19) //! Blocks ruins spawning on the turf
+#define NOJAUNT_1 (1<<17)
+#define UNUSED_RESERVATION_TURF_1 (1<<18)
+#define CAN_BE_DIRTY_1 (1<<19) //! If a turf can be made dirty at roundstart. This is also used in areas.
+#define NO_LAVA_GEN_1 (1<<20) //! Blocks lava rivers being generated on the turf
+#define NO_RUINS_1 (1<<21) //! Blocks ruins spawning on the turf
// Update flags for [/atom/proc/update_appearance]
/// Update the atom's name
diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm
index 294ce03be5928..02ac302b61ea8 100644
--- a/code/__DEFINES/subsystems.dm
+++ b/code/__DEFINES/subsystems.dm
@@ -215,17 +215,17 @@
// 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
+#define SSAIR_ACTIVETURFS 3
+#define SSAIR_EXCITEDGROUPS 4
+#define SSAIR_HIGHPRESSURE 5
+#define SSAIR_HOTSPOTS 6
+#define SSAIR_SUPERCONDUCTIVITY 7
+#define SSAIR_EXCITEDCLEANUP 4
+#define SSAIR_EXCITEDGROUPS 5
+#define SSAIR_HIGHPRESSURE 6
+#define SSAIR_HOTSPOTS 7
+#define SSAIR_SUPERCONDUCTIVITY 8
+#define SSAIR_PROCESS_ATOMS 9
// Explosion Subsystem subtasks
#define SSEXPLOSIONS_MOVABLES 1
diff --git a/code/controllers/subsystem/adjacent_air.dm b/code/controllers/subsystem/adjacent_air.dm
index de0fa09323240..df0a5cab4e6b8 100644
--- a/code/controllers/subsystem/adjacent_air.dm
+++ b/code/controllers/subsystem/adjacent_air.dm
@@ -5,14 +5,14 @@ SUBSYSTEM_DEF(adjacent_air)
wait = 10
priority = FIRE_PRIORITY_ATMOS_ADJACENCY
var/list/queue = list()
- var/list/disable_queue = list()
-/datum/controller/subsystem/adjacent_air/stat_entry()
+/datum/controller/subsystem/adjacent_air/stat_entry(msg)
#ifdef TESTING
- . = ..("P:[length(queue)], S:[GLOB.atmos_adjacent_savings[1]], T:[GLOB.atmos_adjacent_savings[2]]")
+ msg = "P:[length(queue)], S:[GLOB.atmos_adjacent_savings[1]], T:[GLOB.atmos_adjacent_savings[2]]"
#else
- . = ..("P:[length(queue)]")
+ msg = "P:[length(queue)]"
#endif
+ return ..()
/datum/controller/subsystem/adjacent_air/Initialize()
while(length(queue))
@@ -20,32 +20,19 @@ SUBSYSTEM_DEF(adjacent_air)
return ..()
/datum/controller/subsystem/adjacent_air/fire(resumed = FALSE, mc_check = TRUE)
- if(SSair.thread_running())
- pause()
- return
-
- var/list/disable_queue = src.disable_queue
-
- while (length(disable_queue))
- var/turf/terf = disable_queue[1]
- var/arg = disable_queue[terf]
- disable_queue.Cut(1,2)
-
- terf.ImmediateDisableAdjacency(arg)
-
- if(mc_check)
- if(MC_TICK_CHECK)
- return
- else
- CHECK_TICK
var/list/queue = src.queue
while (length(queue))
var/turf/currT = queue[1]
+ var/goal = queue[currT]
queue.Cut(1,2)
currT.ImmediateCalculateAdjacentTurfs()
+ if(goal == MAKE_ACTIVE)
+ SSair.add_to_active(currT)
+ else if(goal == KILL_EXCITED)
+ SSair.add_to_active(currT, TRUE)
if(mc_check)
if(MC_TICK_CHECK)
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index efcd0ca1cf4b4..c9cf98be5f651 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -6,331 +6,212 @@ SUBSYSTEM_DEF(air)
flags = SS_BACKGROUND
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
+ var/cached_cost = 0
+ var/cost_atoms = 0
var/cost_turfs = 0
var/cost_groups = 0
var/cost_highpressure = 0
- var/cost_deferred_airs
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/thread_wait_ticks = 0
- var/cur_thread_wait_ticks = 0
- ///The last time the subsystem completely processed
- var/last_complete_process = 0
-
- var/low_pressure_turfs = 0
- var/high_pressure_turfs = 0
-
- var/num_group_turfs_processed = 0
- var/num_equalize_processed = 0
+ var/cost_ex_cleanup = 0
+ var/list/excited_groups = list()
+ var/list/cleanup_ex_groups = list()
+ var/list/active_turfs = list()
var/list/hotspots = list()
var/list/networks = list()
var/list/pipenets_needing_rebuilt = list()
- var/list/deferred_airs = list()
- var/max_deferred_airs = 0
+ /// A list of machines that will be processed when currentpart == SSAIR_ATMOSMACHINERY. Use SSair.begin_processing_machine and SSair.stop_processing_machine to add and remove machines.
var/list/obj/machinery/atmos_machinery = list()
- var/list/obj/machinery/atmos_air_machinery = list()
var/list/pipe_init_dirs_cache = list()
//atmos singletons
var/list/gas_reactions = list()
+ var/list/atmos_gen
+ var/list/planetary = list() //Lets cache static planetary mixes
//Special functions lists
+ var/list/turf/active_super_conductivity = list()
var/list/turf/open/high_pressure_delta = list()
+ var/list/atom_process = list()
-
+ /// A cache of objects that perisists between processing runs when resumed == TRUE. Dangerous, qdel'd objects not cleared from this may cause runtimes on processing.
var/list/currentrun = list()
- var/currentpart = SSAIR_REBUILD_PIPENETS
+ var/currentpart = SSAIR_PIPENETS
var/map_loading = TRUE
+ var/list/queued_for_activation
+ var/display_all_groups = FALSE
- 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 = FALSE
- // 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
- var/list/unpausing_z_levels = list()
- var/list/unpause_processing = list()
-
- var/list/pausing_z_levels = list()
- var/list/pause_processing = list()
/datum/controller/subsystem/air/stat_entry(msg)
msg += "C:{"
+ msg += "AT:[round(cost_turfs,1)]|"
+ msg += "CL:[round(cost_ex_cleanup, 1)]|"
+ msg += "EG:[round(cost_groups,1)]|"
msg += "HP:[round(cost_highpressure,1)]|"
msg += "HS:[round(cost_hotspots,1)]|"
- msg += "HE:[round(heat_process_time(),1)]|"
msg += "SC:[round(cost_superconductivity,1)]|"
msg += "PN:[round(cost_pipenets,1)]|"
- msg += "AM:[round(cost_atmos_machinery,1)]"
+ msg += "AM:[round(cost_atmos_machinery,1)]|"
+ msg += "AO:[round(cost_atoms, 1)]|"
+ msg += "RB:[round(cost_rebuilds,1)]|"
msg += "} "
- 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 += "AT:[active_turfs.len]|"
+ msg += "CL:[cleanup_ex_groups.len]|"
+ msg += "EG:[excited_groups.len]|"
+ msg += "HP:[high_pressure_delta.len]|"
msg += "HS:[hotspots.len]|"
+ msg += "SC:[active_super_conductivity.len]|"
msg += "PN:[networks.len]|"
- msg += "HP:[high_pressure_delta.len]|"
- msg += "HT:[high_pressure_turfs]|"
- msg += "LT:[low_pressure_turfs]|"
- msg += "ET:[num_equalize_processed]|"
- msg += "GT:[num_group_turfs_processed]|"
- msg += "DF:[max_deferred_airs]|"
- msg += "GA:[get_amt_gas_mixes()]|"
- msg += "MG:[get_max_gas_mixes()]"
+ msg += "AM:[atmos_machinery.len]|"
+ msg += "AO:[atom_process.len]|"
+ msg += "AT/MS:[round((cost ? active_turfs.len/cost : 0),0.1)]"
return ..()
+
/datum/controller/subsystem/air/Initialize(timeofday)
map_loading = FALSE
+ gas_reactions = init_gas_reactions()
setup_allturfs()
setup_atmos_machinery()
setup_pipenets()
- gas_reactions = init_gas_reactions()
- auxtools_update_reactions()
+ setup_turf_visuals()
return ..()
-/datum/controller/subsystem/air/proc/extools_update_ssair()
-
-/datum/controller/subsystem/air/proc/auxtools_update_reactions()
-
-/proc/reset_all_air()
- SSair.can_fire = 0
- 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 = 1
-
-/datum/controller/subsystem/air/proc/thread_running()
- return FALSE
-
-/proc/fix_corrupted_atmos()
-
-/datum/admins/proc/fixcorruption()
- set category = "Debug"
- set desc="Fixes air that has weird NaNs (-1.#IND and such). Hopefully."
- set name="Fix Infinite Air"
- fix_corrupted_atmos()
-
-/datum/controller/subsystem/air/fire(resumed = 0)
+/datum/controller/subsystem/air/fire(resumed = FALSE)
var/timer = TICK_USAGE_REAL
+ var/delta_time = wait * 0.1
- //If we have unpausing z-level, process them first
- if(length(unpausing_z_levels) && !length(unpause_processing))
- var/z_value = unpausing_z_levels[1]
- unpausing_z_levels.Remove(z_value)
- unpause_processing = block(locate(1, 1, z_value), locate(world.maxx, world.maxy, z_value))
-
- while(length(unpause_processing))
- var/turf/T = unpause_processing[length(unpause_processing)]
- if(!isspaceturf(T)) //Skip space turfs, since they won't have atmos
- T.Initalize_Atmos()
- //Goodbye
- unpause_processing.len --
- //We overran this tick, stop processing
- //This may result in a very brief atmos freeze when running unpause_z at high loads
- //but that is better than freezing the entire MC
- if(MC_TICK_CHECK)
- return
-
- //If we have unpausing z-level, process them first
- if(length(pausing_z_levels) && !length(pause_processing))
- var/z_value = pausing_z_levels[1]
- pausing_z_levels.Remove(z_value)
- pause_processing = block(locate(1, 1, z_value), locate(world.maxx, world.maxy, z_value))
-
- while(length(pause_processing))
- var/turf/T = pause_processing[length(pause_processing)]
- T.ImmediateDisableAdjacency()
- //Goodbye
- pause_processing.len --
- //We overran this tick, stop processing
- //This may result in a very brief atmos freeze when running unpause_z at high loads
- //but that is better than freezing the entire MC
- if(MC_TICK_CHECK)
- return
-
- if(currentpart == SSAIR_REBUILD_PIPENETS)
- timer = TICK_USAGE_REAL
+ // Every time we fire, we want to make sure pipenets are rebuilt. The game state could have changed between each fire() proc call
+ // and anything missing a pipenet can lead to unintended behaviour at worse and various runtimes at best.
+ if(length(pipenets_needing_rebuilt))
var/list/pipenet_rebuilds = pipenets_needing_rebuilt
for(var/thing in pipenet_rebuilds)
var/obj/machinery/atmospherics/AT = thing
- if(!istype(AT))
- continue
AT.build_network()
- cost_rebuilds = MC_AVERAGE(cost_rebuilds, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
+ cached_cost += TICK_USAGE_REAL - timer
pipenets_needing_rebuilt.Cut()
if(state != SS_RUNNING)
return
- resumed = FALSE
- currentpart = SSAIR_PIPENETS
+ cost_rebuilds = MC_AVERAGE(cost_rebuilds, TICK_DELTA_TO_MS(cached_cost))
if(currentpart == SSAIR_PIPENETS || !resumed)
timer = TICK_USAGE_REAL
- process_pipenets(resumed)
- cost_pipenets = MC_AVERAGE(cost_pipenets, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
+ if(!resumed)
+ cached_cost = 0
+ process_pipenets(delta_time, resumed)
+ cached_cost += TICK_USAGE_REAL - timer
if(state != SS_RUNNING)
return
- resumed = 0
+ cost_pipenets = MC_AVERAGE(cost_pipenets, TICK_DELTA_TO_MS(cached_cost))
+ resumed = FALSE
currentpart = SSAIR_ATMOSMACHINERY
- // This is only machinery like filters, mixers that don't interact with air
+
if(currentpart == SSAIR_ATMOSMACHINERY)
timer = TICK_USAGE_REAL
- process_atmos_machinery(resumed)
- cost_atmos_machinery = MC_AVERAGE(cost_atmos_machinery, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
+ if(!resumed)
+ cached_cost = 0
+ process_atmos_machinery(delta_time, resumed)
+ cached_cost += TICK_USAGE_REAL - timer
if(state != SS_RUNNING)
return
- resumed = 0
- currentpart = SSAIR_HIGHPRESSURE
+ cost_atmos_machinery = MC_AVERAGE(cost_atmos_machinery, TICK_DELTA_TO_MS(cached_cost))
+ resumed = FALSE
+ currentpart = SSAIR_ACTIVETURFS
- if(currentpart == SSAIR_HIGHPRESSURE)
+ if(currentpart == SSAIR_ACTIVETURFS)
timer = TICK_USAGE_REAL
- process_high_pressure_delta(resumed)
- cost_highpressure = MC_AVERAGE(cost_highpressure, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
+ if(!resumed)
+ cached_cost = 0
+ process_active_turfs(resumed)
+ cached_cost += TICK_USAGE_REAL - timer
if(state != SS_RUNNING)
return
- resumed = 0
- currentpart = SSAIR_FINALIZE_TURFS
- // This literally just waits for the turf processing thread to finish, doesn't do anything else.
- // this is necessary cause the next step after this interacts with the air--we get consistency
- // issues if we don't wait for it, disappearing gases etc.
- if(currentpart == SSAIR_FINALIZE_TURFS)
- finish_turf_processing(resumed)
+ cost_turfs = MC_AVERAGE(cost_turfs, TICK_DELTA_TO_MS(cached_cost))
+ resumed = FALSE
+ currentpart = SSAIR_EXCITEDCLEANUP
+
+ if(currentpart == SSAIR_EXCITEDCLEANUP)
+ timer = TICK_USAGE_REAL
+ if(!resumed)
+ cached_cost = 0
+ process_excited_cleanup(resumed)
+ cached_cost += TICK_USAGE_REAL - timer
if(state != SS_RUNNING)
- cur_thread_wait_ticks++
return
- resumed = 0
- thread_wait_ticks = MC_AVERAGE(thread_wait_ticks, cur_thread_wait_ticks)
- cur_thread_wait_ticks = 0
- currentpart = SSAIR_DEFERRED_AIRS
- if(currentpart == SSAIR_DEFERRED_AIRS)
+ cost_ex_cleanup = MC_AVERAGE(cost_ex_cleanup, TICK_DELTA_TO_MS(cached_cost))
+ resumed = FALSE
+ currentpart = SSAIR_EXCITEDGROUPS
+
+ if(currentpart == SSAIR_EXCITEDGROUPS)
timer = TICK_USAGE_REAL
- process_deferred_airs(resumed)
- cost_deferred_airs = MC_AVERAGE(cost_deferred_airs, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
+ if(!resumed)
+ cached_cost = 0
+ process_excited_groups(resumed)
+ cached_cost += TICK_USAGE_REAL - timer
if(state != SS_RUNNING)
return
- resumed = 0
- currentpart = SSAIR_ATMOSMACHINERY_AIR
- if(currentpart == SSAIR_ATMOSMACHINERY_AIR)
+ cost_groups = MC_AVERAGE(cost_groups, TICK_DELTA_TO_MS(cached_cost))
+ resumed = FALSE
+ currentpart = SSAIR_HIGHPRESSURE
+
+ if(currentpart == SSAIR_HIGHPRESSURE)
timer = TICK_USAGE_REAL
- process_atmos_air_machinery(resumed)
- cost_atmos_machinery = MC_AVERAGE(cost_atmos_machinery, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
+ if(!resumed)
+ cached_cost = 0
+ process_high_pressure_delta(resumed)
+ cached_cost += TICK_USAGE_REAL - timer
if(state != SS_RUNNING)
return
- resumed = 0
+ cost_highpressure = MC_AVERAGE(cost_highpressure, TICK_DELTA_TO_MS(cached_cost))
+ resumed = FALSE
currentpart = SSAIR_HOTSPOTS
if(currentpart == SSAIR_HOTSPOTS)
timer = TICK_USAGE_REAL
- process_hotspots(resumed)
- cost_hotspots = MC_AVERAGE(cost_hotspots, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
- if(state != SS_RUNNING)
- return
- resumed = 0
- currentpart = heat_enabled ? SSAIR_TURF_CONDUCTION : SSAIR_ACTIVETURFS
- // 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(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
- resumed = 0
- currentpart = SSAIR_ACTIVETURFS
- // This simply starts the turf thread. It runs in the background until the FINALIZE_TURFS step, at which point it's waited for.
- // This also happens to do all the commented out stuff below, all in a single separate thread. This is mostly so that the
- // waiting is consistent.
- if(currentpart == SSAIR_ACTIVETURFS)
- timer = TICK_USAGE_REAL
- process_turfs(resumed)
- cost_turfs = MC_AVERAGE(cost_turfs, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
- if(state != SS_RUNNING)
- return
- resumed = 0
- /*
- // Monstermos and/or Putnamos--making large pressure deltas move faster
- if(currentpart == SSAIR_EQUALIZE)
- timer = TICK_USAGE_REAL
- process_turf_equalize(resumed)
- cost_equalize = MC_AVERAGE(cost_equalize, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
+ if(!resumed)
+ cached_cost = 0
+ process_hotspots(delta_time, resumed)
+ cached_cost += TICK_USAGE_REAL - timer
if(state != SS_RUNNING)
return
- resumed = 0
- currentpart = SSAIR_EXCITEDGROUPS
- // Making small pressure deltas equalize immediately so they don't process anymore
- if(currentpart == SSAIR_EXCITEDGROUPS)
+ cost_hotspots = MC_AVERAGE(cost_hotspots, TICK_DELTA_TO_MS(cached_cost))
+ resumed = FALSE
+ currentpart = SSAIR_SUPERCONDUCTIVITY
+
+ if(currentpart == SSAIR_SUPERCONDUCTIVITY)
timer = TICK_USAGE_REAL
- process_excited_groups(resumed)
- cost_groups = MC_AVERAGE(cost_groups, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
+ if(!resumed)
+ cached_cost = 0
+ process_super_conductivity(resumed)
+ cached_cost += TICK_USAGE_REAL - timer
if(state != SS_RUNNING)
return
- resumed = 0
- currentpart = SSAIR_TURF_POST_PROCESS
- // Quick multithreaded "should we display/react?" checks followed by finishing those up before the next step
- if(currentpart == SSAIR_TURF_POST_PROCESS)
+ cost_superconductivity = MC_AVERAGE(cost_superconductivity, TICK_DELTA_TO_MS(cached_cost))
+ resumed = FALSE
+ currentpart = SSAIR_PROCESS_ATOMS
+
+ if(currentpart == SSAIR_PROCESS_ATOMS)
timer = TICK_USAGE_REAL
- post_process_turfs(resumed)
- cost_post_process = MC_AVERAGE(cost_post_process, TICK_DELTA_TO_MS(TICK_USAGE_REAL - timer))
+ if(!resumed)
+ cached_cost = 0
+ process_atoms(resumed)
+ cached_cost += TICK_USAGE_REAL - timer
if(state != SS_RUNNING)
return
- resumed = 0
- currentpart = SSAIR_HOTSPOTS
- */
- currentpart = SSAIR_REBUILD_PIPENETS
- last_complete_process = world.time
-
-/datum/controller/subsystem/air/Recover()
- thread_wait_ticks = SSair.thread_wait_ticks
- cur_thread_wait_ticks = SSair.cur_thread_wait_ticks
- low_pressure_turfs = SSair.low_pressure_turfs
- high_pressure_turfs = SSair.high_pressure_turfs
- num_group_turfs_processed = SSair.num_group_turfs_processed
- num_equalize_processed = SSair.num_equalize_processed
- hotspots = SSair.hotspots
- networks = SSair.networks
- pipenets_needing_rebuilt = SSair.pipenets_needing_rebuilt
- deferred_airs = SSair.deferred_airs
- max_deferred_airs = SSair.max_deferred_airs
- atmos_machinery = SSair.atmos_machinery
- atmos_air_machinery = SSair.atmos_air_machinery
- pipe_init_dirs_cache = SSair.pipe_init_dirs_cache
- gas_reactions = SSair.gas_reactions
- high_pressure_delta = SSair.high_pressure_delta
- currentrun = SSair.currentrun
- currentpart = SSair.currentpart
- map_loading = SSair.map_loading
- log_explosive_decompression = SSair.log_explosive_decompression
- equalize_turf_limit = SSair.equalize_turf_limit
- equalize_hard_turf_limit = SSair.equalize_hard_turf_limit
- equalize_enabled = SSair.equalize_enabled
- heat_enabled = SSair.heat_enabled
- share_max_steps = SSair.share_max_steps
- excited_group_pressure_goal = SSair.excited_group_pressure_goal
- paused_z_levels = SSair.paused_z_levels
-
-/datum/controller/subsystem/air/proc/process_pipenets(resumed = FALSE)
+ cost_atoms = MC_AVERAGE(cost_atoms, TICK_DELTA_TO_MS(cached_cost))
+ resumed = FALSE
+
+ currentpart = SSAIR_PIPENETS
+ SStgui.update_uis(SSair) //Lightning fast debugging motherfucker
+
+
+/datum/controller/subsystem/air/proc/process_pipenets(delta_time, resumed = FALSE)
if (!resumed)
src.currentrun = networks.Copy()
//cache for sanic speed (lists are references anyways)
@@ -339,7 +220,7 @@ SUBSYSTEM_DEF(air)
var/datum/thing = currentrun[currentrun.len]
currentrun.len--
if(thing)
- thing.process()
+ thing.process(delta_time)
else
networks.Remove(thing)
if(MC_TICK_CHECK)
@@ -349,112 +230,47 @@ SUBSYSTEM_DEF(air)
if(istype(atmos_machine, /obj/machinery/atmospherics))
pipenets_needing_rebuilt += atmos_machine
-/datum/controller/subsystem/air/proc/process_deferred_airs(resumed = 0)
- max_deferred_airs = max(deferred_airs.len,max_deferred_airs)
- while(deferred_airs.len)
- var/list/cur_op = deferred_airs[deferred_airs.len]
- deferred_airs.len--
- var/datum/gas_mixture/air1
- var/datum/gas_mixture/air2
- if(isopenturf(cur_op[1]))
- var/turf/open/T = cur_op[1]
- air1 = T.return_air()
- else
- air1 = cur_op[1]
- if(isopenturf(cur_op[2]))
- var/turf/open/T = cur_op[2]
- air2 = T.return_air()
- else
- air2 = cur_op[2]
- if(istype(cur_op[3], /datum/callback))
- var/datum/callback/cb = cur_op[3]
- cb.Invoke(air1, air2)
- else
- if(cur_op[3] == 0)
- air1.transfer_to(air2, air1.total_moles())
- else
- air1.transfer_ratio_to(air2, cur_op[3])
+/datum/controller/subsystem/air/proc/process_atoms(resumed = FALSE)
+ if(!resumed)
+ src.currentrun = atom_process.Copy()
+ //cache for sanic speed (lists are references anyways)
+ var/list/currentrun = src.currentrun
+ while(currentrun.len)
+ var/atom/talk_to = currentrun[currentrun.len]
+ currentrun.len--
+ if(!talk_to)
+ return
+ talk_to.process_exposure()
if(MC_TICK_CHECK)
return
-/datum/controller/subsystem/air/proc/process_atmos_machinery(resumed = 0)
+/datum/controller/subsystem/air/proc/process_atmos_machinery(delta_time, 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/current_machinery = currentrun[currentrun.len]
+ var/obj/machinery/M = currentrun[currentrun.len]
currentrun.len--
- if(!current_machinery)
- atmos_machinery -= current_machinery
- // Prevents uninitalized atmos machinery from processing.
- if (!(current_machinery.flags_1 & INITIALIZED_1))
- continue
- if(current_machinery.process_atmos() == PROCESS_KILL)
- stop_processing_machine(current_machinery)
+ if(!M || (M.process_atmos(delta_time) == PROCESS_KILL))
+ atmos_machinery.Remove(M)
if(MC_TICK_CHECK)
return
-/datum/controller/subsystem/air/proc/process_atmos_air_machinery(resumed = 0)
- var/seconds = wait * 0.1
+
+/datum/controller/subsystem/air/proc/process_super_conductivity(resumed = FALSE)
if (!resumed)
- src.currentrun = atmos_air_machinery.Copy()
+ src.currentrun = active_super_conductivity.Copy()
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
- var/obj/machinery/current_machinery = currentrun[currentrun.len]
+ var/turf/T = currentrun[currentrun.len]
currentrun.len--
- // Prevents uninitalized atmos machinery from processing.
- if (!(current_machinery.flags_1 & INITIALIZED_1))
- continue
- if(!current_machinery)
- atmos_air_machinery -= current_machinery
- if(current_machinery.process_atmos(seconds) == PROCESS_KILL)
- stop_processing_machine(current_machinery)
+ T.super_conduct()
if(MC_TICK_CHECK)
return
-/**
- * Adds a given machine to the processing system for SSAIR_ATMOSMACHINERY processing.
- *
- * Arguments:
- * * machine - The machine to start processing. Can be any /obj/machinery.
- */
-/datum/controller/subsystem/air/proc/start_processing_machine(obj/machinery/machine)
- if(machine.atmos_processing)
- return
- machine.atmos_processing = TRUE
- if(machine.interacts_with_air)
- atmos_air_machinery += machine
- else
- atmos_machinery += machine
-
-/**
- * Removes a given machine to the processing system for SSAIR_ATMOSMACHINERY processing.
- *
- * Arguments:
- * * machine - The machine to stop processing.
- */
-/datum/controller/subsystem/air/proc/stop_processing_machine(obj/machinery/machine)
- if(!machine.atmos_processing)
- return
- machine.atmos_processing = FALSE
- if(machine.interacts_with_air)
- atmos_air_machinery -= machine
- else
- atmos_machinery -= machine
-
- // If we're currently processing atmos machines, there's a chance this machine is in
- // the currentrun list, which is a cache of atmos_machinery. Remove it from that list
- // as well to prevent processing qdeleted objects in the cache.
- if(currentpart == SSAIR_ATMOSMACHINERY)
- currentrun -= machine
- if(machine.interacts_with_air && currentpart == SSAIR_ATMOSMACHINERY_AIR)
- currentrun -= machine
-
-/datum/controller/subsystem/air/proc/process_turf_heat()
-
-/datum/controller/subsystem/air/proc/process_hotspots(resumed = FALSE)
+/datum/controller/subsystem/air/proc/process_hotspots(delta_time, resumed = FALSE)
if (!resumed)
src.currentrun = hotspots.Copy()
//cache for sanic speed (lists are references anyways)
@@ -463,27 +279,22 @@ SUBSYSTEM_DEF(air)
var/obj/effect/hotspot/H = currentrun[currentrun.len]
currentrun.len--
if (H)
- H.process()
+ H.process(delta_time)
else
hotspots -= H
if(MC_TICK_CHECK)
return
-
-/datum/controller/subsystem/air/proc/process_high_pressure_delta(resumed = 0)
+/datum/controller/subsystem/air/proc/process_high_pressure_delta(resumed = FALSE)
while (high_pressure_delta.len)
var/turf/open/T = high_pressure_delta[high_pressure_delta.len]
high_pressure_delta.len--
T.high_pressure_movements()
T.pressure_difference = 0
- T.pressure_specific_target = null
if(MC_TICK_CHECK)
return
-/datum/controller/subsystem/air/proc/process_turf_equalize(resumed = 0)
- if(process_turf_equalize_auxtools(resumed,MC_TICK_REMAINING_MS))
- pause()
- /*
+/datum/controller/subsystem/air/proc/process_active_turfs(resumed = FALSE)
//cache for sanic speed
var/fire_count = times_fired
if (!resumed)
@@ -494,80 +305,196 @@ SUBSYSTEM_DEF(air)
var/turf/open/T = currentrun[currentrun.len]
currentrun.len--
if (T)
- T.equalize_pressure_in_zone(fire_count)
- //equalize_pressure_in_zone(T, fire_count)
+ T.process_cell(fire_count)
if (MC_TICK_CHECK)
return
- */
-/datum/controller/subsystem/air/proc/process_turfs(resumed = 0)
- if(process_turfs_auxtools(resumed,MC_TICK_REMAINING_MS))
- pause()
- /*
+/datum/controller/subsystem/air/proc/process_excited_cleanup(resumed = FALSE)
//cache for sanic speed
var/fire_count = times_fired
if (!resumed)
- src.currentrun = active_turfs.Copy()
+ src.currentrun = cleanup_ex_groups.Copy()
+ cleanup_ex_groups.Cut() //Cut the list here so any later breakdowns get added properly
//cache for sanic speed (lists are references anyways)
var/list/currentrun = src.currentrun
while(currentrun.len)
- var/turf/open/T = currentrun[currentrun.len]
+ var/list/turf_packet = currentrun[currentrun.len]
+ var/breakdown = turf_packet[EX_CLEANUP_BREAKDOWN]
+ var/dismantle = turf_packet[EX_CLEANUP_DISMANTLE]
+ var/list/turf_list = turf_packet[EX_CLEANUP_TURFS]
+ while(turf_list.len) //The turf list
+ var/turf/open/T = turf_list[turf_list.len]
+ //I'd normally check for nulls here, but turfs are dumb with refs, so it's not an issue
+ //We don't allow planetary turfs as a semi stopgap to worldspanning groups
+ if(istype(T) && !istype(T.air, /datum/gas_mixture/immutable) && !T.planetary_atmos)
+ T.cleanup_group(fire_count, breakdown, dismantle)
+ turf_list.len--
+ if (MC_TICK_CHECK)
+ return
+ currentrun.len-- //If we process all the turfs in a packet, del it.
+
+/datum/controller/subsystem/air/proc/process_excited_groups(resumed = FALSE)
+ 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--
- if (T)
- T.process_cell(fire_count)
+ EG.breakdown_cooldown++
+ EG.dismantle_cooldown++
+ if(EG.breakdown_cooldown >= EXCITED_GROUP_BREAKDOWN_CYCLES)
+ EG.self_breakdown(poke_turfs = TRUE)
+ else if(EG.dismantle_cooldown >= EXCITED_GROUP_DISMANTLE_CYCLES)
+ EG.dismantle()
if (MC_TICK_CHECK)
return
- */
-
-/datum/controller/subsystem/air/proc/process_excited_groups(resumed = 0)
- if(process_excited_groups_auxtools(resumed,MC_TICK_REMAINING_MS))
- pause()
-
-/datum/controller/subsystem/air/proc/finish_turf_processing(resumed = 0)
- if(finish_turf_processing_auxtools(MC_TICK_REMAINING_MS))
- pause()
-
-/datum/controller/subsystem/air/proc/post_process_turfs(resumed = 0)
- if(post_process_turfs_auxtools(resumed,MC_TICK_REMAINING_MS))
- pause()
-
-/datum/controller/subsystem/air/proc/finish_turf_processing_auxtools()
-/datum/controller/subsystem/air/proc/process_turfs_auxtools()
-/datum/controller/subsystem/air/proc/post_process_turfs_auxtools()
-/datum/controller/subsystem/air/proc/process_turf_equalize_auxtools()
-/datum/controller/subsystem/air/proc/process_excited_groups_auxtools()
-/datum/controller/subsystem/air/proc/get_amt_gas_mixes()
-/datum/controller/subsystem/air/proc/get_max_gas_mixes()
-/datum/controller/subsystem/air/proc/turf_process_time()
-/datum/controller/subsystem/air/proc/heat_process_time()
+
+///Removes a turf from processing, and causes its excited group to clean up so things properly adapt to the change
+/datum/controller/subsystem/air/proc/remove_from_active(turf/open/T)
+ active_turfs -= T
+ if(currentpart == SSAIR_ACTIVETURFS)
+ currentrun -= T
+ #ifdef VISUALIZE_ACTIVE_TURFS //Use this when you want details about how the turfs are moving, display_all_groups should work for normal operation
+ T.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, COLOR_VIBRANT_LIME)
+ #endif
+ if(istype(T))
+ T.excited = FALSE
+ if(T.excited_group)
+ //If this fires during active turfs it'll cause a slight removal of active turfs, as they breakdown if they have no excited group
+ //The group also expands by a tile per rebuild on each edge, suffering
+ T.excited_group.garbage_collect(will_cleanup = TRUE) //Poke everybody in the group and reform
+
+///Puts an active turf to sleep so it doesn't process. Do this without cleaning up its excited group.
+/datum/controller/subsystem/air/proc/sleep_active_turf(turf/open/T)
+ active_turfs -= T
+ if(currentpart == SSAIR_ACTIVETURFS)
+ currentrun -= T
+ #ifdef VISUALIZE_ACTIVE_TURFS
+ T.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, COLOR_VIBRANT_LIME)
+ #endif
+ if(istype(T))
+ T.excited = FALSE
+
+///Adds a turf to active processing, handles duplicates. Call this with blockchanges == TRUE if you want to nuke the assoc excited group
+/datum/controller/subsystem/air/proc/add_to_active(turf/open/T, blockchanges = FALSE)
+ if(istype(T) && T.air)
+ T.significant_share_ticker = 0
+ if(blockchanges && T.excited_group) //This is used almost exclusivly for shuttles, so the excited group doesn't stay behind
+ T.excited_group.garbage_collect() //Nuke it
+ if(T.excited) //Don't keep doing it if there's no point
+ return
+ #ifdef VISUALIZE_ACTIVE_TURFS
+ T.add_atom_colour(COLOR_VIBRANT_LIME, TEMPORARY_COLOUR_PRIORITY)
+ #endif
+ T.excited = TRUE
+ active_turfs += T
+ if(currentpart == SSAIR_ACTIVETURFS)
+ currentrun += T
+ else if(T.flags_1 & INITIALIZED_1)
+ for(var/turf/S in T.atmos_adjacent_turfs)
+ add_to_active(S, TRUE)
+ else if(map_loading)
+ if(queued_for_activation)
+ queued_for_activation[T] = T
+ return
+ else
+ T.requires_activation = TRUE
+
+/datum/controller/subsystem/air/proc/add_to_cleanup(datum/excited_group/ex_grp)
+ //Store the cooldowns. If we're already doing cleanup, DO NOT add to the currently processing list, infinite loop man bad.
+ cleanup_ex_groups += list(list(ex_grp.breakdown_cooldown, ex_grp.dismantle_cooldown, ex_grp.turf_list.Copy()))
/datum/controller/subsystem/air/StartLoadingMap()
+ LAZYINITLIST(queued_for_activation)
map_loading = TRUE
/datum/controller/subsystem/air/StopLoadingMap()
map_loading = FALSE
-
-/datum/controller/subsystem/air/proc/pause_z(z_level)
- LAZYADD(paused_z_levels, z_level)
- unpausing_z_levels -= z_level
- pausing_z_levels |= z_level
-
-/datum/controller/subsystem/air/proc/unpause_z(z_level)
- pausing_z_levels -= z_level
- unpausing_z_levels |= z_level
- LAZYREMOVE(paused_z_levels, z_level)
+ for(var/T in queued_for_activation)
+ add_to_active(T, TRUE)
+ queued_for_activation.Cut()
/datum/controller/subsystem/air/proc/setup_allturfs()
+ var/list/turfs_to_init = block(locate(1, 1, 1), locate(world.maxx, world.maxy, world.maxz))
+ var/list/active_turfs = src.active_turfs
var/times_fired = ++src.times_fired
- for(var/turf/T as anything in ALL_TURFS())
- if (!T.init_air)
+ // Clear active turfs - faster than removing every single turf in the world
+ // one-by-one, and Initalize_Atmos only ever adds `src` back in.
+ #ifdef VISUALIZE_ACTIVE_TURFS
+ for(var/jumpy in active_turfs)
+ var/turf/active = jumpy
+ active.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, COLOR_VIBRANT_LIME)
+ #endif
+ active_turfs.Cut()
+
+ for(var/thing in turfs_to_init)
+ var/turf/T = thing
+ if (T.blocks_air)
continue
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(roundstart = TRUE)
+ EG.dismantle()
+ CHECK_TICK
+
+ var/msg = "HEY! LISTEN! [DisplayTimeText(world.timeofday - timer)] were wasted processing [starting_ats] turf(s) (connected to [ending_ats - starting_ats] other turfs) with atmos differences at round start."
+ to_chat(world, "[msg]")
+ warning(msg)
+
+/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 = TRUE
+ . += 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 + atmos_air_machinery)
+ for (var/obj/machinery/atmospherics/AM in atmos_machinery)
AM.atmosinit()
CHECK_TICK
@@ -575,13 +502,22 @@ SUBSYSTEM_DEF(air)
// 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 + atmos_air_machinery)
+ for (var/obj/machinery/atmospherics/AM in atmos_machinery)
AM.build_network()
CHECK_TICK
+GLOBAL_LIST_EMPTY(colored_turfs)
+GLOBAL_LIST_EMPTY(colored_images)
+/datum/controller/subsystem/air/proc/setup_turf_visuals()
+ for(var/sharp_color in GLOB.contrast_colors)
+ var/obj/effect/overlay/atmos_excited/suger_high = new()
+ GLOB.colored_turfs += suger_high
+ var/image/shiny = new('icons/effects/effects.dmi', suger_high, "atmos_top", ATMOS_GROUP_LAYER)
+ shiny.plane = ATMOS_GROUP_PLANE
+ shiny.color = sharp_color
+ GLOB.colored_images += shiny
+
/datum/controller/subsystem/air/proc/setup_template_machinery(list/atmos_machines)
- if(!initialized) // yogs - fixes randomized bars
- return // yogs
var/obj/machinery/atmospherics/AM
for(var/A in 1 to atmos_machines.len)
AM = atmos_machines[A]
@@ -604,14 +540,141 @@ SUBSYSTEM_DEF(air)
return pipe_init_dirs_cache[type]["[dir]"]
-#undef SSAIR_PIPENETS
-#undef SSAIR_ATMOSMACHINERY
-#undef SSAIR_EXCITEDGROUPS
-#undef SSAIR_HIGHPRESSURE
-#undef SSAIR_HOTSPOTS
-#undef SSAIR_TURF_CONDUCTION
-#undef SSAIR_EQUALIZE
-#undef SSAIR_ACTIVETURFS
-#undef SSAIR_TURF_POST_PROCESS
-#undef SSAIR_FINALIZE_TURFS
-#undef SSAIR_ATMOSMACHINERY_AIR
+/datum/controller/subsystem/air/proc/generate_atmos()
+ atmos_gen = list()
+ for(var/T in subtypesof(/datum/atmosphere))
+ var/datum/atmosphere/atmostype = T
+ atmos_gen[initial(atmostype.id)] = new atmostype
+
+/datum/controller/subsystem/air/proc/preprocess_gas_string(gas_string)
+ if(!atmos_gen)
+ generate_atmos()
+ if(!atmos_gen[gas_string])
+ return gas_string
+ var/datum/atmosphere/mix = atmos_gen[gas_string]
+ return mix.gas_string
+
+/**
+ * Adds a given machine to the processing system for SSAIR_ATMOSMACHINERY processing.
+ *
+ * This should be fast, so no error checking is done.
+ * If you start adding in things you shouldn't, you'll cause runtimes every 2 seconds for every
+ * object you added. Do not use irresponsibly.
+ * Arguments:
+ * * machine - The machine to start processing. Can be any /obj/machinery.
+ */
+/datum/controller/subsystem/air/proc/start_processing_machine(obj/machinery/machine)
+ atmos_machinery += machine
+
+/**
+ * Removes a given machine to the processing system for SSAIR_ATMOSMACHINERY processing.
+ *
+ * This should be fast, so no error checking is done.
+ * If you call this proc when your machine isn't processing, you're likely attempting to
+ * remove something that isn't in a list with over 1000 objects, twice. Do not use
+ * irresponsibly.
+ * Arguments:
+ * * machine - The machine to stop processing.
+ */
+/datum/controller/subsystem/air/proc/stop_processing_machine(obj/machinery/machine)
+ atmos_machinery -= machine
+
+ // If we're currently processing atmos machines, there's a chance this machine is in
+ // the currentrun list, which is a cache of atmos_machinery. Remove it from that list
+ // as well to prevent processing qdeleted objects in the cache.
+ if(currentpart == SSAIR_ATMOSMACHINERY)
+ currentrun -= machine
+
+/datum/controller/subsystem/air/ui_state(mob/user)
+ return GLOB.debug_state
+
+/datum/controller/subsystem/air/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
+ if(!ui)
+ ui = new(user, src, "AtmosControlPanel")
+ ui.set_autoupdate(FALSE)
+ ui.open()
+
+/datum/controller/subsystem/air/ui_data(mob/user)
+ var/list/data = list()
+ data["excited_groups"] = list()
+ for(var/datum/excited_group/group in excited_groups)
+ var/turf/T = group.turf_list[1]
+ var/area/target = get_area(T)
+ var/max = 0
+ #ifdef TRACK_MAX_SHARE
+ for(var/who in group.turf_list)
+ var/turf/open/lad = who
+ max = max(lad.max_share, max)
+ #endif
+ data["excited_groups"] += list(list(
+ "jump_to" = REF(T), //Just go to the first turf
+ "group" = REF(group),
+ "area" = target.name,
+ "breakdown" = group.breakdown_cooldown,
+ "dismantle" = group.dismantle_cooldown,
+ "size" = group.turf_list.len,
+ "should_show" = group.should_display,
+ "max_share" = max
+ ))
+ data["active_size"] = active_turfs.len
+ data["hotspots_size"] = hotspots.len
+ data["excited_size"] = excited_groups.len
+ data["conducting_size"] = active_super_conductivity.len
+ data["frozen"] = can_fire
+ data["show_all"] = display_all_groups
+ data["fire_count"] = times_fired
+ #ifdef TRACK_MAX_SHARE
+ data["display_max"] = TRUE
+ #else
+ data["display_max"] = FALSE
+ #endif
+ var/atom/movable/screen/plane_master/plane = user.hud_used.plane_masters["[ATMOS_GROUP_PLANE]"]
+ data["showing_user"] = (plane.alpha == 255)
+ return data
+
+/datum/controller/subsystem/air/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
+ . = ..()
+ if(. || !check_rights_for(usr.client, R_DEBUG))
+ return
+ switch(action)
+ if("move-to-target")
+ var/turf/target = locate(params["spot"])
+ if(!target)
+ return
+ usr.forceMove(target)
+ usr.update_parallax_contents()
+ if("toggle-freeze")
+ can_fire = !can_fire
+ return TRUE
+ if("toggle_show_group")
+ var/datum/excited_group/group = locate(params["group"])
+ if(!group)
+ return
+ group.should_display = !group.should_display
+ if(display_all_groups)
+ return TRUE
+ if(group.should_display)
+ group.display_turfs()
+ else
+ group.hide_turfs()
+ return TRUE
+ if("toggle_show_all")
+ display_all_groups = !display_all_groups
+ for(var/datum/excited_group/group in excited_groups)
+ if(display_all_groups)
+ group.display_turfs()
+ else if(!group.should_display) //Don't flicker yeah?
+ group.hide_turfs()
+ return TRUE
+ if("toggle_user_display")
+ var/atom/movable/screen/plane_master/plane = ui.user.hud_used.plane_masters["[ATMOS_GROUP_PLANE]"]
+ if(!plane.alpha)
+ if(ui.user.client)
+ ui.user.client.images += GLOB.colored_images
+ plane.alpha = 255
+ else
+ if(ui.user.client)
+ ui.user.client.images -= GLOB.colored_images
+ plane.alpha = 0
+ return TRUE
diff --git a/code/datums/elements/atmos_sensitive.dm b/code/datums/elements/atmos_sensitive.dm
new file mode 100644
index 0000000000000..601c50e2cdd40
--- /dev/null
+++ b/code/datums/elements/atmos_sensitive.dm
@@ -0,0 +1,71 @@
+//This element facilitates reaction to atmos changes when a tile is inactive.
+//It adds the object to a list on SSair to be processed for so long as the object wants to be processed
+//And removes it as soon as the object is no longer interested
+//Don't put it on things that tend to clump into one spot, you will cause lag spikes.
+/datum/element/atmos_sensitive
+ element_flags = ELEMENT_DETACH
+
+/datum/element/atmos_sensitive/Attach(datum/target)
+ if(!isatom(target)) //How
+ return ELEMENT_INCOMPATIBLE
+ var/atom/to_track = target
+ if(isopenturf(to_track.loc))
+ to_track.RegisterSignal(to_track.loc, COMSIG_TURF_EXPOSE, /atom/proc/check_atmos_process)
+ RegisterSignal(to_track, COMSIG_MOVABLE_MOVED, .proc/handle_move)
+ return ..()
+
+/datum/element/atmos_sensitive/Detach(datum/source, force)
+ var/atom/us = source
+ us.UnregisterSignal(get_turf(us), COMSIG_TURF_EXPOSE)
+ if(us.flags_1 & ATMOS_IS_PROCESSING_1)
+ SSair.atom_process -= us
+ us.flags_1 &= ~ATMOS_IS_PROCESSING_1
+ return ..()
+
+/datum/element/atmos_sensitive/proc/handle_move(datum/source, atom/movable/oldloc, direction, forced)
+ var/atom/microchipped_lad = source
+ microchipped_lad.UnregisterSignal(oldloc, COMSIG_TURF_EXPOSE)
+ if(isopenturf(microchipped_lad.loc))
+ var/turf/open/new_spot = microchipped_lad.loc
+ microchipped_lad.RegisterSignal(new_spot, COMSIG_TURF_EXPOSE, /atom/proc/check_atmos_process)
+ microchipped_lad.check_atmos_process(null, new_spot.air, new_spot.temperature) //Make sure you're properly registered
+
+/atom/proc/check_atmos_process(datum/source, datum/gas_mixture/air, exposed_temperature)
+ if(should_atmos_process(air, exposed_temperature))
+ if(flags_1 & ATMOS_IS_PROCESSING_1)
+ return
+ SSair.atom_process += src
+ flags_1 |= ATMOS_IS_PROCESSING_1
+ else if(flags_1 & ATMOS_IS_PROCESSING_1)
+ SSair.atom_process -= src
+ flags_1 &= ~ATMOS_IS_PROCESSING_1
+
+/atom/proc/process_exposure()
+ var/turf/open/spot
+ if(istype(loc, /turf/open))
+ spot = loc
+ else //If you end up in a locker or a wall reconsider your life decisions
+ SSair.atom_process -= src
+ flags_1 &= ~ATMOS_IS_PROCESSING_1
+ return
+ if(!should_atmos_process(spot.air, spot.air.temperature)) //Things can change without a tile becoming active
+ SSair.atom_process -= src
+ flags_1 &= ~ATMOS_IS_PROCESSING_1
+ return
+ atmos_expose(spot.air, spot.air.temperature)
+
+/turf/open/process_exposure()
+ if(!should_atmos_process(air, air.temperature))
+ SSair.atom_process -= src
+ flags_1 &= ~ATMOS_IS_PROCESSING_1
+ return
+ atmos_expose(air, air.temperature)
+
+///We use this proc to check if we should start processing an item, or continue processing it. Returns true/false as expected
+/atom/proc/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return FALSE
+
+
+///This is your process() proc
+/atom/proc/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ return
diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm
index dc0a7bdb2b6a2..e9c3ec87a0867 100644
--- a/code/game/atoms_movable.dm
+++ b/code/game/atoms_movable.dm
@@ -482,7 +482,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(TRUE, FALSE)
loc.handle_atom_del(src)
if(opacity)
diff --git a/code/game/machinery/doors/airlock.dm b/code/game/machinery/doors/airlock.dm
index 800b94656ea1f..81d493cb999b4 100644
--- a/code/game/machinery/doors/airlock.dm
+++ b/code/game/machinery/doors/airlock.dm
@@ -1225,7 +1225,7 @@
sleep(open_speed - 1)
density = FALSE
z_flags &= ~(Z_BLOCK_IN_DOWN | Z_BLOCK_IN_UP)
- air_update_turf(1)
+ air_update_turf(TRUE, FALSE)
sleep(1)
layer = OPEN_DOOR_LAYER
update_icon(AIRLOCK_OPEN, 1)
@@ -1270,12 +1270,12 @@
if(air_tight)
set_density(TRUE)
z_flags |= (Z_BLOCK_IN_DOWN | Z_BLOCK_IN_UP)
- air_update_turf(1)
+ air_update_turf(TRUE, TRUE)
sleep(1)
if(!air_tight)
set_density(TRUE)
z_flags |= (Z_BLOCK_IN_DOWN | Z_BLOCK_IN_UP)
- air_update_turf(1)
+ air_update_turf(TRUE, TRUE)
sleep(open_speed - 1)
if(!safe)
crush()
diff --git a/code/game/machinery/doors/airlock_types.dm b/code/game/machinery/doors/airlock_types.dm
index 2d4620a826758..06a3ab6af3d4f 100644
--- a/code/game/machinery/doors/airlock_types.dm
+++ b/code/game/machinery/doors/airlock_types.dm
@@ -219,16 +219,20 @@
icon = 'icons/obj/doors/airlocks/station/plasma.dmi'
assemblytype = /obj/structure/door_assembly/door_assembly_plasma
-/obj/machinery/door/airlock/plasma/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature > 300)
- if(plasma_ignition(6))
- PlasmaBurn()
+/obj/machinery/door/airlock/plasma/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
/obj/machinery/door/airlock/plasma/bullet_act(obj/projectile/Proj)
if(!(Proj.nodamage) && Proj.damage_type == BURN)
if(plasma_ignition(6, Proj?.firer))
PlasmaBurn()
. = ..()
+/obj/machinery/door/airlock/plasma/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return (exposed_temperature > 300)
+
+/obj/machinery/door/airlock/plasma/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ PlasmaBurn()
/obj/machinery/door/airlock/plasma/proc/PlasmaBurn()
var/obj/structure/door_assembly/DA
diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm
index ff5e6d0cc7792..d064629674ee2 100644
--- a/code/game/machinery/doors/door.dm
+++ b/code/game/machinery/doors/door.dm
@@ -60,7 +60,7 @@
. = ..()
set_init_door_layer()
update_freelook_sight()
- air_update_turf(1)
+ air_update_turf(TRUE, TRUE)
GLOB.airlocks += src
spark_system = new /datum/effect_system/spark_spread
spark_system.set_up(2, 1, src)
@@ -90,6 +90,7 @@
if(spark_system)
qdel(spark_system)
spark_system = null
+ air_update_turf(TRUE, FALSE)
return ..()
/obj/machinery/door/Bumped(atom/movable/AM)
@@ -125,7 +126,8 @@
/obj/machinery/door/Move()
var/turf/T = loc
. = ..()
- move_update_air(T)
+ if(density) //Gotta be closed my friend
+ move_update_air(T)
/obj/machinery/door/CanAllowThrough(atom/movable/mover, border_dir)
. = ..()
@@ -303,7 +305,7 @@
update_appearance()
set_opacity(0)
operating = FALSE
- air_update_turf(1)
+ air_update_turf(TRUE, FALSE)
update_freelook_sight()
if(autoclose)
spawn(autoclose)
@@ -337,7 +339,7 @@
if(visible && !glass)
set_opacity(1)
operating = FALSE
- air_update_turf(1)
+ air_update_turf(TRUE, TRUE)
update_freelook_sight()
if(safe)
CheckForMobs()
diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm
index 0e6c49eb31d23..3552ca51c38af 100644
--- a/code/game/machinery/doors/windowdoor.dm
+++ b/code/game/machinery/doors/windowdoor.dm
@@ -55,6 +55,7 @@
/obj/machinery/door/window/ComponentInitialize()
. = ..()
+ AddElement(/datum/element/atmos_sensitive)
AddComponent(/datum/component/ntnet_interface)
/obj/machinery/door/window/Destroy()
@@ -63,6 +64,8 @@
if(obj_integrity == 0)
playsound(src, "shatter", 70, 1)
electronics = null
+ var/turf/floor = get_turf(src)
+ floor.air_update_turf(TRUE, FALSE)
return ..()
/obj/machinery/door/window/update_icon()
@@ -176,7 +179,7 @@
icon_state ="[base_state]open"
sleep(operationdelay)
set_density(FALSE)
- air_update_turf(1)
+ air_update_turf(TRUE, FALSE)
update_freelook_sight()
if(operating == 1) //emag again
@@ -199,7 +202,7 @@
icon_state = base_state
set_density(TRUE)
- air_update_turf(1)
+ air_update_turf(TRUE, TRUE)
update_freelook_sight()
sleep(operationdelay)
@@ -242,10 +245,11 @@
C.name = name
qdel(src)
-/obj/machinery/door/window/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature > T0C + (reinf ? 1600 : 800))
- take_damage(round(exposed_volume / 200), BURN, 0, 0)
- ..()
+/obj/machinery/door/window/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return (exposed_temperature > T0C + (reinf ? 1600 : 800))
+
+/obj/machinery/door/window/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ take_damage(round(exposed_temperature / 200), BURN, 0, 0)
/obj/machinery/door/window/should_emag(mob/user)
// Don't allow emag if the door is currently open or moving
diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm
index eb720b05a6439..ae74ac9e58063 100644
--- a/code/game/machinery/firealarm.dm
+++ b/code/game/machinery/firealarm.dm
@@ -34,7 +34,7 @@
var/detecting = 1
var/buildstage = 2 // 2 = complete, 1 = no wires, 0 = circuit gone
- var/last_alarm = 0
+ COOLDOWN_DECLARE(last_alarm)
var/area/myarea = null
/obj/machinery/firealarm/directional/north
@@ -67,6 +67,10 @@
LAZYADD(myarea.firealarms, src)
RegisterSignal(SSdcs, COMSIG_GLOB_SECURITY_ALERT_CHANGE, PROC_REF(handle_alert))
+/obj/machinery/firealarm/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
+
/obj/machinery/firealarm/proc/handle_alert(datum/source, new_alert)
SIGNAL_HANDLER
if(is_station_level(z))
@@ -134,15 +138,16 @@
if(do_after(eminence, 20, target=get_turf(eminence)))
attack_hand(eminence)
-/obj/machinery/firealarm/temperature_expose(datum/gas_mixture/air, temperature, volume)
- if((temperature > T0C + 200 || temperature < BODYTEMP_COLD_DAMAGE_LIMIT) && (last_alarm+FIREALARM_COOLDOWN < world.time) && !(obj_flags & EMAGGED) && detecting && !machine_stat)
- alarm()
- ..()
+/obj/machinery/firealarm/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return (exposed_temperature > T0C + 200 || exposed_temperature < BODYTEMP_COLD_DAMAGE_LIMIT) && !(obj_flags & EMAGGED) && detecting && !machine_stat
+
+/obj/machinery/firealarm/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ alarm()
/obj/machinery/firealarm/proc/alarm(mob/user)
- if(!is_operational || (last_alarm+FIREALARM_COOLDOWN > world.time))
+ if(!is_operational || !COOLDOWN_FINISHED(src, last_alarm))
return
- last_alarm = world.time
+ COOLDOWN_START(src, last_alarm, FIREALARM_COOLDOWN)
var/area/A = get_area(src)
A.firealert(src)
playsound(loc, 'goon/sound/machinery/FireAlarm.ogg', 75)
diff --git a/code/game/machinery/shieldgen.dm b/code/game/machinery/shieldgen.dm
index 91609daabb065..4bb1ab579dfbc 100644
--- a/code/game/machinery/shieldgen.dm
+++ b/code/game/machinery/shieldgen.dm
@@ -15,7 +15,11 @@
/obj/structure/emergency_shield/Initialize(mapload)
. = ..()
setDir(pick(GLOB.cardinals))
- air_update_turf(1)
+ air_update_turf(TRUE, TRUE)
+
+/obj/structure/emergency_shield/Destroy()
+ air_update_turf(TRUE, FALSE)
+ . = ..()
/obj/structure/emergency_shield/Move()
var/turf/T = loc
@@ -60,7 +64,6 @@
max_integrity = 20
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
layer = ABOVE_MOB_LAYER
-
/obj/structure/emergency_shield/invoker/emp_act(severity)
return
diff --git a/code/game/machinery/shuttle/shuttle_engine.dm b/code/game/machinery/shuttle/shuttle_engine.dm
index 262c26e1111c3..320c7733e8b58 100644
--- a/code/game/machinery/shuttle/shuttle_engine.dm
+++ b/code/game/machinery/shuttle/shuttle_engine.dm
@@ -124,7 +124,7 @@
if(deltaTemperature < 0)
return
env.set_temperature(env.return_temperature() + deltaTemperature)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
/obj/machinery/shuttle/engine/attackby(obj/item/I, mob/living/user, params)
check_setup()
diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm
index 8a3e6229a0300..994be48b3eec8 100644
--- a/code/game/machinery/spaceheater.dm
+++ b/code/game/machinery/spaceheater.dm
@@ -126,7 +126,7 @@
delta_temperature *= -1
if(delta_temperature)
environment.set_temperature(environment.return_temperature() + delta_temperature)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
cell.use(required_energy / efficiency)
/obj/machinery/space_heater/RefreshParts()
diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm
index 5ea702d1d52d5..fbd57a9b76ec7 100644
--- a/code/game/objects/effects/effect_system/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/effects_foam.dm
@@ -32,6 +32,10 @@
slippery_foam = FALSE
var/absorbed_plasma = 0
+/obj/effect/particle_effect/foam/firefighting/ComponentInitialize()
+ ..()
+ RemoveElement(/datum/element/atmos_sensitive)
+
/obj/effect/particle_effect/foam/firefighting/process()
..()
@@ -45,7 +49,7 @@
absorbed_plasma += plas_amt
if(G.return_temperature() > T20C)
G.set_temperature(max(G.return_temperature()/2,T20C))
- T.air_update_turf()
+ T.air_update_turf(FALSE, FALSE)
/obj/effect/particle_effect/foam/firefighting/kill_foam()
STOP_PROCESSING(SSfastprocess, src)
@@ -65,9 +69,6 @@
L.adjust_fire_stacks(-2)
L.ExtinguishMob()
-/obj/effect/particle_effect/foam/firefighting/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- return
-
/obj/effect/particle_effect/foam/metal
name = "aluminium foam"
metal = ALUMINUM_FOAM
@@ -107,6 +108,7 @@
/obj/effect/particle_effect/foam/Initialize(mapload)
. = ..()
+ AddElement(/datum/element/atmos_sensitive)
create_reagents(1000) //limited by the size of the reagent holder anyway.
START_PROCESSING(SSfastprocess, src)
playsound(src, 'sound/effects/bubbles2.ogg', 80, 1, -3)
@@ -207,16 +209,13 @@
F.add_atom_colour(color, FIXED_COLOUR_PRIORITY)
F.metal = metal
+/obj/effect/particle_effect/foam/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > 475
-/obj/effect/particle_effect/foam/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(prob(max(0, exposed_temperature - 475))) //foam dissolves when heated
+/obj/effect/particle_effect/foam/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ if(prob(max(0, exposed_temperature - 475))) //foam dissolves when heated
kill_foam()
-
-/obj/effect/particle_effect/foam/metal/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- return
-
-
///////////////////////////////////////////////
//FOAM EFFECT DATUM
/datum/effect_system/foam_spread
@@ -290,7 +289,11 @@
/obj/structure/foamedmetal/Initialize(mapload)
. = ..()
- air_update_turf(1)
+ air_update_turf(TRUE, TRUE)
+
+/obj/structure/foamedmetal/Destroy()
+ air_update_turf(TRUE, FALSE)
+ . = ..()
/obj/structure/foamedmetal/Move()
var/turf/T = loc
@@ -340,7 +343,6 @@
if(I == GAS_O2 || I == GAS_N2)
continue
G.set_moles(I, 0)
- O.air_update_turf()
for(var/obj/machinery/atmospherics/components/unary/U in O)
if(!U.welded)
U.welded = TRUE
diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm
index 62922d034df1b..41f4c374ca757 100644
--- a/code/game/objects/effects/effect_system/effects_smoke.dm
+++ b/code/game/objects/effects/effect_system/effects_smoke.dm
@@ -176,7 +176,7 @@
var/datum/gas_mixture/G = T.air
if(!distcheck || get_dist(T, location) < blast) // Otherwise we'll get silliness like people using Nanofrost to kill people through walls with cold air
G.set_temperature(temperature)
- T.air_update_turf()
+ T.air_update_turf(FALSE, FALSE)
for(var/obj/effect/hotspot/H in T)
qdel(H)
if(G.get_moles(GAS_PLASMA))
diff --git a/code/game/objects/effects/glowshroom.dm b/code/game/objects/effects/glowshroom.dm
index 700439c06377a..ed50f595ec48c 100644
--- a/code/game/objects/effects/glowshroom.dm
+++ b/code/game/objects/effects/glowshroom.dm
@@ -165,9 +165,11 @@
if(damage_type == BURN && damage_amount)
playsound(src.loc, 'sound/items/welder.ogg', 100, 1)
-/obj/structure/glowshroom/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature > 300)
- take_damage(5, BURN, 0, 0)
+/obj/structure/glowshroom/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > 300
+
+/obj/structure/glowshroom/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ take_damage(5, BURN, 0, 0)
/obj/structure/glowshroom/acid_act(acidpwr, acid_volume)
. = 1
@@ -175,3 +177,7 @@
var/obj/effect/decal/cleanable/molten_object/I = new (get_turf(src))
I.desc = "Looks like this was \an [src] some time ago."
qdel(src)
+
+/obj/structure/glowshroom/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
diff --git a/code/game/objects/effects/portals.dm b/code/game/objects/effects/portals.dm
index 472cb998b7797..6e276151487f0 100644
--- a/code/game/objects/effects/portals.dm
+++ b/code/game/objects/effects/portals.dm
@@ -136,8 +136,8 @@
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)
+ atmos_source.air_update_turf(FALSE, FALSE)
+ atmos_destination.air_update_turf(FALSE, FALSE)
/obj/effect/portal/proc/unlink_atmos()
if(istype(atmos_source))
diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm
index 8a84e300264da..4b0c17f14494f 100644
--- a/code/game/objects/effects/spiders.dm
+++ b/code/game/objects/effects/spiders.dm
@@ -7,7 +7,9 @@
density = FALSE
max_integrity = 15
-
+/obj/structure/spider/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
/obj/structure/spider/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
if(damage_type == BURN)//the stickiness of the web mutes all attack sounds except fire damage type
@@ -27,9 +29,11 @@
damage_amount *= 2
. = ..()
-/obj/structure/spider/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature > 300)
- take_damage(5, BURN, 0, 0)
+/obj/structure/spider/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > 300
+
+/obj/structure/spider/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ take_damage(5, BURN, 0, 0)
/obj/structure/spider/stickyweb
icon_state = "stickyweb1"
@@ -127,9 +131,11 @@
else
to_chat(user, "[src] isn't ready yet!")
-/obj/structure/spider/eggcluster/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature > 500)
- take_damage(5, BURN, 0, 0)
+/obj/structure/spider/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > 300
+
+/obj/structure/spider/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ take_damage(5, BURN, 0, 0)
/obj/structure/spider/eggcluster/Destroy()
var/list/spawners = GLOB.mob_spawners[name]
diff --git a/code/game/objects/items/flamethrower.dm b/code/game/objects/items/flamethrower.dm
index 9499d02af4e8c..8e6a54c736a32 100644
--- a/code/game/objects/items/flamethrower.dm
+++ b/code/game/objects/items/flamethrower.dm
@@ -79,6 +79,9 @@
if(ishuman(user))
if(!can_trigger_gun(user))
return
+ if(HAS_TRAIT(user, TRAIT_PACIFISM))
+ to_chat(user, "You can't bring yourself to fire \the [src]! You don't want to risk harming anyone...")
+ return
if(user && user.get_active_held_item() == src) // Make sure our user is still holding us
var/turf/target_turf = get_turf(target)
if(target_turf)
@@ -206,7 +209,7 @@
sleep(1)
previousturf = T
operating = FALSE
- for(var/mob/M as() in viewers(1, loc))
+ for(var/mob/M in viewers(1, loc))
if((M.client && M.machine == src))
attack_self(M)
@@ -215,12 +218,13 @@
//TODO: DEFERRED Consider checking to make sure tank pressure is high enough before doing this...
//Transfer 5% of current tank air contents to turf
var/datum/gas_mixture/air_transfer = ptank.air_contents.remove_ratio(release_amount)
- air_transfer.set_moles(GAS_PLASMA, air_transfer.get_moles(GAS_PLASMA) * 5)
+ if(air_transfer.gases[/datum/gas/plasma])
+ air_transfer.gases[/datum/gas/plasma][MOLES] *= 5
target.assume_air(air_transfer)
//Burn it based on transfered gas
- target.hotspot_expose((ptank.air_contents.return_temperature()*2) + 380,500)
+ target.hotspot_expose((ptank.air_contents.temperature*2) + 380,500)
//location.hotspot_expose(1000,500,1)
-
+ SSair.add_to_active(target)
/obj/item/flamethrower/Initialize(mapload)
. = ..()
diff --git a/code/game/objects/items/latexballoon.dm b/code/game/objects/items/latexballoon.dm
index ca61f9fe5f675..aaad02b4a8230 100644
--- a/code/game/objects/items/latexballoon.dm
+++ b/code/game/objects/items/latexballoon.dm
@@ -45,9 +45,12 @@
burst()
return ..()
-/obj/item/latexballon/temperature_expose(datum/gas_mixture/air, temperature, volume)
- if(temperature > T0C+100)
- burst()
+/obj/item/latexballon/should_atmos_process(datum/gas_mixture/air, temperature)
+ return temperature > T0C+100
+
+/obj/item/latexballon/atmos_expose(datum/gas_mixture/air, temperature)
+ burst()
+
/obj/item/latexballon/attackby(obj/item/W, mob/user, params)
if(istype(W, /obj/item/tank))
diff --git a/code/game/objects/items/powerfist.dm b/code/game/objects/items/powerfist.dm
index 7d4ef3e5fd4b6..fdea15b4f2d62 100644
--- a/code/game/objects/items/powerfist.dm
+++ b/code/game/objects/items/powerfist.dm
@@ -95,7 +95,7 @@
return ..()
if(gasused.total_moles() < gasperfist * fisto_setting)
T.assume_air(gasused)
- T.air_update_turf()
+ T.air_update_turf(FALSE, FALSE)
to_chat(user, "\The [src]'s piston-ram lets out a weak hiss, it needs more gas!")
playsound(loc, 'sound/weapons/punch4.ogg', 50, 1)
force = (baseforce / 2)
@@ -113,7 +113,7 @@
var/mob/living/carbon/human/H = target
if(H.check_shields(src, force))
T.assume_air(gasused)
- T.air_update_turf()
+ T.air_update_turf(FALSE, FALSE)
return
target.visible_message("[user]'s powerfist lets out a loud hiss as [user.p_they()] punch[user.p_es()] [target.name]!", \
"You cry out in pain as [user]'s punch flings you backwards!", ignored_mobs = list(user))
@@ -130,6 +130,6 @@
user.changeNext_move(CLICK_CD_MELEE * click_delay)
T.assume_air(gasused)
- T.air_update_turf()
+ T.air_update_turf(FALSE, FALSE)
return ..()
diff --git a/code/game/objects/items/stacks/sheets/mineral/materials.dm b/code/game/objects/items/stacks/sheets/mineral/materials.dm
index 256533a7ab67a..0dc6093c4b908 100644
--- a/code/game/objects/items/stacks/sheets/mineral/materials.dm
+++ b/code/game/objects/items/stacks/sheets/mineral/materials.dm
@@ -99,9 +99,11 @@ Mineral Sheets
else
return ..()
-/obj/item/stack/sheet/mineral/plasma/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature > 300)
- plasma_ignition(amount/5)
+/obj/item/stack/sheet/mineral/plasma/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > 300
+
+/obj/item/stack/sheet/mineral/plasma/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ plasma_ignition(amount/5)
/obj/item/stack/sheet/mineral/plasma/bullet_act(obj/projectile/Proj)
if(!(Proj.nodamage) && Proj.damage_type == BURN)
diff --git a/code/game/objects/items/stacks/sheets/organic/leather.dm b/code/game/objects/items/stacks/sheets/organic/leather.dm
index 92b2e83b53e15..770735d04d002 100644
--- a/code/game/objects/items/stacks/sheets/organic/leather.dm
+++ b/code/game/objects/items/stacks/sheets/organic/leather.dm
@@ -36,6 +36,11 @@
. = ..()
AddElement(/datum/element/dryable, /obj/item/stack/sheet/leather)
+
+/obj/item/stack/sheet/leather/wetleather/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
+
//Step two to make leather - washing
/obj/item/stack/sheet/leather/hairlesshide/machine_wash(obj/machinery/washing_machine/WM)
@@ -44,14 +49,15 @@
//Step three to make leather - drying, either naturally or... in a more induced way.
-/obj/item/stack/sheet/leather/wetleather/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- ..()
- if(exposed_temperature >= drying_threshold_temperature)
- wetness--
- if(wetness == 0)
- new /obj/item/stack/sheet/leather(drop_location(), 1)
- wetness = initial(wetness)
- use(1)
+/obj/item/stack/sheet/leather/wetleather/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return (exposed_temperature > drying_threshold_temperature)
+
+/obj/item/stack/sheet/leather/wetleather/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ wetness--
+ if(wetness == 0)
+ new /obj/item/stack/sheet/leather(drop_location(), 1)
+ wetness = initial(wetness)
+ use(1)
/obj/item/stack/sheet/leather/wetleather/microwave_act(obj/machinery/microwave/MW)
..()
diff --git a/code/game/objects/items/tanks/tanks.dm b/code/game/objects/items/tanks/tanks.dm
index b4413a5206869..c41d6adf8b8bd 100644
--- a/code/game/objects/items/tanks/tanks.dm
+++ b/code/game/objects/items/tanks/tanks.dm
@@ -125,7 +125,7 @@
var/turf/T = get_turf(src)
if(T)
T.assume_air(air_contents)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
playsound(src.loc, 'sound/effects/spray.ogg', 10, 1, -3)
qdel(src)
diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm
index 5b45e8b8ef67a..38fae2d5c6030 100644
--- a/code/game/objects/structures/aliens.dm
+++ b/code/game/objects/structures/aliens.dm
@@ -68,7 +68,11 @@
/obj/structure/alien/resin/Initialize(mapload)
. = ..()
- air_update_turf(TRUE)
+ air_update_turf(TRUE, TRUE)
+
+/obj/structure/alien/resin/Destroy()
+ air_update_turf(TRUE, FALSE)
+ . = ..()
/obj/structure/alien/resin/Move()
var/turf/T = loc
@@ -171,6 +175,10 @@
icon = 'icons/obj/smooth_structures/alien/weeds3.dmi'
base_icon_state = "weeds3"
+/obj/structure/alien/weeds/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
+
/obj/structure/alien/weeds/proc/expand()
var/turf/U = get_turf(src)
if(is_type_in_typecache(U, blacklisted_turfs))
@@ -187,9 +195,11 @@
new /obj/structure/alien/weeds(T)
return TRUE
-/obj/structure/alien/weeds/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature > 300)
- take_damage(5, BURN, 0, 0)
+/obj/structure/alien/weeds/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > 300
+
+/obj/structure/alien/weeds/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ take_damage(5, BURN, 0, 0)
//Weed nodes
/obj/structure/alien/weeds/node
@@ -260,6 +270,10 @@
if(status == BURST)
obj_integrity = integrity_failure * max_integrity
+/obj/structure/alien/egg/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive
+
/obj/structure/alien/egg/update_icon()
..()
switch(status)
@@ -336,10 +350,11 @@
if(status != BURST)
Burst(kill=TRUE)
-/obj/structure/alien/egg/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature > 500)
- take_damage(5, BURN, 0, 0)
+/obj/structure/alien/egg/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > 500
+/obj/structure/alien/egg/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ take_damage(5, BURN, 0, 0)
/obj/structure/alien/egg/HasProximity(atom/movable/AM)
if(status == GROWN)
diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm
index deaa9387817f0..34a9521373f60 100644
--- a/code/game/objects/structures/false_walls.dm
+++ b/code/game/objects/structures/false_walls.dm
@@ -28,7 +28,7 @@
/obj/structure/falsewall/Initialize(mapload)
. = ..()
- air_update_turf(TRUE)
+ air_update_turf(TRUE, TRUE)
/obj/structure/falsewall/ratvar_act()
new /obj/structure/falsewall/brass(loc)
@@ -57,7 +57,7 @@
z_flags &= density ? (Z_BLOCK_IN_DOWN | Z_BLOCK_IN_UP) : ~(Z_BLOCK_IN_DOWN | Z_BLOCK_IN_UP)
opening = FALSE
update_icon()
- air_update_turf(TRUE)
+ air_update_turf(TRUE, !density)
/obj/structure/falsewall/update_icon()//Calling icon_update will refresh the smoothwalls if it's closed, otherwise it will make sure the icon is correct if it's open
if(opening)
@@ -261,6 +261,10 @@
mineral = /obj/item/stack/sheet/mineral/plasma
walltype = /turf/closed/wall/mineral/plasma
+/obj/structure/falsewall/plasma/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
+
/obj/structure/falsewall/plasma/attackby(obj/item/W, mob/user, params)
if(W.is_hot() > 300)
if(plasma_ignition(6, user))
@@ -269,11 +273,12 @@
else
return ..()
-/obj/structure/falsewall/plasma/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature > 300)
- if(plasma_ignition(6))
- new /obj/structure/girder/displaced(loc)
+/obj/structure/falsewall/plasma/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > 300
+/obj/structure/falsewall/plasma/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ if(plasma_ignition(6))
+ new /obj/structure/girder/displaced(loc)
/obj/structure/falsewall/plasma/bullet_act(obj/projectile/Proj)
if(!(Proj.nodamage) && Proj.damage_type == BURN)
diff --git a/code/game/objects/structures/grille.dm b/code/game/objects/structures/grille.dm
index c0d495519e7f5..d65fbbaed4b8a 100644
--- a/code/game/objects/structures/grille.dm
+++ b/code/game/objects/structures/grille.dm
@@ -23,6 +23,10 @@
pipe_astar_cost = 1\
)
+/obj/structure/grille/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
+
/obj/structure/grille/take_damage(damage_amount, damage_type = BRUTE, damage_flag = 0, sound_effect = 1, attack_dir, armour_penetration = 0)
. = ..()
update_icon()
@@ -271,11 +275,11 @@
return FALSE
return FALSE
-/obj/structure/grille/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(!broken)
- if(exposed_temperature > T0C + 1500)
- take_damage(1, BURN, 0, 0)
- ..()
+/obj/structure/grille/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > T0C + 1500 && !broken
+
+/obj/structure/grille/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ take_damage(1, BURN, 0, 0)
/obj/structure/grille/hitby(atom/movable/AM, skipcatch, hitpush, blocked, datum/thrownthing/throwingdatum)
if(isobj(AM))
diff --git a/code/game/objects/structures/holosign.dm b/code/game/objects/structures/holosign.dm
index d5639986f9dd6..e077af261e06b 100644
--- a/code/game/objects/structures/holosign.dm
+++ b/code/game/objects/structures/holosign.dm
@@ -107,11 +107,12 @@
. = ..()
var/turf/local = get_turf(loc)
ADD_TRAIT(local, TRAIT_FIREDOOR_STOP, TRAIT_GENERIC)
- air_update_turf(TRUE)
+ air_update_turf(TRUE, TRUE)
/obj/structure/holosign/barrier/atmos/Destroy()
var/turf/local = get_turf(loc)
REMOVE_TRAIT(local, TRAIT_FIREDOOR_STOP, TRAIT_GENERIC)
+ air_update_turf(TRUE, FALSE)
return ..()
/obj/structure/holosign/barrier/atmos/Move(atom/newloc, direct)
diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm
index 4f07ad17c9067..ae08039b9fe81 100644
--- a/code/game/objects/structures/mineral_doors.dm
+++ b/code/game/objects/structures/mineral_doors.dm
@@ -28,12 +28,18 @@
/obj/structure/mineral_door/Initialize(mapload)
. = ..()
- air_update_turf(TRUE)
+ air_update_turf(TRUE, TRUE)
+
+/obj/structure/mineral_door/Destroy()
+ if(!door_opened)
+ air_update_turf(TRUE, FALSE)
+ . = ..()
/obj/structure/mineral_door/Move()
var/turf/T = loc
. = ..()
- move_update_air(T)
+ if(!door_opened)
+ move_update_air(T)
/obj/structure/mineral_door/Bumped(atom/movable/AM)
..()
@@ -93,7 +99,7 @@
set_density(FALSE)
z_flags &= ~(Z_BLOCK_IN_DOWN | Z_BLOCK_IN_UP)
door_opened = TRUE
- air_update_turf(1)
+ air_update_turf(TRUE, FALSE)
update_appearance()
isSwitchingStates = FALSE
@@ -114,7 +120,7 @@
z_flags |= (Z_BLOCK_IN_DOWN | Z_BLOCK_IN_UP)
set_opacity(TRUE)
door_opened = FALSE
- air_update_turf(1)
+ air_update_turf(TRUE, TRUE)
update_appearance()
isSwitchingStates = FALSE
@@ -133,7 +139,7 @@
/obj/structure/mineral_door/set_anchored(anchorvalue) //called in default_unfasten_wrench() chain
. = ..()
set_opacity(anchored ? !door_opened : FALSE)
- air_update_turf(TRUE)
+ air_update_turf(TRUE, anchorvalue)
/obj/structure/mineral_door/wrench_act(mob/living/user, obj/item/I)
default_unfasten_wrench(user, I, 40)
@@ -249,7 +255,8 @@
sheetType = /obj/item/stack/sheet/mineral/plasma
/obj/structure/mineral_door/transparent/plasma/ComponentInitialize()
- return
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
/obj/structure/mineral_door/transparent/plasma/welder_act(mob/living/user, obj/item/I)
return
@@ -260,9 +267,11 @@
else
return ..()
-/obj/structure/mineral_door/transparent/plasma/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature > 300)
- plasma_ignition(6)
+/obj/structure/mineral_door/transparent/plasma/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > 300
+
+/obj/structure/mineral_door/transparent/plasma/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ plasma_ignition(6)
/obj/structure/mineral_door/transparent/plasma/bullet_act(obj/projectile/Proj)
if(!(Proj.nodamage) && Proj.damage_type == BURN)
diff --git a/code/game/objects/structures/plasticflaps.dm b/code/game/objects/structures/plasticflaps.dm
index 899b0ea8597fc..e896fa361854e 100644
--- a/code/game/objects/structures/plasticflaps.dm
+++ b/code/game/objects/structures/plasticflaps.dm
@@ -105,4 +105,10 @@
/obj/structure/plasticflaps/Initialize(mapload)
. = ..()
- air_update_turf(TRUE)
+ air_update_turf(TRUE, TRUE)
+
+/obj/structure/plasticflaps/Destroy()
+ var/atom/oldloc = loc
+ . = ..()
+ if (oldloc)
+ oldloc.air_update_turf(TRUE, FALSE)
diff --git a/code/game/objects/structures/statues.dm b/code/game/objects/structures/statues.dm
index 02ef5068fb26c..fd18f6beb92a2 100644
--- a/code/game/objects/structures/statues.dm
+++ b/code/game/objects/structures/statues.dm
@@ -109,8 +109,14 @@
name = "statue of a scientist"
icon_state = "sci"
-/obj/structure/statue/plasma/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature > 300)
+/obj/structure/statue/plasma/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
+
+/obj/structure/statue/plasma/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > 300
+
+/obj/structure/statue/plasma/atmos_expose(datum/gas_mixture/air, exposed_temperature)
plasma_ignition(6)
diff --git a/code/game/objects/structures/transit_tubes/station.dm b/code/game/objects/structures/transit_tubes/station.dm
index b082356aa00a3..e867c501447a1 100644
--- a/code/game/objects/structures/transit_tubes/station.dm
+++ b/code/game/objects/structures/transit_tubes/station.dm
@@ -154,7 +154,7 @@
if(!QDELETED(pod))
var/datum/gas_mixture/floor_mixture = loc.return_air()
equalize_all_gases_in_list(list(pod.air_contents,floor_mixture))
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
/obj/structure/transit_tube/station/init_tube_dirs()
switch(dir)
diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm
index 3467296faf16a..4c18c13485085 100644
--- a/code/game/objects/structures/windoor_assembly.dm
+++ b/code/game/objects/structures/windoor_assembly.dm
@@ -35,7 +35,7 @@
. = ..()
if(set_dir)
setDir(set_dir)
- air_update_turf(1)
+ air_update_turf(TRUE, TRUE)
var/static/list/loc_connections = list(
COMSIG_ATOM_EXIT = PROC_REF(on_exit),
@@ -45,7 +45,7 @@
/obj/structure/windoor_assembly/Destroy()
set_density(FALSE)
- air_update_turf(1)
+ air_update_turf(TRUE, FALSE)
return ..()
/obj/structure/windoor_assembly/Move()
diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm
index 61f81c584cc39..d408f8b1cd362 100644
--- a/code/game/objects/structures/window.dm
+++ b/code/game/objects/structures/window.dm
@@ -58,7 +58,7 @@
state = WINDOW_SCREWED_TO_FRAME
ini_dir = dir
- air_update_turf(1)
+ air_update_turf(TRUE, TRUE)
if(fulltile)
setDir()
@@ -77,6 +77,7 @@
/obj/structure/window/ComponentInitialize()
. = ..()
AddComponent(/datum/component/simple_rotation,ROTATION_ALTCLICK | ROTATION_CLOCKWISE | ROTATION_COUNTERCLOCKWISE | ROTATION_VERBS ,null,CALLBACK(src, PROC_REF(can_be_rotated)),CALLBACK(src, PROC_REF(after_rotation)))
+ AddElement(/datum/element/atmos_sensitive)
/obj/structure/window/rcd_vals(mob/user, obj/item/construction/rcd/the_rcd)
if(the_rcd.mode == RCD_DECONSTRUCT)
@@ -240,7 +241,7 @@
/obj/structure/window/set_anchored(anchorvalue)
..()
- air_update_turf(TRUE)
+ air_update_turf(TRUE, anchorvalue)
update_nearby_icons()
/obj/structure/window/proc/check_state(checked_state)
@@ -317,11 +318,12 @@
return TRUE
/obj/structure/window/proc/after_rotation(mob/user,rotation_type)
+ air_update_turf(TRUE, FALSE)
ini_dir = dir
add_fingerprint(user)
/obj/structure/window/Destroy()
- set_density(FALSE)
+ air_update_turf(TRUE, FALSE)
air_update_turf(1)
update_nearby_icons()
return ..()
@@ -361,11 +363,11 @@
crack_overlay = mutable_appearance('icons/obj/structures.dmi', "damage[ratio]", -(layer+0.1))
add_overlay(crack_overlay)
-/obj/structure/window/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
+/obj/structure/window/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > T0C + heat_resistance
- if(exposed_temperature > (T0C + heat_resistance))
- take_damage(round(exposed_volume / 100), BURN, 0, 0)
- ..()
+/obj/structure/window/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ take_damage(round(air.return_volume() / 100), BURN, 0, 0)
/obj/structure/window/get_dumping_location(obj/item/storage/source,mob/user)
return null
@@ -429,6 +431,10 @@
glass_type = /obj/item/stack/sheet/plasmaglass
rad_insulation = RAD_NO_INSULATION
+/obj/structure/window/plasma/ComponentInitialize()
+ . = ..()
+ RemoveElement(/datum/element/atmos_sensitive)
+
/obj/structure/window/plasma/spawnDebris(location)
. = list()
. += new /obj/item/shard/plasma(location)
diff --git a/code/game/turfs/change_turf.dm b/code/game/turfs/change_turf.dm
index beaa41794ac26..6f89885f81b73 100644
--- a/code/game/turfs/change_turf.dm
+++ b/code/game/turfs/change_turf.dm
@@ -15,7 +15,8 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
if(turf_type)
var/turf/newT = ChangeTurf(turf_type, baseturf_type, flags)
- CALCULATE_ADJACENT_TURFS(newT)
+ SSair.remove_from_active(newT)
+ CALCULATE_ADJACENT_TURFS(newT, KILL_EXCITED)
/turf/proc/copyTurf(turf/T)
if(T.type != type)
@@ -96,6 +97,7 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
blueprint_data = null
var/list/old_baseturfs = baseturfs
+ var/old_type = type
var/list/post_change_callbacks = list()
SEND_SIGNAL(src, COMSIG_TURF_CHANGE, path, new_baseturfs, flags, post_change_callbacks)
@@ -129,7 +131,7 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
new_turf.explosion_level = old_exl
if(!(flags & CHANGETURF_DEFER_CHANGE))
- new_turf.AfterChange(flags)
+ new_turf.AfterChange(flags, old_type)
new_turf.blueprint_data = old_bp
@@ -158,6 +160,8 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
if ((flags & CHANGETURF_INHERIT_AIR) && ispath(path, /turf/open))
var/datum/gas_mixture/stashed_air = new()
stashed_air.copy_from(air)
+ var/stashed_state = excited
+ var/datum/excited_group/stashed_group = excited_group
. = ..()
if (!.) // changeturf failed or didn't do anything
QDEL_NULL(stashed_air)
@@ -166,17 +170,20 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
newTurf.air.copy_from(stashed_air)
update_air_ref(planetary_atmos ? 1 : 2)
QDEL_NULL(stashed_air)
+ newTurf.excited = stashed_state
+ newTurf.excited_group = stashed_group
+ #ifdef VISUALIZE_ACTIVE_TURFS
+ if(stashed_state)
+ newTurf.add_atom_colour(COLOR_VIBRANT_LIME, TEMPORARY_COLOUR_PRIORITY)
+ #endif
+ if(stashed_group)
+ if(stashed_group.should_display || SSair.display_all_groups)
+ stashed_group.display_turf(newTurf)
else
+ SSair.remove_from_active(src) //Clean up wall excitement, and refresh excited groups
if(ispath(path,/turf/closed))
flags |= CHANGETURF_RECALC_ADJACENT
- update_air_ref(-1)
- . = ..()
- else
- . = ..()
- if(flags & CHANGETURF_SKIP) // don't init air before the air subsystem runs
- return
- if(!istype(air,/datum/gas_mixture))
- Initalize_Atmos(0)
+ . = ..()
/turf/closed/ChangeTurf(path, list/new_baseturfs, flags)
if(ispath(path,/turf/open))
@@ -301,12 +308,14 @@ 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()
+/turf/proc/AfterChange(flags, oldType) //called after a turf has been replaced in ChangeTurf()
levelupdate()
if(flags & CHANGETURF_RECALC_ADJACENT)
ImmediateCalculateAdjacentTurfs()
- else
- CALCULATE_ADJACENT_TURFS(src)
+ if(ispath(oldType, /turf/closed) && istype(src, /turf/open))
+ SSair.add_to_active(src)
+ else //In effect, I want closed turfs to make their tile active when sheered, but we need to queue it since they have no adjacent turfs
+ CALCULATE_ADJACENT_TURFS(src, (!(ispath(oldType, /turf/closed) && istype(src, /turf/open)) ? NORMAL_TURF : MAKE_ACTIVE))
//update firedoor adjacency
var/list/turfs_to_check = get_adjacent_open_turfs(src) | src
@@ -322,7 +331,7 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
if(above)
above.update_mimic()
-/turf/open/AfterChange(flags)
+/turf/open/AfterChange(flags, oldType)
..()
RemoveLattice()
if(!(flags & (CHANGETURF_IGNORE_AIR | CHANGETURF_INHERIT_AIR)))
@@ -331,18 +340,41 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
//////Assimilate Air//////
/turf/open/proc/Assimilate_Air()
var/turf_count = LAZYLEN(atmos_adjacent_turfs)
- if(isclosedturf(src) || !turf_count) //if there weren't any open turfs, no need to update.
+ if(blocks_air || !turf_count) //if there weren't any open turfs, no need to update.
return
var/datum/gas_mixture/total = new//Holders to assimilate air from nearby turfs
-
- for(var/T in atmos_adjacent_turfs)
- var/turf/open/S = T
- if(!S.air)
- continue
- total.merge(S.air)
-
- air.copy_from(total.remove_ratio(1/turf_count))
+ var/list/total_gases = total.gases
+ //Stolen blatently from self_breakdown
+ var/list/turf_list = atmos_adjacent_turfs + src
+ var/turflen = turf_list.len
+ var/energy = 0
+ var/heat_cap = 0
+
+ for(var/t in turf_list)
+ var/turf/open/T = t
+ //Cache?
+ var/datum/gas_mixture/turf/mix = T.air
+ //"borrowing" this code from merge(), I need to play with the temp portion. Lets expand it out
+ //temperature = (giver.temperature * giver_heat_capacity + temperature * self_heat_capacity) / combined_heat_capacity
+ var/capacity = mix.heat_capacity()
+ energy += mix.temperature * capacity
+ heat_cap += capacity
+
+ var/list/giver_gases = mix.gases
+ for(var/giver_id in giver_gases)
+ ASSERT_GAS(giver_id, total)
+ total_gases[giver_id][MOLES] += giver_gases[giver_id][MOLES]
+
+ total.temperature = energy / heat_cap
+ for(var/id in total_gases)
+ total_gases[id][MOLES] /= turflen
+
+ for(var/t in turf_list)
+ var/turf/open/T = t
+ T.air.copy_from(total)
+ T.update_visuals()
+ SSair.add_to_active(T)
/turf/proc/ReplaceWithLattice()
ScrapeAway(flags = CHANGETURF_INHERIT_AIR)
diff --git a/code/game/turfs/closed/wall/mineral_walls.dm b/code/game/turfs/closed/wall/mineral_walls.dm
index 6dcd409cc3e94..bd69e4972dd2b 100644
--- a/code/game/turfs/closed/wall/mineral_walls.dm
+++ b/code/game/turfs/closed/wall/mineral_walls.dm
@@ -148,8 +148,9 @@
new /obj/structure/girder/displaced(loc)
..()
-/turf/closed/wall/mineral/plasma/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)//Doesn't fucking work because walls don't interact with air :(
- if(exposed_temperature > 300)
+/turf/closed/wall/mineral/plasma/should_atmos_process(datum/gas_mixture/air, exposed_temperature)//Doesn't work because walls have superconduction turned off
+ return exposed_temperature > 300
+/turf/closed/wall/mineral/plasma/atmos_expose(datum/gas_mixture/air, exposed_temperature)
if(plasma_ignition(6))
new /obj/structure/girder/displaced(loc)
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index b368aaf6fdfed..1497cac2d49be 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -129,6 +129,7 @@
icon = 'icons/turf/boss_floors.dmi'
icon_state = "boss"
baseturfs = /turf/open/indestructible/boss
+ planetary_atmos = TRUE
initial_gas_mix = LAVALAND_DEFAULT_ATMOS
/turf/open/indestructible/boss/air
@@ -136,6 +137,7 @@
/turf/open/indestructible/hierophant
icon = 'icons/turf/floors/hierophant_floor.dmi'
+ planetary_atmos = TRUE
initial_gas_mix = LAVALAND_DEFAULT_ATMOS
baseturfs = /turf/open/indestructible/hierophant
tiled_dirt = FALSE
@@ -174,15 +176,17 @@
init_air = FALSE
/turf/open/Initalize_Atmos(times_fired)
- if(!istype(air, /datum/gas_mixture/turf))
- air = new(2500,src)
- air.copy_from_turf(src)
- update_air_ref(planetary_atmos ? 1 : 2)
-
+ excited = FALSE
update_visuals()
-
+ current_cycle = times_fired
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(!excited && air.compare(enemy_air))
+ //testing("Active turf found. Return value of compare(): [is_active]")
+ excited = TRUE
+ SSair.active_turfs += src
/turf/open/proc/GetHeatCapacity()
. = air.heat_capacity()
@@ -192,7 +196,7 @@
/turf/open/proc/TakeTemperature(temp)
air.set_temperature(air.return_temperature() + temp)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
/turf/open/proc/freeze_turf()
for(var/obj/I in contents)
diff --git a/code/game/turfs/open/floor/mineral_floor.dm b/code/game/turfs/open/floor/mineral_floor.dm
index 99d133c7ed1f8..956c640f7749c 100644
--- a/code/game/turfs/open/floor/mineral_floor.dm
+++ b/code/game/turfs/open/floor/mineral_floor.dm
@@ -40,8 +40,10 @@
icons = list("plasma","plasma_dam")
max_integrity = 200
-/turf/open/floor/mineral/plasma/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature > 300)
+/turf/open/floor/mineral/plasma/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > 300
+
+/turf/open/floor/mineral/plasma/atmos_expose(datum/gas_mixture/air, exposed_temperature)
PlasmaBurn(exposed_temperature)
/turf/open/floor/mineral/plasma/attackby(obj/item/W, mob/user, params)
diff --git a/code/game/turfs/open/space/space.dm b/code/game/turfs/open/space/space.dm
index d4e29778c1bab..62ef458980fb7 100644
--- a/code/game/turfs/open/space/space.dm
+++ b/code/game/turfs/open/space/space.dm
@@ -70,6 +70,9 @@
if(IS_DYNAMIC_LIGHTING(A))
overlays += GLOB.starlight_overlay
+ if(requires_activation)
+ SSair.add_to_active(src, TRUE)
+
return INITIALIZE_HINT_NORMAL
/turf/open/space/Destroy()
diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm
index bbeab37719b8f..b109d5eccc1c6 100644
--- a/code/game/turfs/turf.dm
+++ b/code/game/turfs/turf.dm
@@ -116,7 +116,7 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists)
add_overlay(GLOB.fullbright_overlay)
if(requires_activation)
- CALCULATE_ADJACENT_TURFS(src)
+ CALCULATE_ADJACENT_TURFS(src, KILL_EXCITED)
if(color)
add_atom_colour(color, FIXED_COLOUR_PRIORITY)
@@ -162,7 +162,7 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists)
/// Initializes our adjacent turfs. If you want to avoid this, do not override it, instead set init_air to FALSE
/turf/proc/Initalize_Atmos(times_fired)
- CALCULATE_ADJACENT_TURFS(src)
+ CALCULATE_ADJACENT_TURFS(src, NORMAL_TURF)
/turf/Destroy(force)
. = QDEL_HINT_IWILLGC
diff --git a/code/modules/antagonists/blob/structures/_blob.dm b/code/modules/antagonists/blob/structures/_blob.dm
index 3c84ee7235c92..a77b11b5ce668 100644
--- a/code/modules/antagonists/blob/structures/_blob.dm
+++ b/code/modules/antagonists/blob/structures/_blob.dm
@@ -32,7 +32,7 @@
setDir(pick(GLOB.cardinals))
update_icon()
if(atmosblock)
- air_update_turf(1)
+ air_update_turf(TRUE, TRUE)
ConsumeTile()
/obj/structure/blob/proc/creation_action() //When it's created by the overmind, do this.
@@ -41,7 +41,7 @@
/obj/structure/blob/Destroy()
if(atmosblock)
atmosblock = FALSE
- air_update_turf(1)
+ air_update_turf(TRUE, FALSE)
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
diff --git a/code/modules/antagonists/blob/structures/shield.dm b/code/modules/antagonists/blob/structures/shield.dm
index 1d809d4fe104c..1bcdb78e77f72 100644
--- a/code/modules/antagonists/blob/structures/shield.dm
+++ b/code/modules/antagonists/blob/structures/shield.dm
@@ -31,7 +31,7 @@
. = ..()
if(. && obj_integrity > 0)
atmosblock = obj_integrity < (max_integrity * 0.5)
- air_update_turf(TRUE)
+ air_update_turf(TRUE, atmosblock)
/obj/structure/blob/shield/update_icon_state()
icon_state = "[initial(icon_state)][(obj_integrity < (max_integrity * 0.5)) ? "_damaged" : null]"
diff --git a/code/modules/atmospherics/Atmospherics.md b/code/modules/atmospherics/Atmospherics.md
new file mode 100644
index 0000000000000..c5ab3e7e10ad6
--- /dev/null
+++ b/code/modules/atmospherics/Atmospherics.md
@@ -0,0 +1,444 @@
+# Atmospherics
+## 1. Preamble
+
+This file will be written in the first person in the interest of having a laid back style, as some of the concepts here would be ass to read as technical writing. Understand that this isn't the work of one person, but the combined efforts of several contributors. It is a living document, and one you should strive to keep up to date.
+
+I have ~~stolen~~ adapted this document from the work of duncathan, an off and on maintainer who is responsible for the majority of the quality of the current atmos system. He pushed through several code cleanliness and sanity refactors to the system, and wrote the rundown of gas mixtures you'll find in this document. See the [original](https://gist.github.com/duncathan/77d918748d153b4f31a8f76f6085b91a) for his draft.
+
+Now, the purpose of this bit of documentation.
+
+Over the history of /tg/ there have been several periods where one or no active coders understood how atmospherics works, or even how it was intended to work. We've lost several major pieces of functionality, not because none knew how they worked, but because none knew that they should work, or even that they existed.
+
+Atmospherics tends to be a somewhat cloudy corner of our codebase, unless you know exactly what to look for noticing that something is broken can be a feat in and of itself.
+
+My goal here is to solve that problem once and for all. Not everything will be documented in this file, I won't go line by line. I will however describe how things ought to work, and how some of the more complex stuff is meant to run.
+
+Atmospherics is a very complicated and intimidating system of SS13, and as such very few contributors have ever made changes to it. Even fewer is the number of contributors who have made changes to the more fundamental aspects of atmos, such as Environmental Atmos or gas mixtures. There are several other factors for this, of course. In the case of Environmental, its arcane nature coupled with its extremely important gameplay effects leave it a very undesirable target for even the least sane coder. As for gas mixtures, they were virtually untouchable without extensive reworks of the code. This [paste-bin](https://pastebin.com/bwy4KpBE) is a good example; it lists all the files one would need to make changes in order to add a new type of gas in the old system. As you can imagine, the sheer bulk of work one would need to do to accomplish this essentially invalidated any such attempts. However, my primary goal is to bring atmos to a state where any coder will be able to understand how and why it works, as well as cleanly and relatively easily make changes or additions to the system. While much progress to this end has been achieved, still very few have taken advantage of the new frameworks to try to implement meaningful features or changes. The purpose of this document is to lay out the inner workings of the entire atmos system, such that someone who does not have an intimate understand of the system like myself will be able to contribute to the system nonetheless.
+
+Recognizing this desire, I hope and believe that you who are reading this are willing to learn and contribute.
+
+Thank you.
+
+## 2. Introduction to Atmos
+
+Hello! So glad you could join us.
+
+Atmospherics is the system we use to simulate gases. Might as well get that out of the way. It is made up of several major parts, and a few more minor ones. We'll be covering the air subsystem, gas mixtures, reactions, environmental flow, and pipenets in the document.
+
+If you'd like to understand more about how environmental atmos works after reading the relevant subsection, go to Appendix B. It discusses how to properly visualize the system, and what different behavior looks like.
+
+Now then, into the breach.
+
+## 3. The Air Controller
+
+![Cyclical graph of one atmos tick](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/Cycle.png)
+
+*Figure 3.1: The structure of one air controller tick. Not totally accurate, but it will do*
+
+ The air controller is, at its core, quite simple, yet it is absolutely fundamental to the atmospheric system. The air controller is the clock which triggers all continuous actions within the atmos system, such as vents distributing air or gas moving between tiles. The actions taken by the air controller are quite simple, and will be enumerated here. Much of the substance of the air ticker is due to the game's master controller, whose intricacies I will not delve into for this document. I will however go into more detail about how SSAir in particular works in Chapter 6. In any case, this is a simplified list of the air controller's actions in a single tick:
+1. Rebuild Pipenets
+ - Runs each time SSAir processes, sometimes out of order. It ensures that no pipenets sit unresolved or unbuilt
+ - Calls `build_network()` on each `/obj/machinery/atmospherics` in the `pipenets_needing_rebuilt` list
+2. Pipenets
+ - Updates the internal gasmixes of attached pipe machinery, and reacts the gases in a pipeline
+ - Calls `process()` on each `/datum/pipenet` in the `networks` list
+3. Machinery
+ - Handles machines that effect atmospherics, think vents, the supermatter, pumps, all that
+ - Calls `process_atmos()` on each `/obj/machinery` (typically `/obj/machinery/atmospherics`) in the `atmos_machinery` list
+ - May remove the machinery from said list if `process_atmos()` returns `PROCESS_KILL`
+4. Active turfs
+ - This is the heart and soul of environmental atmos, see more details below
+ - All you need to know right now is it manages moving gas from tile to tile
+ - Calls `process_cell()` on each `/turf/open` in the `active_turfs` list
+5. Excited group cleanup
+ - Rebuilds excited groups when the structure of their turfs changes
+ - Calls `cleanup_group()` on each `/turf/open` in the `cleanup_ex_groups` list
+6. Excited groups
+ - Manages excited groups, which are core to working flow simulation
+ - More details to come, they handle differences between gasmixtures when active turfs can't do the job
+ - Increases the `breakdown_cooldown` and `dismantle_cooldown` for each `/datum/excited_group` in the `excited_groups` list
+ - If either cooldown for a given excited group has passed its threshold
+ - Calls `self_breakdown()` or `dismantle()` appropriately on the excited group.
+7. High pressure deltas
+ - Takes the gas movement from Active Turfs and uses it to move objects on said turfs
+ - Calls `high_pressure_movements()` on each `/turf/open` in the `high_pressure_delta` list.
+ - Sets each turf's `pressure_difference` to 0
+8. Hotspots
+ - These are what you might know as fire, at least the effect of it.
+ - They deal with burning things, and color calculations, lots of color calculations
+ - Calls `process()` on each `/obj/effect/hotspot` in the `hotspots` list
+9. Superconductivity
+ - Moves heat through turfs that don't allow gas to pass
+ - Deals with heating up the floor below windows, and some other more painful heat stuff
+ - Calls `super_conduct()` on each `/turf` in the `active_super_conductivity` list
+10. Atoms
+ - Processes things in the world that should know about gas changes, used to account for turfs sleeping, I'll get more into that in a bit
+ - Calls `process_exposure()` on each `/atom` in the `atom_process` list
+
+## 4. Gas Mixtures
+If the air controller is the heart of atmos, then gas mixtures make up its blood. The bulk of all atmos calculations are performed within a given gas mixture datum (an instance of `/datum/gas_mixture`), be it within a turf or within an emergency oxygen tank or within a pipe. In particular, `/datum/gas_mixture/proc/share()` is the cornerstone of atmos simulation, as it and its stack perform all the calculations for equalizing two gas mixtures.
+
+Gas mixtures contain some of the oldest code still in our codebase, and it is remarkable that overall, the logic behind the majority of gas mixture procs has gone unchanged since the days of Exadv1. Despite being in some sense "oldcode", the logic itself is quite robust and based in real world physics. Thankfully, gas mixtures already are quite well documented in terms of their behavior. Their file is well commented and kept up to date. I will, however, elaborate on some of the less obvious operations here. Additionally, I will document the structure of gas lists, and how one should interface with a gas mixture should you choose to use one in other code.
+
+Now don't be scared by the code mind, it's SPOOKY PHYSICS but it's not the devil, we can break it down into component parts to understand it.
+
+```DM
+//transfer of thermal energy (via changed heat capacity) between self and sharer
+ if(new_self_heat_capacity > MINIMUM_HEAT_CAPACITY)
+ temperature = (old_self_heat_capacity*temperature - heat_capacity_self_to_sharer*temperature_archived + heat_capacity_sharer_to_self*sharer.temperature_archived)/new_self_heat_capacity
+```
+*Snippet 4.1: excerpt from `/datum/gas_mixture/proc/share()`*
+
+The snippet above is an example of one particularly strange looking calculation. This part of share() is updating the temperature of a gas mixture to account for lost or gained thermal energy as gas moves to/from the mixture, since gases themselves carry heat. To understand this snippet, it is important to understand the difference between heat and temperature. For the most part, the average coder need only concern himself with temperature, as it is a familiar experience for anybody. However, internally in atmos, heat (thermal energy) is the truly important quantity. Heat is defined as temperature multiplied by heat capacity, and is measured in joules. Typically within atmos, we are more concerned with manipulating heat than temperature; however, temperature is tracked rather than heat largely to make interfacing with the system simpler for the average coder. Thus, this snippet modifies heat in terms of temperature - it adds/subtracts three terms, each of which measure heat, to determine the new heat in the gas mixture. This heat is then divided by the mixture's heat capacity in order to determine temperature.
+
+One trick to understanding passages like this is to do some simple dimensional analysis. Look only at the units, and ensure that whenever a variable is assigned that it is being assigned the appropriate unit. The snippet previously discussed can be represented with the following units: `temperature = ((J/K)*K - (J/K)*K + (J/K)*K)/(J/K)`. Simplified, you get `(J-J+J)*K/J` and then simply `J*K/J` and `K`, verifying that temperature is being set to a value in kelvins. This trick has proven invaluable to me when debugging the inner workings of gas mixtures.
+
+### Gases
+
+The true beauty of the gas mixture datum is how it represents the gases it contains. A bit of history: gas mixtures used to represent gas in two ways - there were the four primary gases (oxygen, nitrogen, carbon dioxide, and plasma) which were hardcoded. Each gas mixture had two vars (moles and archived moles, a concept to be explained later) to represent each of these gases. Calculations such as thermal energy made use of predefined constants for these hardcoded gases. The benefit of this was that they were extremely quick - only a single datum var access was needed for each one. In contrast, there were trace gases, for which there were a list of gas datums. The only trace gas available in normal gameplay was nitrous oxide (N2O or sleeping agent), though through adminnery it was possible to create oxygen agent B and volatile fuel, curious gases which will be described later for historical reasons. Trace gases, in contrast to hardcoded gases, were quite modular. To add a new trace gas one needed only to define a new subtype of /datum/gas and add appropriate behavior wherever desired, such as breath code. Unfortunately, of course, trace gases were slooooow. Calculations on trace gases were significantly more costly than hardcoded gases. The problem was obvious - it seemed impossible to have a gas definition which shared the modularity of trace gases without sacrificing too much of the performance of the hardcoded gases.
+
+What then to do? There was no option to port an improvement from another codebase. As far as I am aware, there have been no significant downstream improvements to gas mixtures. The other major upstream codebase, Baystation12, uses a very different atmos system; in particular, their XGM gas mixtures have their own solution to this problem. To summarize XGM, there is a singleton which has associative lists of gas metadata (information such as specific heat, or which overlay to display when the gas is present) which gets accessed whenever such information is needed. To count moles, each gas mixture has an associative list of gas ids mapped to mole counts. There were a couple of problems with this approach: 1. There was no measure of archived moles. While it would be easy to simply add a second associative list, this has non-trivial memory implications as well as a potential increase to total datum var accesses within internal atmos calculations. 2. The singleton used for storing metadata helps with the memory impact that using full datums would have, but does not properly address the cost of datum var accesses, as to access metadata you must still access a datum var on the singleton.
+
+For some time, without a clear solution, we simply stuck to the status quo and left gases non-modular. Eventually, however, there was an idea.
+
+Enter Listmos.
+
+### The Gas List
+The solution we came to was beautifully simple, but founded on some unintuitive principles. While datum var accesses are quite slow, proc var accesses are acceptable. If we use a reference for a given var, this can be exploited by "caching" the reference inside of a proc var. How can we take advantage of this without using a datum, thus nullifying the benefit?
+
+The answer was to use a list. The critical realization was that a gas datum functioned more so as a struct than as a class. There were no procs attached to gas datums; only vars. While DM lacks a true struct with quick lookup times, a list works very well to perform the same function. Thus, the current structure of gas was created, under the name Listmos.
+
+Each gas mixture has an associative list, gases, which maps according to a key to a particular gas. This gas is itself a list (not an associative list, mind) with three elements; these elements correspond to the moles, archived moles, and to another list. This final list is a singleton - only one instance of it exists per gas, and all gas instances of a particular type point to this same list as their third element. The final list contains the metadata for the gas, such as specific heat or the name of the gas. The structure of the metadata list varies according to how many attributes are defined overall for all gases, but it is also non-associative since the structure can never change post-compile, so we save a little bit of performance by avoiding associative lookups.
+
+Each type of gas is defined by defining a new subtype of /datum/gas. These datums do not get instantiated; they merely serve as a convenient and familiar means for a coder unfamiliar with the inner workings of listmos to define a new gas. Additionally, the type paths serve a second use as the keys used to access a particular gas within the gases list. It is easiest to demonstrate the manipulation of gas, including these list accesses, with an example.
+
+### Interfacing with a Gas Mixture
+
+```DM
+var/datum/gas_mixture/air = new
+air.assert_gas(/datum/gas/oxygen)
+air.gases[/datum/gas/oxygen][MOLES] = 100
+world << air.gases[/datum/gas/oxygen][GAS_META][META_GAS_NAME] //outputs "Oxygen"
+world << air.gases.heat_capacity() //outputs 2000 (100 mol * 20 J/K/mol)
+air.gases[/datum/gas/oxygen][MOLES] -= 110
+air.garbage_collect() //oxygen is now removed from the gases list, since it was empty
+```
+*Snippet 4.2: gas mixture usage examples*
+
+Of particular note in this snippet are the two procs assert_gas() and garbage_collect(). These procs are very important while interfacing with gas mixtures. If you are uncertain about whether a given mixture has a particular gas, you must use assert_gas() before any reads or writes from the gas. If you fail to use assert_gas() then there will be runtime errors when you try to access the inner lists. When you remove any number of moles from a given gas, be sure to call garbage_collect(). This proc removes all gases which have mole counts less than or equal to 0. This is a memory and performance enhancement for list accesses achieved by reducing the size of the list, and also saves us from having to do sanity checks for negative moles whenever gas is removed. As a quick reference, here is a list of common procs/vars/list indices which the average coder may wish to use when interfacing with a gas mixture.
+
+##### Gas Mixture Datum
+* *`/datum/gas_mixture/proc/assert_gas()`* - Used before accessing a particular type of gas.
+* *`/datum/gas_mixture/proc/assert_gases()`* - Shorthand for calling assert_gas() multiple times.
+* *`/datum/gas_mixture/proc/garbage_collect()`* - Used after removing any number of moles from a mixture.
+* *`/datum/gas_mixture/proc/return_pressure()`* - Pressure is what should be displayed to players to quantify gas; measured in kilopascals.
+* *`/datum/gas_mixture/var/temperature`* - Measured in kelvins. Useful constants are T0C and T20C for 0 and 20 degrees Celsius respectively, and TCMB,the temperature of space and the lower bound for temperature in atmos.
+* *`/datum/gas_mixture/var/volume`* - Measured in liters.
+
+While we're on the subject, `/datum/gas_mixture` has two subtypes.
+The first is `/datum/gas_mixture/turf`, which exists for literally one purpose. When a turf is empty, we want it to have the same heat capacity as space. This lets us achieve that by overriding `heat_capacity()`
+
+The second is `/datum/gas_mixture/immutable`, which itself has two subtypes.
+The type is built to allow for gasmixtures that serve as infinite sources of "something", which can't be changed or mutated.
+It's used by `/datum/gas_mixture/immutable/space`, which implements some particular things for `heat_capacity()` and some optimizations for gas operations.
+It's also implemented by `/datum/gas_mixture/immutable/planetary`, which is used for planetary turfs, and has some code that makes actually having a gasmix possible.
+
+
+##### Gas List
+* *`gases[path][MOLES]`* - Quantity of a particular gas within a mixture.
+* *`gases[path][GAS_META][META_GAS_NAME]`* - The long name of a gas, ex. "Oxygen" or "Hyper-noblium"
+* *`gases[path][GAS_META][META_GAS_ID]`* - The internal ID of a given gas, ex. "o2" or "nob"
+
+### Reactions
+While defining a new gas on its own is very simple, there is no gas-specific behavior defined within /datum/gas. This behavior gets defined in a few places, notably breath code (to be discussed later) and in reactions. The most important and well known reaction in SS13 is fire - the combustion of plasma. Reactions are used for several things - in particular, it is conventional (though by no means enforced) that to form a gas, a reaction must occur. Creating a new reaction is fairly simple, this is the area of atmos that has received the most attention over the last few years, and the best place to start. Don't be scared of the size of reactions.dm, it's not that complex.
+
+There are two procs needed when defining a new reaction, /datum/gas_reaction/proc/init_reqs() and /datum/gas_reaction/proc/react(). init_reqs() initializes the requirements for the reaction to occur. There is a list, min_requirements, which maps gas paths to required amount of moles. It also maps three specific strings ("TEMP", "MAX_TEMP" and "ENER") to temperature in kelvins and thermal energy in joules. More behavior could easily be added here, but it hasn't yet for performance reasons because no reactions have need of it.
+
+As for react(), it is where all the behavior of the reaction is defined. The proc must return one of NO_REACTION, REACTING, or STOP_REACTIONS. The proc takes one or optionally two arguments. The first, mandatory, argument is a gas mixture on which to perform calculations; this mixture is what is reacting. The second, optional, argument is a turf or pipenet, specifically the thing which contains the gas mixture. You may choose for the reaction to affect the object in some way. Note that it is conventional for constants within reactions to be #define'd at the top of the file and #undef'd at the end.
+
+## 5. Environmental Atmos
+
+This is a rather large subject, we will need to cover gas flow, turf sleeping, superconduction, and much more. Strap in and enjoy the ride!
+
+### Active Turfs
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/FlowVisuals.png)
+
+*Figure 5.1: A visual of the algorithm `process_cell()` implements, ignoring our optimizations*
+
+Active turfs are the backbone of how gas moves from tile to tile. While most of `process_cell()` should be easy enough to understand, I am going to go into some detail about archiving, since I think it's a common source of hiccups.
+
+* *`archived_cycle`* this var stores the last cycle of the atmos loop that the turf processed on. The key point to notice here is that when processing a turf, we don't share with all its neighbors, we only talk to those who haven't processed yet. This is because the remainder of `process_cell()` and especially `share()` ought to be similar in form to addition. We can add in any order we like, and we only need to add once. This is what archived gases are for by the way, they store the state of the relevant tile before any processing occurs. This isn't strictly the case unfortunately, but it's minor enough that we can ignore the effects.
+
+Alright then, with that out of the way, what is an active turf.
+
+This is actually the main success of LINDA, the math for gas movement is r4407 goon code or older, but that implementation (FEA) had a glaring issue. All turfs processed, or rather, all `/simulated` turfs processed. There was a separate type for `/unsimulated` turfs, but that was mostly used for things like centcom or space. Aside from that all the turfs that could in theory have gas on them needed to process each tick. `process_cell()` didn't quite look how it does now mind, but this was still a horrible state of affairs.
+
+The major difference between then and now is our turfs will stop processing. They sit idle most of the round, wake up when something changes around them, process until no major changes are happening, and then go to sleep.
+
+Active turfs also poke all the listening objects sitting on them, and start to process them so they can react to heat or gas changes. We do this so objects don't need to process when nothing has changed, but they also can operate through a turf sleeping. In essence this is like waking up things that ought to be listening to us.
+
+If we just used active turfs sleeping would be easy as pie, we could do it turf by turf. But we don't.
+
+### Excited Groups
+
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/Unsettled.png)
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/Settled.png)
+
+*Figure 5.2.1-5.2.2: Settled VS Unsettled gases, this is what excited groups do*
+
+I didn't mention this above, but active turf processing, or really `share()`, has a fatal flaw. The amount of gas moved per tick goes down exponentially the further away a turf is from the source of changes, or diffs.
+
+With only active turfs breaches would never settle, and as soon as a tile becomes active it would never rest again. (This is one of the reasons I wrote this document by the way, excited groups nearly totally broke around about 2016, and none at the time noticed because the code was so twisted none knew how it ought to work, so it persisted for 4 years past that)
+
+So active turfs are bad at evening out diffs. What can we do to solve this?
+
+Enter the excited group. We hold a list of all the turfs that have talked to each other, then we keep track of how active those turfs are. When they start to wind down, we spread all the gas out evenly between them, and the group starts to spread again. They tend to fill the space given to them, so be careful with open plan stations.
+
+This is `self_breakdown()`, our equalization step. It cuts down on churn, and keeps things flowing smoothly.
+
+I've been talking kinda abstractly about turfs sleeping. That's because turfs on their own don't stop waiting to process once they have an excited group. Groups have secondary roles as the grim reaper of active turfs. When a group is totally inactive, and nothing whatsoever is going on, it will `dismantle()`, putting all of the turfs inside it to sleep, and killing itself.
+
+### A brief romp to talk about excited groups and LAST_SHARE_CHECK
+
+Excited groups can tell the amount of diff being shared by hooking into a value `share()` sets on gasmixes, the absolute amount of gas shared by each tile. The issue is this isn't pressure, it's molar count. So heat being shared in a sealed room causes excited groups to break down, then reform from sources. This isn't a major issue due to how breakdown evens things out, but it's worth knowing.
+
+### Back to the main thread
+
+Now this would all be fine, but as I'm sure you've noticed, there's a crouching pile of lag hiding here. What happens if the excited group has turfs with a fire on them over in cargo, but the flow of gas started in medical? There's no point processing the majority of the tiles, but we still want to keep the group alive for equalization.
+
+### Turfs can have a little nap
+
+Originally LINDA only had the above 2 constructions, but we ran into a problem when making planetary turfs. The old implementation was mutable, but shared with a copy of its initial mix each tick. This lead to problems. In essence, the groups never stopped spreading so long as a source of diffs existed. This is because the job of excited groups is to move the diffs from the source, to the edges of the group. But we put these mixes on huge open planets. Doesn't really work out so well.
+
+To combat this, a timer was added to each turf. It reset when a significant share was made, but otherwise if enough time passed the turf was forcibly removed from the active_turfs list. Unfortunately for us, this had unintended side effects.
+
+When a turf is removed from active, the excited group is broken down, as it's assumed that the proc will only be called when the landscape of the map itself has changed. You begin to see the issue. With large enough space, excited groups broke, totally. Constant rebuilds into dismantles, cycling forever.
+
+Now this issue here is we'd like to keep this napping, but we don't want to `garbage_collect()` the excited group constantly.
+
+So, a new proc was added, `sleep_active_turf()`. It removes the active turf from processing, but doesn't `garbage_collect()` the group. This has some additional costs however.
+
+The excited group's `garbage_collect()` proc is the real issue here. When the landscape of the map changes, we need to rebuild the groups, as we don't want to rebuild them across a wall. The old way relied on the group rebuilding itself, in `process_cell()`, but since players can cause rebuilds quite often, can't afford to just wake all the turfs up.
+
+Thus, we have excited group cleanup, which takes all the old turfs, and reaches out to their neighbors to rebuild the group. This allows us to rebuild excited groups without relying on active turfs.
+
+There's another issue here too, how do we deal with things that react to heat? A firelock shouldn't just open because the turf that the alarm is on went to sleep. Thus, atom_process, as I mentioned before, a list of atoms with requirements and things to do. It processes them until their requirements are not met, then it removes them from its list them.
+
+There's one more major aspect of environmental atmos to cover, and while it's not the most misunderstood, it is the code with the worst set dressing.
+
+### Superconduction, or why var names really matter
+
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/Superconduction.png)
+
+*Figure 5.3: The death of a pug, and a visual description of what superconduction does*
+
+Superconduction, an odd name really, it doesn't really describe much of anything aside from something to do with heat. It gets worse, trust me.
+
+Superconduction is the system that makes heat move through solid objects, so in theory walls, windows, airlocks, so on. This is another one that just broke one day, and none noticed cause none knew what it was meant to do.
+
+There's another issue with it, the var names don't mean what you think, and it is very old code, so it's hard to grasp. You can do it, you've made it this far.
+
+So then, what does superconduction do, and what do all these damn vars mean.
+
+### What does superconduction do?
+
+As I mentioned above, superconduction shares heat where heat can't normally travel. It does this by heating up the turf the heat is in, not the gasmix, the turf itself. This temperature is then shared with adjacent turfs, based on `thermal_conductivity`, a value between 0 and 1 that slows the heat share. Turfs also have a `heat_capacity`, which is how hard it is to heat, along with providing a threshold for the lowest temperature that can melt the turf.
+
+There's one more, and it's a doozy. `atmos_superconductivity` is a set of directions that we cannot share with. I know. It's set in CanAtmosPass(), a rather heady set of procs that build `atmos_adjacent_turfs`, and also modify `atmos_superconductivity`.
+
+So then, a review.
+
+* *`thermal_conductivity`* Ranges from 0 to 1, effects how easy it is for a turf to receive heat
+* *`heat_capacity`* Large numbers mean it's harder to heat, but holds more heat. You get it. Also used for turf melting
+* *`atmos_supeconductivity`* Bitfield of directions we **can't** share in, this is often set by firelocks and such
+
+One more thing, turfs will superconduct until they either run out of energy, or temperature. This is a stable system because turfs "conduct" with space, which is why floods of heat will equalize to about 690k over time.
+
+## 6. Processing time, Dynamic scaling, and what slows us down the most
+
+This will require/impart a light understanding of the master controller, I will go over what makes the atmos subsystem slow, what can be done, and what it effects.
+
+First, some new vocab.
+
+* *`wait`* Subsystem var, it is the amount of time to "wait" between each fire, or process. Measured in deciseconds.
+* *`MC_TICK_CHECK`* A define that checks to see if the subsystem has taken more then it's allotted time. In the case of SSAir we use it to allow for dynamic scaling
+
+The MC entry for SSAir is very helpful for debugging, and it is good to understand before I talk about cost.
+
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/SSAirAtRest.png)
+
+*Figure 6.1: SSAir sitting doing little to nothing turf wise, only processing pipenets and atmos machines*
+
+As you can see here, SSAir is a bit of a jumble, don't worry, it'll make sense in a second. The first line is in this order: cost, tick_usage, tick_overrun, ticks.
+All of these are averages by the way.
+
+* *`cost`* Cost is the raw time spent running the subsystem in milliseconds
+* *`tick_usage`* The percent of each byond tick the last fire() took. Tends to be twice cost, good for comparing with overrun.
+* *`tick_overrun`* A percentage of how far past our allotted time we ran. This is what causes Time Dilation, it's bad.
+* *`ticks`* The amount of subsystem fires it takes to run through all the subprocesses once.
+
+The second line is the cost each subprocess contributed per full cycle, this is a rolling average. It'll give you a good feel for what is misbehaving.
+
+The third line is the amount of "whatever" in each subprocess. Handy for noticing dupe bugs and crying at active turf cost. Speaking of, the last entry is the active turfs per overall cost. Not a great metric, but larger is better.
+
+Now then, what the hell is going on in that image.
+
+### Dynamic scaling
+
+SSAir has a wait of 5 deciseconds, or 500ms. This means it wants to fire roughly twice a second. You'll see in a moment why this hardly ever happens.
+
+See that image from before? Notice how the cost of SSAir at rest is about 40ms? yeahhhhh.
+
+The atmos subsystem was used as a testing ground for the robustness of the master-controller. It used to have a wait of 2 seconds, but that was lowered to 0.5 as it was thought that the system could handle it. It can! But this can have annoying side effects. As you know, we edge right up against 1/10th of the wait when sitting at rest, and if we start to make diffs...
+
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/GasTypes.png)
+
+*Figure 6.2: SSAir when a high amount of active turfs are operating, with a large selection of gastypes for each tile*
+
+As you can see, active turfs can be really slow. Oh but it gets so much worse.
+
+Active turf cost is mostly held up in `react()`, `share()` and `compare()`. `react()` and `share()` scale directly with the amount of gas in the air. `compare()` does better, but none of them do that great.
+
+For this reason, and because excited groups spread gas out so much, we want to keep the variation of gastypes in the air relatively low.
+
+react() is called for every active turf, and every pipenet. On each react call for reasons I don't want to go into right now, we need to iterate over every reaction and do a preliminary test. Therefor, the more datum reactions we have, the slower those two processes go.
+
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/LargeExcitedGroup.png)
+
+*Figure 6.3: The effects of a large excited group on overtime*
+
+It's hard to tell here because I took the picture right as it happen, but when large excited groups go through `self_breakdown()` they can overtime by a significant deal. This is because `self_breakdown()` can't be delayed, or done in two parts. We can't let an older gasmix that's already been collected have say 1000 mols of plasma added, then go into breakdown and delete it all. Thus, the overtime cost. This was with a excited group 900 tiles large though, so it isn't nearly ever this bad. It also scales with the amount of gases in the same way that `share()` does.
+
+On the whole excited groups are the only major source of overrun, consider this a treatise on why that 900ms cost number next to atmos isn't making the server die. It's really that excited group mass equalizing constantly.
+
+## 7. What we want atmos code to be
+
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/DiffsSettling.png)
+
+*Figure 7.1: Diffs settling out as they should, around their sources*
+
+Our goal is not to simulate real life atmospherics. It is instead to put on a show of doing so. To sleep wherever we can, and fake it as hard as possible.
+
+This is matters the most with environmental stuff, but it's everywhere you look.
+
+The goal of active turfs, excited groups, and sleeping is to isolate the processing that needs to happen, and move diffs from their source to a consumer as much as we can. We don't simulate every tile, and most of the changes to LINDA have been directed at simulating as little as we can get away with.
+
+Hell, space being cold is a hack we use to make gameplay interesting. There's a lot more stuff like this, because this isn't a simulator, it's a theater production.
+
+Performance and gameplay are much more important then realism. In all your work on the subsystem, keep this in mind, and you'll build fast and quality code.
+
+## 8. Pipelines and pipeline machinery
+
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/PipelineVisuals.png)
+
+*Figure 8.1: The structure of pipelines shown in color, components are a mix*
+
+`/datum/pipeline` handles the simulation of piping and such. It has 2 main actions, one of which you should know very well. The other is slightly more of a hurdle.
+
+To understand pipelines you'll first need to understand how we process things like pumps or vents, atmos components that is.
+To start with, a set of pipes is treated as one gas mixture, however several different components draw from this mix. Think pumps, heaters, mixers, vents, etc.
+
+Since these components change the mix itself, we can't just let them all act on the mix at once, because that would cause concerns around the order in which things process, and so on.
+We don't want canisters that blow up half the time, and the other half of the time don't. Better then to give each component its own gas mix that it alone can act on, that will be shared with the pipeline as a whole. Pipelines do something similar to active turfs by the way, they won't re-equalize their mix if nothing about the state of things has changed.
+
+We do this sharing based on the proportion of volume between all the components. So if you want a component to consume more gas, give it a higher volume.
+
+On that note, I'd like to be clear about something. In lines of connected pipes, each pipe doesn't have its own gasmix, they instead share mixes, as the pipes themselves won't have any effect on the state of the mix.
+
+Oh, and pipelines react the gas mixture inside them, thought I should mention that.
+
+All the other behavior of pipes and pipe components are handled by atmos machinery. I'll give a brief rundown of how they're classified, but the details of each machine are left as an exercise to the reader.
+
+#### Pipes
+
+The raw pipes. They have some amount of nuance, mostly around layers, but it's not too tricky to deal with.
+
+##### Heat Exchange
+
+The HE pipes, used to transfer heat from the pipe to the turf it's sitting on. These work directly with the pipeline's mix, which is ehhhh? Might need some touching up, perhaps making them subnets that do one heat transfer. Not too big a deal in any case, since they're the only thing that acts directly on a pipeline mix. They have some other behavior, like glowing when hot, but it's minor.
+
+#### Components
+
+These are the components I described above, they have some sort of internal gas mix that they act on in some manner.
+
+The following classifications are very simple, but I'll run them over anyhow
+
+##### Unary
+
+Unary devices can only interact with one pipeline, aside from some exceptions, like the heat exchanger. The type path comes from the amount of pipelines a device expects gas-mixtures from. I'm sure you can see where this is going.
+
+##### Binary
+
+Binary devices connect to 2 pipelines.
+
+##### Trinary
+
+Trinary devices connect to 3 p- Listen you get it already.
+
+##### Fusion
+
+Finally something more interesting. Unfortunately I'm not familiar with the inner workings of this machine, but this folder deals with hypertorus code.
+
+#### Other
+
+This is for the oddballs, the one offs, the half useless things. Things that are tied to the module, but that we don't have a better spot for. Think meters, stuff like that.
+
+#### Portable
+
+These are the atmos machines you can move around. They interface with connectors to talk to pipelines, and can contain tanks. Not a whole lot more to discuss here.
+
+## Appendix A - Glossary
+
+* *LINDA* - Our environmental gas system, created by Aranclanos, Beautiful in Spanish
+* *Naps* - A healthy pastime
+* *Gas mixtures* - The datums that store gas information, key to listmos and our underlying method of handling well gas
+* *Diffs* - The differences between gasmixes. We want to get rid of these over time, and clump them up with their sources so we don't need to process too many turfs
+* *FEA* - Finite Element Analysis, the underlying system our atmos is built on top of. Ugly in Spanish
+* *Pipelines* - The datum that represents and handles the gasmixtures of a set of pipes and their components
+* *Components* - Atmos machines that act on pipelines, modifying their mix
+* *Active Turfs* - An optimization of FEA implemented in LINDA that causes processing to only occur when differences are equalizing
+* *Excited Groups* - Evens out groups of active turfs to compensate for the way `share()` works
+* *Carbon dioxide* - What the fuck is this?]
+* *MC* - The master controller, makes sure all subsystems get the time they need to process, prevents lockups from one subsystem having a lot of work
+
+## Appendix B - How to test environmental atmos
+If you really want to get a feeling for how flow works you'll need to load up the game and make some diffs. What follows is a short description of how to set up testing.
+
+To start with, you should enable the `TESTING` define in compile_options.dm, this toggles `VISUALIZE_ACTIVE_TURFS` and `TRACK_MAX_SHARE`. These two debug methods are very helpful for understanding flow, but they aren't cheap, so we make them a compile time option. Active turfs will show up as green, don't worry about the second define, it's coming right up.
+
+Past that you'll want to turn on excited group highlighting, to do this open the atmos control panel in the debug tab and toggle both personal view and display all. Display all makes turfs display their group and personal view shows/hides the groups from you, it's faster to toggle this, and this way you don't piss off the other debuggers on live.
+
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/AtmosControlPanel.png)
+
+*Figure B.1: The atmospherics control panel*
+
+To go into more detail about the control panel, it is split into two parts. At the top there's a readout of some relevant stats, the amount of active turfs, how many times the subsystem has fired, etc. You can get the same information from the SSAir MC entry, but it's a bit harder to read. I detail this in the section on performance in environmental atmos. There's a button that turns the subsystem on/off in the top left, it's handy for debugging and seeing how things work step by step. Use it if you need to slow things down.
+
+The rest of the panel is where things get more interesting, it's a readout of excited groups, sorted by area name. Most of it ought to be obvious, this is where `TRACK_MAX_SHARE` comes into effect. If it's defined, excited groups will have an extra entry which displays the largest molar diff in the group. This is useful for diagnosing group breakdown issues, and getting a feel for when a group will next breakdown. You can also toggle the visibility of each individual group here, and teleport to the group by clicking on the area name.
+
+### What to look for
+
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/StartingOut.png)
+
+An excited group can contain 2 things, sources of diffs, and dead tiles.
+
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/MovingForward.png)
+
+Of course, if left unchecked active turfs will spread further and further out, slowly lowering the amount of dead tiles.
+
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/SleepWorking.png)
+
+Excited group breakdown causes them to recede and wrap around the things causing them
+
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/CleanupTroubles.png)
+
+Cleanup causes a major recession due to turfs becoming suddenly no longer having an excited group
+
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/StrangeGrowth.png)
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/OddGrowth%2BMonkey.png)
+
+Due to how process_cell() works, active turfs will spread strangely when low on diffs
+
+![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/Flickering.png)
+
+They will also occasionally nap, then immediately wake back up. This is either because of a discrepancy between `compare()` and `LAST_SHARE_CHECK`, or just the result of sleeping being a thing.
diff --git a/code/modules/atmospherics/auxgm/gas_types.dm b/code/modules/atmospherics/auxgm/gas_types.dm
deleted file mode 100644
index a5e7c8ec7a73a..0000000000000
--- a/code/modules/atmospherics/auxgm/gas_types.dm
+++ /dev/null
@@ -1,128 +0,0 @@
-/datum/gas/oxygen
- id = GAS_O2
- specific_heat = 20
- name = "Oxygen"
- oxidation_temperature = T0C - 100 // it checks max of this and fire temperature, so rarely will things spontaneously combust
-
-/datum/gas/nitrogen
- id = GAS_N2
- specific_heat = 20
- 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
- )
- )
- name = "Nitrogen"
-
-/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
- )
- )
- fusion_power = 3
- enthalpy = -393500
-
-/datum/gas/plasma
- id = GAS_PLASMA
- specific_heat = 200
- name = "Plasma"
- gas_overlay = "plasma"
- moles_visible = MOLES_GAS_VISIBLE
- flags = GAS_FLAG_DANGEROUS
- // no fire info cause it has its own bespoke reaction for trit generation reasons
- enthalpy = FIRE_PLASMA_ENERGY_RELEASED // 3000000, 3 megajoules, 3000 kj
-
-/datum/gas/water_vapor
- id = GAS_H2O
- specific_heat = 40
- name = "Water Vapor"
- gas_overlay = "water_vapor"
- moles_visible = MOLES_GAS_VISIBLE
- fusion_power = 8
- breath_reagent = /datum/reagent/water
- enthalpy = -241800 // FIRE_HYDROGEN_ENERGY_RELEASED is actually what this was supposed to be
-
-/datum/gas/hypernoblium
- id = GAS_HYPERNOB
- specific_heat = 2000
- name = "Hyper-noblium"
- gas_overlay = "freon"
- moles_visible = MOLES_GAS_VISIBLE
-
-/datum/gas/nitrous_oxide
- id = GAS_NITROUS
- specific_heat = 40
- name = "Nitrous Oxide"
- gas_overlay = "nitrous_oxide"
- moles_visible = MOLES_GAS_VISIBLE * 2
- flags = GAS_FLAG_DANGEROUS
- fire_products = list(GAS_N2 = 1)
- oxidation_rate = 0.5
- oxidation_temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST + 100
- enthalpy = 81600
-
-/datum/gas/nitryl
- id = GAS_NITRYL
- specific_heat = 20
- name = "Nitryl"
- gas_overlay = "nitryl"
- moles_visible = MOLES_GAS_VISIBLE
- flags = GAS_FLAG_DANGEROUS
- fusion_power = 15
- fire_products = list(GAS_N2 = 0.5)
- oxidation_temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST - 50
- enthalpy = 33200
-
-/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
- /*
- these are for when we add hydrogen, trit gets to keep its hardcoded fire for legacy reasons
- fire_provides = list(GAS_H2O = 2)
- fire_burn_rate = 2
- enthalpy = FIRE_HYDROGEN_ENERGY_RELEASED
- fire_temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST - 50
- */
-
-/datum/gas/bz
- id = GAS_BZ
- specific_heat = 20
- name = "BZ"
- flags = GAS_FLAG_DANGEROUS
- fusion_power = 8
- enthalpy = FIRE_CARBON_ENERGY_RELEASED // it is a mystery
-
-/datum/gas/stimulum
- id = GAS_STIMULUM
- specific_heat = 5
- name = "Stimulum"
- fusion_power = 7
-
-/datum/gas/pluoxium
- id = GAS_PLUOXIUM
- specific_heat = 80
- name = "Pluoxium"
- fusion_power = 10
- oxidation_temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST * 1000 // it is VERY stable
- oxidation_rate = 8
- enthalpy = -50000 // but it reduces the heat output a bit
diff --git a/code/modules/atmospherics/environmental/LINDA_fire.dm b/code/modules/atmospherics/environmental/LINDA_fire.dm
index 476f6a1fb717e..1ec6048e79f12 100644
--- a/code/modules/atmospherics/environmental/LINDA_fire.dm
+++ b/code/modules/atmospherics/environmental/LINDA_fire.dm
@@ -8,25 +8,40 @@
/turf/proc/hotspot_expose(exposed_temperature, exposed_volume, soh = 0)
return
+
/turf/open/hotspot_expose(exposed_temperature, exposed_volume, soh)
- if(!air)
+ //If the air doesn't exist we just return false
+ var/list/air_gases = air?.gases
+ if(!air_gases)
return
- if (air.get_oxidation_power(exposed_temperature) < 0.5)
+ . = air_gases[/datum/gas/oxygen]
+ var/oxy = . ? .[MOLES] : 0
+ if (oxy < 0.5)
return
- var/has_fuel = air.get_moles(GAS_PLASMA) > 0.5 || air.get_moles(GAS_TRITIUM) > 0.5 || air.get_fuel_amount(exposed_temperature) > 0.5
+ . = air_gases[/datum/gas/plasma]
+ var/tox = . ? .[MOLES] : 0
+ . = air_gases[/datum/gas/tritium]
+ var/trit = . ? .[MOLES] : 0
+ . = air_gases[/datum/gas/hydrogen]
+ var/h2 = . ? .[MOLES] : 0
if(active_hotspot)
if(soh)
- if(has_fuel)
+ if(tox > 0.5 || trit > 0.5 || h2 > 0.5)
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) && has_fuel)
+ if((exposed_temperature > PLASMA_MINIMUM_BURN_TEMPERATURE) && (tox > 0.5 || trit > 0.5 || h2 > 0.5))
+
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)
+
//This is the icon for fire on turfs, also helps for nurturing small fires until they are full tile
/obj/effect/hotspot
anchored = TRUE
@@ -37,15 +52,14 @@
blend_mode = BLEND_ADD
light_system = MOVABLE_LIGHT
light_range = LIGHT_RANGE_FIRE
- // increase power for more bloom
- light_power = 4
+ light_power = 1
light_color = LIGHT_COLOR_FIRE
var/volume = 125
var/temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST
+ var/just_spawned = TRUE
var/bypassing = FALSE
var/visual_update_tick = 0
- var/first_cycle = TRUE
/obj/effect/hotspot/Initialize(mapload, starting_volume, starting_temperature)
@@ -57,11 +71,7 @@
temperature = starting_temperature
perform_exposure()
setDir(pick(GLOB.cardinals))
- air_update_turf()
- var/static/list/loc_connections = list(
- COMSIG_ATOM_ENTERED = PROC_REF(on_entered),
- )
- AddElement(/datum/element/connect_loc, loc_connections)
+ air_update_turf(FALSE, FALSE)
/obj/effect/hotspot/proc/perform_exposure()
var/turf/open/location = loc
@@ -70,25 +80,23 @@
location.active_hotspot = src
- bypassing = !first_cycle && volume > CELL_VOLUME*0.95 || location.air.return_temperature() > FUSION_TEMPERATURE_THRESHOLD
- if(first_cycle)
- first_cycle = FALSE
+ bypassing = !just_spawned && (volume > CELL_VOLUME*0.95)
if(bypassing)
volume = location.air.reaction_results["fire"]*FIRE_GROWTH_RATE
- temperature = location.air.return_temperature()
+ temperature = location.air.temperature
else
- var/datum/gas_mixture/affected = location.air.remove_ratio(volume/location.air.return_volume())
+ var/datum/gas_mixture/affected = location.air.remove_ratio(volume/location.air.volume)
if(affected) //in case volume is 0
- affected.set_temperature(temperature)
+ affected.temperature = temperature
affected.react(src)
- temperature = affected.return_temperature()
+ temperature = affected.temperature
volume = affected.reaction_results["fire"]*FIRE_GROWTH_RATE
location.assume_air(affected)
for(var/A in location)
var/atom/AT = A
- if(!QDELETED(AT) && AT != src) // It's possible that the item is deleted in temperature_expose
+ if(!QDELETED(AT) && AT != src)
AT.fire_act(temperature, volume)
return
@@ -113,29 +121,25 @@
heat_b = LERP(heat_b,255,normal_amt)
heat_a -= gauss_lerp(temperature, -5000, 5000) * 128
greyscale_fire -= normal_amt
- light_power = 4
if(temperature > 40000) //Past this temperature the fire will gradually turn a bright purple
var/purple_amt = temperature < LERP(40000,200000,0.5) ? gauss_lerp(temperature, 40000, 200000) : 1
heat_r = LERP(heat_r,255,purple_amt)
- light_power = 5
if(temperature > 200000 && temperature < 500000) //Somewhere at this temperature nitryl happens.
var/sparkle_amt = gauss_lerp(temperature, 200000, 500000)
var/mutable_appearance/sparkle_overlay = mutable_appearance('icons/effects/effects.dmi', "shieldsparkles")
sparkle_overlay.blend_mode = BLEND_ADD
sparkle_overlay.alpha = sparkle_amt * 255
- light_power = 6
add_overlay(sparkle_overlay)
if(temperature > 400000 && temperature < 1500000) //Lightning because very anime.
var/mutable_appearance/lightning_overlay = mutable_appearance(icon, "overcharged")
lightning_overlay.blend_mode = BLEND_ADD
- light_power = 6
add_overlay(lightning_overlay)
if(temperature > 4500000) //This is where noblium happens. Some fusion-y effects.
var/fusion_amt = temperature < LERP(4500000,12000000,0.5) ? gauss_lerp(temperature, 4500000, 12000000) : 1
var/mutable_appearance/fusion_overlay = mutable_appearance('icons/effects/atmospherics.dmi', "fusion_gas")
fusion_overlay.blend_mode = BLEND_ADD
fusion_overlay.alpha = fusion_amt * 255
- var/mutable_appearance/rainbow_overlay = mutable_appearance('icons/mob/screen_gen.dmi', "druggy")
+ var/mutable_appearance/rainbow_overlay = mutable_appearance('icons/hud/screen_gen.dmi', "druggy")
rainbow_overlay.blend_mode = BLEND_ADD
rainbow_overlay.alpha = fusion_amt * 255
rainbow_overlay.appearance_flags = RESET_COLOR
@@ -144,7 +148,6 @@
heat_b = LERP(heat_b,150,fusion_amt)
add_overlay(fusion_overlay)
add_overlay(rainbow_overlay)
- light_power = 8
set_light_color(rgb(LERP(250, heat_r, greyscale_fire), LERP(160, heat_g, greyscale_fire), LERP(25, heat_b, greyscale_fire)))
@@ -155,19 +158,26 @@
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(path) (!location.air.gases[path] || location.air.gases[path][MOLES] < 0.5)
/obj/effect/hotspot/process()
+ if(just_spawned)
+ just_spawned = FALSE
+ return
+
var/turf/open/location = loc
if(!istype(location))
qdel(src)
return
- location.eg_reset_cooldowns()
+ if(location.excited_group)
+ location.excited_group.reset_cooldowns()
if((temperature < FIRE_MINIMUM_TEMPERATURE_TO_EXIST) || (volume <= 1))
qdel(src)
return
- if(!location.air || location.air.get_oxidation_power() < 0.5 || (INSUFFICIENT(GAS_PLASMA) && INSUFFICIENT(GAS_TRITIUM) && location.air.get_fuel_amount() < 0.5))
+
+ //Not enough / nothing to burn
+ if(!location.air || (INSUFFICIENT(/datum/gas/plasma) && INSUFFICIENT(/datum/gas/tritium) && INSUFFICIENT(/datum/gas/hydrogen)) || INSUFFICIENT(/datum/gas/oxygen))
qdel(src)
return
@@ -178,8 +188,8 @@
location.burn_tile()
//Possible spread due to radiated heat
- if(location.air.return_temperature() > FIRE_MINIMUM_TEMPERATURE_TO_SPREAD)
- var/radiated_temperature = location.air.return_temperature()*FIRE_SPREAD_RADIOSITY_SCALE
+ if(location.air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_SPREAD)
+ var/radiated_temperature = location.air.temperature*FIRE_SPREAD_RADIOSITY_SCALE
for(var/t in location.atmos_adjacent_turfs)
var/turf/open/T = t
if(!T.active_hotspot)
@@ -194,11 +204,6 @@
if((visual_update_tick++ % 7) == 0)
update_color()
- if(temperature > location.max_fire_temperature_sustained)
- location.max_fire_temperature_sustained = temperature
-
- if(location.heat_capacity && temperature > location.heat_capacity)
- location.to_be_destroyed = TRUE
return TRUE
/obj/effect/hotspot/Destroy()
@@ -206,30 +211,13 @@
var/turf/open/T = loc
if(istype(T) && T.active_hotspot == src)
T.active_hotspot = null
- DestroyTurf()
return ..()
-/obj/effect/hotspot/proc/DestroyTurf()
- if(isturf(loc))
- var/turf/T = loc
- if(T.to_be_destroyed && !T.changing_turf)
- var/chance_of_deletion
- if (T.heat_capacity) //beware of division by zero
- chance_of_deletion = T.max_fire_temperature_sustained / T.heat_capacity * 8 //there is no problem with prob(23456), min() was redundant --rastaf0
- else
- chance_of_deletion = 100
- if(prob(chance_of_deletion))
- T.Melt()
- else
- T.to_be_destroyed = FALSE
- T.max_fire_temperature_sustained = 0
-
-/obj/effect/hotspot/proc/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs)
- SIGNAL_HANDLER
-
- if(isliving(arrived))
- var/mob/living/immolated = arrived
- immolated.fire_act(temperature, volume)
+/obj/effect/hotspot/Crossed(atom/movable/AM, oldLoc)
+ ..()
+ if(isliving(AM))
+ var/mob/living/L = AM
+ L.fire_act(temperature, volume)
/obj/effect/hotspot/singularity_pull()
return
diff --git a/code/modules/atmospherics/environmental/LINDA_system.dm b/code/modules/atmospherics/environmental/LINDA_system.dm
index 15075fe32063e..378dd21b9e362 100644
--- a/code/modules/atmospherics/environmental/LINDA_system.dm
+++ b/code/modules/atmospherics/environmental/LINDA_system.dm
@@ -16,99 +16,54 @@
/turf/open/CanAtmosPass = ATMOS_PASS_PROC
/turf/open/CanAtmosPassVertical = ATMOS_PASS_PROC
+//Do NOT use this to see if 2 turfs are connected, it mutates state, and we cache that info anyhow. Use TURFS_CAN_SHARE or TURF_SHARES depending on your usecase
/turf/open/CanAtmosPass(turf/T, vertical = FALSE)
- var/dir = vertical ? get_dir_multiz(src, T) : get_dir(src, T)
+ var/dir = vertical? get_dir_multiz(src, T) : get_dir(src, T)
var/opp = REVERSE_DIR(dir)
- . = TRUE
+ var/R = FALSE
if(vertical && !(zAirOut(dir, T) && T.zAirIn(dir, src)))
- . = FALSE
- if(isclosedturf(src) || isclosedturf(T))
- . = FALSE
+ R = TRUE
+ if(blocks_air || T.blocks_air)
+ R = TRUE
if (T == src)
- return .
+ return !R
for(var/obj/O in contents+T.contents)
var/turf/other = (O.loc == src ? T : src)
if(!(vertical? (CANVERTICALATMOSPASS(O, other)) : (CANATMOSPASS(O, other))))
- . = FALSE
- if(O.BlockThermalConductivity()) //the direction and open/closed are already checked on CanAtmosPass() so there are no arguments
- conductivity_blocked_directions |= dir
- T.conductivity_blocked_directions |= opp
- if(!.)
- return .
-
-/atom/movable/proc/BlockThermalConductivity() // Objects that don't let heat through.
+ 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
+
+ atmos_supeconductivity &= ~dir
+ T.atmos_supeconductivity &= ~opp
+
+ return !R
+
+/atom/movable/proc/BlockSuperconductivity() // objects that block air and don't let superconductivity act. Only firelocks atm.
return FALSE
/turf/proc/ImmediateCalculateAdjacentTurfs()
- if(SSair.thread_running())
- CALCULATE_ADJACENT_TURFS(src)
- return
- LAZYINITLIST(src.atmos_adjacent_turfs)
- var/is_closed = isclosedturf(src)
- var/list/atmos_adjacent_turfs = src.atmos_adjacent_turfs
var/canpass = CANATMOSPASS(src, src)
var/canvpass = CANVERTICALATMOSPASS(src, src)
- // I am essentially inlineing two get_dir_multizs here, because they're way too slow on their own. I'm sorry brother
- var/list/z_traits = SSmapping.multiz_levels[z]
for(var/direction in GLOB.cardinals_multiz)
- // Yes this is a reimplementation of get_step_mutliz. It's faster tho. fuck you
- var/turf/current_turf = (direction & (UP|DOWN)) ? \
- (direction & UP) ? \
- (z_traits[Z_LEVEL_UP]) ? \
- (get_step(locate(x, y, z + 1), NONE)) : \
- (null) : \
- (z_traits[Z_LEVEL_DOWN]) ? \
- (get_step(locate(x, y, z - 1), NONE)) : \
- (null) : \
- (get_step(src, direction))
- if(!isopenturf(current_turf))
+ var/turf/T = get_step_multiz(src, direction)
+ if(!isopenturf(T))
continue
- if(!is_closed && ((direction & (UP|DOWN)) ? (canvpass && CANVERTICALATMOSPASS(current_turf, src)) : (canpass && CANATMOSPASS(current_turf, src))))
- LAZYINITLIST(current_turf.atmos_adjacent_turfs)
- atmos_adjacent_turfs[current_turf] = TRUE
- current_turf.atmos_adjacent_turfs[src] = TRUE
+ if(!(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] = TRUE
+ T.atmos_adjacent_turfs[src] = TRUE
else
- atmos_adjacent_turfs -= current_turf
- if (current_turf.atmos_adjacent_turfs)
- current_turf.atmos_adjacent_turfs -= src
- UNSETEMPTY(current_turf.atmos_adjacent_turfs)
- current_turf.set_sleeping(isclosedturf(current_turf))
- current_turf.__update_auxtools_turf_adjacency_info()
+ if (atmos_adjacent_turfs)
+ atmos_adjacent_turfs -= T
+ if (T.atmos_adjacent_turfs)
+ T.atmos_adjacent_turfs -= src
+ UNSETEMPTY(T.atmos_adjacent_turfs)
UNSETEMPTY(atmos_adjacent_turfs)
src.atmos_adjacent_turfs = atmos_adjacent_turfs
- set_sleeping(is_closed)
- __update_auxtools_turf_adjacency_info()
-
-/turf/proc/ImmediateDisableAdjacency(disable_adjacent = TRUE)
- if(SSair.thread_running())
- SSadjacent_air.disable_queue[src] = disable_adjacent
- return
- if(disable_adjacent)
- // I am essentially inlineing two get_dir_multizs here, because they're way too slow on their own. I'm sorry brother
- var/list/z_traits = SSmapping.multiz_levels[z]
- for(var/direction in GLOB.cardinals_multiz)
- // Yes this is a reimplementation of get_step_mutliz. It's faster tho.
- var/turf/current_turf = (direction & (UP|DOWN)) ? \
- (direction & UP) ? \
- (z_traits[Z_LEVEL_UP]) ? \
- (get_step(locate(x, y, z + 1), NONE)) : \
- (null) : \
- (z_traits[Z_LEVEL_DOWN]) ? \
- (get_step(locate(x, y, z - 1), NONE)) : \
- (null) : \
- (get_step(src, direction))
- if(!istype(current_turf))
- continue
- if (current_turf.atmos_adjacent_turfs)
- current_turf.atmos_adjacent_turfs -= src
- UNSETEMPTY(current_turf.atmos_adjacent_turfs)
- current_turf.__update_auxtools_turf_adjacency_info()
- LAZYCLEARLIST(atmos_adjacent_turfs)
- __update_auxtools_turf_adjacency_info()
-
-/turf/proc/set_sleeping(should_sleep)
-
-/turf/proc/__update_auxtools_turf_adjacency_info()
//returns a list of adjacent turfs that can share air with this one.
//alldir includes adjacent diagonal tiles that can share
@@ -145,28 +100,31 @@
return adjacent_turfs
-/**
- * For the love of all that is holy, DO NOT SET `command` TO TRUE ON HOTCODE. This will cause atmos to freeze up for considerable amounts at a time.
- * In fact- please just refrain from using this if you're not changing how atmos flows turf to turf
- */
-/atom/proc/air_update_turf(command = 0)
- if(!SSair.initialized) // I'm sorry for polutting user code, I'll do 10 hail giacom's
- return
- if(!isturf(loc) && command)
- return
+/atom/proc/air_update_turf(update = FALSE, remove = FALSE)
var/turf/T = get_turf(loc)
- T.air_update_turf(command)
+ T.air_update_turf(update, remove)
-/turf/air_update_turf(command = 0)
- if(!SSair.initialized) // I'm sorry for polutting user code, I'll do 10 hail giacom's
- return
- if(command)
+/**
+ * A helper proc for dealing with atmos changes
+ *
+ * Ok so this thing is pretty much used as a catch all for all the situations someone might wanna change something
+ * About a turfs atmos. It's real clunky, and someone needs to clean it up, but not today.
+ * Arguments:
+ * * update - Has the state of the structures in the world changed? If so, update our adjacent atmos turf list, if not, don't.
+ * * remove - Are you removing an active turf (Read wall), or adding one
+*/
+/turf/air_update_turf(update = FALSE, remove = FALSE)
+ if(update)
ImmediateCalculateAdjacentTurfs()
+ if(remove)
+ SSair.remove_from_active(src)
+ else
+ SSair.add_to_active(src)
/atom/movable/proc/move_update_air(turf/T)
- if(isturf(T))
- T.air_update_turf(1)
- air_update_turf(1)
+ if(isturf(T))
+ T.air_update_turf(TRUE, FALSE) //You're empty now
+ air_update_turf(TRUE, TRUE) //You aren't
/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)
@@ -180,4 +138,7 @@
var/datum/gas_mixture/G = new
G.parse_gas_string(text)
- assume_air(G)
+
+ air.merge(G)
+ archive()
+ SSair.add_to_active(src)
diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
index 5af7263477686..e626be4a721a6 100644
--- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
+++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
@@ -1,12 +1,17 @@
/turf
- //conductivity is divided by 10 when interacting with air for balance purposes
+ //used for temperature calculations
var/thermal_conductivity = 0.05
- var/heat_capacity = 1
+ var/heat_capacity = INFINITY //This should be opt in rather then opt out
+ var/temperature_archived
- //list of open turfs adjacent to us
+ ///list of turfs adjacent to us that air can flow onto
var/list/atmos_adjacent_turfs
- //bitfield of dirs in which we thermal conductivity is blocked
- var/conductivity_blocked_directions = NONE
+ ///bitfield of dirs in which we are superconducitng
+ var/atmos_supeconductivity = NONE
+
+ //used to determine whether we should archive
+ var/archived_cycle = 0
+ var/current_cycle = 0
//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
@@ -18,89 +23,46 @@
//used for spacewind
var/pressure_difference = 0
var/pressure_direction = 0
- var/turf/pressure_specific_target
+ var/datum/excited_group/excited_group
+ var/excited = FALSE
var/datum/gas_mixture/turf/air
var/obj/effect/hotspot/active_hotspot
- var/planetary_atmos = FALSE //air will revert to initial_gas_mix over time
+ var/planetary_atmos = FALSE //air will revert to initial_gas_mix
var/list/atmos_overlay_types //gas IDs of current active gas overlays
-
-/turf/open/Initialize(mapload)
- if (planetary_atmos && Debugger?.enabled)
- var/static/list/planet_atmos_types = list()
- if(planet_atmos_types[type])
- air = planet_atmos_types[type]
- else
- air = new(2500,src)
- air.copy_from_turf(src)
- update_air_ref(1)
- planet_atmos_types[type] = air
- else
- air = new(2500,src)
+ var/significant_share_ticker = 0
+ #ifdef TRACK_MAX_SHARE
+ var/max_share = 0
+ #endif
+
+/turf/open/Initialize()
+ if(!blocks_air)
+ air = new
air.copy_from_turf(src)
- update_air_ref(planetary_atmos ? 1 : 2)
+ if(planetary_atmos)
+ if(!SSair.planetary[initial_gas_mix])
+ var/datum/gas_mixture/immutable/planetary/mix = new
+ mix.parse_string_immutable(initial_gas_mix)
+ SSair.planetary[initial_gas_mix] = mix
. = ..()
/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
- if(SSair.thread_running())
- var giver_moles = giver.total_moles()
- if(giver_moles > 0)
- SSair.deferred_airs += list(list(giver, air, moles / giver_moles))
- else
- SSair.deferred_airs += list(list(giver, air, 0))
- else
- giver.transfer_to(air, moles)
- update_visuals()
- return TRUE
-
-/turf/open/assume_air_ratio(datum/gas_mixture/giver, ratio)
- if(!giver)
- return FALSE
- if(SSair.thread_running())
- SSair.deferred_airs += list(list(giver, air, ratio))
- else
- giver.transfer_ratio_to(air, ratio)
- update_visuals()
- return TRUE
-
-/turf/open/transfer_air(datum/gas_mixture/taker, moles)
- if(!taker || !return_air()) // shouldn't transfer from space
- return FALSE
- if(SSair.thread_running())
- var air_moles = air.total_moles()
- if(air_moles > 0)
- SSair.deferred_airs += list(list(air, taker, moles / air_moles))
- else
- SSair.deferred_airs += list(list(air, taker, 0))
- else
- air.transfer_to(taker, moles)
- update_visuals()
- return TRUE
-
-/turf/open/transfer_air_ratio(datum/gas_mixture/taker, ratio)
- if(!taker || !return_air())
- return FALSE
- if(SSair.thread_running())
- SSair.deferred_airs += list(list(air, taker, ratio))
- else
- air.transfer_ratio_to(taker, ratio)
- update_visuals()
+ air.merge(giver)
+ update_visuals()
return TRUE
/turf/open/remove_air(amount)
@@ -109,12 +71,6 @@
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)
- update_visuals()
- return removed
-
/turf/open/proc/copy_air_with_tile(turf/open/T)
if(istype(T))
air.copy_from(T.air)
@@ -136,15 +92,48 @@
/turf/open/return_analyzable_air()
return return_air()
-/turf/temperature_expose()
- if(return_temperature() > heat_capacity)
+/turf/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return (exposed_temperature >= heat_capacity || to_be_destroyed)
+
+/turf/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ if(exposed_temperature >= heat_capacity)
to_be_destroyed = TRUE
+ if(to_be_destroyed && exposed_temperature >= max_fire_temperature_sustained)
+ max_fire_temperature_sustained = min(exposed_temperature, max_fire_temperature_sustained + heat_capacity / 4) //Ramp up to 100% yeah?
+ if(to_be_destroyed && !changing_turf)
+ burn()
+
+/turf/proc/burn()
+ burn_tile()
+ var/chance_of_deletion
+ if (heat_capacity) //beware of division by zero
+ chance_of_deletion = max_fire_temperature_sustained / heat_capacity * 8 //there is no problem with prob(23456), min() was redundant --rastaf0
+ else
+ chance_of_deletion = 100
+ if(prob(chance_of_deletion))
+ Melt()
+ max_fire_temperature_sustained = 0
+ else
+ to_be_destroyed = FALSE
+
+/turf/open/burn()
+ if(!active_hotspot) //Might not even be needed since excited groups are no longer cringe
+ ..()
+
+/turf/temperature_expose(datum/gas_mixture/air, exposed_temperature)
+ atmos_expose(air, exposed_temperature)
+/turf/open/temperature_expose(datum/gas_mixture/air, exposed_temperature)
+ SEND_SIGNAL(src, COMSIG_TURF_EXPOSE, air, exposed_temperature)
+ check_atmos_process(null, air, exposed_temperature) //Manually do this to avoid needing to use elements, don't want 200 second atom init times
-/turf/open/proc/eg_reset_cooldowns()
-/turf/open/proc/eg_garbage_collect()
-/turf/open/proc/get_excited()
-/turf/open/proc/set_excited()
+/turf/proc/archive()
+ temperature_archived = temperature
+
+/turf/open/archive()
+ air.archive()
+ archived_cycle = SSair.times_fired
+ temperature_archived = temperature
/////////////////////////GAS OVERLAYS//////////////////////////////
@@ -162,13 +151,16 @@
src.atmos_overlay_types = null
return
+ var/list/gases = air.gases
- for(var/id in air.get_gases())
+ for(var/id in gases)
if (nonoverlaying_gases[id])
continue
- 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))]
+ var/gas = gases[id]
+ var/gas_meta = gas[GAS_META]
+ var/gas_overlay = gas_meta[META_GAS_OVERLAY]
+ if(gas_overlay && gas[MOLES] > gas_meta[META_GAS_MOLES_VISIBLE])
+ new_overlay_types += gas_overlay[min(TOTAL_VISIBLE_STATES, CEILING(gas[MOLES] / MOLES_GAS_VISIBLE_STEP, 1))]
if (atmos_overlay_types)
for(var/overlay in atmos_overlay_types-new_overlay_types) //doesn't remove overlays that would only be added
@@ -183,67 +175,202 @@
UNSETEMPTY(new_overlay_types)
src.atmos_overlay_types = new_overlay_types
-/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
- vis_contents -= overlay
-
- if (length(new_overlay_types))
- if (atmos_overlay_types)
- vis_contents += new_overlay_types - atmos_overlay_types //don't add overlays that already exist
- else
- vis_contents += new_overlay_types
- UNSETEMPTY(new_overlay_types)
- src.atmos_overlay_types = new_overlay_types
-
/proc/typecache_of_gases_with_no_overlays()
. = list()
for (var/gastype in subtypesof(/datum/gas))
var/datum/gas/gasvar = gastype
if (!initial(gasvar.gas_overlay))
- .[initial(gasvar.id)] = TRUE
+ .[gastype] = TRUE
/////////////////////////////SIMULATION///////////////////////////////////
+#ifdef TRACK_MAX_SHARE
+#define LAST_SHARE_CHECK \
+ var/last_share = our_air.last_share;\
+ max_share = max(last_share, max_share);\
+ if(last_share > MINIMUM_AIR_TO_SUSPEND){\
+ our_excited_group.reset_cooldowns();\
+ cached_ticker = 0;\
+ enemy_tile.significant_share_ticker = 0;\
+ } else if(last_share > MINIMUM_MOLES_DELTA_TO_MOVE) {\
+ our_excited_group.dismantle_cooldown = 0;\
+ cached_ticker = 0;\
+ enemy_tile.significant_share_ticker = 0;\
+ }
+#else
+#define LAST_SHARE_CHECK \
+ var/last_share = our_air.last_share;\
+ if(last_share > MINIMUM_AIR_TO_SUSPEND){\
+ our_excited_group.reset_cooldowns();\
+ cached_ticker = 0;\
+ enemy_tile.significant_share_ticker = 0;\
+ } else if(last_share > MINIMUM_MOLES_DELTA_TO_MOVE) {\
+ our_excited_group.dismantle_cooldown = 0;\
+ cached_ticker = 0;\
+ enemy_tile.significant_share_ticker = 0;\
+ }
+#endif
+#ifdef TRACK_MAX_SHARE
+#define PLANET_SHARE_CHECK \
+ var/last_share = our_air.last_share;\
+ max_share = max(last_share, max_share);\
+ if(last_share > MINIMUM_AIR_TO_SUSPEND){\
+ our_excited_group.reset_cooldowns();\
+ cached_ticker = 0;\
+ } else if(last_share > MINIMUM_MOLES_DELTA_TO_MOVE) {\
+ our_excited_group.dismantle_cooldown = 0;\
+ cached_ticker = 0;\
+ }
+#else
+#define PLANET_SHARE_CHECK \
+ var/last_share = our_air.last_share;\
+ if(last_share > MINIMUM_AIR_TO_SUSPEND){\
+ our_excited_group.reset_cooldowns();\
+ cached_ticker = 0;\
+ } else if(last_share > MINIMUM_MOLES_DELTA_TO_MOVE) {\
+ our_excited_group.dismantle_cooldown = 0;\
+ cached_ticker = 0;\
+ }
+#endif
/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)
+/turf/open/process_cell(fire_count)
+ if(archived_cycle < fire_count) //archive self if not already done
+ archive()
+
+ current_cycle = fire_count
+ var/cached_ticker = significant_share_ticker
+ cached_ticker += 1
+
+ //cache for sanic speed
+ var/list/adjacent_turfs = atmos_adjacent_turfs
+ var/datum/excited_group/our_excited_group = excited_group
+ var/adjacent_turfs_length = LAZYLEN(adjacent_turfs)
+
+ var/datum/gas_mixture/our_air = air
+
+ #ifdef TRACK_MAX_SHARE
+ max_share = 0 //Gotta reset our tracker
+ #endif
+
+ for(var/t in adjacent_turfs)
+ var/turf/open/enemy_tile = t
+
+ if(fire_count <= enemy_tile.current_cycle)
continue
- FD.emergency_pressure_stop()
- reconsider_adj = TRUE
- if(reconsider_adj)
- T2.ImmediateCalculateAdjacentTurfs() // We want those firelocks closed yesterday.
+ enemy_tile.archive()
+
+ /******************* GROUP HANDLING START *****************************************************************/
+
+ var/should_share_air = FALSE
+ var/datum/gas_mixture/enemy_air = enemy_tile.air
+
+ //cache for sanic speed
+ var/datum/excited_group/enemy_excited_group = enemy_tile.excited_group
+ //If we are both in an excited group, and they aren't the same, merge.
+ //If we are both in an excited group, and you're active, share
+ //If we pass compare, and if we're not already both in a group, lets join up
+ //If we both pass compare, add to active and share
+ if(our_excited_group && enemy_excited_group)
+ if(our_excited_group != enemy_excited_group)
+ //combine groups (this also handles updating the excited_group var of all involved turfs)
+ our_excited_group.merge_groups(enemy_excited_group)
+ our_excited_group = excited_group //update our cache
+ if(our_excited_group && enemy_excited_group && enemy_tile.excited) //If you're both excited, no need to compare right?
+ should_share_air = TRUE
+ else if(our_air.compare(enemy_air)) //Lets see if you're up for it
+ SSair.add_to_active(enemy_tile) //Add yourself young man
+ var/datum/excited_group/EG = our_excited_group || enemy_excited_group || new
+ if(!our_excited_group)
+ EG.add_turf(src)
+ if(!enemy_excited_group)
+ EG.add_turf(enemy_tile)
+ our_excited_group = excited_group
+ should_share_air = TRUE
+
+ //air sharing
+ if(should_share_air)
+ var/difference = our_air.share(enemy_air, adjacent_turfs_length)
+ if(difference)
+ if(difference > 0)
+ consider_pressure_difference(enemy_tile, difference)
+ else
+ enemy_tile.consider_pressure_difference(src, -difference)
+ //This acts effectivly as a very slow timer, the max deltas of the group will slowly lower until it breaksdown, they then pop up a bit, and fall back down until irrelevant
+ LAST_SHARE_CHECK
+
+
+ /******************* GROUP HANDLING FINISH *********************************************************************/
+
+ if (planetary_atmos) //share our air with the "atmosphere" "above" the turf
+ var/datum/gas_mixture/G = SSair.planetary[initial_gas_mix]
+ // archive ourself again so we don't accidentally share more gas than we currently have
+ archive()
+ if(our_air.compare(G))
+ if(!our_excited_group)
+ var/datum/excited_group/EG = new
+ EG.add_turf(src)
+ our_excited_group = excited_group
+ // shares 4/5 of our difference in moles with the atmosphere
+ our_air.share(G, 0.25)
+ // temperature share with the atmosphere with an inflated heat capacity to simulate faster sharing with a large atmosphere
+ our_air.temperature_share(G, OPEN_HEAT_TRANSFER_COEFFICIENT, G.temperature_archived, G.heat_capacity() * 5)
+ G.garbage_collect()
+ PLANET_SHARE_CHECK
+
+ our_air.react(src)
-/turf/proc/handle_decompression_floor_rip()
-/turf/open/floor/handle_decompression_floor_rip(sum)
- if(sum > 20 && prob(clamp(sum / 20, 0, 15)))
- if(floor_tile)
- new floor_tile(src)
- make_plating()
+ update_visuals()
+ if(!consider_superconductivity(starting = TRUE) && !active_hotspot) //Might need to include the return of react() here
+ if(!our_excited_group) //If nothing of interest is happening, kill the active turf
+ SSair.remove_from_active(src) //This will kill any connected excited group, be careful (This broke atmos for 4 years)
+ if(cached_ticker > EXCITED_GROUP_DISMANTLE_CYCLES) //If you're stalling out, take a rest
+ SSair.sleep_active_turf(src)
-/turf/open/floor/plating/handle_decompression_floor_rip()
- return
+ significant_share_ticker = cached_ticker //Save our changes
+ temperature_expose(our_air, our_air.temperature)
-/turf/open/floor/engine/handle_decompression_floor_rip()
- return
+////////////////////Excited Group Cleanup///////////////////////
-/turf/open/process_cell(fire_count)
+///For dealing with reforming excited groups, this prevents clog in process_cell
+/turf/open/proc/cleanup_group(fire_count, breakdown, dismantle)
+ current_cycle = fire_count + 0.5 //It works, I know it's dumb but it works
-//////////////////////////SPACEWIND/////////////////////////////
+ //cache for sanic speed
+ var/list/adjacent_turfs = atmos_adjacent_turfs
+ var/datum/excited_group/our_excited_group = excited_group
-/turf/proc/consider_pressure_difference()
- return
+ for(var/t in adjacent_turfs)
+ var/turf/open/enemy_tile = t
-/turf/open/consider_pressure_difference(turf/T, difference)
+ if(current_cycle <= enemy_tile.current_cycle)
+ continue
+
+ //cache for sanic speed
+ var/datum/excited_group/enemy_excited_group = enemy_tile.excited_group
+ //If we are both in an excited group, and they aren't the same, merge.
+ //Otherwise make/take one to join and get to it
+ if(our_excited_group && enemy_excited_group)
+ if(our_excited_group != enemy_excited_group)
+ //combine groups (this also handles updating the excited_group var of all involved turfs)
+ our_excited_group.merge_groups(enemy_excited_group)
+ our_excited_group = excited_group //update our cache
+ else
+ var/datum/excited_group/EG = our_excited_group || enemy_excited_group || new
+ if(!our_excited_group)
+ EG.add_turf(src)
+ if(!enemy_excited_group && enemy_tile.flags_1 & EXCITED_CLEANUP_1)
+ EG.add_turf(enemy_tile)
+ our_excited_group = excited_group
+ if(our_excited_group)
+ our_excited_group.breakdown_cooldown = breakdown //Update with the old data
+ our_excited_group.dismantle_cooldown = dismantle
+ flags_1 &= ~EXCITED_CLEANUP_1
+
+//////////////////////////SPACEWIND/////////////////////////////
+
+/turf/open/proc/consider_pressure_difference(turf/T, difference)
SSair.high_pressure_delta |= src
if(difference > pressure_difference)
pressure_direction = get_dir(src, T)
@@ -251,40 +378,306 @@
/turf/open/proc/high_pressure_movements()
var/atom/movable/M
- var/multiplier = 1
- if(locate(/obj/structure/rack) in src)
- multiplier *= 0.1
- else if(locate(/obj/structure/table) in src)
- multiplier *= 0.2
for(var/thing in src)
M = thing
if (!M.anchored && !M.pulledby && M.last_high_pressure_movement_air_cycle < SSair.times_fired)
- M.experience_pressure_difference(pressure_difference * multiplier, pressure_direction, 0, pressure_specific_target)
+ M.experience_pressure_difference(pressure_difference, pressure_direction)
/atom/movable/var/pressure_resistance = 10
/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)
- set waitfor = FALSE
- if(SEND_SIGNAL(src, COMSIG_MOVABLE_PRE_PRESSURE_PUSH) & COMSIG_MOVABLE_BLOCKS_PRESSURE)
- return
-
- var/const/PROBABILITY_OFFSET = 40
- var/const/PROBABILITY_BASE_PRECENT = 10
+/atom/movable/proc/experience_pressure_difference(pressure_difference, direction, pressure_resistance_prob_delta = 0)
+ var/const/PROBABILITY_OFFSET = 25
+ var/const/PROBABILITY_BASE_PRECENT = 75
var/max_force = sqrt(pressure_difference)*(MOVE_FORCE_DEFAULT / 5)
+ set waitfor = FALSE
var/move_prob = 100
- if(pressure_resistance > 0)
+ if (pressure_resistance > 0)
move_prob = (pressure_difference/pressure_resistance*PROBABILITY_BASE_PRECENT)-PROBABILITY_OFFSET
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 > 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 / 3000), 1, 10)
- throw_at(throw_turf, move_force / 3000, throw_speed)
- else
- step(src, direction)
+ 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))))
+ step(src, direction)
last_high_pressure_movement_air_cycle = SSair.times_fired
+
+///////////////////////////EXCITED GROUPS/////////////////////////////
+
+/*
+ I've got a problem with excited groups
+ Adding tiles works out fine, but if you try and remove them, we get issues
+ The main one is to do with how sleeping tiles are processed
+ If a tile is sleeping, it is removed from the active turfs list and not processed at all
+ The issue comes when we try and reform excited groups after a removal like this
+ and the turfs just poof go fully to sleep.
+ We solve this with excited group cleanup. See the documentation for more details.
+*/
+/datum/excited_group
+ var/list/turf_list = list()
+ var/breakdown_cooldown = 0
+ var/dismantle_cooldown = 0
+ var/should_display = FALSE
+ var/display_id = 0
+ var/static/wrapping_id = 0
+
+/datum/excited_group/New()
+ SSair.excited_groups += src
+
+/datum/excited_group/proc/add_turf(turf/open/T)
+ turf_list += T
+ T.excited_group = src
+ reset_cooldowns()
+ if(should_display || SSair.display_all_groups)
+ display_turf(T)
+
+/datum/excited_group/proc/merge_groups(datum/excited_group/E)
+ if(turf_list.len > E.turf_list.len)
+ SSair.excited_groups -= E
+ for(var/t in E.turf_list)
+ var/turf/open/T = t
+ T.excited_group = src
+ turf_list += T
+ should_display = E.should_display | should_display
+ if(should_display || SSair.display_all_groups)
+ E.hide_turfs()
+ display_turfs()
+ reset_cooldowns()
+ else
+ SSair.excited_groups -= src
+ for(var/t in turf_list)
+ var/turf/open/T = t
+ T.excited_group = E
+ E.turf_list += T
+ E.reset_cooldowns()
+ E.should_display = E.should_display | should_display
+ if(E.should_display || SSair.display_all_groups)
+ hide_turfs()
+ E.display_turfs()
+
+/datum/excited_group/proc/reset_cooldowns()
+ breakdown_cooldown = 0
+ dismantle_cooldown = 0
+
+/datum/excited_group/proc/self_breakdown(roundstart = FALSE, poke_turfs = FALSE)
+ var/datum/gas_mixture/A = new
+
+ //make local for sanic speed
+ var/list/A_gases = A.gases
+ var/list/turf_list = src.turf_list
+ var/turflen = turf_list.len
+ var/imumutable_in_group = FALSE
+ var/energy = 0
+ var/heat_cap = 0
+
+ for(var/t in turf_list)
+ var/turf/open/T = t
+ //Cache?
+ var/datum/gas_mixture/turf/mix = T.air
+ if (roundstart && istype(T.air, /datum/gas_mixture/immutable))
+ imumutable_in_group = TRUE
+ A.copy_from(T.air) //This had better be immutable young man
+ A_gases = A.gases //update the cache
+ break
+ //"borrowing" this code from merge(), I need to play with the temp portion. Lets expand it out
+ //temperature = (giver.temperature * giver_heat_capacity + temperature * self_heat_capacity) / combined_heat_capacity
+ var/capacity = mix.heat_capacity()
+ energy += mix.temperature * capacity
+ heat_cap += capacity
+
+ var/list/giver_gases = mix.gases
+ for(var/giver_id in giver_gases)
+ ASSERT_GAS(giver_id, A)
+ A_gases[giver_id][MOLES] += giver_gases[giver_id][MOLES]
+
+ if(!imumutable_in_group)
+ A.temperature = energy / heat_cap
+ for(var/id in A_gases)
+ A_gases[id][MOLES] /= turflen
+ A.garbage_collect()
+
+ for(var/t in turf_list)
+ var/turf/open/T = t
+ if(T.planetary_atmos) //We do this as a hack to try and minimize unneeded excited group spread over planetary turfs
+ T.air.copy_from(SSair.planetary[T.initial_gas_mix]) //Comes with a cost of "slower" drains, but it's worth it
+ else
+ T.air.copy_from(A) //Otherwise just set the mix to a copy of our equalized mix
+ T.update_visuals()
+ if(poke_turfs) //Because we only activate all these once every breakdown, in event of lag due to this code and slow space + vent things, increase the wait time for breakdowns
+ SSair.add_to_active(T)
+ T.significant_share_ticker = EXCITED_GROUP_DISMANTLE_CYCLES //Max out the ticker, if they don't share next tick, nuke em
+
+ breakdown_cooldown = 0
+
+///Dismantles the excited group, puts allll the turfs to sleep
+/datum/excited_group/proc/dismantle()
+ for(var/t in turf_list)
+ var/turf/open/T = t
+ T.excited = FALSE
+ T.significant_share_ticker = 0
+ SSair.active_turfs -= T
+ #ifdef VISUALIZE_ACTIVE_TURFS //Use this when you want details about how the turfs are moving, display_all_groups should work for normal operation
+ T.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, COLOR_VIBRANT_LIME)
+ #endif
+ garbage_collect()
+
+//Breaks down the excited group, this doesn't sleep the turfs mind, just removes them from the group
+/datum/excited_group/proc/garbage_collect(will_cleanup = FALSE)
+ if(display_id) //If we ever did make those changes
+ hide_turfs()
+ for(var/t in turf_list)
+ var/turf/open/T = t
+ T.excited_group = null
+ if(will_cleanup)
+ T.flags_1 |= EXCITED_CLEANUP_1
+ if(will_cleanup)
+ SSair.add_to_cleanup(src)
+ turf_list.Cut()
+ SSair.excited_groups -= src
+ if(SSair.currentpart == SSAIR_EXCITEDGROUPS)
+ SSair.currentrun -= src
+
+/datum/excited_group/proc/display_turfs()
+ if(display_id == 0) //Hasn't been shown before
+ wrapping_id = wrapping_id % GLOB.colored_turfs.len
+ wrapping_id++ //We do this after because lists index at 1
+ display_id = wrapping_id
+ for(var/thing in turf_list)
+ var/turf/display = thing
+ display.vis_contents += GLOB.colored_turfs[display_id]
+
+/datum/excited_group/proc/hide_turfs()
+ for(var/thing in turf_list)
+ var/turf/display = thing
+ display.vis_contents -= GLOB.colored_turfs[display_id]
+ display_id = 0
+
+/datum/excited_group/proc/display_turf(turf/thing)
+ if(display_id == 0) //Hasn't been shown before
+ wrapping_id = wrapping_id % GLOB.colored_turfs.len
+ wrapping_id++ //We do this after because lists index at 1
+ display_id = wrapping_id
+ thing.vis_contents += GLOB.colored_turfs[display_id]
+
+////////////////////////SUPERCONDUCTIVITY/////////////////////////////
+
+/**
+ALLLLLLLLLLLLLLLLLLLLRIGHT HERE WE GOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
+
+Read the code for more details, but first, a brief concept discussion/area
+
+Our goal here is to "model" heat moving through solid objects, so walls, windows, and sometimes doors.
+We do this by heating up the floor itself with the heat of the gasmix ontop of it, this is what the coeffs are for here, they slow that movement
+Then we go through the process below.
+
+If an active turf is fitting, we add it to processing, conduct with any covered tiles, (read windows and sometimes walls)
+Then we space some of our heat, and think about if we should stop conducting.
+**/
+
+/turf/proc/conductivity_directions()
+ if(archived_cycle < SSair.times_fired)
+ archive()
+ return ALL_CARDINALS
+
+///Returns a set of directions that we should be conducting in, NOTE, atmos_supeconductivity is ACTUALLY inversed, don't worrry about it
+/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
+
+///These two procs are a bit of a web, I belive in you
+/turf/proc/neighbor_conduct_with_src(turf/open/other)
+ if(!other.blocks_air) //Solid but neighbor is open
+ other.temperature_share_open_to_solid(src)
+ else //Both tiles are solid
+ other.share_temperature_mutual_solid(src, thermal_conductivity)
+ temperature_expose(null, temperature)
+
+/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 //Open but neighbor is solid
+ temperature_share_open_to_solid(other)
+ SSair.add_to_active(src)
+
+/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.temperature))
+
+///Should we attempt to superconduct?
+/turf/proc/consider_superconductivity(starting)
+ if(!thermal_conductivity)
+ return FALSE
+
+ SSair.active_super_conductivity |= src
+ return TRUE
+
+/turf/open/consider_superconductivity(starting)
+ if(air.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) //This is all just heat sharing, don't get freaked out
+ 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)) //The larger the combined capacity the less is shared
+
+ temperature -= heat/heat_capacity //The higher your own heat cap the less heat you get from this arrangement
+ sharer.temperature += heat/sharer.heat_capacity
diff --git a/code/modules/atmospherics/gasmixtures/auxgm.dm b/code/modules/atmospherics/gasmixtures/auxgm.dm
deleted file mode 100644
index 25e58dd50e898..0000000000000
--- a/code/modules/atmospherics/gasmixtures/auxgm.dm
+++ /dev/null
@@ -1,130 +0,0 @@
-GLOBAL_LIST_INIT(hardcoded_gases, list(GAS_O2, GAS_N2, GAS_CO2, GAS_PLASMA)) //the main four gases, which were at one time hardcoded
-GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(GAS_O2, GAS_N2, GAS_CO2, GAS_PLUOXIUM, GAS_STIMULUM, GAS_NITRYL))) //unable to react amongst themselves
-
-// 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
-
-/proc/_auxtools_register_gas(datum/gas/gas) // makes sure auxtools knows stuff about this gas
-
-/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()
-
-
-/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 // how much energy is released per mole of fuel burned
- var/fire_burn_rate = 1 // how many moles are burned per product released
-
-/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
-
- 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)
-
-/proc/finalize_gas_refs()
-
-/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 a98e8ab5df44d..bc028ec2da09f 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -1,283 +1,524 @@
+/*
+What are the archived variables for?
+Calculations are done using the archived variables with the results merged into the regular variables.
+This prevents race conditions that arise based on the order of tile processing.
+*/
+#define MINIMUM_HEAT_CAPACITY 0.0003
+#define MINIMUM_MOLE_COUNT 0.01
+#define MOLAR_ACCURACY 1E-7
+/**
+ *I feel the need to document what happens here. Basically this is used
+ *catch most rounding errors, however its previous value made it so that
+ *once gases got hot enough, most procedures wouldn't occur due to the fact that the mole
+ *counts would get rounded away. Thus, we lowered it a few orders of magnitude
+ *Edit: As far as I know this might have a bug caused by round(). When it has a second arg it will round up.
+ *So for instance round(0.5, 1) == 1. Trouble is I haven't found any instances of it causing a bug,
+ *and any attempts to fix it just killed atmos. I leave this to a greater man then I
+ */
+#define QUANTIZE(variable) (round((variable), (MOLAR_ACCURACY)))
+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/gases
+ var/temperature = 0 //kelvins
+ var/tmp/temperature_archived = 0
+ var/volume = CELL_VOLUME //liters
+ var/last_share = 0
var/list/reaction_results
var/list/analyzer_results //used for analyzer feedback - not initialized until its used
- var/_extools_pointer_gasmixture // Contains the index in the gas vector for this gas mixture in rust land. Don't. Touch. This. Var.
-
-GLOBAL_LIST_INIT(auxtools_atmos_initialized, FALSE)
-
-/proc/auxtools_atmos_init()
+ var/gc_share = FALSE // Whether to call garbage_collect() on the sharer during shares, used for immutable mixtures
/datum/gas_mixture/New(volume)
+ gases = new
if (!isnull(volume))
- initial_volume = volume
- AUXTOOLS_CHECK(AUXMOS)
- if(!GLOB.auxtools_atmos_initialized && auxtools_atmos_init())
- GLOB.auxtools_atmos_initialized = TRUE
- __gasmixture_register()
+ src.volume = volume
reaction_results = new
-/*
-we use a hook instead
-/datum/gas_mixture/Del()
- __gasmixture_unregister()
- . = ..()
-*/
-
-/datum/gas_mixture/vv_edit_var(var_name, var_value)
- if(var_name == "_extools_pointer_gasmixture")
- return FALSE // please no. segfaults bad.
- if(var_name == "gas_list_view_only")
- return FALSE
- return ..()
-
-/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)
- . = ..()
+//listmos procs
+//use the macros in performance intensive areas. for their definitions, refer to code/__DEFINES/atmospherics.dm
+
+ ///assert_gas(gas_id) - used to guarantee that the gas list for this id exists in gas_mixture.gases.
+ //Must be used before adding to a gas. May be used before reading from a gas.
+/datum/gas_mixture/proc/assert_gas(gas_id)
+ ASSERT_GAS(gas_id, src)
+
+ ///assert_gases(args) - shorthand for calling ASSERT_GAS() once for each gas type.
+/datum/gas_mixture/proc/assert_gases(...)
+ for(var/id in args)
+ ASSERT_GAS(id, src)
+
+ ///add_gas(gas_id) - similar to assert_gas(), but does not check for an existing gas list for this id. This can clobber existing gases.
+ ///Used instead of assert_gas() when you know the gas does not exist. Faster than assert_gas().
+/datum/gas_mixture/proc/add_gas(gas_id)
+ ADD_GAS(gas_id, gases)
+
+ ///add_gases(args) - shorthand for calling add_gas() once for each gas_type.
+/datum/gas_mixture/proc/add_gases(...)
+ var/cached_gases = gases
+ for(var/id in args)
+ ADD_GAS(id, cached_gases)
+
+ ///garbage_collect() - removes any gas list which is empty.
+ ///If called with a list as an argument, only removes gas lists with IDs from that list.
+ ///Must be used after subtracting from a gas. Must be used after assert_gas()
+ ///if assert_gas() was called only to read from the gas.
+ ///By removing empty gases, processing speed is increased.
+/datum/gas_mixture/proc/garbage_collect(list/tocheck)
+ var/list/cached_gases = gases
+ for(var/id in (tocheck || cached_gases))
+ if(QUANTIZE(cached_gases[id][MOLES]) <= 0)
+ cached_gases -= id
+
+ //PV = nRT
+
+ ///joules per kelvin
+/datum/gas_mixture/proc/heat_capacity(data = MOLES)
+ var/list/cached_gases = gases
+ . = 0
+ for(var/id in cached_gases)
+ var/gas_data = cached_gases[id]
+ . += gas_data[data] * gas_data[GAS_META][META_GAS_SPECIFIC_HEAT]
+
+ /// Same as above except vacuums return HEAT_CAPACITY_VACUUM
+/datum/gas_mixture/turf/heat_capacity(data = MOLES)
+ var/list/cached_gases = gases
+ . = 0
+ for(var/id in cached_gases)
+ var/gas_data = cached_gases[id]
+ . += gas_data[data] * gas_data[GAS_META][META_GAS_SPECIFIC_HEAT]
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)
-
-/datum/gas_mixture/proc/__gasmixture_unregister()
-/datum/gas_mixture/proc/__gasmixture_register()
-
-/proc/gas_types()
- var/list/L = subtypesof(/datum/gas)
- for(var/gt in L)
- var/datum/gas/G = gt
- L[gt] = initial(G.specific_heat)
- return L
-
-/datum/gas_mixture/proc/heat_capacity() //joules per kelvin
-
-/datum/gas_mixture/proc/partial_heat_capacity(gas_type)
+ . += HEAT_CAPACITY_VACUUM //we want vacuums in turfs to have the same heat capacity as space
+ /// Calculate moles
/datum/gas_mixture/proc/total_moles()
+ var/cached_gases = gases
+ TOTAL_MOLES(cached_gases, .)
+
+ /// Calculate pressure in kilopascals
+/datum/gas_mixture/proc/return_pressure()
+ if(volume) // to prevent division by zero
+ var/cached_gases = gases
+ TOTAL_MOLES(cached_gases, .)
+ . *= R_IDEAL_GAS_EQUATION * temperature / volume
+ return
+ return 0
-/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/get_by_flag(flag)
-/datum/gas_mixture/proc/set_moles(gas_type, moles)
-/datum/gas_mixture/proc/scrub_into(datum/gas_mixture/target, ratio, list/gases)
-/datum/gas_mixture/proc/mark_immutable()
-/datum/gas_mixture/proc/get_gases()
-/datum/gas_mixture/proc/add(amt)
-/datum/gas_mixture/proc/subtract(amt)
-/datum/gas_mixture/proc/multiply(factor)
-/datum/gas_mixture/proc/divide(factor)
-/datum/gas_mixture/proc/get_last_share()
-/datum/gas_mixture/proc/clear()
-
-/datum/gas_mixture/proc/adjust_moles(gas_type, amt = 0)
- set_moles(gas_type, clamp(get_moles(gas_type) + amt,0,INFINITY))
+ /// Calculate temperature in kelvins
+/datum/gas_mixture/proc/return_temperature()
+ return temperature
-/datum/gas_mixture/proc/adjust_moles_temp(gas_type, amt, temperature)
+ /// Calculate volume in liters
+/datum/gas_mixture/proc/return_volume()
+ return max(0, volume)
-/datum/gas_mixture/proc/adjust_multi()
+ /// Calculate thermal energy in joules
+/datum/gas_mixture/proc/thermal_energy()
+ return THERMAL_ENERGY(src) //see code/__DEFINES/atmospherics.dm; use the define in performance critical areas
-/datum/gas_mixture/proc/return_volume() //liters
+ ///Update archived versions of variables. Returns: 1 in all cases
+/datum/gas_mixture/proc/archive()
+ var/list/cached_gases = gases
-/datum/gas_mixture/proc/thermal_energy() //joules
+ temperature_archived = temperature
+ for(var/id in cached_gases)
+ cached_gases[id][ARCHIVE] = cached_gases[id][MOLES]
-/datum/gas_mixture/proc/archive()
- //Update archived versions of variables
- //Returns: 1 in all cases
+ return TRUE
+ ///Merges all air from giver into self. Deletes giver. Returns: 1 if we are mutable, 0 otherwise
/datum/gas_mixture/proc/merge(datum/gas_mixture/giver)
- //Merges all air from giver into self. Does NOT delete the giver.
- //Returns: 1 if we are mutable, 0 otherwise
+ if(!giver)
+ return FALSE
+ //heat transfer
+ if(abs(temperature - giver.temperature) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
+ var/self_heat_capacity = heat_capacity()
+ var/giver_heat_capacity = giver.heat_capacity()
+ var/combined_heat_capacity = giver_heat_capacity + self_heat_capacity
+ if(combined_heat_capacity)
+ temperature = (giver.temperature * giver_heat_capacity + temperature * self_heat_capacity) / combined_heat_capacity
+
+ var/list/cached_gases = gases //accessing datum vars is slower than proc vars
+ var/list/giver_gases = giver.gases
+ //gas transfer
+ for(var/giver_id in giver_gases)
+ ASSERT_GAS(giver_id, src)
+ cached_gases[giver_id][MOLES] += giver_gases[giver_id][MOLES]
+
+ return TRUE
+
+ ///Proportionally removes amount of gas from the gas_mixture.
+ ///Returns: gas_mixture with the gases removed
/datum/gas_mixture/proc/remove(amount)
- //Proportionally removes amount of gas from the gas_mixture
- //Returns: gas_mixture with the gases removed
-
-/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
+ var/sum
+ var/list/cached_gases = gases
+ TOTAL_MOLES(cached_gases, sum)
+ amount = min(amount, sum) //Can not take more air than tile has!
+ if(amount <= 0)
+ return null
+ var/datum/gas_mixture/removed = new type
+ var/list/removed_gases = removed.gases //accessing datum vars is slower than proc vars
-/datum/gas_mixture/proc/transfer_to(datum/gas_mixture/target, amount)
+ removed.temperature = temperature
+ for(var/id in cached_gases)
+ ADD_GAS(id, removed.gases)
+ removed_gases[id][MOLES] = QUANTIZE((cached_gases[id][MOLES] / sum) * amount)
+ cached_gases[id][MOLES] -= removed_gases[id][MOLES]
+ garbage_collect()
-/datum/gas_mixture/proc/transfer_ratio_to(datum/gas_mixture/target, ratio)
- //Transfers ratio of gas to target. Equivalent to target.merge(remove_ratio(amount)) but faster.
+ return removed
+ ///Proportionally removes amount of gas from the gas_mixture.
+ ///Returns: gas_mixture with the gases removed
/datum/gas_mixture/proc/remove_ratio(ratio)
- //Proportionally removes amount of gas from the gas_mixture
- //Returns: gas_mixture with the gases removed
-
-/datum/gas_mixture/proc/copy()
- //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
-
-/datum/gas_mixture/proc/parse_gas_string(gas_string)
- //Copies variables from a particularly formatted string.
- //Returns: 1 if we are mutable, 0 otherwise
+ if(ratio <= 0)
+ return null
+ ratio = min(ratio, 1)
-/datum/gas_mixture/proc/share(datum/gas_mixture/sharer)
- //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
+ var/list/cached_gases = gases
+ var/datum/gas_mixture/removed = new type
+ var/list/removed_gases = removed.gases //accessing datum vars is slower than proc vars
-/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
+ removed.temperature = temperature
+ for(var/id in cached_gases)
+ ADD_GAS(id, removed.gases)
+ removed_gases[id][MOLES] = QUANTIZE(cached_gases[id][MOLES] * ratio)
+ cached_gases[id][MOLES] -= removed_gases[id][MOLES]
-/datum/gas_mixture/proc/adjust_heat(amt)
- //Adjusts the thermal energy of the gas mixture, rather than having to do the full calculation.
- //Returns: null
+ garbage_collect()
-/datum/gas_mixture/proc/equalize_with(datum/gas_mixture/giver)
- //Makes this mix have the same temperature and gas ratios as the giver, but with the same pressure, accounting for volume.
- //Returns: null
+ return removed
-/datum/gas_mixture/proc/get_oxidation_power(temp)
- //Gets how much oxidation this gas can do, optionally at a given temperature.
+ ///Removes an amount of a specific gas from the gas_mixture.
+ ///Returns: gas_mixture with the gas removed
+/datum/gas_mixture/proc/remove_specific(gas_id, amount)
+ var/list/cached_gases = gases
+ amount = min(amount, cached_gases[gas_id][MOLES])
+ if(amount <= 0)
+ return null
+ var/datum/gas_mixture/removed = new type
+ var/list/removed_gases = removed.gases
+ removed.temperature = temperature
+ ADD_GAS(gas_id, removed.gases)
+ removed_gases[gas_id][MOLES] = amount
+ cached_gases[gas_id][MOLES] -= amount
-/datum/gas_mixture/proc/get_fuel_amount(temp)
- //Gets how much fuel for fires (not counting trit/plasma!) this gas has, optionally at a given temperature.
+ garbage_collect(list(gas_id))
+ return removed
-/proc/equalize_all_gases_in_list(list/L)
- //Makes every gas in the given list have the same pressure, temperature and gas proportions.
- //Returns: null
+ ///Distributes the contents of two mixes equally between themselves
+ //Returns: bool indicating whether gases moved between the two mixes
+/datum/gas_mixture/proc/equalize(datum/gas_mixture/other)
+ . = FALSE
+ if(abs(return_temperature() - other.return_temperature()) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND)
+ . = TRUE
+ var/self_heat_cap = heat_capacity()
+ var/other_heat_cap = other.heat_capacity()
+ var/new_temp = (temperature * self_heat_cap + other.temperature * other_heat_cap) / (self_heat_cap + other_heat_cap)
+ temperature = new_temp
+ other.temperature = new_temp
+
+ var/min_p_delta = 0.1
+ var/total_volume = volume + other.volume
+ var/list/gas_list = gases | other.gases
+ for(var/gas_id in gas_list)
+ assert_gas(gas_id)
+ other.assert_gas(gas_id)
+ //math is under the assumption temperatures are equal
+ if(abs(gases[gas_id][MOLES] / volume - other.gases[gas_id][MOLES] / other.volume) > min_p_delta / (R_IDEAL_GAS_EQUATION * temperature))
+ . = TRUE
+ var/total_moles = gases[gas_id][MOLES] + other.gases[gas_id][MOLES]
+ gases[gas_id][MOLES] = total_moles * (volume/total_volume)
+ other.gases[gas_id][MOLES] = total_moles * (other.volume/total_volume)
+
+
+ ///Creates new, identical gas mixture
+ ///Returns: duplicate gas mixture
+/datum/gas_mixture/proc/copy()
+ var/list/cached_gases = gases
+ var/datum/gas_mixture/copy = new type
+ var/list/copy_gases = copy.gases
-/datum/gas_mixture/proc/__remove_by_flag()
+ copy.temperature = temperature
+ for(var/id in cached_gases)
+ ADD_GAS(id, copy.gases)
+ copy_gases[id][MOLES] = cached_gases[id][MOLES]
-/datum/gas_mixture/remove_by_flag(flag, amount)
- var/datum/gas_mixture/removed = new type
- __remove_by_flag(removed, flag, amount)
+ return copy
- return removed
+ ///Copies variables from sample, moles multiplicated by partial
+ ///Returns: 1 if we are mutable, 0 otherwise
+/datum/gas_mixture/proc/copy_from(datum/gas_mixture/sample, partial = 1)
+ var/list/cached_gases = gases //accessing datum vars is slower than proc vars
+ var/list/sample_gases = sample.gases
-/datum/gas_mixture/proc/__remove()
-/datum/gas_mixture/remove(amount)
- var/datum/gas_mixture/removed = new type
- __remove(removed, amount)
+ //remove all gases not in the sample
+ cached_gases &= sample_gases
- return removed
+ temperature = sample.temperature
+ for(var/id in sample_gases)
+ ASSERT_GAS(id,src)
+ cached_gases[id][MOLES] = sample_gases[id][MOLES] * partial
-/datum/gas_mixture/proc/__remove_ratio()
-/datum/gas_mixture/remove_ratio(ratio)
- var/datum/gas_mixture/removed = new type
- __remove_ratio(removed, ratio)
+ return 1
- return removed
+ ///Copies all gas info from the turf into the gas list along with temperature
+ ///Returns: TRUE if we are mutable, FALSE otherwise
+/datum/gas_mixture/proc/copy_from_turf(turf/model)
+ parse_gas_string(model.initial_gas_mix)
-/datum/gas_mixture/copy()
- var/datum/gas_mixture/copy = new type
- copy.copy_from(src)
+ //acounts for changes in temperature
+ var/turf/model_parent = model.parent_type
+ if(model.temperature != initial(model.temperature) || model.temperature != initial(model_parent.temperature))
+ temperature = model.temperature
- return copy
+ return TRUE
-/datum/gas_mixture/copy_from_turf(turf/model)
- set_temperature(initial(model.initial_temperature))
- parse_gas_string(model.initial_gas_mix)
+ ///Copies variables from a particularly formatted string.
+ ///Returns: 1 if we are mutable, 0 otherwise
+/datum/gas_mixture/proc/parse_gas_string(gas_string)
+ gas_string = SSair.preprocess_gas_string(gas_string)
+
+ var/list/gases = src.gases
+ var/list/gas = params2list(gas_string)
+ if(gas["TEMP"])
+ temperature = text2num(gas["TEMP"])
+ temperature_archived = temperature
+ gas -= "TEMP"
+ else // if we do not have a temp in the new gas mix lets assume room temp.
+ temperature = T20C
+ gases.Cut()
+ 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
+ ADD_GAS(path, gases)
+ gases[path][MOLES] = text2num(gas[id])
return 1
-/datum/gas_mixture/proc/__auxtools_parse_gas_string(gas_string)
-
-/datum/gas_mixture/parse_gas_string(gas_string)
- return __auxtools_parse_gas_string(gas_string)
+ ///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/share(datum/gas_mixture/sharer, atmos_adjacent_turfs = 4)
+ var/list/cached_gases = gases
+ var/list/sharer_gases = sharer.gases
+
+ var/temperature_delta = temperature_archived - sharer.temperature_archived
+ var/abs_temperature_delta = abs(temperature_delta)
+
+ var/old_self_heat_capacity = 0
+ var/old_sharer_heat_capacity = 0
+ if(abs_temperature_delta > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
+ old_self_heat_capacity = heat_capacity()
+ old_sharer_heat_capacity = sharer.heat_capacity()
+
+ var/heat_capacity_self_to_sharer = 0 //heat capacity of the moles transferred from us to the sharer
+ var/heat_capacity_sharer_to_self = 0 //heat capacity of the moles transferred from the sharer to us
+
+ var/moved_moles = 0
+ var/abs_moved_moles = 0
+
+ //GAS TRANSFER
+ for(var/id in sharer_gases - cached_gases) // create gases not in our cache
+ ADD_GAS(id, gases)
+ for(var/id in cached_gases) // transfer gases
+ ASSERT_GAS(id, sharer)
+
+ var/gas = cached_gases[id]
+ var/sharergas = sharer_gases[id]
+
+ var/delta = QUANTIZE(gas[ARCHIVE] - sharergas[ARCHIVE])/(atmos_adjacent_turfs+1) //the amount of gas that gets moved between the mixtures
+
+ if(delta && abs_temperature_delta > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
+ var/gas_heat_capacity = delta * gas[GAS_META][META_GAS_SPECIFIC_HEAT]
+ if(delta > 0)
+ heat_capacity_self_to_sharer += gas_heat_capacity
+ else
+ heat_capacity_sharer_to_self -= gas_heat_capacity //subtract here instead of adding the absolute value because we know that delta is negative.
+
+ gas[MOLES] -= delta
+ sharergas[MOLES] += delta
+ moved_moles += delta
+ abs_moved_moles += abs(delta)
+
+ last_share = abs_moved_moles
+
+ //THERMAL ENERGY TRANSFER
+ if(abs_temperature_delta > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
+ var/new_self_heat_capacity = old_self_heat_capacity + heat_capacity_sharer_to_self - heat_capacity_self_to_sharer
+ var/new_sharer_heat_capacity = old_sharer_heat_capacity + heat_capacity_self_to_sharer - heat_capacity_sharer_to_self
+
+ //transfer of thermal energy (via changed heat capacity) between self and sharer
+ if(new_self_heat_capacity > MINIMUM_HEAT_CAPACITY)
+ temperature = (old_self_heat_capacity*temperature - heat_capacity_self_to_sharer*temperature_archived + heat_capacity_sharer_to_self*sharer.temperature_archived)/new_self_heat_capacity
+
+ if(new_sharer_heat_capacity > MINIMUM_HEAT_CAPACITY)
+ sharer.temperature = (old_sharer_heat_capacity*sharer.temperature-heat_capacity_sharer_to_self*sharer.temperature_archived + heat_capacity_self_to_sharer*temperature_archived)/new_sharer_heat_capacity
+ //thermal energy of the system (self and sharer) is unchanged
+
+ if(abs(old_sharer_heat_capacity) > MINIMUM_HEAT_CAPACITY)
+ if(abs(new_sharer_heat_capacity/old_sharer_heat_capacity - 1) < 0.1) // <10% change in sharer heat capacity
+ temperature_share(sharer, OPEN_HEAT_TRANSFER_COEFFICIENT)
+
+ garbage_collect()
+ sharer.garbage_collect()
+ if(temperature_delta > MINIMUM_TEMPERATURE_TO_MOVE || abs(moved_moles) > MINIMUM_MOLES_DELTA_TO_MOVE)
+ var/our_moles
+ TOTAL_MOLES(cached_gases,our_moles)
+ var/their_moles
+ TOTAL_MOLES(sharer_gases,their_moles)
+ return (temperature_archived*(our_moles + moved_moles) - sharer.temperature_archived*(their_moles - moved_moles)) * R_IDEAL_GAS_EQUATION / volume
+
+ ///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/temperature_share(datum/gas_mixture/sharer, conduction_coefficient, sharer_temperature, sharer_heat_capacity)
+ //transfer of thermal energy (via conduction) between self and sharer
+ if(sharer)
+ sharer_temperature = sharer.temperature_archived
+ var/temperature_delta = temperature_archived - sharer_temperature
+ if(abs(temperature_delta) > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
+ var/self_heat_capacity = heat_capacity(ARCHIVE)
+ sharer_heat_capacity = sharer_heat_capacity || sharer.heat_capacity(ARCHIVE)
+
+ if((sharer_heat_capacity > MINIMUM_HEAT_CAPACITY) && (self_heat_capacity > MINIMUM_HEAT_CAPACITY))
+ var/heat = conduction_coefficient*temperature_delta* \
+ (self_heat_capacity*sharer_heat_capacity/(self_heat_capacity+sharer_heat_capacity))
+
+ temperature = max(temperature - heat/self_heat_capacity, TCMB)
+ sharer_temperature = max(sharer_temperature + heat/sharer_heat_capacity, TCMB)
+ if(sharer)
+ sharer.temperature = sharer_temperature
+ if (initial(sharer.gc_share))
+ sharer.garbage_collect()
+ return sharer_temperature
+ //thermal energy of the system (self and sharer) is unchanged
+
+ ///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/compare(datum/gas_mixture/sample)
+ var/list/sample_gases = sample.gases //accessing datum vars is slower than proc vars
+ var/list/cached_gases = gases
+
+ for(var/id in cached_gases | sample_gases) // compare gases from either mixture
+ var/gas_moles = cached_gases[id]
+ gas_moles = gas_moles ? gas_moles[MOLES] : 0
+ var/sample_moles = sample_gases[id]
+ sample_moles = sample_moles ? sample_moles[MOLES] : 0
+ var/delta = abs(gas_moles - sample_moles)
+ if(delta > MINIMUM_MOLES_DELTA_TO_MOVE && \
+ delta > gas_moles * MINIMUM_AIR_RATIO_TO_MOVE)
+ return id
+
+ var/our_moles
+ TOTAL_MOLES(cached_gases, our_moles)
+ if(our_moles > MINIMUM_MOLES_DELTA_TO_MOVE) //Don't consider temp if there's not enough mols
+ var/temp = temperature
+ var/sample_temp = sample.temperature
+
+ var/temperature_delta = abs(temp - sample_temp)
+ if(temperature_delta > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND)
+ return "temp"
+
+ return ""
+
+ ///Performs various reactions such as combustion or fusion (LOL)
+ ///Returns: 1 if any reaction took place; 0 otherwise
+/datum/gas_mixture/proc/react(datum/holder)
+ . = NO_REACTION
+ var/list/cached_gases = gases
+ if(!length(cached_gases))
+ return
+ var/list/reactions = list()
+ for(var/G in SSair.gas_reactions)
+ var/datum/gas_reaction/reaction = G
+ if(cached_gases[reaction.major_gas])
+ reactions += G
-/datum/gas_mixture/proc/set_analyzer_results(instability)
- if(!analyzer_results)
- analyzer_results = new
- analyzer_results["fusion"] = instability
+ if(!length(reactions))
+ return
-//Mathematical proofs:
-/*
+ reaction_results = new
+ //It might be worth looking into updating these after each reaction, but it changes things a lot, so be careful
+ var/temp = temperature
+ var/ener = THERMAL_ENERGY(src)
+
+ 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(!cached_gases[id] || cached_gases[id][MOLES] < 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
+
+ if(.) //If we changed the mix to any degree, or if we stopped reacting
+ garbage_collect()
+
+///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 * temperature) / BREATH_VOLUME
+///inverse
+/datum/gas_mixture/proc/get_true_breath_pressure(partial_pressure)
+ return (partial_pressure * BREATH_VOLUME) / (R_IDEAL_GAS_EQUATION * temperature)
+
+///Mathematical proofs:
+/**
get_breath_partial_pressure(gas_pp) --> gas_pp/total_moles()*breath_pp = pp
get_true_breath_pressure(pp) --> gas_pp = pp/breath_pp*total_moles()
10/20*5 = 2.5
10 = 2.5/5*20
-*/
+**/
+
+/// Pumps gas from src to output_air. 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
-/datum/gas_mixture/turf
+ //Calculate necessary moles to transfer using PV=nRT
+ if((total_moles() > 0) && (temperature>0))
+ var/pressure_delta = target_pressure - output_starting_pressure
+ var/transfer_moles = (pressure_delta*output_air.volume)/(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)
@@ -286,21 +527,19 @@ 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
- if((total_moles() > 0) && (return_temperature()>0))
+ if((total_moles() > 0) && (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*output_air.return_volume()/(return_temperature() * R_IDEAL_GAS_EQUATION)
+ var/transfer_moles = (pressure_delta*output_air.volume)/(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
-
-/datum/gas_mixture/proc/vv_react(datum/holder)
- return react(holder)
diff --git a/code/modules/atmospherics/gasmixtures/gas_types.dm b/code/modules/atmospherics/gasmixtures/gas_types.dm
new file mode 100644
index 0000000000000..68fffae0cd90a
--- /dev/null
+++ b/code/modules/atmospherics/gasmixtures/gas_types.dm
@@ -0,0 +1,161 @@
+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
+//Now this is what I call history
+GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/gas/nitrogen, /datum/gas/carbon_dioxide, /datum/gas/pluoxium, /datum/gas/stimulum, /datum/gas/nitryl))) //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(TOTAL_VISIBLE_STATES)
+ for(var/i in 1 to TOTAL_VISIBLE_STATES)
+ gas_info[META_GAS_OVERLAY][i] = new /obj/effect/overlay/gas(initial(gas.gas_overlay), log(4, (i+0.4*TOTAL_VISIBLE_STATES) / (0.35*TOTAL_VISIBLE_STATES)) * 255)
+
+ 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 = ""
+ var/gas_overlay = "" //icon_state in icons/effects/atmospherics.dmi
+ var/moles_visible = null
+ var/dangerous = FALSE //currently used by canisters
+ var/fusion_power = 0 //How much the gas accelerates a fusion reaction
+ var/rarity = 0 // relative rarity compared to other gases, used when setting up the reactions list.
+
+/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
+ fusion_power = 10
+ 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/nitryl
+ id = "no2"
+ specific_heat = 20
+ name = "Nitryl"
+ gas_overlay = "nitryl"
+ moles_visible = MOLES_GAS_VISIBLE
+ dangerous = TRUE
+ rarity = 100
+
+/datum/gas/tritium
+ id = "tritium"
+ specific_heat = 10
+ name = "Tritium"
+ gas_overlay = "tritium"
+ moles_visible = MOLES_GAS_VISIBLE
+ dangerous = TRUE
+ fusion_power = 5
+ rarity = 300
+
+/datum/gas/bz
+ id = "bz"
+ specific_heat = 20
+ name = "BZ"
+ dangerous = TRUE
+ fusion_power = 8
+ rarity = 400
+
+/datum/gas/stimulum
+ id = "stim"
+ specific_heat = 5
+ name = "Stimulum"
+ fusion_power = 7
+ rarity = 1
+
+/datum/gas/pluoxium
+ id = "pluox"
+ specific_heat = 80
+ name = "Pluoxium"
+ fusion_power = -10
+ rarity = 200
+
+/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/immutable_mixtures.dm b/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
index cd8b88d60fb49..94fead2e8905a 100644
--- a/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
+++ b/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
@@ -27,10 +27,39 @@
/datum/gas_mixture/immutable/cloner/populate()
set_moles(GAS_N2, MOLES_O2STANDARD + MOLES_N2STANDARD)
-//breathable planet surface
+//planet side stuff
/datum/gas_mixture/immutable/planetary
- initial_temperature = T20C
+ var/list/initial_gas = list()
+
+/datum/gas_mixture/immutable/planetary/garbage_collect()
+ ..()
+ gases.Cut()
+ for(var/id in initial_gas)
+ ADD_GAS(id, gases)
+ gases[id][MOLES] = initial_gas[id][MOLES]
+ gases[id][ARCHIVE] = initial_gas[id][ARCHIVE]
+
+/datum/gas_mixture/immutable/planetary/proc/parse_string_immutable(gas_string) //I know I know, I need this tho
+ gas_string = SSair.preprocess_gas_string(gas_string)
+
+ var/list/mix = initial_gas
+ var/list/gas = params2list(gas_string)
+ if(gas["TEMP"])
+ initial_temperature = text2num(gas["TEMP"])
+ temperature_archived = initial_temperature
+ temperature = initial_temperature
+ gas -= "TEMP"
+ mix.Cut()
+ 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
+ ADD_GAS(path, mix)
+ mix[path][MOLES] = text2num(gas[id])
+ mix[path][ARCHIVE] = mix[path][MOLES]
+
+ for(var/id in mix)
+ ADD_GAS(id, gases)
+ gases[id][MOLES] = mix[id][MOLES]
+ gases[id][ARCHIVE] = mix[id][MOLES]
-/datum/gas_mixture/immutable/planetary/populate()
- set_moles(GAS_O2, MOLES_O2STANDARD)
- set_moles(GAS_N2, MOLES_N2STANDARD)
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index 23e7c52f50a80..54e1adbdd46ec 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -136,10 +136,6 @@
/proc/fire_expose(turf/open/location, datum/gas_mixture/air, temperature)
if(istype(location) && temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
location.hotspot_expose(temperature, CELL_VOLUME)
- for(var/I in location)
- var/atom/movable/item = I
- item.temperature_expose(air, temperature, CELL_VOLUME)
- location.temperature_expose(air, temperature, CELL_VOLUME)
/proc/radiation_burn(turf/open/location, energy_released)
if(istype(location) && prob(10))
@@ -184,10 +180,6 @@
temperature = air.return_temperature()
if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
location.hotspot_expose(temperature, CELL_VOLUME)
- for(var/I in location)
- var/atom/movable/item = I
- item.temperature_expose(air, temperature, CELL_VOLUME)
- location.temperature_expose(air, temperature, CELL_VOLUME)
return cached_results["fire"] ? REACTING : NO_REACTION
@@ -256,10 +248,6 @@
temperature = air.return_temperature()
if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
location.hotspot_expose(temperature, CELL_VOLUME)
- for(var/I in location)
- var/atom/movable/item = I
- item.temperature_expose(air, temperature, CELL_VOLUME)
- location.temperature_expose(air, temperature, CELL_VOLUME)
return cached_results["fire"] ? REACTING : NO_REACTION
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
index 5ab205e98b439..a145a6e802ce2 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
@@ -51,7 +51,7 @@
if(air2.return_temperature()>0)
var/pressure_delta = (input_starting_pressure - output_starting_pressure)/2
- var/transfer_moles = pressure_delta*air1.return_volume()/(air2.return_temperature() * R_IDEAL_GAS_EQUATION)
+ var/transfer_moles = (pressure_delta*air1.return_volume())/(air2.return_temperature() * R_IDEAL_GAS_EQUATION)
last_pressure_delta = pressure_delta
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 298b46b58133d..92bcca1b77fd2 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
@@ -81,16 +81,14 @@
if(pressure_delta > 0)
if(air1.return_temperature() > 0)
- var/transfer_moles = pressure_delta*environment.return_volume()/(air1.return_temperature() * R_IDEAL_GAS_EQUATION)
+ var/transfer_moles = (pressure_delta*environment.volume)/(air1.return_temperature() * R_IDEAL_GAS_EQUATION)
loc.assume_air_moles(air1, transfer_moles)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
var/datum/pipeline/parent1 = parents[1]
- if(!parent1)
- return
- parent1.update = PIPENET_UPDATE_STATUS_RECONCILE_NEEDED
+ parent1.update = TRUE
else //external -> output
if(environment.return_pressure() > 0)
@@ -103,10 +101,10 @@
if(moles_delta > 0)
loc.transfer_air(air2, moles_delta)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
var/datum/pipeline/parent2 = parents[2]
- parent2.update = PIPENET_UPDATE_STATUS_RECONCILE_NEEDED
+ parent2.update = TRUE
//Radio remote control
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 638527e13f1cf..2f5629c989365 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
@@ -77,7 +77,7 @@
if(istype(T))
var/datum/gas_mixture/leaked = air1.remove_ratio(VOLUME_PUMP_LEAK_AMOUNT)
T.assume_air(leaked)
- T.air_update_turf()
+ T.air_update_turf(FALSE, FALSE)
var/transfer_ratio = transfer_rate / air1.return_volume()
air1.transfer_ratio_to(air2,transfer_ratio)
diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm
index bd98932755f10..fc0e35a28e57d 100644
--- a/code/modules/atmospherics/machinery/components/components_base.dm
+++ b/code/modules/atmospherics/machinery/components/components_base.dm
@@ -18,27 +18,23 @@
..()
for(var/i in 1 to device_type)
- var/datum/gas_mixture/A = new(200)
+ var/datum/gas_mixture/A = new
+ A.volume = 200
airs[i] = A
-/obj/machinery/atmospherics/components/examine(mob/user)
- . = ..()
- . += "[src] is on layer [piping_layer]."
-
/obj/machinery/atmospherics/components/Initialize()
. = ..()
if(hide)
- RegisterSignal(src, COMSIG_OBJ_HIDE, PROC_REF(hide_pipe))
+ RegisterSignal(src, COMSIG_OBJ_HIDE, .proc/hide_pipe)
// Iconnery
/obj/machinery/atmospherics/components/proc/update_icon_nopipes()
return
-/obj/machinery/atmospherics/components/proc/hide_pipe(datum/source, underfloor_accessibility)
- SIGNAL_HANDLER
- showpipe = !!underfloor_accessibility
+/obj/machinery/atmospherics/components/proc/hide_pipe(datum/source, covered)
+ showpipe = !covered
update_icon()
/obj/machinery/atmospherics/components/update_icon()
@@ -49,7 +45,7 @@
plane = showpipe ? GAME_PLANE : FLOOR_PLANE
if(!showpipe)
- return
+ return ..()
var/connected = 0 //Direction bitset
@@ -66,6 +62,7 @@
if(!shift_underlay_only)
PIPING_LAYER_SHIFT(src, piping_layer)
+ return ..()
/obj/machinery/atmospherics/components/proc/get_pipe_underlay(state, dir, color = null)
if(color)
@@ -76,10 +73,8 @@
// Pipenet stuff; housekeeping
/obj/machinery/atmospherics/components/nullifyNode(i)
- // Every node has a parent pipeline and an air associated with it, but we need to accomdate for edge cases like init dir cache building...
if(parents[i])
nullifyPipenet(parents[i])
- if(airs[i])
QDEL_NULL(airs[i])
..()
@@ -89,7 +84,7 @@
/obj/machinery/atmospherics/components/build_network()
for(var/i in 1 to device_type)
- if(QDELETED(parents[i]))
+ if(!parents[i])
parents[i] = new /datum/pipeline()
var/datum/pipeline/P = parents[i]
P.build_pipeline(src)
@@ -100,27 +95,10 @@
var/i = parents.Find(reference)
reference.other_airs -= airs[i]
reference.other_atmosmch -= src
- /**
- * We explicitly qdel pipeline when this particular pipeline
- * is projected to have no member and cause GC problems.
- * We have to do this because components don't qdel pipelines
- * while pipes must and will happily wreck and rebuild everything again
- * every time they are qdeleted.
- */
- if(!(reference.other_atmosmch.len || reference.members.len || QDESTROYING(reference)))
- qdel(reference)
parents[i] = null
-// We should return every air sharing a parent
/obj/machinery/atmospherics/components/returnPipenetAir(datum/pipeline/reference)
- for(var/i in 1 to device_type)
- if(parents[i] == reference)
- if(.)
- if(!islist(.))
- . = list(.)
- . += airs[i]
- else
- . = airs[i]
+ return airs[parents.Find(reference)]
/obj/machinery/atmospherics/components/pipeline_expansion(datum/pipeline/reference)
if(reference)
@@ -136,7 +114,7 @@
/obj/machinery/atmospherics/components/replacePipenet(datum/pipeline/Old, datum/pipeline/New)
parents[parents.Find(Old)] = New
-/obj/machinery/atmospherics/components/unsafe_pressure_release(var/mob/user, var/pressures)
+/obj/machinery/atmospherics/components/unsafe_pressure_release(mob/user, pressures)
..()
var/turf/T = get_turf(src)
@@ -147,18 +125,29 @@
var/times_lost = 0
for(var/i in 1 to device_type)
var/datum/gas_mixture/air = airs[i]
- lost += pressures*environment.return_volume()/(air.return_temperature() * R_IDEAL_GAS_EQUATION)
+ lost += pressures*environment.volume/(air.temperature * R_IDEAL_GAS_EQUATION)
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]
- T.assume_air_moles(air, shared_loss)
+ 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(FALSE, FALSE)
+
+/obj/machinery/atmospherics/components/proc/safe_input(title, text, default_set)
+ var/new_value = input(usr,text,title,default_set) as num|null
+
+ if (isnull(new_value))
+ return default_set
-/obj/machinery/atmospherics/components/proc/safe_input(var/title, var/text, var/default_set)
- var/new_value = input(usr,text,title,default_set) as num
if(usr.canUseTopic(src))
return new_value
+
return default_set
// Helpers
@@ -167,11 +156,10 @@
for(var/i in 1 to device_type)
var/datum/pipeline/parent = parents[i]
if(!parent)
- //WARNING("Component is missing a pipenet! Rebuilding...")
- //At pre-SSair_rebuild_pipenets times, not having a parent wasn't supposed to happen
+ WARNING("Component is missing a pipenet! Rebuilding...")
SSair.add_to_rebuild_queue(src)
- continue
- parent.update = PIPENET_UPDATE_STATUS_RECONCILE_NEEDED
+ else
+ parent.update = TRUE
/obj/machinery/atmospherics/components/returnPipenets()
. = list()
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 47a12d462d568..7a6abac873c8e 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm
@@ -70,7 +70,7 @@
if(air_contents != null)
if(air_contents.return_temperature() > 0)
loc.assume_air_ratio(air_contents, volume_rate / air_contents.return_volume())
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
update_parents()
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 1fa5221e38eac..306b15289c105 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm
@@ -38,7 +38,7 @@
active = internal.temperature_share(external, OPEN_HEAT_TRANSFER_COEFFICIENT) || active
if(active)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
update_parents()
/obj/machinery/atmospherics/components/unary/passive_vent/can_crawl_through()
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 05d2d9b84a17f..7a1fdaaa9d4a7 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
@@ -118,10 +118,10 @@
if(pressure_delta > 0)
if(air_contents.return_temperature() > 0 && air_contents.return_volume() > 0)
- var/transfer_moles = pressure_delta*environment.return_volume()/(air_contents.return_temperature() * R_IDEAL_GAS_EQUATION)
+ var/transfer_moles = (pressure_delta*environment.return_volume())/(air_contents.return_temperature() * R_IDEAL_GAS_EQUATION)
loc.assume_air_moles(air_contents, transfer_moles)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
else // external -> internal
if(environment.return_pressure() > 0)
@@ -134,7 +134,7 @@
if(moles_delta > 0)
loc.transfer_air(air_contents, moles_delta)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
update_parents()
//Radio remote control
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 78f7434100d7f..07926c0bf9c8b 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
@@ -155,11 +155,11 @@
if(scrubbing & SCRUBBING)
environment.scrub_into(air_contents, volume_rate/environment.return_volume(), filter_types)
- tile.air_update_turf()
+ tile.air_update_turf(FALSE, FALSE)
else //Just siphoning all air
environment.transfer_ratio_to(air_contents, volume_rate/environment.return_volume())
- tile.air_update_turf()
+ tile.air_update_turf(FALSE, FALSE)
update_parents()
diff --git a/code/modules/atmospherics/machinery/pipes/pipes.dm b/code/modules/atmospherics/machinery/pipes/pipes.dm
index 4ace48b93e9cf..6f364d2500e00 100644
--- a/code/modules/atmospherics/machinery/pipes/pipes.dm
+++ b/code/modules/atmospherics/machinery/pipes/pipes.dm
@@ -52,7 +52,7 @@
if(air_temporary)
var/turf/T = loc
T.assume_air(air_temporary)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
/obj/machinery/atmospherics/pipe/return_air()
if(parent)
diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm
index 463ef5df40d75..3d0d2a4b77b8d 100644
--- a/code/modules/atmospherics/machinery/portable/canister.dm
+++ b/code/modules/atmospherics/machinery/portable/canister.dm
@@ -58,6 +58,10 @@
. = ..()
AddComponent(/datum/component/usb_port, list(/obj/item/circuit_component/canister_valve))
+/obj/machinery/portable_atmospherics/canister/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
+
/obj/item/circuit_component/canister_valve
display_name = "Canister Valve"
desc = "The interface for communicating with a canister's valve."
@@ -310,10 +314,11 @@
if(update == last_update)
return
-/obj/machinery/portable_atmospherics/canister/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature > temperature_resistance)
- take_damage(5, BURN, 0)
+/obj/machinery/portable_atmospherics/canister/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > temperature_resistance * mode
+/obj/machinery/portable_atmospherics/canister/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ take_damage(5, BURN, 0)
/obj/machinery/portable_atmospherics/canister/deconstruct(disassembled = TRUE)
if(!(flags_1 & NODECONSTRUCT_1))
@@ -350,7 +355,7 @@
disconnect()
var/turf/T = get_turf(src)
T.assume_air(air_contents)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
set_machine_stat(machine_stat | BROKEN)
density = FALSE
@@ -389,7 +394,7 @@
var/datum/gas_mixture/target_air = holding ? holding.air_contents : T.return_air()
if(air_contents.release_gas_to(target_air, release_pressure) && !holding)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
update_icon()
/obj/machinery/portable_atmospherics/canister/ui_status(mob/user)
diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
index 0e9d101d8b382..d280d79690361 100644
--- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
+++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
@@ -35,7 +35,7 @@
//This explosion will destroy the can, release its air.
var/turf/T = get_turf(src)
T.assume_air(air_contents)
- T.air_update_turf()
+ T.air_update_turf(FALSE, FALSE)
return ..()
diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm
index 46c2b531dd4ea..7413841f70104 100644
--- a/code/modules/atmospherics/machinery/portable/pump.dm
+++ b/code/modules/atmospherics/machinery/portable/pump.dm
@@ -86,7 +86,7 @@
/obj/machinery/portable_atmospherics/pump/Destroy()
var/turf/T = get_turf(src)
T.assume_air(air_contents)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
QDEL_NULL(pump)
return ..()
@@ -116,7 +116,7 @@
pump.process_atmos() // Pump gas.
if(!holding)
- air_update_turf() // Update the environment if needed.
+ air_update_turf(FALSE, FALSE) // Update the environment if needed.
/obj/machinery/portable_atmospherics/pump/emp_act(severity)
. = ..()
diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm
index fdfd77d663e06..853719803feec 100644
--- a/code/modules/atmospherics/machinery/portable/scrubber.dm
+++ b/code/modules/atmospherics/machinery/portable/scrubber.dm
@@ -16,7 +16,7 @@
/obj/machinery/portable_atmospherics/scrubber/Destroy()
var/turf/T = get_turf(src)
T.assume_air(air_contents)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
return ..()
/obj/machinery/portable_atmospherics/scrubber/update_icon()
@@ -45,7 +45,7 @@
mixture.scrub_into(air_contents, volume_rate / mixture.return_volume(), scrubbing)
if(!holding)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
/obj/machinery/portable_atmospherics/scrubber/emp_act(severity)
. = ..()
diff --git a/code/modules/clothing/under/accessories.dm b/code/modules/clothing/under/accessories.dm
index 22b024c42f02b..8d27fa031b4e5 100755
--- a/code/modules/clothing/under/accessories.dm
+++ b/code/modules/clothing/under/accessories.dm
@@ -231,11 +231,17 @@
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = -10, ACID = 0, STAMINA = 0) //It's made of plasma. Of course it's flammable.
custom_materials = list(/datum/material/plasma=1000)
-/obj/item/clothing/accessory/medal/plasma/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature > 300)
- atmos_spawn_air("plasma=20;TEMP=[exposed_temperature]")
- visible_message(" \The [src] bursts into flame!","Your [src] bursts into flame!")
- qdel(src)
+/obj/item/clothing/accessory/medal/plasma/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
+
+/obj/item/clothing/accessory/medal/plasma/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > 300
+
+/obj/item/clothing/accessory/medal/plasma/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ atmos_spawn_air("plasma=20;TEMP=[exposed_temperature]")
+ visible_message("\The [src] bursts into flame!", "Your [src] bursts into flame!")
+ qdel(src)
/obj/item/clothing/accessory/medal/plasma/nobel_science
name = "nobel sciences award"
diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm
index 0f3a56cd1de40..3e03ebd316815 100644
--- a/code/modules/events/spacevine.dm
+++ b/code/modules/events/spacevine.dm
@@ -24,6 +24,10 @@
new /datum/spacevine_controller(T, list(pick(subtypesof(/datum/spacevine_mutation))), rand(10,100), rand(1,6)) //spawn a controller at turf with randomized stats and a single random mutation
message_admins("Event spacevine has been spawned in [ADMIN_VERBOSEJMP(T)].")
+/obj/structure/spacevine/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
+
/datum/spacevine_mutation
var/name = ""
var/severity = 1
@@ -570,10 +574,14 @@
if(!i && prob(100/severity))
qdel(src)
-/obj/structure/spacevine/temperature_expose(null, temp, volume)
+/obj/structure/spacevine/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return TRUE
+
+/obj/structure/spacevine/atmos_expose(datum/gas_mixture/air, exposed_temperature)
var/override = 0
+ var/volume = air.return_volume()
for(var/datum/spacevine_mutation/SM in mutations)
- override += SM.process_temperature(src, temp, volume)
+ override += SM.process_temperature(src, exposed_temperature, volume)
if(!override)
qdel(src)
diff --git a/code/modules/holodeck/area_copy.dm b/code/modules/holodeck/area_copy.dm
index a80e470ddd88b..399126f99401a 100644
--- a/code/modules/holodeck/area_copy.dm
+++ b/code/modules/holodeck/area_copy.dm
@@ -142,6 +142,6 @@ GLOBAL_LIST_INIT(duplicate_forbidden_vars,list(
if(toupdate.len)
for(var/turf/T1 in toupdate)
- CALCULATE_ADJACENT_TURFS(T1)
+ CALCULATE_ADJACENT_TURFS(T1, KILL_EXCITED)
return copiedobjs
diff --git a/code/modules/mapping/map_template.dm b/code/modules/mapping/map_template.dm
index f7719b3c233ba..f855707a46082 100644
--- a/code/modules/mapping/map_template.dm
+++ b/code/modules/mapping/map_template.dm
@@ -106,7 +106,7 @@
)
)
for(var/turf/affected_turf as anything in template_and_bordering_turfs)
- affected_turf.air_update_turf(TRUE)
+ affected_turf.air_update_turf(TRUE, TRUE)
affected_turf.levelupdate()
/datum/map_template/proc/load_new_z(orbital_body_type, list/level_traits = list(ZTRAIT_AWAY = TRUE))
diff --git a/code/modules/mining/coins.dm b/code/modules/mining/coins.dm
index a68925cda10ac..b0ed8413599a6 100644
--- a/code/modules/mining/coins.dm
+++ b/code/modules/mining/coins.dm
@@ -119,9 +119,11 @@
/obj/item/coin/plasma
custom_materials = list(/datum/material/plasma = 400)
-/obj/item/coin/plasma/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature > 300)
- plasma_ignition(0)
+/obj/item/coin/plasma/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > 300
+
+/obj/item/coin/plasma/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ plasma_ignition(0)
/obj/item/coin/plasma/bullet_act(obj/projectile/Proj)
diff --git a/code/modules/mining/equipment/survival_pod.dm b/code/modules/mining/equipment/survival_pod.dm
index 03d1e351f5f1b..bf4b7d32dd1cf 100644
--- a/code/modules/mining/equipment/survival_pod.dm
+++ b/code/modules/mining/equipment/survival_pod.dm
@@ -28,6 +28,7 @@
/obj/item/survivalcapsule/Destroy()
template = null // without this, capsules would be one use. per round.
+ air_update_turf(TRUE, FALSE)
. = ..()
/obj/item/survivalcapsule/examine(mob/user)
@@ -323,7 +324,7 @@
/obj/structure/fans/Initialize(mapload)
. = ..()
- air_update_turf(1)
+ air_update_turf(TRUE, TRUE)
//Inivisible, indestructible fans
/obj/structure/fans/tiny/invisible
diff --git a/code/modules/mob/living/carbon/alien/special/facehugger.dm b/code/modules/mob/living/carbon/alien/special/facehugger.dm
index f14ccc217ffdd..3233cfd6de0c8 100644
--- a/code/modules/mob/living/carbon/alien/special/facehugger.dm
+++ b/code/modules/mob/living/carbon/alien/special/facehugger.dm
@@ -28,6 +28,10 @@
var/strength = 5
var/attached = 0
+/obj/item/clothing/mask/facehugger/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
+
/obj/item/clothing/mask/facehugger/Initialize(mapload)
. = ..()
var/static/list/loc_connections = list(
@@ -95,9 +99,12 @@
. += "It looks like the proboscis has been removed."
-/obj/item/clothing/mask/facehugger/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature > 300)
- Die()
+/obj/item/clothing/mask/facehugger/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ Die()
+
+
+/obj/item/clothing/mask/facehugger/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return (exposed_temperature > 300)
/obj/item/clothing/mask/facehugger/equipped(mob/M)
. = ..()
diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm
index 19863f210eb53..d44fca0cd9dfc 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -146,7 +146,7 @@
if(breath)
loc.assume_air(breath)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
/mob/living/carbon/proc/has_smoke_protection()
if(HAS_TRAIT(src, TRAIT_NOBREATH))
diff --git a/code/modules/mob/living/simple_animal/bot/atmosbot.dm b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
index 6a42640d86618..9c0712e341b22 100644
--- a/code/modules/mob/living/simple_animal/bot/atmosbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
@@ -218,7 +218,7 @@
else
environment.adjust_moles(GAS_N2, transfer_moles * 0.7885)
environment.adjust_moles(GAS_O2, transfer_moles * 0.2115)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
new /obj/effect/temp_visual/vent_wind(get_turf(src))
/mob/living/simple_animal/bot/atmosbot/proc/scrub_toxins()
diff --git a/code/modules/mob/living/simple_animal/bot/firebot.dm b/code/modules/mob/living/simple_animal/bot/firebot.dm
index 3dad5161e63a0..32f488e9d80cc 100644
--- a/code/modules/mob/living/simple_animal/bot/firebot.dm
+++ b/code/modules/mob/living/simple_animal/bot/firebot.dm
@@ -33,7 +33,7 @@
var/speech_cooldown = 0
var/detected_cooldown = 0
- var/foam_cooldown = 0
+ COOLDOWN_DECLARE(foam_cooldown)
var/extinguish_people = TRUE
var/extinguish_fires = TRUE
@@ -49,6 +49,12 @@
create_extinguisher()
+/mob/living/simple_animal/bot/firebot/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
+
+
+
/mob/living/simple_animal/bot/firebot/bot_reset()
create_extinguisher()
@@ -274,11 +280,13 @@
return result
-/mob/living/simple_animal/bot/firebot/temperature_expose(datum/gas_mixture/air, temperature, volume)
- if((temperature > T0C + 200 || temperature < BODYTEMP_COLD_DAMAGE_LIMIT) && foam_cooldown + FOAM_INTERVAL < world.time)
+/mob/living/simple_animal/bot/firebot/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return (exposed_temperature > T0C + 200 || exposed_temperature < BODYTEMP_COLD_DAMAGE_LIMIT)
+
+/mob/living/simple_animal/bot/firebot/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ if(COOLDOWN_FINISHED(src, foam_cooldown))
new /obj/effect/particle_effect/foam/firefighting(loc)
- foam_cooldown = world.time
- ..()
+ COOLDOWN_START(src, foam_cooldown, FOAM_INTERVAL)
/mob/living/simple_animal/bot/firebot/proc/spray_water(atom/target, mob/user)
if(stationary_mode)
diff --git a/code/modules/power/apc/apc_main.dm b/code/modules/power/apc/apc_main.dm
index cada253c82ce5..e49c9cbe329c6 100644
--- a/code/modules/power/apc/apc_main.dm
+++ b/code/modules/power/apc/apc_main.dm
@@ -196,6 +196,18 @@
. = ..()
+/obj/machinery/power/apc/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
+
+/obj/machinery/power/apc/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return (exposed_temperature > 2000)
+
+/obj/machinery/power/apc/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ take_damage(min(exposed_temperature/100, 10), BURN)
+
+
+
/obj/machinery/power/apc/handle_atom_del(atom/A)
if(A == cell)
cell = null
diff --git a/code/modules/power/lighting/light.dm b/code/modules/power/lighting/light.dm
index eb877225f0701..7dda4ce6cd115 100644
--- a/code/modules/power/lighting/light.dm
+++ b/code/modules/power/lighting/light.dm
@@ -164,6 +164,10 @@
if(nightshift_enabled)
update(FALSE, TRUE, TRUE)
+/obj/machinery/light/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
+
/obj/machinery/light/Destroy()
var/area/A = get_area(src)
if(A)
@@ -197,7 +201,7 @@
if(on && turning_on)
return
-
+
var/area/local_area = get_area(src)
if(emergency_mode || (local_area?.fire))
. += mutable_appearance(overlayicon, "[base_state]_emergency")
@@ -669,7 +673,10 @@
// called when on fire
-/obj/machinery/light/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
+/obj/machinery/light/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > 673
+
+/obj/machinery/light/atmos_expose(datum/gas_mixture/air, exposed_temperature)
if(prob(max(0, exposed_temperature - 673))) //0% at <400C, 100% at >500C
break_light_tube()
diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm
index fdeda81ddd307..bf8b25f1295b5 100644
--- a/code/modules/power/singularity/containment_field.dm
+++ b/code/modules/power/singularity/containment_field.dm
@@ -28,6 +28,7 @@
/obj/machinery/field/containment/Destroy()
FG1?.fields -= src
FG2?.fields -= src
+ air_update_turf(TRUE, FALSE)
return ..()
/obj/machinery/field/containment/proc/block_singularity()
diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm
index f05ed4eedfe24..ab6ad558d629a 100644
--- a/code/modules/power/singularity/field_generator.dm
+++ b/code/modules/power/singularity/field_generator.dm
@@ -182,6 +182,8 @@ field_generator power level display
/obj/machinery/field/generator/proc/turn_off()
active = FG_OFFLINE
+ air_update_turf(TRUE, FALSE)
+ CanAtmosPass = ATMOS_PASS_YES
spawn(1)
cleanup()
while (warming_up>0 && !active)
@@ -252,7 +254,7 @@ field_generator power level display
return
move_resist = INFINITY
CanAtmosPass = ATMOS_PASS_NO
- air_update_turf(TRUE)
+ air_update_turf(TRUE, TRUE)
addtimer(CALLBACK(src, PROC_REF(setup_field), 1), 1)
addtimer(CALLBACK(src, PROC_REF(setup_field), 2), 2)
addtimer(CALLBACK(src, PROC_REF(setup_field), 4), 3)
diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm
index e26fb9848c3cd..4970113b34ccb 100644
--- a/code/modules/power/supermatter/supermatter.dm
+++ b/code/modules/power/supermatter/supermatter.dm
@@ -527,7 +527,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
if(produces_gas)
env.merge(removed)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
for(var/mob/living/carbon/human/l in viewers(HALLUCINATION_RANGE(power), src)) // If they can see it without mesons on. Bad on them.
if(HAS_TRAIT(l, TRAIT_MADNESS_IMMUNE) || (l.mind && HAS_TRAIT(l.mind, TRAIT_MADNESS_IMMUNE)))
diff --git a/code/modules/procedural_mapping/mapGeneratorModules/helpers.dm b/code/modules/procedural_mapping/mapGeneratorModules/helpers.dm
index 18607b919aba4..08d5cb781b9c8 100644
--- a/code/modules/procedural_mapping/mapGeneratorModules/helpers.dm
+++ b/code/modules/procedural_mapping/mapGeneratorModules/helpers.dm
@@ -12,11 +12,8 @@
var/list/map = mother.map
for(var/turf/open/T in map)
if(T.air)
- 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)
+ T.air.copy_from_turf(T)
+ SSair.add_to_active(T, TRUE)
/datum/mapGeneratorModule/bottomLayer/massdelete
spawnableAtoms = list()
diff --git a/code/modules/reagents/reagent_containers.dm b/code/modules/reagents/reagent_containers.dm
index b87527b7b4986..92a56f4a52f53 100644
--- a/code/modules/reagents/reagent_containers.dm
+++ b/code/modules/reagents/reagent_containers.dm
@@ -140,8 +140,8 @@
reagents.expose_temperature(1000)
return ..()
-/obj/item/reagent_containers/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- reagents.expose_temperature(exposed_temperature)
+/obj/item/reagent_containers/fire_act(temperature, volume)
+ reagents.expose_temperature(temperature)
/obj/item/reagent_containers/on_reagent_change(changetype)
update_icon()
diff --git a/code/modules/recycling/disposal/bin.dm b/code/modules/recycling/disposal/bin.dm
index f23d7a069cbff..3a25bd4c8c81b 100644
--- a/code/modules/recycling/disposal/bin.dm
+++ b/code/modules/recycling/disposal/bin.dm
@@ -395,16 +395,16 @@
var/atom/L = loc //recharging from loc turf
var/datum/gas_mixture/env = L.return_air()
+ if(!env.temperature)
+ return
var/pressure_delta = (SEND_PRESSURE*1.01) - air_contents.return_pressure()
- 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()
+ var/transfer_moles = 0.05 * delta_time * (pressure_delta*air_contents.volume)/(env.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(FALSE, FALSE)
//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 159024937c109..93aac3adb4d3b 100644
--- a/code/modules/recycling/disposal/holder.dm
+++ b/code/modules/recycling/disposal/holder.dm
@@ -147,7 +147,7 @@
// 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()
+ T.air_update_turf(FALSE, FALSE)
/obj/structure/disposalholder/AllowDrop()
return TRUE
diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm
index a64e6ec972681..4e90298ce3a9f 100644
--- a/code/modules/research/experimentor.dm
+++ b/code/modules/research/experimentor.dm
@@ -374,7 +374,7 @@
visible_message("[src] malfunctions, melting [exp_on] and leaking hot air!")
var/datum/gas_mixture/env = loc.return_air()
env.adjust_heat(100000)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
investigate_log("Experimentor has released hot air.", INVESTIGATE_EXPERIMENTOR)
ejectItem(TRUE)
else if(prob(EFFECT_PROB_MEDIUM-badThingCoeff))
@@ -413,7 +413,7 @@
visible_message("[src] malfunctions, shattering [exp_on] and leaking cold air!")
var/datum/gas_mixture/env = loc.return_air()
env.adjust_heat(-75000)
- air_update_turf()
+ air_update_turf(FALSE, FALSE)
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 2ea70ed407f99..312c09a28147e 100644
--- a/code/modules/research/server.dm
+++ b/code/modules/research/server.dm
@@ -92,8 +92,8 @@
var/perc = max((get_env_temp() - temp_tolerance_high), 0) * temp_penalty_coefficient / base_mining_income
env.adjust_heat(heating_power * perc * heat_gen)
- air_update_turf()
- src.air_update_turf()
+ air_update_turf(FALSE, FALSE)
+ src.air_update_turf(FALSE, FALSE)
else
current_temp = env ? env.return_temperature() : -1
diff --git a/code/modules/research/xenobiology/crossbreeding/_structures.dm b/code/modules/research/xenobiology/crossbreeding/_structures.dm
index 612030b771205..f98070baaedd7 100644
--- a/code/modules/research/xenobiology/crossbreeding/_structures.dm
+++ b/code/modules/research/xenobiology/crossbreeding/_structures.dm
@@ -150,7 +150,7 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals)
return
var/datum/gas_mixture/gas = T.return_air()
gas.set_temperature(T0C + 200)
- T.air_update_turf()
+ T.air_update_turf(FALSE, FALSE)
/obj/structure/slime_crystal/purple
colour = "purple"
@@ -191,7 +191,7 @@ 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()
+ T.air_update_turf(FALSE, FALSE)
/obj/structure/slime_crystal/metal
colour = "metal"
diff --git a/code/modules/research/xenobiology/crossbreeding/chilling.dm b/code/modules/research/xenobiology/crossbreeding/chilling.dm
index 9a1e4d432f6ce..756522f4b1bc9 100644
--- a/code/modules/research/xenobiology/crossbreeding/chilling.dm
+++ b/code/modules/research/xenobiology/crossbreeding/chilling.dm
@@ -108,7 +108,7 @@ Chilling extracts:
if(istype(G))
G.set_moles(GAS_PLASMA, 0)
filtered = TRUE
- T.air_update_turf()
+ T.air_update_turf(FALSE, FALSE)
if(filtered)
user.visible_message("Cracks spread throughout [src], and some air is sucked in!")
else
diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm
index 3c36e5ad5712e..b7f644b73a92f 100644
--- a/code/modules/shuttle/on_move.dm
+++ b/code/modules/shuttle/on_move.dm
@@ -78,8 +78,8 @@ All ShuttleMove procs go here
update_air_ref(-1)
//Air stuff
- newT.air_update_turf(TRUE)
- air_update_turf(TRUE)
+ newT.air_update_turf(TRUE, FALSE)
+ air_update_turf(TRUE, TRUE)
return TRUE
@@ -119,8 +119,8 @@ All ShuttleMove procs go here
return TRUE
/turf/proc/lateShuttleMove(turf/oldT)
- air_update_turf(TRUE)
- oldT.air_update_turf(TRUE)
+ air_update_turf(TRUE, blocks_air)
+ oldT.air_update_turf(TRUE, oldT.blocks_air)
/////////////////////////////////////////////////////////////////////////////////////
diff --git a/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm b/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm
index 9a43f7fdfc721..c226d12f89403 100644
--- a/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm
+++ b/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm
@@ -206,10 +206,10 @@
/datum/artifact_effect/airfreeze/proc/updateAir(atom/source, atom/oldLoc)
if(isturf(oldLoc))
var/turf/oldTurf = oldLoc
- oldTurf.air_update_turf(TRUE)
+ oldTurf.air_update_turf(TRUE, TRUE)
if(isturf(source.loc))
var/turf/newTurf = source.loc
- newTurf.air_update_turf(TRUE)
+ newTurf.air_update_turf(TRUE, TRUE)
//===================
// Atmos Stabilizer
diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm
index ecf6168e53570..57d405d02ab6f 100644
--- a/code/modules/vehicles/mecha/_mecha.dm
+++ b/code/modules/vehicles/mecha/_mecha.dm
@@ -212,6 +212,10 @@
become_hearing_sensitive(trait_source = ROUNDSTART_TRAIT)
update_step_speed()
+/obj/mecha/ComponentInitialize()
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive)
+
/obj/vehicle/sealed/mecha/Destroy()
for(var/M in occupants)
var/mob/living/occupant = M
diff --git a/code/modules/vehicles/mecha/mecha_defense.dm b/code/modules/vehicles/mecha/mecha_defense.dm
index 6c811227b11ed..7b1ed257ca41a 100644
--- a/code/modules/vehicles/mecha/mecha_defense.dm
+++ b/code/modules/vehicles/mecha/mecha_defense.dm
@@ -176,10 +176,13 @@
addtimer(CALLBACK(src, TYPE_PROC_REF(/obj/vehicle/sealed/mecha, restore_equipment)), 3 SECONDS, TIMER_UNIQUE | TIMER_OVERRIDE)
equipment_disabled = 1
-/obj/vehicle/sealed/mecha/temperature_expose(datum/gas_mixture/air, exposed_temperature, exposed_volume)
- if(exposed_temperature>max_temperature)
- log_message("Exposed to dangerous temperature.", LOG_MECHA, color="red")
- take_damage(5, BURN, 0, 1)
+/obj/vehicle/sealed/mecha/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature>max_temperature
+
+/obj/vehicle/sealed/mecha/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ log_message("Exposed to dangerous temperature.", LOG_MECHA, color="red")
+ take_damage(5, BURN, 0, 1)
+
/obj/vehicle/sealed/mecha/attackby(obj/item/W, mob/user, params)
diff --git a/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm b/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm
index 9834d24c07c9c..e0b80167c31e0 100644
--- a/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm
+++ b/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm
@@ -252,14 +252,14 @@
var/turf/T = get_turf(X)
var/datum/gas_mixture/mixture = T.return_air()
mixture.scrub_into(air_contents, volume_rate / mixture.return_volume(), scrubbing)
- X.air_update_turf()
+ X.air_update_turf(FALSE, FALSE)
//Throw sucked gas into our tile when we die
/datum/xenoartifact_trait/malfunction/absorbant/Destroy()
. = ..()
var/turf/T = get_turf(parent)
T.assume_air(air_contents)
- parent.air_update_turf()
+ parent.air_update_turf(FALSE, FALSE)
//============
// Hallucination, shows a random hallucination to the target once
From 1b5b26c2cd1fbfafcd792595b173442bf099f464 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Tue, 9 Jul 2024 13:38:02 +0200
Subject: [PATCH 002/114] https://github.com/tgstation/tgstation/pull/56081
---
code/__DEFINES/atmospherics.dm | 13 ++++++++++---
.../atmospherics/environmental/LINDA_turf_tile.dm | 6 +++---
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm
index 351d27e3c8a52..a31551174b3ca 100644
--- a/code/__DEFINES/atmospherics.dm
+++ b/code/__DEFINES/atmospherics.dm
@@ -47,12 +47,19 @@
/// Amount of air to take a from a tile
#define BREATH_PERCENTAGE (BREATH_VOLUME/CELL_VOLUME)
-
+/**
+ * Some further context on breakdown. Unlike dismantle, the breakdown ticker doesn't reset itself when a tile is added
+ * This is because we cannot expect maps to have small spaces, so we need to even ourselves out often
+ * We do this to avoid equalizing a large space in one tick, with some significant amount of say heat diff
+ * This way large areas don't suddenly all become cold at once, it acts more like a wave
+ *
+ * Because of this and the behavior of share(), the breakdown cycles value can be tweaked directly to effect how fast we want gas to move
+ */
//EXCITED GROUPS
/// number of FULL air controller ticks before an excited group breaks down (averages gas contents across turfs)
-#define EXCITED_GROUP_BREAKDOWN_CYCLES 4
+#define EXCITED_GROUP_BREAKDOWN_CYCLES 5
/// number of FULL air controller ticks before an excited group dismantles and removes its turfs from active
-#define EXCITED_GROUP_DISMANTLE_CYCLES 9 //Reset after 2 breakdowns
+#define EXCITED_GROUP_DISMANTLE_CYCLES (EXCITED_GROUP_BREAKDOWN_CYCLES * 2) + 1 //Reset after 2 breakdowns
/// Ratio of air that must move to/from a tile to reset group processing
#define MINIMUM_AIR_RATIO_TO_SUSPEND 0.1
/// Minimum ratio of air that must move to/from a tile
diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
index e626be4a721a6..3e9aa5b631540 100644
--- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
+++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
@@ -424,7 +424,7 @@
/datum/excited_group/proc/add_turf(turf/open/T)
turf_list += T
T.excited_group = src
- reset_cooldowns()
+ dismantle_cooldown = 0
if(should_display || SSair.display_all_groups)
display_turf(T)
@@ -439,14 +439,14 @@
if(should_display || SSair.display_all_groups)
E.hide_turfs()
display_turfs()
- reset_cooldowns()
+ dismantle_cooldown = 0
else
SSair.excited_groups -= src
for(var/t in turf_list)
var/turf/open/T = t
T.excited_group = E
E.turf_list += T
- E.reset_cooldowns()
+ E.dismantle_cooldown = 0
E.should_display = E.should_display | should_display
if(E.should_display || SSair.display_all_groups)
hide_turfs()
From da3c99a341ade9ebab05d0c8c57baec253fdc56d Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Tue, 9 Jul 2024 13:56:44 +0200
Subject: [PATCH 003/114] The thingy
---
code/__DEFINES/subsystems.dm | 15 ++++++---------
code/controllers/subsystem/air.dm | 2 ++
2 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm
index 02ac302b61ea8..ea4cb8cd158b9 100644
--- a/code/__DEFINES/subsystems.dm
+++ b/code/__DEFINES/subsystems.dm
@@ -212,18 +212,15 @@
#define RUNLEVELS_DEFAULT (RUNLEVEL_SETUP | RUNLEVEL_GAME | RUNLEVEL_POSTGAME)
-// SSair run section
+
+// Air subsystem subtasks
#define SSAIR_PIPENETS 1
#define SSAIR_ATMOSMACHINERY 2
#define SSAIR_ACTIVETURFS 3
-#define SSAIR_EXCITEDGROUPS 4
-#define SSAIR_HIGHPRESSURE 5
-#define SSAIR_HOTSPOTS 6
-#define SSAIR_SUPERCONDUCTIVITY 7
-#define SSAIR_EXCITEDCLEANUP 4
-#define SSAIR_EXCITEDGROUPS 5
-#define SSAIR_HIGHPRESSURE 6
-#define SSAIR_HOTSPOTS 7
+#define SSAIR_HOTSPOTS 4
+#define SSAIR_EXCITEDCLEANUP 5
+#define SSAIR_EXCITEDGROUPS 6
+#define SSAIR_HIGHPRESSURE 7
#define SSAIR_SUPERCONDUCTIVITY 8
#define SSAIR_PROCESS_ATOMS 9
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index c9cf98be5f651..7f26556c6a146 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -17,6 +17,8 @@ SUBSYSTEM_DEF(air)
var/cost_rebuilds = 0
var/cost_atmos_machinery = 0
var/cost_ex_cleanup = 0
+ var/cost_rebuilds = 0
+ var/cost_hotspots = 0
var/list/excited_groups = list()
var/list/cleanup_ex_groups = list()
From ca63e669b403bc3da4bf84e473b26db652a7d7b7 Mon Sep 17 00:00:00 2001
From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Date: Sat, 23 Jan 2021 01:56:19 -0800
Subject: [PATCH 004/114] Prevents the most common case of fire settling with
an excited group (#56317)
Basically when a group with a breakdown timer one tick away from settling merges with a group with hotspots in
it, and the one with a high breakdown timer is larger, the group would settle without respecting the timer of
the hotspot group, causing fwoosh levels of flame.
There's two other ways to achieve this, if you had one group of tiles that are close to the same gasmix as
another
group, and they became inactive, we'd have the same issue. I've solved this by moving the hotspot subprocess to
after active turfs and before excited groups, just for safety ya feel me?
It's still in theory possible, but much much harder. The hard solution to this would be to integrate heat with
how we reset excited group timers, and split excited groups into smaller portions, but I'm not sure I like that
idea.
I need to mull it over.
---
code/__DEFINES/subsystems.dm | 32 ++++++++--------
code/controllers/subsystem/air.dm | 37 +++++++++++--------
.../environmental/LINDA_turf_tile.dm | 4 +-
3 files changed, 40 insertions(+), 33 deletions(-)
diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm
index ea4cb8cd158b9..7998d3401fb64 100644
--- a/code/__DEFINES/subsystems.dm
+++ b/code/__DEFINES/subsystems.dm
@@ -213,22 +213,6 @@
#define RUNLEVELS_DEFAULT (RUNLEVEL_SETUP | RUNLEVEL_GAME | RUNLEVEL_POSTGAME)
-// Air subsystem subtasks
-#define SSAIR_PIPENETS 1
-#define SSAIR_ATMOSMACHINERY 2
-#define SSAIR_ACTIVETURFS 3
-#define SSAIR_HOTSPOTS 4
-#define SSAIR_EXCITEDCLEANUP 5
-#define SSAIR_EXCITEDGROUPS 6
-#define SSAIR_HIGHPRESSURE 7
-#define SSAIR_SUPERCONDUCTIVITY 8
-#define SSAIR_PROCESS_ATOMS 9
-
-// Explosion Subsystem subtasks
-#define SSEXPLOSIONS_MOVABLES 1
-#define SSEXPLOSIONS_TURFS 2
-#define SSEXPLOSIONS_THROWS 3
-
//SSticker.current_state values
/// Game is loading
#define GAME_STATE_STARTUP 0
@@ -274,6 +258,22 @@
*/
#define addtimer(args...) _addtimer(args, file = __FILE__, line = __LINE__)
+// Air subsystem subtasks
+#define SSAIR_PIPENETS 1
+#define SSAIR_ATMOSMACHINERY 2
+#define SSAIR_ACTIVETURFS 3
+#define SSAIR_HOTSPOTS 4
+#define SSAIR_EXCITEDCLEANUP 5
+#define SSAIR_EXCITEDGROUPS 6
+#define SSAIR_HIGHPRESSURE 7
+#define SSAIR_SUPERCONDUCTIVITY 8
+#define SSAIR_PROCESS_ATOMS 9
+
+// Explosion Subsystem subtasks
+#define SSEXPLOSIONS_MOVABLES 1
+#define SSEXPLOSIONS_TURFS 2
+#define SSEXPLOSIONS_THROWS 3
+
// Subsystem delta times or tickrates, in seconds. I.e, how many seconds in between each process() call for objects being processed by that subsystem.
// Only use these defines if you want to access some other objects processing delta_time, otherwise use the delta_time that is sent as a parameter to process()
#define SSMACHINES_DT (SSmachines.wait/10)
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index 7f26556c6a146..5afc53d963141 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -9,16 +9,20 @@ SUBSYSTEM_DEF(air)
var/cached_cost = 0
var/cost_atoms = 0
var/cost_turfs = 0
+ var/cost_hotspots = 0
+ var/cost_ex_cleanup = 0
var/cost_groups = 0
var/cost_highpressure = 0
- var/cost_hotspots = 0
var/cost_superconductivity = 0
var/cost_pipenets = 0
- var/cost_rebuilds = 0
var/cost_atmos_machinery = 0
+<<<<<<< HEAD
var/cost_ex_cleanup = 0
var/cost_rebuilds = 0
var/cost_hotspots = 0
+=======
+ var/cost_rebuilds = 0
+>>>>>>> 4cd1db4e6f0 (Prevents the most common case of fire settling with an excited group (#56317))
var/list/excited_groups = list()
var/list/cleanup_ex_groups = list()
@@ -52,10 +56,10 @@ SUBSYSTEM_DEF(air)
/datum/controller/subsystem/air/stat_entry(msg)
msg += "C:{"
msg += "AT:[round(cost_turfs,1)]|"
+ msg += "HS:[round(cost_hotspots,1)]|"
msg += "CL:[round(cost_ex_cleanup, 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 += "AM:[round(cost_atmos_machinery,1)]|"
@@ -63,14 +67,15 @@ SUBSYSTEM_DEF(air)
msg += "RB:[round(cost_rebuilds,1)]|"
msg += "} "
msg += "AT:[active_turfs.len]|"
+ msg += "HS:[hotspots.len]|"
msg += "CL:[cleanup_ex_groups.len]|"
msg += "EG:[excited_groups.len]|"
msg += "HP:[high_pressure_delta.len]|"
- msg += "HS:[hotspots.len]|"
msg += "SC:[active_super_conductivity.len]|"
msg += "PN:[networks.len]|"
msg += "AM:[atmos_machinery.len]|"
msg += "AO:[atom_process.len]|"
+ msg += "RB:[pipenets_needing_rebuilt.len]|"
msg += "AT/MS:[round((cost ? active_turfs.len/cost : 0),0.1)]"
return ..()
@@ -136,6 +141,18 @@ SUBSYSTEM_DEF(air)
return
cost_turfs = MC_AVERAGE(cost_turfs, TICK_DELTA_TO_MS(cached_cost))
resumed = FALSE
+ currentpart = SSAIR_HOTSPOTS
+
+ if(currentpart == SSAIR_HOTSPOTS) //We do this before excited groups to allow breakdowns to be independent of adding turfs while still *mostly preventing mass fires
+ timer = TICK_USAGE_REAL
+ if(!resumed)
+ cached_cost = 0
+ process_hotspots(delta_time, 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_EXCITEDCLEANUP
if(currentpart == SSAIR_EXCITEDCLEANUP)
@@ -172,18 +189,6 @@ SUBSYSTEM_DEF(air)
return
cost_highpressure = MC_AVERAGE(cost_highpressure, TICK_DELTA_TO_MS(cached_cost))
resumed = FALSE
- currentpart = SSAIR_HOTSPOTS
-
- if(currentpart == SSAIR_HOTSPOTS)
- timer = TICK_USAGE_REAL
- if(!resumed)
- cached_cost = 0
- process_hotspots(delta_time, 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
if(currentpart == SSAIR_SUPERCONDUCTIVITY)
diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
index 3e9aa5b631540..13b9577a9e746 100644
--- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
+++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
@@ -439,6 +439,7 @@
if(should_display || SSair.display_all_groups)
E.hide_turfs()
display_turfs()
+ breakdown_cooldown = min(breakdown_cooldown, E.breakdown_cooldown) //Take the smaller of the two options
dismantle_cooldown = 0
else
SSair.excited_groups -= src
@@ -446,11 +447,12 @@
var/turf/open/T = t
T.excited_group = E
E.turf_list += T
- E.dismantle_cooldown = 0
E.should_display = E.should_display | should_display
if(E.should_display || SSair.display_all_groups)
hide_turfs()
E.display_turfs()
+ E.breakdown_cooldown = min(breakdown_cooldown, E.breakdown_cooldown)
+ E.dismantle_cooldown = 0
/datum/excited_group/proc/reset_cooldowns()
breakdown_cooldown = 0
From eb223d42cab100b289bf1f88e584442837f57e5e Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Tue, 9 Jul 2024 14:00:54 +0200
Subject: [PATCH 005/114] some dumb stuff
---
code/controllers/subsystem/air.dm | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index 5afc53d963141..2d3ee59cb714d 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -16,13 +16,7 @@ SUBSYSTEM_DEF(air)
var/cost_superconductivity = 0
var/cost_pipenets = 0
var/cost_atmos_machinery = 0
-<<<<<<< HEAD
- var/cost_ex_cleanup = 0
- var/cost_rebuilds = 0
- var/cost_hotspots = 0
-=======
var/cost_rebuilds = 0
->>>>>>> 4cd1db4e6f0 (Prevents the most common case of fire settling with an excited group (#56317))
var/list/excited_groups = list()
var/list/cleanup_ex_groups = list()
@@ -676,6 +670,7 @@ GLOBAL_LIST_EMPTY(colored_images)
return TRUE
if("toggle_user_display")
var/atom/movable/screen/plane_master/plane = ui.user.hud_used.plane_masters["[ATMOS_GROUP_PLANE]"]
+
if(!plane.alpha)
if(ui.user.client)
ui.user.client.images += GLOB.colored_images
From 90b2df2d38d488790e120580016d1afe4d5c1631 Mon Sep 17 00:00:00 2001
From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Date: Sun, 7 Feb 2021 12:14:02 -0800
Subject: [PATCH 006/114] Fixes the atmos subsystem locking up on rare
occasions (#56556)
---
code/controllers/subsystem/air.dm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index 2d3ee59cb714d..1774daa3cd9a2 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -94,6 +94,8 @@ SUBSYSTEM_DEF(air)
var/list/pipenet_rebuilds = pipenets_needing_rebuilt
for(var/thing in pipenet_rebuilds)
var/obj/machinery/atmospherics/AT = thing
+ if(!thing) //If a null somehow shows up here, this next line runtimes and the subsystem dies
+ continue
AT.build_network()
cached_cost += TICK_USAGE_REAL - timer
pipenets_needing_rebuilt.Cut()
From 738ba573f377c25562772fdef2c8e3850a88b519 Mon Sep 17 00:00:00 2001
From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Date: Thu, 4 Mar 2021 13:13:56 -0800
Subject: [PATCH 007/114] Removes the excited cleanup subprocess (#57381)
When I was in the process of developing my atmos fixes/optimizations, I focused heavily on maintaining the area
of excited groups, since growing delayed self_breakdown(), and lead to shitty behavior which I thought was the
result of my sleeping changes.
This was not the case, those who came before me knew better, as always.
Especially now, since I've unhooked breakdown from excited groups gaining new tiles, my concern was unfounded,
and actually lead to shitty behavior and wasted time.
I failed to recognize the value in random garbage_collect()s, they help prevent mass gas equalization over large
spaces, they make gas appear to move more consistently when in these large spaces, and they lessen the amount of
self_breakdown()s over large turf lists, which is very helpful for lowering the overall overtime of the
subsystem.
This fixes my mistake, and purges the excited cleanup subprocess from the air subsystem. It's free real estate
babyyyyyyyy.
---
code/__DEFINES/atmospherics.dm | 5 --
code/__DEFINES/flags.dm | 2 -
code/__DEFINES/subsystems.dm | 9 ++--
code/controllers/subsystem/air.dm | 46 +------------------
code/modules/atmospherics/Atmospherics.md | 23 ++++------
.../environmental/LINDA_turf_tile.dm | 43 +----------------
6 files changed, 15 insertions(+), 113 deletions(-)
diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm
index a31551174b3ca..5d75de96148ee 100644
--- a/code/__DEFINES/atmospherics.dm
+++ b/code/__DEFINES/atmospherics.dm
@@ -77,11 +77,6 @@
#define MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION (T20C+80)
#define MINIMUM_TEMPERATURE_START_SUPERCONDUCTION (T20C+400)
-//Excited Group Cleanup helper defines
-#define EX_CLEANUP_BREAKDOWN 1
-#define EX_CLEANUP_DISMANTLE 2
-#define EX_CLEANUP_TURFS 3
-
//HEAT TRANSFER COEFFICIENTS
//Must be between 0 and 1. Values closer to 1 equalize temperature faster
//Should not exceed 0.4 else strange heat flow occur
diff --git a/code/__DEFINES/flags.dm b/code/__DEFINES/flags.dm
index cc7e14e4fa632..0031a68b321ec 100644
--- a/code/__DEFINES/flags.dm
+++ b/code/__DEFINES/flags.dm
@@ -58,8 +58,6 @@ GLOBAL_LIST_INIT(bitflags, list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 204
#define NO_DIRECT_ACCESS_FROM_CONTENTS_1 (1<<14)
/// Is this object currently processing in the atmos object list?
#define ATMOS_IS_PROCESSING_1 (1<<15)
-/// Should this tile be cleaned up and reinserted into an excited group?
-#define EXCITED_CLEANUP_1 (1 << 16)
//turf-only flags. These use flags_1 too.
// These exist to cover /turf and /area at the same time
diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm
index 7998d3401fb64..92842809ecde2 100644
--- a/code/__DEFINES/subsystems.dm
+++ b/code/__DEFINES/subsystems.dm
@@ -263,11 +263,10 @@
#define SSAIR_ATMOSMACHINERY 2
#define SSAIR_ACTIVETURFS 3
#define SSAIR_HOTSPOTS 4
-#define SSAIR_EXCITEDCLEANUP 5
-#define SSAIR_EXCITEDGROUPS 6
-#define SSAIR_HIGHPRESSURE 7
-#define SSAIR_SUPERCONDUCTIVITY 8
-#define SSAIR_PROCESS_ATOMS 9
+#define SSAIR_EXCITEDGROUPS 5
+#define SSAIR_HIGHPRESSURE 6
+#define SSAIR_SUPERCONDUCTIVITY 7
+#define SSAIR_PROCESS_ATOMS 8
// Explosion Subsystem subtasks
#define SSEXPLOSIONS_MOVABLES 1
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index 1774daa3cd9a2..bba56d4191543 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -10,7 +10,6 @@ SUBSYSTEM_DEF(air)
var/cost_atoms = 0
var/cost_turfs = 0
var/cost_hotspots = 0
- var/cost_ex_cleanup = 0
var/cost_groups = 0
var/cost_highpressure = 0
var/cost_superconductivity = 0
@@ -19,7 +18,6 @@ SUBSYSTEM_DEF(air)
var/cost_rebuilds = 0
var/list/excited_groups = list()
- var/list/cleanup_ex_groups = list()
var/list/active_turfs = list()
var/list/hotspots = list()
var/list/networks = list()
@@ -51,7 +49,6 @@ SUBSYSTEM_DEF(air)
msg += "C:{"
msg += "AT:[round(cost_turfs,1)]|"
msg += "HS:[round(cost_hotspots,1)]|"
- msg += "CL:[round(cost_ex_cleanup, 1)]|"
msg += "EG:[round(cost_groups,1)]|"
msg += "HP:[round(cost_highpressure,1)]|"
msg += "SC:[round(cost_superconductivity,1)]|"
@@ -62,7 +59,6 @@ SUBSYSTEM_DEF(air)
msg += "} "
msg += "AT:[active_turfs.len]|"
msg += "HS:[hotspots.len]|"
- msg += "CL:[cleanup_ex_groups.len]|"
msg += "EG:[excited_groups.len]|"
msg += "HP:[high_pressure_delta.len]|"
msg += "SC:[active_super_conductivity.len]|"
@@ -149,18 +145,6 @@ SUBSYSTEM_DEF(air)
return
cost_hotspots = MC_AVERAGE(cost_hotspots, TICK_DELTA_TO_MS(cached_cost))
resumed = FALSE
- currentpart = SSAIR_EXCITEDCLEANUP
-
- if(currentpart == SSAIR_EXCITEDCLEANUP)
- timer = TICK_USAGE_REAL
- if(!resumed)
- cached_cost = 0
- process_excited_cleanup(resumed)
- cached_cost += TICK_USAGE_REAL - timer
- if(state != SS_RUNNING)
- return
- cost_ex_cleanup = MC_AVERAGE(cost_ex_cleanup, TICK_DELTA_TO_MS(cached_cost))
- resumed = FALSE
currentpart = SSAIR_EXCITEDGROUPS
if(currentpart == SSAIR_EXCITEDGROUPS)
@@ -312,30 +296,6 @@ SUBSYSTEM_DEF(air)
if (MC_TICK_CHECK)
return
-/datum/controller/subsystem/air/proc/process_excited_cleanup(resumed = FALSE)
- //cache for sanic speed
- var/fire_count = times_fired
- if (!resumed)
- src.currentrun = cleanup_ex_groups.Copy()
- cleanup_ex_groups.Cut() //Cut the list here so any later breakdowns get added properly
- //cache for sanic speed (lists are references anyways)
- var/list/currentrun = src.currentrun
- while(currentrun.len)
- var/list/turf_packet = currentrun[currentrun.len]
- var/breakdown = turf_packet[EX_CLEANUP_BREAKDOWN]
- var/dismantle = turf_packet[EX_CLEANUP_DISMANTLE]
- var/list/turf_list = turf_packet[EX_CLEANUP_TURFS]
- while(turf_list.len) //The turf list
- var/turf/open/T = turf_list[turf_list.len]
- //I'd normally check for nulls here, but turfs are dumb with refs, so it's not an issue
- //We don't allow planetary turfs as a semi stopgap to worldspanning groups
- if(istype(T) && !istype(T.air, /datum/gas_mixture/immutable) && !T.planetary_atmos)
- T.cleanup_group(fire_count, breakdown, dismantle)
- turf_list.len--
- if (MC_TICK_CHECK)
- return
- currentrun.len-- //If we process all the turfs in a packet, del it.
-
/datum/controller/subsystem/air/proc/process_excited_groups(resumed = FALSE)
if (!resumed)
src.currentrun = excited_groups.Copy()
@@ -366,7 +326,7 @@ SUBSYSTEM_DEF(air)
if(T.excited_group)
//If this fires during active turfs it'll cause a slight removal of active turfs, as they breakdown if they have no excited group
//The group also expands by a tile per rebuild on each edge, suffering
- T.excited_group.garbage_collect(will_cleanup = TRUE) //Poke everybody in the group and reform
+ T.excited_group.garbage_collect() //Kill the excited group, it'll reform on its own later
///Puts an active turf to sleep so it doesn't process. Do this without cleaning up its excited group.
/datum/controller/subsystem/air/proc/sleep_active_turf(turf/open/T)
@@ -404,10 +364,6 @@ SUBSYSTEM_DEF(air)
else
T.requires_activation = TRUE
-/datum/controller/subsystem/air/proc/add_to_cleanup(datum/excited_group/ex_grp)
- //Store the cooldowns. If we're already doing cleanup, DO NOT add to the currently processing list, infinite loop man bad.
- cleanup_ex_groups += list(list(ex_grp.breakdown_cooldown, ex_grp.dismantle_cooldown, ex_grp.turf_list.Copy()))
-
/datum/controller/subsystem/air/StartLoadingMap()
LAZYINITLIST(queued_for_activation)
map_loading = TRUE
diff --git a/code/modules/atmospherics/Atmospherics.md b/code/modules/atmospherics/Atmospherics.md
index c5ab3e7e10ad6..5baa739fd4adc 100644
--- a/code/modules/atmospherics/Atmospherics.md
+++ b/code/modules/atmospherics/Atmospherics.md
@@ -50,28 +50,25 @@ Now then, into the breach.
- This is the heart and soul of environmental atmos, see more details below
- All you need to know right now is it manages moving gas from tile to tile
- Calls `process_cell()` on each `/turf/open` in the `active_turfs` list
-5. Excited group cleanup
- - Rebuilds excited groups when the structure of their turfs changes
- - Calls `cleanup_group()` on each `/turf/open` in the `cleanup_ex_groups` list
-6. Excited groups
+5. Excited groups
- Manages excited groups, which are core to working flow simulation
- More details to come, they handle differences between gasmixtures when active turfs can't do the job
- Increases the `breakdown_cooldown` and `dismantle_cooldown` for each `/datum/excited_group` in the `excited_groups` list
- If either cooldown for a given excited group has passed its threshold
- Calls `self_breakdown()` or `dismantle()` appropriately on the excited group.
-7. High pressure deltas
+6. High pressure deltas
- Takes the gas movement from Active Turfs and uses it to move objects on said turfs
- Calls `high_pressure_movements()` on each `/turf/open` in the `high_pressure_delta` list.
- Sets each turf's `pressure_difference` to 0
-8. Hotspots
+7. Hotspots
- These are what you might know as fire, at least the effect of it.
- They deal with burning things, and color calculations, lots of color calculations
- Calls `process()` on each `/obj/effect/hotspot` in the `hotspots` list
-9. Superconductivity
+8. Superconductivity
- Moves heat through turfs that don't allow gas to pass
- Deals with heating up the floor below windows, and some other more painful heat stuff
- Calls `super_conduct()` on each `/turf` in the `active_super_conductivity` list
-10. Atoms
+9. Atoms
- Processes things in the world that should know about gas changes, used to account for turfs sleeping, I'll get more into that in a bit
- Calls `process_exposure()` on each `/atom` in the `atom_process` list
@@ -167,7 +164,7 @@ This is a rather large subject, we will need to cover gas flow, turf sleeping, s
Active turfs are the backbone of how gas moves from tile to tile. While most of `process_cell()` should be easy enough to understand, I am going to go into some detail about archiving, since I think it's a common source of hiccups.
-* *`archived_cycle`* this var stores the last cycle of the atmos loop that the turf processed on. The key point to notice here is that when processing a turf, we don't share with all its neighbors, we only talk to those who haven't processed yet. This is because the remainder of `process_cell()` and especially `share()` ought to be similar in form to addition. We can add in any order we like, and we only need to add once. This is what archived gases are for by the way, they store the state of the relevant tile before any processing occurs. This isn't strictly the case unfortunately, but it's minor enough that we can ignore the effects.
+* *`archived_cycle`* this var stores the last cycle of the atmos loop that the turf processed on. The key point to notice here is that when processing a turf, we don't share with all its neighbors, we only talk to those who haven't processed yet. This is because the remainder of `process_cell()` and especially `share()` ought to be similar in form to addition. We can add in any order we like, and we only need to add once. This is what archived gases are for by the way, they store the state of the relevant tile before any processing occurs. This additive behavior isn't strictly the case unfortunately, but it's minor enough that we can ignore the effects.
Alright then, with that out of the way, what is an active turf.
@@ -216,13 +213,11 @@ When a turf is removed from active, the excited group is broken down, as it's as
Now this issue here is we'd like to keep this napping, but we don't want to `garbage_collect()` the excited group constantly.
-So, a new proc was added, `sleep_active_turf()`. It removes the active turf from processing, but doesn't `garbage_collect()` the group. This has some additional costs however.
+So, a new proc was added, `sleep_active_turf()`. It removes the active turf from processing, but doesn't `garbage_collect()` the group.
-The excited group's `garbage_collect()` proc is the real issue here. When the landscape of the map changes, we need to rebuild the groups, as we don't want to rebuild them across a wall. The old way relied on the group rebuilding itself, in `process_cell()`, but since players can cause rebuilds quite often, can't afford to just wake all the turfs up.
+You'd think this would cause issues with maintaining the shape of an excited group, however this isn't actually a priority, since `garbage_collect()` and the subsequent rebuild in `process_cell()` causes turfs that are actually active to reform, just as it always has. This has benefits, as it lessens the tendency of one group to cover a huge space, equalize all at once, and fuck with things.
-Thus, we have excited group cleanup, which takes all the old turfs, and reaches out to their neighbors to rebuild the group. This allows us to rebuild excited groups without relying on active turfs.
-
-There's another issue here too, how do we deal with things that react to heat? A firelock shouldn't just open because the turf that the alarm is on went to sleep. Thus, atom_process, as I mentioned before, a list of atoms with requirements and things to do. It processes them until their requirements are not met, then it removes them from its list them.
+There's another issue here however, how do we deal with things that react to heat? A firelock shouldn't just open because the turf that the alarm is on went to sleep. Thus, atom_process, as I mentioned before, a list of atoms with requirements and things to do. It processes them until their requirements are not met, then it removes them from its list them.
There's one more major aspect of environmental atmos to cover, and while it's not the most misunderstood, it is the code with the worst set dressing.
diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
index 13b9577a9e746..e501ef607a4d4 100644
--- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
+++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
@@ -331,43 +331,6 @@
significant_share_ticker = cached_ticker //Save our changes
temperature_expose(our_air, our_air.temperature)
-////////////////////Excited Group Cleanup///////////////////////
-
-///For dealing with reforming excited groups, this prevents clog in process_cell
-/turf/open/proc/cleanup_group(fire_count, breakdown, dismantle)
- current_cycle = fire_count + 0.5 //It works, I know it's dumb but it works
-
- //cache for sanic speed
- var/list/adjacent_turfs = atmos_adjacent_turfs
- var/datum/excited_group/our_excited_group = excited_group
-
- for(var/t in adjacent_turfs)
- var/turf/open/enemy_tile = t
-
- if(current_cycle <= enemy_tile.current_cycle)
- continue
-
- //cache for sanic speed
- var/datum/excited_group/enemy_excited_group = enemy_tile.excited_group
- //If we are both in an excited group, and they aren't the same, merge.
- //Otherwise make/take one to join and get to it
- if(our_excited_group && enemy_excited_group)
- if(our_excited_group != enemy_excited_group)
- //combine groups (this also handles updating the excited_group var of all involved turfs)
- our_excited_group.merge_groups(enemy_excited_group)
- our_excited_group = excited_group //update our cache
- else
- var/datum/excited_group/EG = our_excited_group || enemy_excited_group || new
- if(!our_excited_group)
- EG.add_turf(src)
- if(!enemy_excited_group && enemy_tile.flags_1 & EXCITED_CLEANUP_1)
- EG.add_turf(enemy_tile)
- our_excited_group = excited_group
- if(our_excited_group)
- our_excited_group.breakdown_cooldown = breakdown //Update with the old data
- our_excited_group.dismantle_cooldown = dismantle
- flags_1 &= ~EXCITED_CLEANUP_1
-
//////////////////////////SPACEWIND/////////////////////////////
/turf/open/proc/consider_pressure_difference(turf/T, difference)
@@ -521,16 +484,12 @@
garbage_collect()
//Breaks down the excited group, this doesn't sleep the turfs mind, just removes them from the group
-/datum/excited_group/proc/garbage_collect(will_cleanup = FALSE)
+/datum/excited_group/proc/garbage_collect()
if(display_id) //If we ever did make those changes
hide_turfs()
for(var/t in turf_list)
var/turf/open/T = t
T.excited_group = null
- if(will_cleanup)
- T.flags_1 |= EXCITED_CLEANUP_1
- if(will_cleanup)
- SSair.add_to_cleanup(src)
turf_list.Cut()
SSair.excited_groups -= src
if(SSair.currentpart == SSAIR_EXCITEDGROUPS)
From 8567d274a60e479c5f0980d1171a91d8a8211607 Mon Sep 17 00:00:00 2001
From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Date: Sun, 7 Mar 2021 22:11:02 -0800
Subject: [PATCH 008/114] Removes delta_time from the atmos system. (#57478)
Why?
delta_time is about maintaining behavior when changing the wait of subsystems
SSair's wait is dynamic by design, we hardly ever hit below it. What is important then, is maintaining behavior
across each process.
The key point here is making sure excited groups and turfs share the same amoumt of gas each process, no matter
how high or low wait is. This is why subprocesses are a thing in the first place, to maintain this consistency.
delta_time fucks with this, and will end up changing behavior if wait is ever changed.
---
code/__DEFINES/atmospherics.dm | 4 +--
code/controllers/subsystem/air.dm | 19 +++++-----
.../components/binary_devices/volume_pump.dm | 11 +++---
.../components/trinary_devices/filter.dm | 35 +++++++++++++++----
.../components/unary_devices/cryo.dm | 35 +++++++++++--------
.../components/unary_devices/vent_scrubber.dm | 4 +--
.../machinery/portable/scrubber.dm | 2 +-
7 files changed, 70 insertions(+), 40 deletions(-)
diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm
index 5d75de96148ee..4932ea3e4304d 100644
--- a/code/__DEFINES/atmospherics.dm
+++ b/code/__DEFINES/atmospherics.dm
@@ -219,9 +219,9 @@
/// (kPa) What pressure pumps and powered equipment max out at.
#define MAX_OUTPUT_PRESSURE 4500
/// (L/s) Maximum speed powered equipment can work at.
-#define MAX_TRANSFER_RATE 400
+#define MAX_TRANSFER_RATE 200
/// How many percent of the contents that an overclocked volume pumps leak into the air
-#define VOLUME_PUMP_LEAK_AMOUNT 0.2
+#define VOLUME_PUMP_LEAK_AMOUNT 0.1
//used for device_type vars
#define UNARY 1
#define BINARY 2
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index bba56d4191543..d608ea59296db 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -82,7 +82,6 @@ SUBSYSTEM_DEF(air)
/datum/controller/subsystem/air/fire(resumed = FALSE)
var/timer = TICK_USAGE_REAL
- var/delta_time = wait * 0.1
// Every time we fire, we want to make sure pipenets are rebuilt. The game state could have changed between each fire() proc call
// and anything missing a pipenet can lead to unintended behaviour at worse and various runtimes at best.
@@ -103,7 +102,7 @@ SUBSYSTEM_DEF(air)
timer = TICK_USAGE_REAL
if(!resumed)
cached_cost = 0
- process_pipenets(delta_time, resumed)
+ process_pipenets(resumed)
cached_cost += TICK_USAGE_REAL - timer
if(state != SS_RUNNING)
return
@@ -115,7 +114,7 @@ SUBSYSTEM_DEF(air)
timer = TICK_USAGE_REAL
if(!resumed)
cached_cost = 0
- process_atmos_machinery(delta_time, resumed)
+ process_atmos_machinery(resumed)
cached_cost += TICK_USAGE_REAL - timer
if(state != SS_RUNNING)
return
@@ -139,7 +138,7 @@ SUBSYSTEM_DEF(air)
timer = TICK_USAGE_REAL
if(!resumed)
cached_cost = 0
- process_hotspots(delta_time, resumed)
+ process_hotspots(resumed)
cached_cost += TICK_USAGE_REAL - timer
if(state != SS_RUNNING)
return
@@ -198,7 +197,7 @@ SUBSYSTEM_DEF(air)
SStgui.update_uis(SSair) //Lightning fast debugging motherfucker
-/datum/controller/subsystem/air/proc/process_pipenets(delta_time, resumed = FALSE)
+/datum/controller/subsystem/air/proc/process_pipenets(resumed = FALSE)
if (!resumed)
src.currentrun = networks.Copy()
//cache for sanic speed (lists are references anyways)
@@ -207,7 +206,7 @@ SUBSYSTEM_DEF(air)
var/datum/thing = currentrun[currentrun.len]
currentrun.len--
if(thing)
- thing.process(delta_time)
+ thing.process()
else
networks.Remove(thing)
if(MC_TICK_CHECK)
@@ -231,7 +230,7 @@ SUBSYSTEM_DEF(air)
if(MC_TICK_CHECK)
return
-/datum/controller/subsystem/air/proc/process_atmos_machinery(delta_time, resumed = FALSE)
+/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)
@@ -239,7 +238,7 @@ SUBSYSTEM_DEF(air)
while(currentrun.len)
var/obj/machinery/M = currentrun[currentrun.len]
currentrun.len--
- if(!M || (M.process_atmos(delta_time) == PROCESS_KILL))
+ if(!M || (M.process_atmos() == PROCESS_KILL))
atmos_machinery.Remove(M)
if(MC_TICK_CHECK)
return
@@ -257,7 +256,7 @@ SUBSYSTEM_DEF(air)
if(MC_TICK_CHECK)
return
-/datum/controller/subsystem/air/proc/process_hotspots(delta_time, resumed = FALSE)
+/datum/controller/subsystem/air/proc/process_hotspots(resumed = FALSE)
if (!resumed)
src.currentrun = hotspots.Copy()
//cache for sanic speed (lists are references anyways)
@@ -266,7 +265,7 @@ SUBSYSTEM_DEF(air)
var/obj/effect/hotspot/H = currentrun[currentrun.len]
currentrun.len--
if (H)
- H.process(delta_time)
+ H.process()
else
hotspots -= H
if(MC_TICK_CHECK)
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 2f5629c989365..519134df2a4b0 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
@@ -54,7 +54,6 @@
icon_state = "volpump_[on && is_operational ? "on" : "off"]-[set_overlay_offset(piping_layer)]"
/obj/machinery/atmospherics/components/binary/volume_pump/process_atmos()
-// ..()
if(!on || !is_operational)
return
@@ -72,15 +71,19 @@
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.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 = air1.remove_ratio(VOLUME_PUMP_LEAK_AMOUNT)
+ var/datum/gas_mixture/leaked = removed.remove_ratio(VOLUME_PUMP_LEAK_AMOUNT)
T.assume_air(leaked)
T.air_update_turf(FALSE, FALSE)
- var/transfer_ratio = transfer_rate / air1.return_volume()
- air1.transfer_ratio_to(air2,transfer_ratio)
+ air2.merge(removed)
update_parents()
diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
index 191c4c4947f9b..214f4b5df4eb1 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
@@ -61,7 +61,6 @@
var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational
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)
@@ -69,7 +68,7 @@
//Early return
var/datum/gas_mixture/air1 = airs[1]
- if(!air1 || air1.return_temperature() <= 0)
+ if(!air1 || air1.temperature <= 0)
return
var/datum/gas_mixture/air2 = airs[2]
@@ -81,17 +80,39 @@
//No need to transfer if target is already full!
return
- var/transfer_ratio = transfer_rate / air1.return_volume()
+ var/transfer_ratio = transfer_rate / air1.volume
//Actually transfer the gas
if(transfer_ratio <= 0)
return
- if(filter_type && air2.return_pressure() <= 9000)
- air1.scrub_into(air2, transfer_ratio, list(filter_type))
- if(air3.return_pressure() <= 9000)
- air1.transfer_ratio_to(air3, transfer_ratio)
+ var/datum/gas_mixture/removed = air1.remove_ratio(transfer_ratio)
+
+ if(!removed)
+ return
+
+ var/filtering = TRUE
+ if(!ispath(filter_type))
+ if(filter_type)
+ filter_type = gas_id2path(filter_type) //support for mappers so they don't need to type out paths
+ else
+ filtering = FALSE
+
+ if(filtering && removed.gases[filter_type])
+ var/datum/gas_mixture/filtered_out = new
+
+ filtered_out.temperature = removed.temperature
+ filtered_out.add_gas(filter_type)
+ filtered_out.gases[filter_type][MOLES] = removed.gases[filter_type][MOLES]
+
+ removed.gases[filter_type][MOLES] = 0
+ removed.garbage_collect()
+
+ var/datum/gas_mixture/target = (air2.return_pressure() < MAX_OUTPUT_PRESSURE ? air2 : air1) //if there's no room for the filtered gas; just leave it in air1
+ target.merge(filtered_out)
+
+ air3.merge(removed)
update_parents()
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
index 5c20e4d4fe45a..aa40107f02adb 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
@@ -223,7 +223,7 @@
beaker.reagents.trans_to(occupant, (CRYO_TX_QTY / (efficiency * CRYO_MULTIPLY_FACTOR)) * delta_time, efficiency * CRYO_MULTIPLY_FACTOR, method = VAPOR) // Transfer reagents.
use_power(1000 * efficiency)
- return 1
+ return TRUE
/obj/machinery/atmospherics/components/unary/cryo_cell/process_atmos()
..()
@@ -233,38 +233,45 @@
var/datum/gas_mixture/air1 = airs[1]
- if(!nodes[1] || !airs[1] || air1.get_moles(GAS_O2) < 5) // Turn off if the machine won't work due to not having enough moles to operate.
- on = FALSE
- update_icon()
- var/msg = "Aborting. Not enough gas present to operate."
+ if(!nodes[1] || !airs[1] || !air1.gases.len || air1.gases[/datum/gas/oxygen][MOLES] < CRYO_MIN_GAS_MOLES) // Turn off if the machine won't work.
+ var/msg = "Insufficient cryogenic gas, shutting down."
radio.talk_into(src, msg, radio_channel)
+ set_on(FALSE)
return
if(occupant)
var/mob/living/mob_occupant = occupant
var/cold_protection = 0
- var/temperature_delta = air1.return_temperature() - mob_occupant.bodytemperature // The only semi-realistic thing here: share temperature between the cell and the occupant.
+ var/temperature_delta = air1.temperature - mob_occupant.bodytemperature // The only semi-realistic thing here: share temperature between the cell and the occupant.
if(ishuman(mob_occupant))
var/mob/living/carbon/human/H = mob_occupant
- cold_protection = H.get_cold_protection(air1.return_temperature())
+ cold_protection = H.get_cold_protection(air1.temperature)
if(abs(temperature_delta) > 1)
var/air_heat_capacity = air1.heat_capacity()
var/heat = ((1 - cold_protection) * 0.1 + conduction_coefficient) * temperature_delta * (air_heat_capacity * heat_capacity / (air_heat_capacity + heat_capacity))
- air1.set_temperature(max(air1.return_temperature() - heat / air_heat_capacity, TCMB))
+ air1.temperature = clamp(air1.temperature - heat / air_heat_capacity, TCMB, MAX_TEMPERATURE)
mob_occupant.adjust_bodytemperature(heat / heat_capacity, TCMB)
- 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.
+ //lets have the core temp match the body temp in humans
+ if(ishuman(mob_occupant))
+ var/mob/living/carbon/human/humi = mob_occupant
+ humi.adjust_coretemperature(humi.bodytemperature - humi.coretemperature)
+
+ if(consume_gas) // Transferring reagent costs us extra gas
+ air1.gases[/datum/gas/oxygen][MOLES] -= max(0, 2 / efficiency + 1 / efficiency) // Magically consume gas? Why not, we run on cryo magic.
+ consume_gas = FALSE
+ if(!consume_gas)
+ air1.gases[/datum/gas/oxygen][MOLES] -= max(0, 2 / efficiency)
+ air1.garbage_collect()
- update_parents()
+ if(air1.temperature > 2000)
+ take_damage(clamp((air1.temperature)/200, 10, 20), BURN)
-/obj/machinery/atmospherics/components/unary/cryo_cell/relaymove(mob/user)
- if(message_cooldown <= world.time)
- message_cooldown = world.time + 50
- to_chat(user, "[src]'s door won't budge!")
+ update_parents()
/obj/machinery/atmospherics/components/unary/cryo_cell/open_machine(drop = FALSE)
if(!state_open && !panel_open)
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 07926c0bf9c8b..ad3d4067537ad 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
@@ -19,7 +19,7 @@
var/scrubbing = SCRUBBING //0 = siphoning, 1 = scrubbing
- var/filter_types = list(GAS_CO2, GAS_BZ)
+ var/filter_types = list(/datum/gas/carbon_dioxide, /datum/gas/bz)
var/volume_rate = 200
var/widenet = 0 //is this scrubber acting on the 3x3 area around it.
var/list/turf/adjacent_turfs = list()
@@ -144,7 +144,7 @@
scrub(tile)
return TRUE
-/obj/machinery/atmospherics/components/unary/vent_scrubber/proc/scrub(var/turf/open/tile)
+/obj/machinery/atmospherics/components/unary/vent_scrubber/proc/scrub(var/turf/tile)
if(!istype(tile))
return FALSE
var/datum/gas_mixture/environment = tile.return_air()
diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm
index 853719803feec..8767f50a8ff35 100644
--- a/code/modules/atmospherics/machinery/portable/scrubber.dm
+++ b/code/modules/atmospherics/machinery/portable/scrubber.dm
@@ -7,7 +7,7 @@
var/on = FALSE
- var/volume_rate = 1000
+ var/volume_rate = 500
var/overpressure_m = 80
volume = 1000
From 3707a65a14fe296ee96765ac6fce86e4e23f3cd8 Mon Sep 17 00:00:00 2001
From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Date: Wed, 10 Mar 2021 01:32:01 -0800
Subject: [PATCH 009/114] Makes pipenet rebuilds yield much more often (#57511)
Makes both the act of starting a rebuild, and the full rebuild itself yield.
This might? Expose some things that rely on parent existing, but that was a problem before, if a rare one. It'll
need cleaned up at some point, but I'd like some feedback on how I'm acomplishing this.
Oh and I changed a very slight detail about how volume is used, instead of storing it throughout the whole loop
and applying it at the last moment, we just operate on the pipeline's volume step by step. This fixes like,
pipes being wrenched up while a rebuild is in progress, and the behavior is older then git, but I figured I
should mention it
---
code/__DEFINES/subsystems.dm | 4 +
code/controllers/subsystem/air.dm | 124 ++++++-
code/modules/atmospherics/Atmospherics.md | 15 +-
.../atmospherics/machinery/atmosmachinery.dm | 13 +-
.../machinery/components/components_base.dm | 149 +++++---
.../atmospherics/machinery/datum_pipeline.dm | 347 +++++++++++-------
.../atmospherics/machinery/pipes/pipes.dm | 56 ++-
7 files changed, 459 insertions(+), 249 deletions(-)
diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm
index 92842809ecde2..d02fad04e3b77 100644
--- a/code/__DEFINES/subsystems.dm
+++ b/code/__DEFINES/subsystems.dm
@@ -268,6 +268,10 @@
#define SSAIR_SUPERCONDUCTIVITY 7
#define SSAIR_PROCESS_ATOMS 8
+//Pipeline rebuild helper defines, these suck but it'll do for now
+#define SSAIR_REBUILD_PIPELINE 1
+#define SSAIR_REBUILD_QUEUE 2
+
// Explosion Subsystem subtasks
#define SSEXPLOSIONS_MOVABLES 1
#define SSEXPLOSIONS_TURFS 2
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index d608ea59296db..8c8659a6119c9 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -7,6 +7,7 @@ SUBSYSTEM_DEF(air)
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
var/cached_cost = 0
+
var/cost_atoms = 0
var/cost_turfs = 0
var/cost_hotspots = 0
@@ -21,7 +22,9 @@ SUBSYSTEM_DEF(air)
var/list/active_turfs = list()
var/list/hotspots = list()
var/list/networks = list()
- var/list/pipenets_needing_rebuilt = list()
+ var/list/rebuild_queue = list()
+ //Subservient to rebuild queue
+ var/list/expansion_queue = list()
/// A list of machines that will be processed when currentpart == SSAIR_ATMOSMACHINERY. Use SSair.begin_processing_machine and SSair.stop_processing_machine to add and remove machines.
var/list/obj/machinery/atmos_machinery = list()
var/list/pipe_init_dirs_cache = list()
@@ -65,7 +68,8 @@ SUBSYSTEM_DEF(air)
msg += "PN:[networks.len]|"
msg += "AM:[atmos_machinery.len]|"
msg += "AO:[atom_process.len]|"
- msg += "RB:[pipenets_needing_rebuilt.len]|"
+ msg += "RB:[rebuild_queue.len]|"
+ msg += "EP:[expansion_queue.len]|"
msg += "AT/MS:[round((cost ? active_turfs.len/cost : 0),0.1)]"
return ..()
@@ -83,20 +87,18 @@ SUBSYSTEM_DEF(air)
/datum/controller/subsystem/air/fire(resumed = FALSE)
var/timer = TICK_USAGE_REAL
+ //Rebuilds can happen at any time, so this needs to be done outside of the normal system
+ cost_rebuilds = 0
+
// Every time we fire, we want to make sure pipenets are rebuilt. The game state could have changed between each fire() proc call
// and anything missing a pipenet can lead to unintended behaviour at worse and various runtimes at best.
- if(length(pipenets_needing_rebuilt))
- var/list/pipenet_rebuilds = pipenets_needing_rebuilt
- for(var/thing in pipenet_rebuilds)
- var/obj/machinery/atmospherics/AT = thing
- if(!thing) //If a null somehow shows up here, this next line runtimes and the subsystem dies
- continue
- AT.build_network()
- cached_cost += TICK_USAGE_REAL - timer
- pipenets_needing_rebuilt.Cut()
+ 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
- cost_rebuilds = MC_AVERAGE(cost_rebuilds, TICK_DELTA_TO_MS(cached_cost))
if(currentpart == SSAIR_PIPENETS || !resumed)
timer = TICK_USAGE_REAL
@@ -212,9 +214,22 @@ 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/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_atoms(resumed = FALSE)
if(!resumed)
@@ -312,6 +327,75 @@ SUBSYSTEM_DEF(air)
if (MC_TICK_CHECK)
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
+ var/list/targets = remake.get_rebuild_targets()
+ remake.rebuilding = FALSE //It's allowed to renter the queue now
+ for(var/datum/pipeline/build_off as anything in targets)
+ build_off.build_pipeline(remake) //This'll add to the expansion queue
+ 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.setPipenet(net, borderline)
+ net.addMachineryMember(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.volume += item.volume
+ item.parent = net
+
+ if(item.air_temporary)
+ net.air.merge(item.air_temporary)
+ item.air_temporary = null
+
+ if (MC_TICK_CHECK)
+ return
+
///Removes a turf from processing, and causes its excited group to clean up so things properly adapt to the change
/datum/controller/subsystem/air/proc/remove_from_active(turf/open/T)
active_turfs -= T
@@ -448,6 +532,7 @@ SUBSYSTEM_DEF(air)
if (!ET.excited)
ET.excited = TRUE
. += ET
+
/turf/open/space/resolve_active_graph()
return list()
@@ -461,7 +546,9 @@ SUBSYSTEM_DEF(air)
// pipenet can be built.
/datum/controller/subsystem/air/proc/setup_pipenets()
for (var/obj/machinery/atmospherics/AM in atmos_machinery)
- AM.build_network()
+ 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
GLOBAL_LIST_EMPTY(colored_turfs)
@@ -484,9 +571,12 @@ GLOBAL_LIST_EMPTY(colored_images)
for(var/A in 1 to atmos_machines.len)
AM = atmos_machines[A]
- AM.build_network()
+ 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)
if(!pipe_init_dirs_cache[type])
pipe_init_dirs_cache[type] = list()
diff --git a/code/modules/atmospherics/Atmospherics.md b/code/modules/atmospherics/Atmospherics.md
index 5baa739fd4adc..592923c72a9bc 100644
--- a/code/modules/atmospherics/Atmospherics.md
+++ b/code/modules/atmospherics/Atmospherics.md
@@ -37,8 +37,8 @@ Now then, into the breach.
The air controller is, at its core, quite simple, yet it is absolutely fundamental to the atmospheric system. The air controller is the clock which triggers all continuous actions within the atmos system, such as vents distributing air or gas moving between tiles. The actions taken by the air controller are quite simple, and will be enumerated here. Much of the substance of the air ticker is due to the game's master controller, whose intricacies I will not delve into for this document. I will however go into more detail about how SSAir in particular works in Chapter 6. In any case, this is a simplified list of the air controller's actions in a single tick:
1. Rebuild Pipenets
- - Runs each time SSAir processes, sometimes out of order. It ensures that no pipenets sit unresolved or unbuilt
- - Calls `build_network()` on each `/obj/machinery/atmospherics` in the `pipenets_needing_rebuilt` list
+ - Runs each time SSAir processes, sometimes out of order. It ensures that no pipeline sit unresolved or unbuilt
+ - Processes the `rebuild_queue` list into the `expansion_queue` list, and then builds a full pipeline piecemeal. We do a ton of fenagling here to reduce overrun
2. Pipenets
- Updates the internal gasmixes of attached pipe machinery, and reacts the gases in a pipeline
- Calls `process()` on each `/datum/pipenet` in the `networks` list
@@ -272,7 +272,7 @@ All of these are averages by the way.
* *`tick_overrun`* A percentage of how far past our allotted time we ran. This is what causes Time Dilation, it's bad.
* *`ticks`* The amount of subsystem fires it takes to run through all the subprocesses once.
-The second line is the cost each subprocess contributed per full cycle, this is a rolling average. It'll give you a good feel for what is misbehaving.
+The second line is the cost each subprocess contributed per full cycle, this is a rolling average. It'll give you a good feel for what is misbehaving. (The only exception to this is pipenet rebuilds, the last entry. Because of its nature as something that can happen at any time, it doesn't have a rolling average, instead it just displays the time it used last process)
The third line is the amount of "whatever" in each subprocess. Handy for noticing dupe bugs and crying at active turf cost. Speaking of, the last entry is the active turfs per overall cost. Not a great metric, but larger is better.
@@ -342,8 +342,17 @@ On that note, I'd like to be clear about something. In lines of connected pipes,
Oh, and pipelines react the gas mixture inside them, thought I should mention that.
+### A short note on rebuilding
+
+Everything that needs a pipeline should have it before it's allowed to do any processing. This is to prevent runtimes and shitcode related things.
+
+The act of rebuilding a pipeline is quite expensive however, since it involves iterating over all the connected pipes/components.
+That's why we go to such great pains to make sure no large amount of work is allowed to happen at once. It's in an attempt to avoid the excited group settling type of lag I discussed above. It's ok for atmos to lock up for a short period if the system isn't killing the game as a whole.
+
+
All the other behavior of pipes and pipe components are handled by atmos machinery. I'll give a brief rundown of how they're classified, but the details of each machine are left as an exercise to the reader.
+
#### Pipes
The raw pipes. They have some amount of nuance, mostly around layers, but it's not too tricky to deal with.
diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm
index 46865bfe0499a..200f0b52de99e 100644
--- a/code/modules/atmospherics/machinery/atmosmachinery.dm
+++ b/code/modules/atmospherics/machinery/atmosmachinery.dm
@@ -43,6 +43,9 @@
/// whether it can be painted
var/paintable = FALSE
+ ///Is the thing being rebuilt by SSair or not. Prevents list blaot
+ var/rebuilding = FALSE
+
/obj/machinery/atmospherics/examine(mob/user)
. = ..()
if(is_type_in_list(src, GLOB.ventcrawl_machinery) && isliving(user))
@@ -68,7 +71,7 @@
nullifyNode(i)
SSair.stop_processing_machine(src)
- SSair.pipenets_needing_rebuilt -= src
+ SSair.rebuild_queue -= src
if(pipe_vision_img)
qdel(pipe_vision_img)
@@ -79,8 +82,10 @@
/obj/machinery/atmospherics/proc/destroy_network()
return
-/obj/machinery/atmospherics/proc/build_network()
- // Called to build a network from this node
+/**
+ * Returns a list of new pipelines that need to be built up
+ */
+/obj/machinery/atmospherics/proc/get_rebuild_targets()
return
/obj/machinery/atmospherics/proc/nullifyNode(i)
@@ -281,7 +286,7 @@
for(var/obj/machinery/atmospherics/A in nodes)
A.atmosinit()
A.addMember(src)
- build_network()
+ SSair.add_to_rebuild_queue(src)
/obj/machinery/atmospherics/Entered(atom/movable/arrived, atom/old_loc, list/atom/old_locs)
if(istype(arrived, /mob/living))
diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm
index fc0e35a28e57d..a5039825dc7f0 100644
--- a/code/modules/atmospherics/machinery/components/components_base.dm
+++ b/code/modules/atmospherics/machinery/components/components_base.dm
@@ -3,12 +3,15 @@
/obj/machinery/atmospherics/components
hide = FALSE
-
- var/welded = FALSE //Used on pumps and scrubbers
+ ///Is the component welded?
+ var/welded = FALSE
+ ///Should the component should show the pipe underneath it?
var/showpipe = TRUE
- var/shift_underlay_only = TRUE //Layering only shifts underlay?
-
+ ///When the component is on a non default layer should we shift everything? Or just the underlay pipe
+ var/shift_underlay_only = TRUE
+ ///Stores the component pipeline
var/list/datum/pipeline/parents
+ ///Stores the component gas mixture
var/list/datum/gas_mixture/airs
/obj/machinery/atmospherics/components/New()
@@ -30,12 +33,18 @@
// Iconnery
+/**
+ * Called by update_icon(), used individually by each component to determine the icon state without the pipe in consideration
+ */
/obj/machinery/atmospherics/components/proc/update_icon_nopipes()
return
+/**
+ * Called in Initialize(), set the showpipe var to true or false depending on the situation, calls update_icon()
+ */
/obj/machinery/atmospherics/components/proc/hide_pipe(datum/source, covered)
showpipe = !covered
- update_icon()
+ update_appearance()
/obj/machinery/atmospherics/components/update_icon()
update_icon_nopipes()
@@ -50,11 +59,12 @@
var/connected = 0 //Direction bitset
for(var/i in 1 to device_type) //adds intact pieces
- if(nodes[i])
- var/obj/machinery/atmospherics/node = nodes[i]
- var/image/img = get_pipe_underlay("pipe_intact", get_dir(src, node), node.pipe_color)
- underlays += img
- connected |= img.dir
+ if(!nodes[i])
+ continue
+ var/obj/machinery/atmospherics/node = nodes[i]
+ var/image/img = get_pipe_underlay("pipe_intact", get_dir(src, node), node.pipe_color)
+ underlays += img
+ connected |= img.dir
for(var/direction in GLOB.cardinals)
if((initialize_directions & direction) && !(connected & direction))
@@ -64,6 +74,13 @@
PIPING_LAYER_SHIFT(src, piping_layer)
return ..()
+/**
+ * Called by update_icon() when showpipe is TRUE, set the image for the underlay pipe
+ * Arguments:
+ * * -state: icon_state of the selected pipe
+ * * -dir: direction of the pipe
+ * * -color: color of the pipe
+ */
/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)
@@ -75,30 +92,58 @@
/obj/machinery/atmospherics/components/nullifyNode(i)
if(parents[i])
nullifyPipenet(parents[i])
- QDEL_NULL(airs[i])
- ..()
+ QDEL_NULL(airs[i])
+ return ..()
/obj/machinery/atmospherics/components/on_construction()
..()
update_parents()
-/obj/machinery/atmospherics/components/build_network()
+/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
+
+/**
+ * Called by nullifyNode(), used to remove the pipeline the component is attached to
+ * Arguments:
+ * * -reference: the pipeline the component is attached to
+ */
/obj/machinery/atmospherics/components/proc/nullifyPipenet(datum/pipeline/reference)
if(!reference)
CRASH("nullifyPipenet(null) called by [type] on [COORD(src)]")
- var/i = parents.Find(reference)
- reference.other_airs -= airs[i]
+
+ 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_atmosmch -= src
- parents[i] = null
-/obj/machinery/atmospherics/components/returnPipenetAir(datum/pipeline/reference)
- return airs[parents.Find(reference)]
+ /**
+ * We explicitly qdel pipeline when this particular pipeline
+ * is projected to have no member and cause GC problems.
+ * We have to do this because components don't qdel pipelines
+ * while pipes must and will happily wreck and rebuild everything
+ * again every time they are qdeleted.
+ */
+
+ if(!length(reference.other_atmosmch) && !length(reference.members))
+ if(QDESTROYING(reference))
+ CRASH("nullifyPipenet() called on qdeleting [reference]")
+ qdel(reference)
+
+/obj/machinery/atmospherics/components/returnPipenetAirs(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)
@@ -115,43 +160,37 @@
parents[parents.Find(Old)] = New
/obj/machinery/atmospherics/components/unsafe_pressure_release(mob/user, pressures)
- ..()
+ . = ..()
var/turf/T = get_turf(src)
- if(T)
- //Remove the gas from airs and assume it
- var/datum/gas_mixture/environment = T.return_air()
- var/lost = null
- var/times_lost = 0
- for(var/i in 1 to device_type)
- var/datum/gas_mixture/air = airs[i]
- lost += pressures*environment.volume/(air.temperature * R_IDEAL_GAS_EQUATION)
- 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(FALSE, FALSE)
-
-/obj/machinery/atmospherics/components/proc/safe_input(title, text, default_set)
- var/new_value = input(usr,text,title,default_set) as num|null
-
- if (isnull(new_value))
- return default_set
-
- if(usr.canUseTopic(src))
- return new_value
-
- return default_set
+ if(!T)
+ return
+ //Remove the gas from airs and assume it
+ var/datum/gas_mixture/environment = T.return_air()
+ var/lost = null
+ var/times_lost = 0
+ for(var/i in 1 to device_type)
+ var/datum/gas_mixture/air = airs[i]
+ lost += pressures*environment.volume/(air.temperature * R_IDEAL_GAS_EQUATION)
+ 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(FALSE, FALSE)
// Helpers
+/**
+ * Called in most atmos processes and gas handling situations, update the parents pipelines of the devices connected to the source component
+ * This way gases won't get stuck
+ */
/obj/machinery/atmospherics/components/proc/update_parents()
for(var/i in 1 to device_type)
var/datum/pipeline/parent = parents[i]
diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm
index 94b347f1be75e..c7b90709fbf0b 100644
--- a/code/modules/atmospherics/machinery/datum_pipeline.dm
+++ b/code/modules/atmospherics/machinery/datum_pipeline.dm
@@ -5,7 +5,10 @@
var/list/obj/machinery/atmospherics/pipe/members
var/list/obj/machinery/atmospherics/components/other_atmosmch
+ ///Should we equalize air amoung all our members?
var/update = TRUE
+ ///Is this pipeline being reconstructed?
+ var/building = FALSE
/datum/pipeline/New()
other_airs = list()
@@ -15,123 +18,163 @@
/datum/pipeline/Destroy()
SSair.networks -= src
- if(air && air.return_volume())
+ if(building)
+ SSair.remove_from_expansion(src)
+ if(air?.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_atmosmch)
+ considered_component.nullifyPipenet(src)
return ..()
/datum/pipeline/process()
+ if(building)
+ return
if(update)
update = FALSE
reconcile_air()
update = air.react(src)
+///Preps a pipeline for rebuilding, insterts it into the rebuild queue
/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/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)
+
+ if(!air)
+ air = new
+
+ air.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/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)
+
if(!air)
air = new
var/list/possible_expansions = list(base)
- while(possible_expansions.len>0)
+ while(possible_expansions.len)
for(var/obj/machinery/atmospherics/borderline in possible_expansions)
-
var/list/result = borderline.pipeline_expansion(src)
-
- if(result.len>0)
- 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 = 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) Nearby: ([item.x], [item.y], [item.z]).")
- pipenetwarnings -= 1
- 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.setPipenet(src, borderline)
+ addMachineryMember(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)
+ air.volume = volume
+
+ /**
+ * For a machine to properly "connect" to a pipeline and share gases,
+ * the pipeline needs to acknowledge a gas mixture as it's member.
+ * This is currently handled by the other_airs list in the pipeline datum.
+ *
+ * Other_airs itself is populated by gas mixtures through the parents list that each machineries have.
+ * This parents list is populated when a machinery calls update_parents and is then added into the queue by the controller.
+ */
+
+/datum/pipeline/proc/addMachineryMember(obj/machinery/atmospherics/components/considered_component)
+ other_atmosmch |= considered_component
+ var/list/returned_airs = considered_component.returnPipenetAirs(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/addMember(obj/machinery/atmospherics/reference_device, obj/machinery/atmospherics/device_to_add)
+ if(!istype(reference_device, /obj/machinery/atmospherics/pipe))
+ reference_device.setPipenet(src, device_to_add)
+ addMachineryMember(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.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.volume += parent_pipeline.air.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_atmosmch)
+ reference_component.replacePipenet(parent_pipeline, src)
+ other_atmosmch |= parent_pipeline.other_atmosmch
+ other_airs |= parent_pipeline.other_airs
+ parent_pipeline.members.Cut()
+ parent_pipeline.other_atmosmch.Cut()
update = TRUE
- qdel(E)
+ qdel(parent_pipeline)
-/obj/machinery/atmospherics/proc/addMember(obj/machinery/atmospherics/A)
+/obj/machinery/atmospherics/proc/addMember(obj/machinery/atmospherics/considered_device)
return
-/obj/machinery/atmospherics/pipe/addMember(obj/machinery/atmospherics/A)
- parent.addMember(A, src)
+/obj/machinery/atmospherics/pipe/addMember(obj/machinery/atmospherics/considered_device)
+ parent.addMember(considered_device, src)
-/obj/machinery/atmospherics/components/addMember(obj/machinery/atmospherics/A)
- var/datum/pipeline/P = returnPipenet(A)
- if(!P)
+/obj/machinery/atmospherics/components/addMember(obj/machinery/atmospherics/considered_device)
+ var/datum/pipeline/device_pipeline = returnPipenet(considered_device)
+ if(!device_pipeline)
CRASH("null.addMember() called by [type] on [COORD(src)]")
- P.addMember(A, src)
+ device_pipeline.addMember(considered_device, src)
/datum/pipeline/proc/temporarily_store_air()
@@ -139,16 +182,14 @@
for(var/obj/machinery/atmospherics/pipe/member in members)
member.air_temporary = new
- member.air_temporary.set_volume(member.volume)
- member.air_temporary.copy_from(air)
+ member.air_temporary.volume = member.volume
+ member.air_temporary.copy_from(air, member.volume / air.volume)
- member.air_temporary.multiply(member.volume/air.return_volume())
-
- member.air_temporary.set_temperature(air.return_temperature())
+ member.air_temporary.temperature = air.temperature
/datum/pipeline/proc/temperature_interact(turf/target, share_volume, thermal_conductivity)
var/total_heat_capacity = air.heat_capacity()
- var/partial_heat_capacity = total_heat_capacity*(share_volume/air.return_volume())
+ var/partial_heat_capacity = total_heat_capacity * (share_volume / air.volume)
var/target_temperature
var/target_heat_capacity
@@ -158,71 +199,101 @@
target_temperature = modeled_location.GetTemperature()
target_heat_capacity = modeled_location.GetHeatCapacity()
+ if(modeled_location.blocks_air)
- var/delta_temperature = 0
- var/sharer_heat_capacity = 0
-
- delta_temperature = (air.return_temperature() - target_temperature)
- sharer_heat_capacity = target_heat_capacity
+ if((modeled_location.heat_capacity > 0) && (partial_heat_capacity > 0))
+ var/delta_temperature = air.temperature - target_temperature
- var/self_temperature_delta = 0
- var/sharer_temperature_delta = 0
+ var/heat = thermal_conductivity * delta_temperature * (partial_heat_capacity * target_heat_capacity / (partial_heat_capacity + target_heat_capacity))
- if((sharer_heat_capacity>0) && (partial_heat_capacity>0))
- var/heat = thermal_conductivity*delta_temperature* \
- (partial_heat_capacity*sharer_heat_capacity/(partial_heat_capacity+sharer_heat_capacity))
+ air.temperature -= heat/total_heat_capacity
+ modeled_location.TakeTemperature(heat / target_heat_capacity)
- self_temperature_delta = -heat/total_heat_capacity
- sharer_temperature_delta = heat/sharer_heat_capacity
else
- return 1
+ var/delta_temperature = 0
+ var/sharer_heat_capacity = 0
- air.set_temperature(air.return_temperature() + self_temperature_delta)
- modeled_location.TakeTemperature(sharer_temperature_delta)
+ delta_temperature = (air.temperature - target_temperature)
+ sharer_heat_capacity = target_heat_capacity
+ var/self_temperature_delta = 0
+ var/sharer_temperature_delta = 0
- else
- if((target.heat_capacity>0) && (partial_heat_capacity>0))
- var/delta_temperature = air.return_temperature() - target.return_temperature()
+ if((sharer_heat_capacity <= 0) || (partial_heat_capacity <= 0))
+ return TRUE
+ var/heat = thermal_conductivity * delta_temperature * (partial_heat_capacity * sharer_heat_capacity / (partial_heat_capacity + sharer_heat_capacity))
+
+ self_temperature_delta = - heat / total_heat_capacity
+ sharer_temperature_delta = heat / sharer_heat_capacity
+ air.temperature += self_temperature_delta
+ modeled_location.TakeTemperature(sharer_temperature_delta)
+
+
+ else
+ if((target.heat_capacity > 0) && (partial_heat_capacity > 0))
+ var/delta_temperature = air.temperature - target.temperature
+ //Temp share things, see superconduction for more like this
var/heat = thermal_conductivity*delta_temperature* \
(partial_heat_capacity*target.heat_capacity/(partial_heat_capacity+target.heat_capacity))
- air.set_temperature(air.return_temperature() - heat/total_heat_capacity)
+ air.temperature -= heat / total_heat_capacity
update = TRUE
/datum/pipeline/proc/return_air()
. = other_airs + air
if(null in .)
- stack_trace("[src]([REF(src)]) has one or more null gas mixtures, which may cause bugs. Null mixtures will not be considered in reconcile_air().")
- list_clear_nulls(.)
-
-/datum/pipeline/proc/empty()
- for(var/datum/gas_mixture/GM in get_all_connected_airs())
- GM.clear()
+ stack_trace("[src] has one or more null gas mixtures, which may cause bugs. Null mixtures will not be considered in reconcile_air().")
+ return removeNullsFromList(.)
-/datum/pipeline/proc/get_all_connected_airs()
- var/list/datum/gas_mixture/GL = list()
- var/list/datum/pipeline/PL = list()
- PL += src
+/datum/pipeline/proc/reconcile_air()
+ var/list/datum/gas_mixture/gas_mixture_list = list()
+ var/list/datum/pipeline/pipeline_list = list()
+ pipeline_list += src
- 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)
+ 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
- GL += P.return_air()
- for(var/atmosmch in P.other_atmosmch)
+ gas_mixture_list += pipeline.other_airs
+ gas_mixture_list += pipeline.air
+ for(var/atmosmch in pipeline.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]
+ var/obj/machinery/atmospherics/components/binary/valve/considered_valve = atmosmch
+ if(considered_valve.on)
+ pipeline_list |= considered_valve.parents[1]
+ pipeline_list |= considered_valve.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.portableConnectorReturnAir()
- return GL
+ var/obj/machinery/atmospherics/components/unary/portables_connector/considered_connector = atmosmch
+ if(considered_connector.connected_device)
+ gas_mixture_list += considered_connector.connected_device.air_contents
-/datum/pipeline/proc/reconcile_air()
- var/list/datum/gas_mixture/GL = get_all_connected_airs()
- equalize_all_gases_in_list(GL)
+ var/total_thermal_energy = 0
+ var/total_heat_capacity = 0
+ var/datum/gas_mixture/total_gas_mixture = new(0)
+
+ var/list/total_gases = total_gas_mixture.gases
+
+ for(var/mixture in gas_mixture_list)
+ var/datum/gas_mixture/gas_mixture = mixture
+ total_gas_mixture.volume += gas_mixture.volume
+
+ // This is sort of a combined merge + heat_capacity calculation
+
+ var/list/giver_gases = gas_mixture.gases
+ //gas transfer
+ for(var/giver_id in giver_gases)
+ var/giver_gas_data = giver_gases[giver_id]
+ ASSERT_GAS(giver_id, total_gas_mixture)
+ total_gases[giver_id][MOLES] += giver_gas_data[MOLES]
+ total_heat_capacity += giver_gas_data[MOLES] * giver_gas_data[GAS_META][META_GAS_SPECIFIC_HEAT]
+
+ total_thermal_energy += THERMAL_ENERGY(gas_mixture)
+
+ total_gas_mixture.temperature = total_heat_capacity ? (total_thermal_energy / total_heat_capacity) : 0
+
+ if(total_gas_mixture.volume > 0)
+ //Update individual gas_mixtures by volume ratio
+ for(var/mixture in gas_mixture_list)
+ var/datum/gas_mixture/gas_mixture = mixture
+ gas_mixture.copy_from(total_gas_mixture, gas_mixture.volume / total_gas_mixture.volume)
diff --git a/code/modules/atmospherics/machinery/pipes/pipes.dm b/code/modules/atmospherics/machinery/pipes/pipes.dm
index 6f364d2500e00..f97100dc8b213 100644
--- a/code/modules/atmospherics/machinery/pipes/pipes.dm
+++ b/code/modules/atmospherics/machinery/pipes/pipes.dm
@@ -1,22 +1,18 @@
/obj/machinery/atmospherics/pipe
+ damage_deflection = 12
var/datum/gas_mixture/air_temporary //used when reconstructing a pipeline that broke
var/volume = 0
use_power = NO_POWER_USE
can_unwrench = 1
var/datum/pipeline/parent = null
+
paintable = TRUE
//Buckling
- can_buckle = 1
- buckle_requires_restraints = 1
- buckle_lying = -1
-
- FASTDMM_PROP(\
- set_instance_vars(\
- icon_state = INSTANCE_VAR_DEFAULT\
- ),\
- )
+ can_buckle = TRUE
+ buckle_requires_restraints = TRUE
+ buckle_lying = NO_BUCKLE_LYING
/obj/machinery/atmospherics/pipe/New()
add_atom_colour(pipe_color, FIXED_COLOUR_PRIORITY)
@@ -28,11 +24,7 @@
. = ..()
if(hide)
- AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE)
-
-/obj/machinery/atmospherics/pipe/examine(mob/user)
- . = ..()
- . += "[src] is on layer [piping_layer]."
+ AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE) //if changing this, change the subtypes RemoveElements too, because thats how bespoke works
/obj/machinery/atmospherics/pipe/nullifyNode(i)
var/obj/machinery/atmospherics/oldN = nodes[i]
@@ -43,10 +35,11 @@
/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/proc/releaseAirToTurf()
if(air_temporary)
@@ -55,19 +48,20 @@
air_update_turf(FALSE, FALSE)
/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(air_temporary)
+ return air_temporary.remove(amount)
return parent.air.remove(amount)
-/obj/machinery/atmospherics/pipe/remove_air_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))
var/obj/item/pipe_meter/meter = W
@@ -77,8 +71,7 @@
return ..()
/obj/machinery/atmospherics/pipe/returnPipenet()
- if(parent)
- return parent.air
+ return parent
/obj/machinery/atmospherics/pipe/setPipenet(datum/pipeline/P)
parent = P
@@ -97,6 +90,10 @@
qdel(meter)
. = ..()
+/obj/machinery/atmospherics/pipe/update_icon()
+ . = ..()
+ update_layer()
+
/obj/machinery/atmospherics/pipe/proc/update_node_icon()
for(var/i in 1 to device_type)
if(nodes[i])
@@ -106,11 +103,6 @@
/obj/machinery/atmospherics/pipe/returnPipenets()
. = list(parent)
-/obj/machinery/atmospherics/pipe/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir)
- if(damage_flag == MELEE && damage_amount < 12)
- return 0
- . = ..()
-
/obj/machinery/atmospherics/pipe/paint(paint_color)
if(paintable)
add_atom_colour(paint_color, FIXED_COLOUR_PRIORITY)
From 2d78ac4d05e46c014567a4405d6c1ef567a7dc57 Mon Sep 17 00:00:00 2001
From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Date: Fri, 12 Mar 2021 17:49:50 -0800
Subject: [PATCH 010/114] Makes gas actually dissipate (#57634)
* Raises the quantize threshold from 1E-7 to 1E-4.
This makes gas dissipate as expected, and should help with the amount of useless gas floating around the station
at highpop
Adds a garbage_collect() call to the portion of pipeline code where all gasmixes are in one place, this should
clean things up properly.
Changes BREATH_VOLUME from 2 to 1.99. This is imperative
Documents a FUCKING HELLBUG in quantize/breathcode that can lead to breaths just not working sometimes. I'm not
sure how to fix this totally, so I'll document it and pray.
See
Adds a unit test to check for this sort of failure.
Addendum for people tweaking this value in the future.
Because o2 tank release values/human o2 requirements are very strictly set to the same pressure, small errors
can cause breakage
This comes from QUANTIZE being used in /datum/gas_mixture.remove(), forming a slight sawtooth pattern of the
added/removed gas, centered on the actual pressure
Changing BREATH_VOLUME can set us on the lower half of this sawtooth, making humans unable to breath at standard
pressure.
There's no good way I can come up with to hardcode a fix for this. So if you're going to change this variable
graph the functions that describe how it is used/how it interacts with breath code, and pick something on the
upper half of the sawtooth
NOTE: I've made this change with a focus on o2 requirements. Changing this will effect other settings, but most
all of them can be ignored, as none will notice.
* Thank you moth man
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
* Docs the purpose of the breath unit test, and better explains partial pressure
Co-authored-by: Mothblocks <35135081+Mothblocks@users.noreply.github.com>
---
code/__DEFINES/atmospherics.dm | 15 +++++---
code/_onclick/hud/alert.dm | 4 +++
.../atmospherics/gasmixtures/gas_mixture.dm | 19 +++++-----
.../atmospherics/machinery/datum_pipeline.dm | 2 ++
code/modules/surgery/organs/lungs.dm | 1 +
code/modules/unit_tests/_unit_tests.dm | 1 +
code/modules/unit_tests/breath.dm | 36 +++++++++++++++++++
7 files changed, 65 insertions(+), 13 deletions(-)
create mode 100644 code/modules/unit_tests/breath.dm
diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm
index 4932ea3e4304d..8f36e5ecce99e 100644
--- a/code/__DEFINES/atmospherics.dm
+++ b/code/__DEFINES/atmospherics.dm
@@ -40,10 +40,17 @@
/// N2 standard value (79%)
#define MOLES_N2STANDARD (MOLES_CELLSTANDARD*N2STANDARD)
/// liters in a cell
-#define CELL_VOLUME 2500
-
-/// liters in a normal breath. note that breaths are taken once every 4 life ticks, which is 8 seconds
-#define BREATH_VOLUME 2
+#define CELL_VOLUME 2500
+/** liters in a normal breath. note that breaths are taken once every 4 life ticks, which is 8 seconds
+ * Addendum for people tweaking this value in the future.
+ * Because o2 tank release values/human o2 requirements are very strictly set to the same pressure, small errors can cause breakage
+ * This comes from QUANTIZE being used in /datum/gas_mixture.remove(), forming a slight sawtooth pattern of the added/removed gas, centered on the actual pressure
+ * Changing BREATH_VOLUME can set us on the lower half of this sawtooth, making humans unable to breath at standard pressure.
+ * There's no good way I can come up with to hardcode a fix for this. So if you're going to change this variable
+ * graph the functions that describe how it is used/how it interacts with breath code, and pick something on the upper half of the sawtooth
+ *
+**/
+#define BREATH_VOLUME 1.99
/// Amount of air to take a from a tile
#define BREATH_PERCENTAGE (BREATH_VOLUME/CELL_VOLUME)
diff --git a/code/_onclick/hud/alert.dm b/code/_onclick/hud/alert.dm
index d9a94490bc3ea..cd98437a11636 100644
--- a/code/_onclick/hud/alert.dm
+++ b/code/_onclick/hud/alert.dm
@@ -87,6 +87,10 @@
client.screen -= alert
qdel(alert)
+// Proc to check for an alert
+/mob/proc/has_alert(category)
+ return !isnull(alerts[category])
+
/atom/movable/screen/alert
icon = 'icons/mob/screen_alert.dmi'
icon_state = "default"
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index bc028ec2da09f..6fed8b0ccdc6e 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -3,17 +3,18 @@ What are the archived variables for?
Calculations are done using the archived variables with the results merged into the regular variables.
This prevents race conditions that arise based on the order of tile processing.
*/
-#define MINIMUM_HEAT_CAPACITY 0.0003
-#define MINIMUM_MOLE_COUNT 0.01
-#define MOLAR_ACCURACY 1E-7
+#define MINIMUM_HEAT_CAPACITY 0.0003
+#define MINIMUM_MOLE_COUNT 0.01
+#define MOLAR_ACCURACY 1E-4
/**
*I feel the need to document what happens here. Basically this is used
- *catch most rounding errors, however its previous value made it so that
- *once gases got hot enough, most procedures wouldn't occur due to the fact that the mole
- *counts would get rounded away. Thus, we lowered it a few orders of magnitude
- *Edit: As far as I know this might have a bug caused by round(). When it has a second arg it will round up.
- *So for instance round(0.5, 1) == 1. Trouble is I haven't found any instances of it causing a bug,
- *and any attempts to fix it just killed atmos. I leave this to a greater man then I
+ *catch rounding errors, and make gas go away in small portions.
+ *People have raised it to higher levels in the past, do not do this. Consider this number a soft limit
+ *If you're making gasmixtures that have unexpected behavior related to this value, you're doing something wrong.
+ *
+ *On an unrelated note this may cause a bug that creates negative gas, related to round(). When it has a second arg it will round up.
+ *So for instance round(0.5, 1) == 1. I've hardcoded a fix for this into share, by forcing the garbage collect.
+ *Any other attempts to fix it just killed atmos. I leave this to a greater man then I
*/
#define QUANTIZE(variable) (round((variable), (MOLAR_ACCURACY)))
GLOBAL_LIST_INIT(meta_gas_info, meta_gas_list()) //see ATMOSPHERICS/gas_types.dm
diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm
index c7b90709fbf0b..29702d3d3da80 100644
--- a/code/modules/atmospherics/machinery/datum_pipeline.dm
+++ b/code/modules/atmospherics/machinery/datum_pipeline.dm
@@ -292,6 +292,8 @@
total_gas_mixture.temperature = total_heat_capacity ? (total_thermal_energy / total_heat_capacity) : 0
+ total_gas_mixture.garbage_collect()
+
if(total_gas_mixture.volume > 0)
//Update individual gas_mixtures by volume ratio
for(var/mixture in gas_mixture_list)
diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index d2d9f5d45aa8e..b8b0049847ce6 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -19,6 +19,7 @@
food_reagents = list(/datum/reagent/consumable/nutriment = 5, /datum/reagent/medicine/salbutamol = 5)
//Breath damage
+ //These thresholds are checked against what amounts to total_mix_pressure * (gas_type_mols/total_mols)
var/breathing_class = BREATH_OXY // can be a gas instead of a breathing class
var/safe_breath_min = 16
diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm
index 89679c50c9ae9..844d081b281cd 100644
--- a/code/modules/unit_tests/_unit_tests.dm
+++ b/code/modules/unit_tests/_unit_tests.dm
@@ -85,6 +85,7 @@
#include "component_tests.dm"
#include "connect_loc.dm"
#include "crafting_tests.dm"
+#include "breath.dm"
// Del the World.
// This unit test creates and qdels almost every atom in the code, checking for errors with initialization and harddels on deletion.
diff --git a/code/modules/unit_tests/breath.dm b/code/modules/unit_tests/breath.dm
new file mode 100644
index 0000000000000..a36e573140860
--- /dev/null
+++ b/code/modules/unit_tests/breath.dm
@@ -0,0 +1,36 @@
+/// Tests to make sure humans can breath in normal situations
+/// Built to prevent regression on an issue surrounding QUANTIZE() and BREATH_VOLUME
+/// See the comment on BREATH_VOLUME for more details
+/datum/unit_test/breath_sanity
+
+/datum/unit_test/breath_sanity/Run()
+ var/mob/living/carbon/human/lab_rat = allocate(/mob/living/carbon/human)
+ var/obj/item/clothing/mask/breath/tube = allocate(/obj/item/clothing/mask/breath)
+ var/obj/item/tank/internals/emergency_oxygen/source = allocate(/obj/item/tank/internals/emergency_oxygen)
+
+ lab_rat.equip_to_slot_if_possible(tube, ITEM_SLOT_MASK)
+ lab_rat.equip_to_slot_if_possible(source, ITEM_SLOT_HANDS)
+ source.toggle_internals(lab_rat)
+
+ lab_rat.breathe()
+
+ TEST_ASSERT(!lab_rat.has_alert("not_enough_oxy"), "Humans can't get a full breath from standard o2 tanks")
+ lab_rat.clear_alert("not_enough_oxy")
+
+ //Prep the mob
+ lab_rat.forceMove(run_loc_floor_bottom_left)
+ source.toggle_internals(lab_rat)
+ TEST_ASSERT(!lab_rat.internal, "toggle_internals() failed to toggle internals")
+
+ var/turf/open/to_fill = run_loc_floor_bottom_left
+ //Prep the floor
+ to_fill.initial_gas_mix = OPENTURF_DEFAULT_ATMOS
+ to_fill.air = new
+ to_fill.air.copy_from_turf(to_fill)
+
+ lab_rat.breathe()
+
+ TEST_ASSERT(!lab_rat.has_alert("not_enough_oxy"), "Humans can't get a full breath from the standard initial_gas_mix on a turf")
+
+
+
From 1e1536b0b41f8ccbdec61552806871f5815c99e3 Mon Sep 17 00:00:00 2001
From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Date: Fri, 26 Mar 2021 14:43:39 -0700
Subject: [PATCH 011/114] Some minor atmos cleanup (#57933)
Fixes mining not making turfs active, I forgot to add a type arg when I added one to AfterChange(). This isn't the only source of the issue, but it's the most prevalent one
Cleans up total_moles_specific() slightly, there's no point iterating a list if you already have the gas id. Removes a null assignment and if check, they don't catch anything as things are now, and if someone passes null to the proc I want a runtime
Oh and I reordered a bit of atmospherics.dm to make a comment make sense. Don't worry about it
---
code/__DEFINES/atmospherics.dm | 59 ++++++++++++-------
code/game/turfs/closed/minerals.dm | 28 ++++++++-
.../atmospherics/gasmixtures/gas_mixture.dm | 16 ++++-
3 files changed, 77 insertions(+), 26 deletions(-)
diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm
index 8f36e5ecce99e..6af9647e727ea 100644
--- a/code/__DEFINES/atmospherics.dm
+++ b/code/__DEFINES/atmospherics.dm
@@ -468,7 +468,30 @@
/// north/south east/west doesn't matter, auto normalize on build.
#define PIPING_CARDINAL_AUTONORMALIZE (1<<3)
-//HELPERS
+// Ventcrawling bitflags, handled in var/vent_movement
+///Allows for ventcrawling to occur. All atmospheric machines have this flag on by default. Cryo is the exception
+#define VENTCRAWL_ALLOWED (1<<0)
+///Allows mobs to enter or leave from atmospheric machines. On for passive, unary, and scrubber vents.
+#define VENTCRAWL_ENTRANCE_ALLOWED (1<<1)
+///Used to check if a machinery is visible. Called by update_pipe_vision(). On by default for all except cryo.
+#define VENTCRAWL_CAN_SEE (1<<2)
+
+GLOBAL_LIST_INIT(pipe_paint_colors, sortList(list(
+ "amethyst" = rgb(130,43,255), //supplymain
+ "blue" = rgb(0,0,255),
+ "brown" = rgb(178,100,56),
+ "cyan" = rgb(0,255,249),
+ "dark" = rgb(69,69,69),
+ "green" = rgb(30,255,0),
+ "grey" = rgb(255,255,255),
+ "orange" = rgb(255,129,25),
+ "purple" = rgb(128,0,182),
+ "red" = rgb(255,0,0),
+ "violet" = rgb(64,0,128),
+ "yellow" = rgb(255,198,0)
+)))
+
+//Helpers
#define PIPING_LAYER_SHIFT(T, PipingLayer) \
if(T.dir & (NORTH|SOUTH)) { \
T.pixel_x = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_X;\
@@ -502,9 +525,13 @@
for(var/total_moles_id in cached_gases){\
out_var += cached_gases[total_moles_id][MOLES];\
}
-#define NORMAL_TURF 1
-#define MAKE_ACTIVE 2
-#define KILL_EXCITED 3
+
+#define TOTAL_MOLES_SPECIFIC(cached_gases, gas_id, out_var)\
+ out_var = 0;\
+ if(cached_gases[gas_id]){\
+ out_var = cached_gases[gas_id][MOLES];\
+ }
+
#ifdef TESTING
GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
#define CALCULATE_ADJACENT_TURFS(T, state) if (SSadjacent_air.queue[T]) { GLOB.atmos_adjacent_savings[1] += 1 } else { GLOB.atmos_adjacent_savings[2] += 1; SSadjacent_air.queue[T] = state}
@@ -512,25 +539,13 @@ GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
#define CALCULATE_ADJACENT_TURFS(T, state) SSadjacent_air.queue[T] = state
#endif
+//Adjacent turf related defines, they dictate what to do with a turf once it's been recalculated
+//Used as "state" in CALCULATE_ADJACENT_TURFS
+#define NORMAL_TURF 1
+#define MAKE_ACTIVE 2
+#define KILL_EXCITED 3
+
//If you're doing spreading things related to atmos, DO NOT USE CANATMOSPASS, IT IS NOT CHEAP. use this instead, the info is cached after all. it's tweaked just a bit to allow for circular checks
#define TURFS_CAN_SHARE(T1, T2) (LAZYACCESS(T2.atmos_adjacent_turfs, T1) || LAZYLEN(T1.atmos_adjacent_turfs & T2.atmos_adjacent_turfs))
//Use this to see if a turf is fully blocked or not, think windows or firelocks. Fails with 1x1 non full tile windows, but it's not worth the cost.
#define TURF_SHARES(T) (LAZYLEN(T.atmos_adjacent_turfs))
-
-GLOBAL_LIST_INIT(pipe_paint_colors, sortList(list(
- "amethyst" = rgb(130,43,255), //supplymain
- "blue" = rgb(0,0,255),
- "brown" = rgb(178,100,56),
- "cyan" = rgb(0,255,249),
- "dark" = rgb(69,69,69),
- "green" = rgb(30,255,0),
- "grey" = rgb(255,255,255),
- "orange" = rgb(255,129,25),
- "purple" = rgb(128,0,182),
- "red" = rgb(255,0,0),
- "violet" = rgb(64,0,128),
- "yellow" = rgb(255,198,0)
-)))
-
-#define MIASMA_CORPSE_MOLES 0.02
-#define MIASMA_GIBS_MOLES 0.005
diff --git a/code/game/turfs/closed/minerals.dm b/code/game/turfs/closed/minerals.dm
index 079a3de486990..d7a063e34936d 100644
--- a/code/game/turfs/closed/minerals.dm
+++ b/code/game/turfs/closed/minerals.dm
@@ -91,11 +91,33 @@
for(var/obj/effect/temp_visual/mining_overlay/M in src)
qdel(M)
var/flags = NONE
+ var/old_type = type
if(defer_change) // TODO: make the defer change var a var for any changeturf flag
flags = CHANGETURF_DEFER_CHANGE
- ScrapeAway(null, flags)
- addtimer(CALLBACK(src, PROC_REF(AfterChange)), 1, TIMER_UNIQUE)
- playsound(src, 'sound/effects/break_stone.ogg', 50, 1) //beautiful destruction
+ var/turf/open/mined = ScrapeAway(null, flags)
+ addtimer(CALLBACK(src, .proc/AfterChange, old_type), 1, TIMER_UNIQUE)
+ playsound(src, 'sound/effects/break_stone.ogg', 50, TRUE) //beautiful destruction
+ mined.update_visuals()
+
+/turf/closed/mineral/attack_animal(mob/living/simple_animal/user, list/modifiers)
+ if((user.environment_smash & ENVIRONMENT_SMASH_WALLS) || (user.environment_smash & ENVIRONMENT_SMASH_RWALLS))
+ gets_drilled(user)
+ ..()
+
+/turf/closed/mineral/attack_alien(mob/living/carbon/alien/user, list/modifiers)
+ to_chat(user, "You start digging into the rock...")
+ playsound(src, 'sound/effects/break_stone.ogg', 50, TRUE)
+ if(do_after(user, 4 SECONDS, target = src))
+ to_chat(user, "You tunnel into the rock.")
+ gets_drilled(user)
+
+/turf/closed/mineral/attack_hulk(mob/living/carbon/human/H)
+ ..()
+ if(do_after(H, 50, target = src))
+ playsound(src, 'sound/effects/meteorimpact.ogg', 100, TRUE)
+ H.say(pick(";RAAAAAAAARGH!", ";HNNNNNNNNNGGGGGGH!", ";GWAAAAAAAARRRHHH!", "NNNNNNNNGGGGGGGGHH!", ";AAAAAAARRRGH!" ), forced = "hulk")
+ gets_drilled(H)
+ return TRUE
/turf/closed/mineral/Bumped(atom/movable/AM)
..()
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index 6fed8b0ccdc6e..16058a899efe1 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -107,7 +107,21 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
var/cached_gases = gases
TOTAL_MOLES(cached_gases, .)
- /// Calculate pressure in kilopascals
+/// Calculate moles for a specific gas in the mixture
+/datum/gas_mixture/proc/total_moles_specific(gas_id)
+ var/cached_gases = gases
+ TOTAL_MOLES_SPECIFIC(cached_gases, gas_id, .)
+
+/// Checks to see if gas amount exists in mixture.
+/// Do NOT use this in code where performance matters!
+/// It's better to batch calls to garbage_collect(), especially in places where you're checking many gastypes
+/datum/gas_mixture/proc/has_gas(gas_id, amount=0)
+ ASSERT_GAS(gas_id, src)
+ var/is_there_gas = amount < gases[gas_id][MOLES]
+ garbage_collect()
+ return is_there_gas
+
+/// Calculate pressure in kilopascals
/datum/gas_mixture/proc/return_pressure()
if(volume) // to prevent division by zero
var/cached_gases = gases
From 2ab9bdf98c91437e2cc44f38f936338989087958 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Thu, 11 Jul 2024 00:07:26 +0200
Subject: [PATCH 012/114] Gas defines begone
---
code/__HELPERS/turfs.dm | 2 +-
.../diseases/advance/symptoms/clockwork.dm | 4 +-
code/datums/elements/atmos_requirements.dm | 8 +-
code/game/atoms.dm | 2 +-
code/game/gamemodes/objective_items.dm | 2 +-
code/game/machinery/shuttle/shuttle_heater.dm | 2 +-
.../effects/effect_system/effects_foam.dm | 6 +-
.../effects/effect_system/effects_smoke.dm | 6 +-
.../objects/effects/spawners/bombspawner.dm | 6 +-
code/game/objects/items/chrono_eraser.dm | 4 +-
code/game/objects/items/devices/scanners.dm | 24 +--
code/game/objects/items/melee/misc.dm | 2 +-
code/game/objects/items/tanks/jetpack.dm | 20 +--
code/game/objects/items/tanks/tank_types.dm | 26 +--
code/game/objects/structures/aliens.dm | 2 +-
.../transit_tubes/transit_tube_pod.dm | 4 +-
code/game/turfs/closed/wall/mineral_walls.dm | 4 +-
code/game/turfs/open/_open.dm | 8 +-
code/modules/admin/verbs/debug.dm | 2 +-
.../atmospherics/auxgm/breathing_classes.dm | 10 +-
.../gasmixtures/immutable_mixtures.dm | 2 +-
.../atmospherics/gasmixtures/reactions.dm | 166 +++++++++---------
.../atmospherics/machinery/airalarm.dm | 80 ++++-----
.../components/unary_devices/tank.dm | 12 +-
.../components/unary_devices/vent_scrubber.dm | 4 +-
.../atmospherics/machinery/other/miner.dm | 34 ++--
.../machinery/portable/canister.dm | 26 +--
.../atmospherics/machinery/portable/pump.dm | 4 +-
.../machinery/portable/scrubber.dm | 2 +-
code/modules/cargo/bounties/engineering.dm | 4 +-
code/modules/cargo/exports/large_objects.dm | 6 +-
code/modules/events/spacevine.dm | 8 +-
code/modules/events/supermatter_surge.dm | 4 +-
code/modules/hydroponics/grown/towercap.dm | 2 +-
code/modules/mob/living/carbon/alien/life.dm | 10 +-
.../carbon/human/species_types/oozelings.dm | 4 +-
.../carbon/human/species_types/plasmamen.dm | 2 +-
code/modules/mob/living/carbon/life.dm | 32 ++--
code/modules/mob/living/life.dm | 2 +-
.../mob/living/simple_animal/bot/atmosbot.dm | 24 +--
.../mob/living/simple_animal/hostile/tree.dm | 4 +-
.../mob/living/simple_animal/simple_animal.dm | 8 +-
.../mob/living/simple_animal/slime/life.dm | 8 +-
code/modules/power/singularity/collector.dm | 18 +-
code/modules/power/supermatter/supermatter.dm | 18 +-
.../xenobiology/crossbreeding/_structures.dm | 4 +-
.../xenobiology/crossbreeding/chilling.dm | 2 +-
.../shuttle_components/plasma_refiner.dm | 6 +-
code/modules/station_goals/dna_vault.dm | 2 +-
code/modules/surgery/organs/lungs.dm | 30 ++--
code/modules/vehicles/mecha/_mecha.dm | 4 +-
.../traits/xenoartifact_malfunctions.dm | 2 +-
52 files changed, 339 insertions(+), 339 deletions(-)
diff --git a/code/__HELPERS/turfs.dm b/code/__HELPERS/turfs.dm
index 409f2b65925af..cf9796729c1b5 100644
--- a/code/__HELPERS/turfs.dm
+++ b/code/__HELPERS/turfs.dm
@@ -404,7 +404,7 @@ Turf and target are separate in case you want to teleport some distance from a t
if(id in GLOB.hardcoded_gases)
continue
return FALSE
- if(air.get_moles(GAS_O2) < 16 || air.get_moles(GAS_PLASMA) || air.get_moles(GAS_CO2) >= 10)
+ if(air.get_moles(/datum/gas/oxygen) < 16 || air.get_moles(/datum/gas/plasma) || air.get_moles(/datum/gas/carbon_dioxide) >= 10)
return FALSE
var/temperature = air.return_temperature()
if(temperature <= 270 || temperature >= 360)
diff --git a/code/datums/diseases/advance/symptoms/clockwork.dm b/code/datums/diseases/advance/symptoms/clockwork.dm
index 51e3c94fb8c45..d810d09fc2353 100644
--- a/code/datums/diseases/advance/symptoms/clockwork.dm
+++ b/code/datums/diseases/advance/symptoms/clockwork.dm
@@ -107,8 +107,8 @@
var/obj/item/organ/lungs/clockwork/organ = new()
if(robustbits)
organ.gas_max = list(
- GAS_PLASMA = 15,
- GAS_CO2 = 15,
+ /datum/gas/plasma = 15,
+ /datum/gas/carbon_dioxide = 15,
)
organ.SA_para_min = 15
organ.SA_sleep_min = 15
diff --git a/code/datums/elements/atmos_requirements.dm b/code/datums/elements/atmos_requirements.dm
index d944a4dbac53f..99b29bd259d65 100644
--- a/code/datums/elements/atmos_requirements.dm
+++ b/code/datums/elements/atmos_requirements.dm
@@ -45,10 +45,10 @@
if(!ST.air && (atmos_requirements["min_oxy"] || atmos_requirements["min_tox"] || atmos_requirements["min_n2"] || atmos_requirements["min_co2"]))
return FALSE
- var/plas = 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)
+ var/plas = 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)
. = TRUE
if(atmos_requirements["min_oxy"] && oxy < atmos_requirements["min_oxy"])
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index 4876331219eda..9cac675790fb0 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -1858,7 +1858,7 @@
/atom/proc/plasma_ignition(strength, mob/user, reagent_reaction)
var/turf/T = get_turf(src)
var/datum/gas_mixture/environment = T.return_air()
- if(environment.get_moles(GAS_O2) >= PLASMA_MINIMUM_OXYGEN_NEEDED) //Flashpoint ignition can only occur with at least this much oxygen present
+ if(environment.get_moles(/datum/gas/oxygen) >= PLASMA_MINIMUM_OXYGEN_NEEDED) //Flashpoint ignition can only occur with at least this much oxygen present
//no reason to alert admins or create an explosion if there's not enough power to actually make an explosion
if(strength > 1)
if(user)
diff --git a/code/game/gamemodes/objective_items.dm b/code/game/gamemodes/objective_items.dm
index 1b80a82c1e2fa..e29221230f24e 100644
--- a/code/game/gamemodes/objective_items.dm
+++ b/code/game/gamemodes/objective_items.dm
@@ -143,7 +143,7 @@
/datum/objective_item/steal/plasma/check_special_completion(obj/item/tank/T)
var/target_amount = text2num(name)
var/found_amount = 0
- found_amount += T.air_contents.get_moles(GAS_PLASMA)
+ found_amount += T.air_contents.get_moles(/datum/gas/plasma)
return found_amount>=target_amount
/datum/objective_item/steal/functionalai
diff --git a/code/game/machinery/shuttle/shuttle_heater.dm b/code/game/machinery/shuttle/shuttle_heater.dm
index 1420165f4e4d7..98d4764e89ae9 100644
--- a/code/game/machinery/shuttle/shuttle_heater.dm
+++ b/code/game/machinery/shuttle/shuttle_heater.dm
@@ -29,7 +29,7 @@
pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY
- var/gas_type = GAS_PLASMA
+ var/gas_type = /datum/gas/plasma
var/efficiency_multiplier = 1
var/gas_capacity = 0
diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm
index fbd57a9b76ec7..45d051709d309 100644
--- a/code/game/objects/effects/effect_system/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/effects_foam.dm
@@ -44,8 +44,8 @@
if(hotspot && istype(T) && T.air)
qdel(hotspot)
var/datum/gas_mixture/G = T.air
- var/plas_amt = min(30,G.get_moles(GAS_PLASMA)) //Absorb some plasma
- G.adjust_moles(GAS_PLASMA, -plas_amt)
+ var/plas_amt = min(30,G.get_moles(/datum/gas/plasma)) //Absorb some plasma
+ G.adjust_moles(/datum/gas/plasma, -plas_amt)
absorbed_plasma += plas_amt
if(G.return_temperature() > T20C)
G.set_temperature(max(G.return_temperature()/2,T20C))
@@ -340,7 +340,7 @@
for(var/obj/effect/hotspot/H in O)
qdel(H)
for(var/I in G.get_gases())
- if(I == GAS_O2 || I == GAS_N2)
+ if(I == /datum/gas/oxygen || I == /datum/gas/nitrogen)
continue
G.set_moles(I, 0)
for(var/obj/machinery/atmospherics/components/unary/U in O)
diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm
index 41f4c374ca757..1654e4b878a0e 100644
--- a/code/game/objects/effects/effect_system/effects_smoke.dm
+++ b/code/game/objects/effects/effect_system/effects_smoke.dm
@@ -179,9 +179,9 @@
T.air_update_turf(FALSE, FALSE)
for(var/obj/effect/hotspot/H in T)
qdel(H)
- if(G.get_moles(GAS_PLASMA))
- G.adjust_moles(GAS_N2, G.get_moles(GAS_PLASMA))
- G.set_moles(GAS_PLASMA, 0)
+ if(G.get_moles(/datum/gas/plasma))
+ G.adjust_moles(/datum/gas/nitrogen, G.get_moles(/datum/gas/plasma))
+ G.set_moles(/datum/gas/plasma, 0)
if (weldvents)
for(var/obj/machinery/atmospherics/components/unary/U in T)
if(!isnull(U.welded) && !U.welded) //must be an unwelded vent pump or vent scrubber.
diff --git a/code/game/objects/effects/spawners/bombspawner.dm b/code/game/objects/effects/spawners/bombspawner.dm
index 7f5e8b6989e0c..0322878bb6ca9 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.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_SCALE(PRESSURE_P,PRESSURE_O,TEMP_O) (((PRESSURE_P) * GLOB.gas_data.specific_heats[/datum/gas/plasma]) / (((PRESSURE_P) * GLOB.gas_data.specific_heats[/datum/gas/plasma] + (PRESSURE_O) * GLOB.gas_data.specific_heats[/datum/gas/oxygen]) / PLASMA_UPPER_TEMPERATURE - (PRESSURE_O) * GLOB.gas_data.specific_heats[/datum/gas/oxygen] / 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(GAS_PLASMA, pressure_p*PT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_p)))
+ 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_temperature(CELSIUS_TO_KELVIN(temp_p))
- OT.air_contents.set_moles(GAS_O2, pressure_o*OT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o)))
+ 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_temperature(CELSIUS_TO_KELVIN(temp_o))
V.tank_one = PT
diff --git a/code/game/objects/items/chrono_eraser.dm b/code/game/objects/items/chrono_eraser.dm
index 3a58d75db273e..087e13b24e673 100644
--- a/code/game/objects/items/chrono_eraser.dm
+++ b/code/game/objects/items/chrono_eraser.dm
@@ -264,8 +264,8 @@
/obj/structure/chrono_field/return_air() //we always have nominal air and temperature
var/datum/gas_mixture/GM = new
- GM.set_moles(GAS_O2, MOLES_O2STANDARD)
- GM.set_moles(GAS_N2, MOLES_N2STANDARD)
+ GM.set_moles(/datum/gas/oxygen, MOLES_O2STANDARD)
+ GM.set_moles(/datum/gas/nitrogen, MOLES_N2STANDARD)
GM.set_temperature(T20C)
return GM
diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm
index 2178dcf5be457..304be87c43e48 100644
--- a/code/game/objects/items/devices/scanners.dm
+++ b/code/game/objects/items/devices/scanners.dm
@@ -698,30 +698,30 @@ GENE SCANNER
else
message += "Pressure: [round(pressure, 0.01)] kPa"
if(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
+ 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
if(abs(n2_concentration - N2STANDARD) < 20)
- message += "Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(environment.get_moles(GAS_N2), 0.01)] mol)"
+ message += "Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/nitrogen), 0.01)] mol)"
else
- message += "Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(environment.get_moles(GAS_N2), 0.01)] mol)"
+ message += "Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/nitrogen), 0.01)] mol)"
if(abs(o2_concentration - O2STANDARD) < 2)
- message += "Oxygen: [round(o2_concentration*100, 0.01)] % ([round(environment.get_moles(GAS_O2), 0.01)] mol)"
+ message += "Oxygen: [round(o2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/oxygen), 0.01)] mol)"
else
- message += "Oxygen: [round(o2_concentration*100, 0.01)] % ([round(environment.get_moles(GAS_O2), 0.01)] mol)"
+ message += "Oxygen: [round(o2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/oxygen), 0.01)] mol)"
if(co2_concentration > 0.01)
- message += "CO2: [round(co2_concentration*100, 0.01)] % ([round(environment.get_moles(GAS_CO2), 0.01)] mol)"
+ message += "CO2: [round(co2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/carbon_dioxide), 0.01)] mol)"
else
- message += "CO2: [round(co2_concentration*100, 0.01)] % ([round(environment.get_moles(GAS_CO2), 0.01)] mol)"
+ message += "CO2: [round(co2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/carbon_dioxide), 0.01)] mol)"
if(plasma_concentration > 0.005)
- message += "Plasma: [round(plasma_concentration*100, 0.01)] % ([round(environment.get_moles(GAS_PLASMA), 0.01)] mol)"
+ message += "Plasma: [round(plasma_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/plasma), 0.01)] mol)"
else
- message += "Plasma: [round(plasma_concentration*100, 0.01)] % ([round(environment.get_moles(GAS_PLASMA), 0.01)] mol)"
+ message += "Plasma: [round(plasma_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/plasma), 0.01)] mol)"
for(var/id in environment.get_gases())
if(id in GLOB.hardcoded_gases)
diff --git a/code/game/objects/items/melee/misc.dm b/code/game/objects/items/melee/misc.dm
index e3b27ec60b476..ec84c088f3cf3 100644
--- a/code/game/objects/items/melee/misc.dm
+++ b/code/game/objects/items/melee/misc.dm
@@ -874,7 +874,7 @@
T.visible_message("[T] smacks into [src] and rapidly flashes to ash.",\
"You hear a loud crack as you are washed with a wave of heat.")
shard.Consume()
- CALCULATE_ADJACENT_TURFS(T)
+ CALCULATE_ADJACENT_TURFS(T, MAKE_ACTIVE)
/obj/item/melee/supermatter_sword/add_blood_DNA(list/blood_dna)
return FALSE
diff --git a/code/game/objects/items/tanks/jetpack.dm b/code/game/objects/items/tanks/jetpack.dm
index 072351d11c440..7c41df1ceb68e 100644
--- a/code/game/objects/items/tanks/jetpack.dm
+++ b/code/game/objects/items/tanks/jetpack.dm
@@ -8,7 +8,7 @@
w_class = WEIGHT_CLASS_BULKY
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)
- var/gas_type = GAS_O2
+ var/gas_type = /datum/gas/oxygen
var/on = FALSE
var/stabilizers = FALSE
var/full_speed = TRUE // If the jetpack will have a speedboost in space/nograv or not
@@ -335,8 +335,8 @@
/obj/item/tank/jetpack/combustion/populate_gas()
var/moles_full = ((6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
var/ideal_o2_percent = (1 / PLASMA_OXYGEN_FULLBURN) * 2
- air_contents.set_moles(GAS_PLASMA, moles_full * (1 - ideal_o2_percent))
- air_contents.set_moles(GAS_O2, moles_full * ideal_o2_percent)
+ air_contents.set_moles(/datum/gas/plasma, moles_full * (1 - ideal_o2_percent))
+ air_contents.set_moles(/datum/gas/oxygen, moles_full * ideal_o2_percent)
/obj/item/tank/jetpack/combustion/allow_thrust(num, mob/living/user, use_fuel = TRUE)
if(!on || !known_user)
@@ -350,12 +350,12 @@
// Also produces no waste products (CO2/Trit)
var/oxygen_burn_rate = (OXYGEN_BURN_RATE_BASE - 1)
var/plasma_burn_rate = 0
- if(air_contents.get_moles(GAS_O2) > air_contents.get_moles(GAS_PLASMA)*PLASMA_OXYGEN_FULLBURN)
- plasma_burn_rate = air_contents.get_moles(GAS_PLASMA)/PLASMA_BURN_RATE_DELTA
+ if(air_contents.get_moles(/datum/gas/oxygen) > air_contents.get_moles(/datum/gas/plasma)*PLASMA_OXYGEN_FULLBURN)
+ plasma_burn_rate = air_contents.get_moles(/datum/gas/plasma)/PLASMA_BURN_RATE_DELTA
else
- plasma_burn_rate = (air_contents.get_moles(GAS_O2)/PLASMA_OXYGEN_FULLBURN)/PLASMA_BURN_RATE_DELTA
+ plasma_burn_rate = (air_contents.get_moles(/datum/gas/oxygen)/PLASMA_OXYGEN_FULLBURN)/PLASMA_BURN_RATE_DELTA
if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY)
- plasma_burn_rate = min(plasma_burn_rate,air_contents.get_moles(GAS_PLASMA),air_contents.get_moles(GAS_O2)/oxygen_burn_rate) //Ensures matter is conserved properly
+ plasma_burn_rate = min(plasma_burn_rate,air_contents.get_moles(/datum/gas/plasma),air_contents.get_moles(/datum/gas/oxygen)/oxygen_burn_rate) //Ensures matter is conserved properly
potential_energy = FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate)
// Normalize thrust volume to joules
@@ -369,8 +369,8 @@
// Consume
if(use_fuel)
- air_contents.set_moles(GAS_PLASMA, QUANTIZE(air_contents.get_moles(GAS_PLASMA) - plasma_burn_rate))
- air_contents.set_moles(GAS_O2, QUANTIZE(air_contents.get_moles(GAS_O2) - (plasma_burn_rate * oxygen_burn_rate)))
+ air_contents.set_moles(/datum/gas/plasma, QUANTIZE(air_contents.get_moles(/datum/gas/plasma) - plasma_burn_rate))
+ air_contents.set_moles(/datum/gas/oxygen, QUANTIZE(air_contents.get_moles(/datum/gas/oxygen) - (plasma_burn_rate * oxygen_burn_rate)))
update_fade(15)
update_lifespan(4)
@@ -382,7 +382,7 @@
icon_state = "jetpack-black"
item_state = "jetpack-black"
distribute_pressure = 0
- gas_type = GAS_CO2
+ gas_type = /datum/gas/carbon_dioxide
// Integrated suit jetpacks
// These use the tanks of a suit's suit storage instead of an internal tank, and their parent hardsuit assigns their known user.
diff --git a/code/game/objects/items/tanks/tank_types.dm b/code/game/objects/items/tanks/tank_types.dm
index f7a4ffdcd7397..992fe96c27369 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(GAS_O2, (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.set_moles(/datum/gas/oxygen, (6*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/oxygen/yellow
desc = "A tank of oxygen, this one is yellow."
@@ -56,8 +56,8 @@
force = 10
/obj/item/tank/internals/anesthetic/populate_gas()
- 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_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
@@ -71,8 +71,8 @@
dog_fashion = /datum/dog_fashion/back
/obj/item/tank/internals/air/populate_gas()
- 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)
+ 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)
/*
* Plasma
@@ -87,7 +87,7 @@
/obj/item/tank/internals/plasma/populate_gas()
- air_contents.set_moles(GAS_PLASMA, (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.set_moles(/datum/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))
@@ -103,7 +103,7 @@
return ..()
/obj/item/tank/internals/plasma/full/populate_gas()
- air_contents.set_moles(GAS_PLASMA, (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.set_moles(/datum/gas/plasma, (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasma/empty/populate_gas()
return
@@ -122,10 +122,10 @@
distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE
/obj/item/tank/internals/plasmaman/populate_gas()
- air_contents.set_moles(GAS_PLASMA, (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.set_moles(/datum/gas/plasma, (3*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasmaman/full/populate_gas()
- air_contents.set_moles(GAS_PLASMA, (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.set_moles(/datum/gas/plasma, (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasmaman/empty/populate_gas()
return
@@ -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(GAS_PLASMA, (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.set_moles(/datum/gas/plasma, (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasmaman/belt/empty/populate_gas()
return
@@ -170,7 +170,7 @@
/obj/item/tank/internals/emergency_oxygen/populate_gas()
- air_contents.set_moles(GAS_O2, (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.set_moles(/datum/gas/oxygen, (10*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/emergency_oxygen/empty/populate_gas()
return
@@ -214,5 +214,5 @@
volume = 1
/obj/item/tank/internals/emergency_oxygen/clown/populate_gas()
- air_contents.set_moles(GAS_O2, (9.99*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
- air_contents.set_moles(GAS_NITROUS, (0.01*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.set_moles(/datum/gas/oxygen, (9.99*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.set_moles(/datum/gas/nitrous_oxide, (0.01*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm
index 38fae2d5c6030..b458bea80e71a 100644
--- a/code/game/objects/structures/aliens.dm
+++ b/code/game/objects/structures/aliens.dm
@@ -272,7 +272,7 @@
/obj/structure/alien/egg/ComponentInitialize()
. = ..()
- AddElement(/datum/element/atmos_sensitive
+ AddElement(/datum/element/atmos_sensitive)
/obj/structure/alien/egg/update_icon()
..()
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 ddcdb05e101a7..151f9960a466f 100644
--- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
+++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
@@ -13,8 +13,8 @@
/obj/structure/transit_tube_pod/Initialize(mapload)
. = ..()
- air_contents.set_moles(GAS_O2, MOLES_O2STANDARD)
- air_contents.set_moles(GAS_N2, MOLES_N2STANDARD)
+ air_contents.set_moles(/datum/gas/oxygen, MOLES_O2STANDARD)
+ air_contents.set_moles(/datum/gas/nitrogen, MOLES_N2STANDARD)
air_contents.set_temperature(T20C)
diff --git a/code/game/turfs/closed/wall/mineral_walls.dm b/code/game/turfs/closed/wall/mineral_walls.dm
index bd69e4972dd2b..d20f14269db7b 100644
--- a/code/game/turfs/closed/wall/mineral_walls.dm
+++ b/code/game/turfs/closed/wall/mineral_walls.dm
@@ -151,8 +151,8 @@
/turf/closed/wall/mineral/plasma/should_atmos_process(datum/gas_mixture/air, exposed_temperature)//Doesn't work because walls have superconduction turned off
return exposed_temperature > 300
/turf/closed/wall/mineral/plasma/atmos_expose(datum/gas_mixture/air, exposed_temperature)
- if(plasma_ignition(6))
- new /obj/structure/girder/displaced(loc)
+ if(plasma_ignition(6))
+ new /obj/structure/girder/displaced(loc)
/turf/closed/wall/mineral/plasma/bullet_act(obj/projectile/Proj)
if(!(Proj.nodamage) && Proj.damage_type == BURN)
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index 1497cac2d49be..d026edec08b2f 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -284,10 +284,10 @@
/turf/open/rad_act(pulse_strength)
. = ..()
- if (air.get_moles(GAS_CO2) && air.get_moles(GAS_O2))
- 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/1000),0))
- air.set_moles(GAS_O2, max(air.get_moles(GAS_O2)-(pulse_strength/2000),0))
+ if (air.get_moles(/datum/gas/carbon_dioxide) && air.get_moles(/datum/gas/oxygen))
+ 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/1000),0))
+ air.set_moles(/datum/gas/oxygen, max(air.get_moles(/datum/gas/oxygen)-(pulse_strength/2000),0))
air.adjust_moles(GAS_PLUOXIUM, pulse_strength/4000)
/turf/open/proc/break_tile(force, allow_base)
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index 36ac67e919dea..f4eaaecc68b59 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -624,7 +624,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
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(GAS_PLASMA, 70)
+ Plasma.air_contents.set_moles(/datum/gas/plasma, 70)
Rad.drainratio = 0
Rad.loaded_tank = Plasma
Plasma.forceMove(Rad)
diff --git a/code/modules/atmospherics/auxgm/breathing_classes.dm b/code/modules/atmospherics/auxgm/breathing_classes.dm
index cfc82adbffa16..e9d4c13e38fe3 100644
--- a/code/modules/atmospherics/auxgm/breathing_classes.dm
+++ b/code/modules/atmospherics/auxgm/breathing_classes.dm
@@ -22,20 +22,20 @@
/datum/breathing_class/oxygen
gases = list(
- GAS_O2 = 1,
+ /datum/gas/oxygen = 1,
GAS_PLUOXIUM = 8,
- GAS_CO2 = -0.7, // CO2 isn't actually toxic, just an asphyxiant
+ /datum/gas/carbon_dioxide = -0.7, // CO2 isn't actually toxic, just an asphyxiant
)
products = list(
- GAS_CO2 = 1,
+ /datum/gas/carbon_dioxide = 1,
)
/datum/breathing_class/plasma
gases = list(
- GAS_PLASMA = 1
+ /datum/gas/plasma = 1
)
products = list(
- GAS_CO2 = 1
+ /datum/gas/carbon_dioxide = 1
)
low_alert_category = "not_enough_tox"
low_alert_datum = /atom/movable/screen/alert/not_enough_tox
diff --git a/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm b/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
index 94fead2e8905a..cebdfe7ae0c91 100644
--- a/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
+++ b/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
@@ -25,7 +25,7 @@
initial_temperature = T20C
/datum/gas_mixture/immutable/cloner/populate()
- set_moles(GAS_N2, MOLES_O2STANDARD + MOLES_N2STANDARD)
+ set_moles(/datum/gas/nitrogen, MOLES_O2STANDARD + MOLES_N2STANDARD)
//planet side stuff
/datum/gas_mixture/immutable/planetary
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index 54e1adbdd46ec..d4233bedff176 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -62,7 +62,7 @@
/datum/gas_reaction/water_vapor/init_reqs()
min_requirements = list(
- GAS_H2O = MOLES_GAS_VISIBLE,
+ /datum/gas/water_vapor = MOLES_GAS_VISIBLE,
"MAX_TEMP" = WATER_VAPOR_CONDENSATION_POINT,
)
@@ -82,7 +82,7 @@
consumed = MOLES_GAS_VISIBLE
if(consumed)
- air.adjust_moles(GAS_H2O, -consumed)
+ air.adjust_moles(/datum/gas/water_vapor, -consumed)
SET_REACTION_RESULTS(consumed)
. = REACTING
@@ -95,7 +95,7 @@
/datum/gas_reaction/nitrous_decomp/init_reqs()
min_requirements = list(
"TEMP" = N2O_DECOMPOSITION_MIN_ENERGY,
- GAS_NITROUS = MINIMUM_MOLE_COUNT
+ /datum/gas/nitrous_oxide = MINIMUM_MOLE_COUNT
)
/datum/gas_reaction/nitrous_decomp/react(datum/gas_mixture/air, datum/holder)
@@ -105,14 +105,14 @@
var/burned_fuel = 0
- burned_fuel = max(0,0.00002*(temperature-(0.00001*(temperature**2))))*air.get_moles(GAS_NITROUS)
- air.set_moles(GAS_NITROUS, air.get_moles(GAS_NITROUS) - burned_fuel)
+ burned_fuel = max(0,0.00002*(temperature-(0.00001*(temperature**2))))*air.get_moles(/datum/gas/nitrous_oxide)
+ air.set_moles(/datum/gas/nitrous_oxide, air.get_moles(/datum/gas/nitrous_oxide) - burned_fuel)
if(burned_fuel)
energy_released += (N2O_DECOMPOSITION_ENERGY_RELEASED * burned_fuel)
- air.set_moles(GAS_O2, air.get_moles(GAS_O2) + burned_fuel/2)
- air.set_moles(GAS_N2, air.get_moles(GAS_N2) + burned_fuel)
+ air.set_moles(/datum/gas/oxygen, air.get_moles(/datum/gas/oxygen) + burned_fuel/2)
+ air.set_moles(/datum/gas/nitrogen, air.get_moles(/datum/gas/nitrogen) + burned_fuel)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
@@ -129,8 +129,8 @@
/datum/gas_reaction/tritfire/init_reqs()
min_requirements = list(
"TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST,
- GAS_TRITIUM = MINIMUM_MOLE_COUNT,
- GAS_O2 = MINIMUM_MOLE_COUNT
+ /datum/gas/tritium = MINIMUM_MOLE_COUNT,
+ /datum/gas/oxygen = MINIMUM_MOLE_COUNT
)
/proc/fire_expose(turf/open/location, datum/gas_mixture/air, temperature)
@@ -149,15 +149,15 @@
cached_results["fire"] = 0
var/turf/open/location = isturf(holder) ? holder : null
var/burned_fuel = 0
- var/initial_trit = air.get_moles(GAS_TRITIUM)// Yogs
- if(air.get_moles(GAS_O2) < initial_trit || MINIMUM_TRIT_OXYBURN_ENERGY > (temperature * old_heat_capacity))// Yogs -- Maybe a tiny performance boost? I'unno
- burned_fuel = air.get_moles(GAS_O2)/TRITIUM_BURN_OXY_FACTOR
+ var/initial_trit = air.get_moles(/datum/gas/tritium)// Yogs
+ if(air.get_moles(/datum/gas/oxygen) < initial_trit || MINIMUM_TRIT_OXYBURN_ENERGY > (temperature * old_heat_capacity))// Yogs -- Maybe a tiny performance boost? I'unno
+ burned_fuel = air.get_moles(/datum/gas/oxygen)/TRITIUM_BURN_OXY_FACTOR
if(burned_fuel > initial_trit) burned_fuel = initial_trit //Yogs -- prevents negative moles of Tritium
- air.adjust_moles(GAS_TRITIUM, -burned_fuel)
+ air.adjust_moles(/datum/gas/tritium, -burned_fuel)
else
burned_fuel = initial_trit // Yogs -- Conservation of Mass fix
- air.set_moles(GAS_TRITIUM, air.get_moles(GAS_TRITIUM) * (1 - 1/TRITIUM_BURN_TRIT_FACTOR)) // Yogs -- Maybe a tiny performance boost? I'unno
- air.adjust_moles(GAS_O2, -air.get_moles(GAS_TRITIUM))
+ air.set_moles(/datum/gas/tritium, air.get_moles(/datum/gas/tritium) * (1 - 1/TRITIUM_BURN_TRIT_FACTOR)) // Yogs -- Maybe a tiny performance boost? I'unno
+ air.adjust_moles(/datum/gas/oxygen, -air.get_moles(/datum/gas/tritium))
energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel * (TRITIUM_BURN_TRIT_FACTOR - 1)) // Yogs -- Fixes low-energy tritium fires
if(burned_fuel)
@@ -166,7 +166,7 @@
radiation_pulse(location, energy_released/TRITIUM_BURN_RADIOACTIVITY_FACTOR)
//oxygen+more-or-less hydrogen=H2O
- air.adjust_moles(GAS_H2O, burned_fuel )// Yogs -- Conservation of Mass
+ air.adjust_moles(/datum/gas/water_vapor, burned_fuel )// Yogs -- Conservation of Mass
cached_results["fire"] += burned_fuel
@@ -192,8 +192,8 @@
/datum/gas_reaction/plasmafire/init_reqs()
min_requirements = list(
"TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST,
- GAS_PLASMA = MINIMUM_MOLE_COUNT,
- GAS_O2 = MINIMUM_MOLE_COUNT
+ /datum/gas/plasma = MINIMUM_MOLE_COUNT,
+ /datum/gas/oxygen = MINIMUM_MOLE_COUNT
)
/datum/gas_reaction/plasmafire/react(datum/gas_mixture/air, datum/holder)
@@ -218,21 +218,21 @@
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(GAS_O2) / air.get_moles(GAS_PLASMA) > SUPER_SATURATION_THRESHOLD) //supersaturation. Form Tritium.
+ if(air.get_moles(/datum/gas/oxygen) / air.get_moles(/datum/gas/plasma) > SUPER_SATURATION_THRESHOLD) //supersaturation. Form Tritium.
super_saturation = TRUE
- if(air.get_moles(GAS_O2) > air.get_moles(GAS_PLASMA)*PLASMA_OXYGEN_FULLBURN)
- plasma_burn_rate = (air.get_moles(GAS_PLASMA)*temperature_scale)/PLASMA_BURN_RATE_DELTA
+ 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
else
- plasma_burn_rate = (temperature_scale*(air.get_moles(GAS_O2)/PLASMA_OXYGEN_FULLBURN))/PLASMA_BURN_RATE_DELTA
+ plasma_burn_rate = (temperature_scale*(air.get_moles(/datum/gas/oxygen)/PLASMA_OXYGEN_FULLBURN))/PLASMA_BURN_RATE_DELTA
if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY)
- plasma_burn_rate = min(plasma_burn_rate,air.get_moles(GAS_PLASMA),air.get_moles(GAS_O2)/oxygen_burn_rate) //Ensures matter is conserved properly
- air.set_moles(GAS_PLASMA, QUANTIZE(air.get_moles(GAS_PLASMA) - plasma_burn_rate))
- air.set_moles(GAS_O2, QUANTIZE(air.get_moles(GAS_O2) - (plasma_burn_rate * oxygen_burn_rate)))
+ 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)))
if (super_saturation)
- air.adjust_moles(GAS_TRITIUM, plasma_burn_rate)
+ air.adjust_moles(/datum/gas/tritium, plasma_burn_rate)
else
- air.adjust_moles(GAS_CO2, plasma_burn_rate)
+ air.adjust_moles(/datum/gas/carbon_dioxide, plasma_burn_rate)
energy_released += FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate)
@@ -342,9 +342,9 @@
/datum/gas_reaction/fusion/init_reqs()
min_requirements = list(
"TEMP" = FUSION_TEMPERATURE_THRESHOLD,
- GAS_TRITIUM = FUSION_TRITIUM_MOLES_USED,
- GAS_PLASMA = FUSION_MOLE_THRESHOLD,
- GAS_CO2 = FUSION_MOLE_THRESHOLD)
+ /datum/gas/tritium = FUSION_TRITIUM_MOLES_USED,
+ /datum/gas/plasma = FUSION_MOLE_THRESHOLD,
+ /datum/gas/carbon_dioxide = FUSION_MOLE_THRESHOLD)
/datum/gas_reaction/fusion/react(datum/gas_mixture/air, datum/holder)
var/turf/open/location
@@ -358,8 +358,8 @@
var/list/cached_scan_results = air.analyzer_results
var/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(GAS_PLASMA)
- var/initial_carbon = air.get_moles(GAS_CO2)
+ var/initial_plasma = air.get_moles(/datum/gas/plasma)
+ var/initial_carbon = air.get_moles(/datum/gas/carbon_dioxide)
var/scale_factor = max(air.return_volume() / FUSION_SCALE_DIVISOR, FUSION_MINIMAL_SCALE)
var/temperature_scale = log(10, air.return_temperature())
//The size of the phase space hypertorus
@@ -380,9 +380,9 @@
plasma = MODULUS(plasma - (instability*sin(TODEGREES(carbon))), toroidal_size)
carbon = MODULUS(carbon - plasma, toroidal_size)
- 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 = min(initial_plasma - air.get_moles(GAS_PLASMA), toroidal_size * scale_factor * 1.5)
+ 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 = min(initial_plasma - air.get_moles(/datum/gas/plasma), toroidal_size * scale_factor * 1.5)
//Energy is gained or lost corresponding to the creation or destruction of mass.
//Low instability prevents endothermality while higher instability acutally encourages it.
@@ -402,16 +402,16 @@
thermal_energy = middle_energy * 10 ** log(FUSION_ENERGY_TRANSLATION_EXPONENT, (thermal_energy + bowdlerized_reaction_energy) / middle_energy)
//The reason why you should set up a tritium production line.
- air.adjust_moles(GAS_TRITIUM, -FUSION_TRITIUM_MOLES_USED)
+ air.adjust_moles(/datum/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
var/standard_waste_gas_output = scale_factor * (FUSION_TRITIUM_CONVERSION_COEFFICIENT*FUSION_TRITIUM_MOLES_USED)
- delta_plasma > 0 ? air.adjust_moles(GAS_H2O, standard_waste_gas_output) : air.adjust_moles(GAS_BZ, standard_waste_gas_output)
- air.adjust_moles(GAS_O2, standard_waste_gas_output) //Oxygen is a bit touchy subject
+ delta_plasma > 0 ? air.adjust_moles(/datum/gas/water_vapor, standard_waste_gas_output) : air.adjust_moles(/datum/gas/bz, standard_waste_gas_output)
+ air.adjust_moles(/datum/gas/oxygen, standard_waste_gas_output) //Oxygen is a bit touchy subject
if(reaction_energy)
if(location)
- var/standard_energy = 400 * air.get_moles(GAS_PLASMA) * air.return_temperature() //Prevents putting meaningless waste gases to achieve high rads.
+ var/standard_energy = 400 * air.get_moles(/datum/gas/plasma) * air.return_temperature() //Prevents putting meaningless waste gases to achieve high rads.
if(prob(PERCENT(((PARTICLE_CHANCE_CONSTANT)/(reaction_energy-PARTICLE_CHANCE_CONSTANT)) + 1))) //Asymptopically approaches 100% as the energy of the reaction goes up.
location.fire_nuclear_particle(customize = TRUE, custompower = standard_energy)
radiation_pulse(location, max(2000 * 3 ** (log(10,standard_energy) - FUSION_RAD_MIDPOINT), 0))
@@ -432,8 +432,8 @@
/datum/gas_reaction/nitrylformation/init_reqs()
min_requirements = list(
- GAS_O2 = 20,
- GAS_N2 = 20,
+ /datum/gas/oxygen = 20,
+ /datum/gas/nitrogen = 20,
GAS_PLUOXIUM = 5, //Gates Nitryl behind pluoxium to offset N2O burning up during formation
"TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST*60
)
@@ -442,13 +442,13 @@
var/temperature = air.return_temperature()
var/old_heat_capacity = air.heat_capacity()
- var/heat_efficency = min(temperature/(FIRE_MINIMUM_TEMPERATURE_TO_EXIST*60),air.get_moles(GAS_O2),air.get_moles(GAS_N2))
+ var/heat_efficency = min(temperature/(FIRE_MINIMUM_TEMPERATURE_TO_EXIST*60),air.get_moles(/datum/gas/oxygen),air.get_moles(/datum/gas/nitrogen))
var/energy_used = heat_efficency*NITRYL_FORMATION_ENERGY
- if ((air.get_moles(GAS_O2) - heat_efficency < 0 )|| (air.get_moles(GAS_N2) - heat_efficency < 0)) //Shouldn't produce gas from nothing.
+ if ((air.get_moles(/datum/gas/oxygen) - heat_efficency < 0 )|| (air.get_moles(/datum/gas/nitrogen) - heat_efficency < 0)) //Shouldn't produce gas from nothing.
return NO_REACTION
- air.adjust_moles(GAS_O2, -heat_efficency)
- air.adjust_moles(GAS_N2, -heat_efficency)
- air.adjust_moles(GAS_NITRYL, heat_efficency*2)
+ air.adjust_moles(/datum/gas/oxygen, -heat_efficency)
+ air.adjust_moles(/datum/gas/nitrogen, -heat_efficency)
+ air.adjust_moles(/datum/gas/nitryl, heat_efficency*2)
if(energy_used > 0)
var/new_heat_capacity = air.heat_capacity()
@@ -463,8 +463,8 @@
/datum/gas_reaction/bzformation/init_reqs()
min_requirements = list(
- GAS_NITROUS = 10,
- GAS_PLASMA = 10
+ /datum/gas/nitrous_oxide = 10,
+ /datum/gas/plasma = 10
)
@@ -472,16 +472,16 @@
var/temperature = air.return_temperature()
var/pressure = air.return_pressure()
var/old_heat_capacity = air.heat_capacity()
- var/reaction_efficency = min(1/((pressure/(0.5*ONE_ATMOSPHERE))*(max(air.get_moles(GAS_PLASMA)/air.get_moles(GAS_NITROUS),1))),air.get_moles(GAS_NITROUS),air.get_moles(GAS_PLASMA)/2)
+ var/reaction_efficency = min(1/((pressure/(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/energy_released = 2*reaction_efficency*FIRE_CARBON_ENERGY_RELEASED
- if ((air.get_moles(GAS_NITROUS) - reaction_efficency < 0 )|| (air.get_moles(GAS_PLASMA) - (2*reaction_efficency) < 0) || energy_released <= 0) //Shouldn't produce gas from nothing.
+ 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.
return NO_REACTION
- air.adjust_moles(GAS_BZ, reaction_efficency)
- if(reaction_efficency == air.get_moles(GAS_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)
+ 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)
SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, min((reaction_efficency**2)*BZ_RESEARCH_SCALE,BZ_RESEARCH_MAX_AMOUNT))
SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DISCOVERY, min((reaction_efficency**2)*BZ_RESEARCH_SCALE,BZ_RESEARCH_MAX_AMOUNT)*0.5)
@@ -499,24 +499,24 @@
/datum/gas_reaction/stimformation/init_reqs()
min_requirements = list(
- GAS_TRITIUM = 30,
- GAS_PLASMA = 10,
- GAS_BZ = 20,
- GAS_NITRYL = 30,
+ /datum/gas/tritium = 30,
+ /datum/gas/plasma = 10,
+ /datum/gas/bz = 20,
+ /datum/gas/nitryl = 30,
"TEMP" = STIMULUM_HEAT_SCALE/2)
/datum/gas_reaction/stimformation/react(datum/gas_mixture/air)
var/old_heat_capacity = air.heat_capacity()
- var/heat_scale = min(air.return_temperature()/STIMULUM_HEAT_SCALE,air.get_moles(GAS_PLASMA),air.get_moles(GAS_NITRYL))
+ var/heat_scale = min(air.return_temperature()/STIMULUM_HEAT_SCALE,air.get_moles(/datum/gas/plasma),air.get_moles(/datum/gas/nitryl))
var/stim_energy_change = heat_scale + STIMULUM_FIRST_RISE*(heat_scale**2) - STIMULUM_FIRST_DROP*(heat_scale**3) + STIMULUM_SECOND_RISE*(heat_scale**4) - STIMULUM_ABSOLUTE_DROP*(heat_scale**5)
- if ((air.get_moles(GAS_PLASMA) - heat_scale < 0) || (air.get_moles(GAS_NITRYL) - heat_scale < 0) || (air.get_moles(GAS_TRITIUM) - heat_scale < 0)) //Shouldn't produce gas from nothing.
+ if ((air.get_moles(/datum/gas/plasma) - heat_scale < 0) || (air.get_moles(/datum/gas/nitryl) - heat_scale < 0) || (air.get_moles(/datum/gas/tritium) - heat_scale < 0)) //Shouldn't produce gas from nothing.
return NO_REACTION
- air.adjust_moles(GAS_STIMULUM, heat_scale/10)
- air.adjust_moles(GAS_PLASMA, -heat_scale)
- air.adjust_moles(GAS_NITRYL, -heat_scale)
- air.adjust_moles(GAS_TRITIUM, -heat_scale)
+ air.adjust_moles(/datum/gas/stimulum, heat_scale/10)
+ air.adjust_moles(/datum/gas/plasma, -heat_scale)
+ air.adjust_moles(/datum/gas/nitryl, -heat_scale)
+ air.adjust_moles(/datum/gas/tritium, -heat_scale)
SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, STIMULUM_RESEARCH_AMOUNT*max(stim_energy_change,0))
SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DISCOVERY, STIMULUM_RESEARCH_AMOUNT*max(stim_energy_change,0)*0.5)
if(stim_energy_change)
@@ -532,18 +532,18 @@
/datum/gas_reaction/nobliumformation/init_reqs()
min_requirements = list(
- GAS_N2 = 10,
- GAS_TRITIUM = 5,
+ /datum/gas/nitrogen = 10,
+ /datum/gas/tritium = 5,
"TEMP" = 5000000)
/datum/gas_reaction/nobliumformation/react(datum/gas_mixture/air)
var/old_heat_capacity = air.heat_capacity()
- var/nob_formed = min((air.get_moles(GAS_N2)+air.get_moles(GAS_TRITIUM))/100,air.get_moles(GAS_TRITIUM)/10,air.get_moles(GAS_N2)/20)
- var/energy_taken = nob_formed*(NOBLIUM_FORMATION_ENERGY/(max(air.get_moles(GAS_BZ),1)))
- if ((air.get_moles(GAS_TRITIUM) - 10*nob_formed < 0) || (air.get_moles(GAS_N2) - 20*nob_formed < 0))
+ var/nob_formed = min((air.get_moles(/datum/gas/nitrogen)+air.get_moles(/datum/gas/tritium))/100,air.get_moles(/datum/gas/tritium)/10,air.get_moles(/datum/gas/nitrogen)/20)
+ var/energy_taken = nob_formed*(NOBLIUM_FORMATION_ENERGY/(max(air.get_moles(/datum/gas/bz),1)))
+ if ((air.get_moles(/datum/gas/tritium) - 10*nob_formed < 0) || (air.get_moles(/datum/gas/nitrogen) - 20*nob_formed < 0))
return NO_REACTION
- air.adjust_moles(GAS_TRITIUM, -10*nob_formed)
- air.adjust_moles(GAS_N2, -20*nob_formed)
+ air.adjust_moles(/datum/gas/tritium, -10*nob_formed)
+ air.adjust_moles(/datum/gas/nitrogen, -20*nob_formed)
air.adjust_moles(GAS_HYPERNOB, nob_formed)
SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, nob_formed*NOBLIUM_RESEARCH_AMOUNT)
SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DISCOVERY, nob_formed*NOBLIUM_RESEARCH_AMOUNT*0.5)
@@ -561,9 +561,9 @@
/datum/gas_reaction/stim_ball/init_reqs()
min_requirements = list(
GAS_PLUOXIUM = STIM_BALL_GAS_AMOUNT,
- GAS_STIMULUM = STIM_BALL_GAS_AMOUNT,
- GAS_NITRYL = MINIMUM_MOLE_COUNT,
- GAS_PLASMA = MINIMUM_MOLE_COUNT,
+ /datum/gas/stimulum = STIM_BALL_GAS_AMOUNT,
+ /datum/gas/nitryl = MINIMUM_MOLE_COUNT,
+ /datum/gas/plasma = MINIMUM_MOLE_COUNT,
"TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST
)
@@ -575,16 +575,16 @@
location = get_turf(pick(pipenet.members))
else
location = get_turf(holder)
- var/ball_shot_angle = 180*cos(air.get_moles(GAS_H2O)/air.get_moles(GAS_NITRYL))+180
- var/stim_used = min(STIM_BALL_GAS_AMOUNT/air.get_moles(GAS_PLASMA),air.get_moles(GAS_STIMULUM))
- var/pluox_used = min(STIM_BALL_GAS_AMOUNT/air.get_moles(GAS_PLASMA),air.get_moles(GAS_PLUOXIUM))
+ var/ball_shot_angle = 180*cos(air.get_moles(/datum/gas/water_vapor)/air.get_moles(/datum/gas/nitryl))+180
+ var/stim_used = min(STIM_BALL_GAS_AMOUNT/air.get_moles(/datum/gas/plasma),air.get_moles(/datum/gas/stimulum))
+ var/pluox_used = min(STIM_BALL_GAS_AMOUNT/air.get_moles(/datum/gas/plasma),air.get_moles(GAS_PLUOXIUM))
var/energy_released = stim_used*STIMULUM_HEAT_SCALE//Stimulum has a lot of stored energy, and breaking it up releases some of it
location.fire_nuclear_particle(ball_shot_angle)
- air.adjust_moles(GAS_CO2, 4*pluox_used)
- air.adjust_moles(GAS_N2, 8*stim_used)
+ air.adjust_moles(/datum/gas/carbon_dioxide, 4*pluox_used)
+ air.adjust_moles(/datum/gas/nitrogen, 8*stim_used)
air.adjust_moles(GAS_PLUOXIUM, -pluox_used)
- air.adjust_moles(GAS_STIMULUM, -stim_used)
- air.adjust_moles(GAS_PLASMA, max(-air.get_moles(GAS_PLASMA)/2,-30))
+ air.adjust_moles(/datum/gas/stimulum, -stim_used)
+ air.adjust_moles(/datum/gas/plasma, max(-air.get_moles(/datum/gas/plasma)/2,-30))
if(energy_released)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm
index c72272eea7584..c9827ac580a7d 100644
--- a/code/modules/atmospherics/machinery/airalarm.dm
+++ b/code/modules/atmospherics/machinery/airalarm.dm
@@ -92,17 +92,17 @@
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),
- 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_PLASMA = new/datum/tlv/dangerous,
- GAS_NITROUS = new/datum/tlv/dangerous,
- GAS_BZ = new/datum/tlv/dangerous,
+ /datum/gas/oxygen = new/datum/tlv(16, 19, 40, 50), // 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/plasma = new/datum/tlv/dangerous,
+ /datum/gas/nitrous_oxide = new/datum/tlv/dangerous,
+ /datum/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_STIMULUM = new/datum/tlv/dangerous,
- GAS_NITRYL = new/datum/tlv/dangerous,
+ /datum/gas/water_vapor = new/datum/tlv/dangerous,
+ /datum/gas/tritium = new/datum/tlv/dangerous,
+ /datum/gas/stimulum = new/datum/tlv/dangerous,
+ /datum/gas/nitryl = new/datum/tlv/dangerous,
GAS_PLUOXIUM = new/datum/tlv(-1, -1, 5, 6), // Unlike oxygen, pluoxium does not fuel plasma/tritium fires
)
@@ -110,17 +110,17 @@
TLV = list(
"pressure" = new/datum/tlv/no_checks,
"temperature" = new/datum/tlv/no_checks,
- GAS_O2 = new/datum/tlv/no_checks,
- GAS_N2 = new/datum/tlv/no_checks,
- GAS_CO2 = 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,
+ /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/plasma = new/datum/tlv/no_checks,
+ /datum/gas/nitrous_oxide = new/datum/tlv/no_checks,
+ /datum/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_STIMULUM = new/datum/tlv/no_checks,
- GAS_NITRYL = new/datum/tlv/no_checks,
+ /datum/gas/water_vapor = new/datum/tlv/no_checks,
+ /datum/gas/tritium = new/datum/tlv/no_checks,
+ /datum/gas/stimulum = new/datum/tlv/no_checks,
+ /datum/gas/nitryl = new/datum/tlv/no_checks,
GAS_PLUOXIUM = new/datum/tlv/no_checks
)
@@ -128,17 +128,17 @@
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-80, T0C-10, T0C+10),
- 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_PLASMA = new/datum/tlv/dangerous,
- GAS_NITROUS = new/datum/tlv/dangerous,
- GAS_BZ = new/datum/tlv/dangerous,
+ /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/plasma = new/datum/tlv/dangerous,
+ /datum/gas/nitrous_oxide = new/datum/tlv/dangerous,
+ /datum/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_STIMULUM = new/datum/tlv/dangerous,
- GAS_NITRYL = new/datum/tlv/dangerous,
+ /datum/gas/water_vapor = new/datum/tlv/dangerous,
+ /datum/gas/tritium = new/datum/tlv/dangerous,
+ /datum/gas/stimulum = new/datum/tlv/dangerous,
+ /datum/gas/nitryl = new/datum/tlv/dangerous,
GAS_PLUOXIUM = new/datum/tlv(-1, -1, 1000, 1000) // Unlike oxygen, pluoxium does not fuel plasma/tritium fires
)
@@ -512,7 +512,7 @@
for(var/device_id in A.air_scrub_names)
send_signal(device_id, list(
"power" = 1,
- "set_filters" = list(GAS_CO2, GAS_BZ),
+ "set_filters" = list(/datum/gas/carbon_dioxide, /datum/gas/bz),
"scrubbing" = 1,
"widenet" = 0
), signal_source)
@@ -527,15 +527,15 @@
send_signal(device_id, list(
"power" = 1,
"set_filters" = list(
- GAS_CO2,
- GAS_PLASMA,
- GAS_H2O,
+ /datum/gas/carbon_dioxide,
+ /datum/gas/plasma,
+ /datum/gas/water_vapor,
GAS_HYPERNOB,
- GAS_NITROUS,
- GAS_NITRYL,
- GAS_TRITIUM,
- GAS_BZ,
- GAS_STIMULUM,
+ /datum/gas/nitrous_oxide,
+ /datum/gas/nitryl,
+ /datum/gas/tritium,
+ /datum/gas/bz,
+ /datum/gas/stimulum,
GAS_PLUOXIUM
),
"scrubbing" = 1,
@@ -564,7 +564,7 @@
for(var/device_id in A.air_scrub_names)
send_signal(device_id, list(
"power" = 1,
- "set_filters" = list(GAS_CO2, GAS_BZ),
+ "set_filters" = list(/datum/gas/carbon_dioxide, /datum/gas/bz),
"scrubbing" = 1,
"widenet" = 0
), signal_source)
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
index 622dd74ea04c9..5b3f5ba7f6513 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
@@ -32,20 +32,20 @@
/obj/machinery/atmospherics/components/unary/tank/air/New()
..()
var/datum/gas_mixture/air_contents = airs[1]
- air_contents.set_moles(GAS_O2, AIR_CONTENTS * 0.2)
- air_contents.set_moles(GAS_N2, AIR_CONTENTS * 0.8)
+ air_contents.set_moles(/datum/gas/oxygen, AIR_CONTENTS * 0.2)
+ air_contents.set_moles(/datum/gas/nitrogen, AIR_CONTENTS * 0.8)
/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide
- gas_type = GAS_CO2
+ gas_type = /datum/gas/carbon_dioxide
/obj/machinery/atmospherics/components/unary/tank/plasma
icon_state = "orange"
- gas_type = GAS_PLASMA
+ gas_type = /datum/gas/plasma
/obj/machinery/atmospherics/components/unary/tank/oxygen
icon_state = "blue"
- gas_type = GAS_O2
+ gas_type = /datum/gas/oxygen
/obj/machinery/atmospherics/components/unary/tank/nitrogen
icon_state = "red"
- gas_type = GAS_N2
+ gas_type = /datum/gas/nitrogen
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 ad3d4067537ad..c250f3ea8fe49 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
@@ -290,10 +290,10 @@
icon_state = "scrub_map_on-4"
/obj/machinery/atmospherics/components/unary/vent_scrubber/on/lavaland
- filter_types = list(GAS_CO2, GAS_PLASMA, GAS_H2O, GAS_BZ)
+ filter_types = list(/datum/gas/carbon_dioxide, /datum/gas/plasma, /datum/gas/water_vapor, /datum/gas/bz)
/obj/machinery/atmospherics/components/unary/vent_scrubber/on/layer4/lavaland
- filter_types = list(GAS_CO2, GAS_PLASMA, GAS_H2O, GAS_BZ)
+ filter_types = list(/datum/gas/carbon_dioxide, /datum/gas/plasma, /datum/gas/water_vapor, /datum/gas/bz)
#undef SIPHONING
#undef SCRUBBING
diff --git a/code/modules/atmospherics/machinery/other/miner.dm b/code/modules/atmospherics/machinery/other/miner.dm
index c025855411842..58fab5d1e1bff 100644
--- a/code/modules/atmospherics/machinery/other/miner.dm
+++ b/code/modules/atmospherics/machinery/other/miner.dm
@@ -146,42 +146,42 @@
/obj/machinery/atmospherics/miner/n2o
name = "\improper N2O Gas Miner"
overlay_color = "#FFCCCC"
- spawn_id = GAS_NITROUS
+ spawn_id = /datum/gas/nitrous_oxide
/obj/machinery/atmospherics/miner/nitrogen
name = "\improper N2 Gas Miner"
overlay_color = "#CCFFCC"
- spawn_id = GAS_N2
+ spawn_id = /datum/gas/nitrogen
/obj/machinery/atmospherics/miner/oxygen
name = "\improper O2 Gas Miner"
overlay_color = "#007FFF"
- spawn_id = GAS_O2
+ spawn_id = /datum/gas/oxygen
/obj/machinery/atmospherics/miner/plasma
name = "\improper Plasma Gas Miner"
overlay_color = "#FF0000"
- spawn_id = GAS_PLASMA
+ spawn_id = /datum/gas/plasma
/obj/machinery/atmospherics/miner/carbon_dioxide
name = "\improper CO2 Gas Miner"
overlay_color = "#CDCDCD"
- spawn_id = GAS_CO2
+ spawn_id = /datum/gas/carbon_dioxide
/obj/machinery/atmospherics/miner/bz
name = "\improper BZ Gas Miner"
overlay_color = "#FAFF00"
- spawn_id = GAS_BZ
+ spawn_id = /datum/gas/bz
/obj/machinery/atmospherics/miner/water_vapor
name = "\improper Water Vapor Gas Miner"
overlay_color = "#99928E"
- spawn_id = GAS_H2O
+ spawn_id = /datum/gas/water_vapor
/obj/machinery/atmospherics/miner/tritium
name = "\improper Tritium Gas Miner"
overlay_color = "#1ae000"
- spawn_id = GAS_TRITIUM
+ spawn_id = /datum/gas/tritium
/obj/machinery/atmospherics/miner/hypernoblium
name = "\improper Hypernoblium Gas Miner"
@@ -191,12 +191,12 @@
/obj/machinery/atmospherics/miner/nitryl
name = "\improper Nitryl Gas Miner"
overlay_color = "#5e4000"
- spawn_id = GAS_NITRYL
+ spawn_id = /datum/gas/nitryl
/obj/machinery/atmospherics/miner/stimulum
name = "\improper Stimulum Gas Miner"
overlay_color = "#c9c9c9"
- spawn_id = GAS_STIMULUM
+ spawn_id = /datum/gas/stimulum
/obj/machinery/atmospherics/miner/pluoxium
name = "\improper Pluoxium Gas Miner"
@@ -211,37 +211,37 @@
/obj/machinery/atmospherics/miner/station/n2o
name = "\improper N2O Gas Miner"
overlay_color = "#FFCCCC"
- spawn_id = GAS_NITROUS
+ spawn_id = /datum/gas/nitrous_oxide
/obj/machinery/atmospherics/miner/station/nitrogen
name = "\improper N2 Gas Miner"
overlay_color = "#CCFFCC"
- spawn_id = GAS_N2
+ spawn_id = /datum/gas/nitrogen
/obj/machinery/atmospherics/miner/station/oxygen
name = "\improper O2 Gas Miner"
overlay_color = "#007FFF"
- spawn_id = GAS_O2
+ spawn_id = /datum/gas/oxygen
/obj/machinery/atmospherics/miner/station/plasma
name = "\improper Plasma Gas Miner"
overlay_color = "#FF0000"
- spawn_id = GAS_PLASMA
+ spawn_id = /datum/gas/plasma
/obj/machinery/atmospherics/miner/station/carbon_dioxide
name = "\improper CO2 Gas Miner"
overlay_color = "#CDCDCD"
- spawn_id = GAS_CO2
+ spawn_id = /datum/gas/carbon_dioxide
/obj/machinery/atmospherics/miner/station/bz
name = "\improper BZ Gas Miner"
overlay_color = "#FAFF00"
- spawn_id = GAS_BZ
+ spawn_id = /datum/gas/bz
/obj/machinery/atmospherics/miner/station/water_vapor
name = "\improper Water Vapor Gas Miner"
overlay_color = "#99928E"
- spawn_id = GAS_H2O
+ spawn_id = /datum/gas/water_vapor
#undef GASMINER_POWER_NONE
diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm
index 3d0d2a4b77b8d..9ab565b148f4a 100644
--- a/code/modules/atmospherics/machinery/portable/canister.dm
+++ b/code/modules/atmospherics/machinery/portable/canister.dm
@@ -135,35 +135,35 @@
/obj/machinery/portable_atmospherics/canister/bz
name = "\improper BZ canister"
desc = "BZ, a powerful hallucinogenic nerve agent."
- gas_type = GAS_BZ
+ gas_type = /datum/gas/bz
greyscale_config = /datum/greyscale_config/canister/double_stripe
greyscale_colors = "#9b5d7f#d0d2a0"
/obj/machinery/portable_atmospherics/canister/carbon_dioxide
name = "co2 canister"
desc = "Carbon dioxide. What the fuck is carbon dioxide?"
- gas_type = GAS_CO2
+ gas_type = /datum/gas/carbon_dioxide
greyscale_config = /datum/greyscale_config/canister
greyscale_colors = "#4e4c48"
/obj/machinery/portable_atmospherics/canister/nitrogen
name = "n2 canister"
desc = "Nitrogen gas. Reportedly useful for something."
- gas_type = GAS_N2
+ gas_type = /datum/gas/nitrogen
greyscale_config = /datum/greyscale_config/canister
greyscale_colors = "#d41010"
/obj/machinery/portable_atmospherics/canister/nitrous_oxide
name = "n2o canister"
desc = "Nitrous oxide gas. Known to cause drowsiness."
- gas_type = GAS_NITROUS
+ gas_type = /datum/gas/nitrous_oxide
greyscale_config = /datum/greyscale_config/canister/double_stripe
greyscale_colors = "#c63e3b#f7d5d3"
/obj/machinery/portable_atmospherics/canister/nitryl
name = "nitryl canister"
desc = "Nitryl gas. Feels great 'til the acid eats your lungs."
- gas_type = GAS_NITRYL
+ gas_type = /datum/gas/nitryl
greyscale_config = /datum/greyscale_config/canister
greyscale_colors = "#7b4732"
@@ -177,7 +177,7 @@
/obj/machinery/portable_atmospherics/canister/oxygen
name = "o2 canister"
desc = "Oxygen. Necessary for human life."
- gas_type = GAS_O2
+ gas_type = /datum/gas/oxygen
greyscale_config = /datum/greyscale_config/canister/stripe
greyscale_colors = "#2786e5#e8fefe"
@@ -191,28 +191,28 @@
/obj/machinery/portable_atmospherics/canister/stimulum
name = "stimulum canister"
desc = "Stimulum. High energy gas, high energy people."
- gas_type = GAS_STIMULUM
+ gas_type = /datum/gas/stimulum
greyscale_config = /datum/greyscale_config/canister
greyscale_colors = "#9b5d7f"
/obj/machinery/portable_atmospherics/canister/plasma
name = "plasma canister"
desc = "Plasma gas. The reason YOU are here. Highly toxic."
- gas_type = GAS_PLASMA
+ gas_type = /datum/gas/plasma
greyscale_config = /datum/greyscale_config/canister/hazard
greyscale_colors = "#f64300#000000"
/obj/machinery/portable_atmospherics/canister/tritium
name = "tritium canister"
desc = "Tritium. Inhalation might cause irradiation."
- gas_type = GAS_TRITIUM
+ gas_type = /datum/gas/tritium
greyscale_config = /datum/greyscale_config/canister/hazard
greyscale_colors = "#3fcd40#000000"
/obj/machinery/portable_atmospherics/canister/water_vapor
name = "water vapor canister"
desc = "Water Vapor. We get it, you vape."
- gas_type = GAS_H2O
+ gas_type = /datum/gas/water_vapor
filled = 1
greyscale_config = /datum/greyscale_config/canister/double_stripe
greyscale_colors = "#4c4e4d#f7d5d3"
@@ -248,7 +248,7 @@
/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 = GAS_O2
+ gas_type = /datum/gas/oxygen
filled = 1
release_pressure = ONE_ATMOSPHERE*2
@@ -280,8 +280,8 @@
/obj/machinery/portable_atmospherics/canister/air/create_gas()
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()))
+ 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()))
/obj/machinery/portable_atmospherics/canister/update_icon()
. = ..()
diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm
index 7413841f70104..879d49010bf47 100644
--- a/code/modules/atmospherics/machinery/portable/pump.dm
+++ b/code/modules/atmospherics/machinery/portable/pump.dm
@@ -178,8 +178,8 @@
if("power")
on = !on
if(on && !holding)
- var/plasma = air_contents.get_moles(GAS_PLASMA)
- var/n2o = air_contents.get_moles(GAS_NITROUS)
+ var/plasma = air_contents.get_moles(/datum/gas/plasma)
+ var/n2o = air_contents.get_moles(/datum/gas/nitrous_oxide)
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 8767f50a8ff35..2157cca1cad11 100644
--- a/code/modules/atmospherics/machinery/portable/scrubber.dm
+++ b/code/modules/atmospherics/machinery/portable/scrubber.dm
@@ -11,7 +11,7 @@
var/overpressure_m = 80
volume = 1000
- var/list/scrubbing = list(GAS_PLASMA, GAS_CO2, GAS_NITROUS, GAS_BZ, GAS_NITRYL, GAS_TRITIUM, GAS_HYPERNOB, GAS_H2O)
+ var/list/scrubbing = list(/datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz, /datum/gas/nitryl, /datum/gas/tritium, GAS_HYPERNOB, /datum/gas/water_vapor)
/obj/machinery/portable_atmospherics/scrubber/Destroy()
var/turf/T = get_turf(src)
diff --git a/code/modules/cargo/bounties/engineering.dm b/code/modules/cargo/bounties/engineering.dm
index 2f4902309fa3c..b7026207c373d 100644
--- a/code/modules/cargo/bounties/engineering.dm
+++ b/code/modules/cargo/bounties/engineering.dm
@@ -15,12 +15,12 @@
/datum/bounty/item/engineering/gas/nitryl_tank
name = "Full Tank of Nitryl"
description = "The non-human staff of Station 88 has been volunteered to test performance enhancing drugs. Ship them a tank full of Nitryl so they can get started."
- gas_type = GAS_NITRYL
+ gas_type = /datum/gas/nitryl
/datum/bounty/item/engineering/gas/tritium_tank
name = "Full Tank of Tritium"
description = "Station 49 is looking to kickstart their research program. Ship them a tank full of Tritium."
- gas_type = GAS_TRITIUM
+ gas_type = /datum/gas/tritium
/datum/bounty/item/engineering/energy_ball
name = "Contained Tesla Ball"
diff --git a/code/modules/cargo/exports/large_objects.dm b/code/modules/cargo/exports/large_objects.dm
index c5e80f845a7e9..2da9b461cbf65 100644
--- a/code/modules/cargo/exports/large_objects.dm
+++ b/code/modules/cargo/exports/large_objects.dm
@@ -130,9 +130,9 @@
var/obj/machinery/portable_atmospherics/canister/C = O
var/worth = 10
- worth += C.air_contents.get_moles(GAS_BZ)*4
- worth += C.air_contents.get_moles(GAS_STIMULUM)*100
+ worth += C.air_contents.get_moles(/datum/gas/bz)*4
+ worth += C.air_contents.get_moles(/datum/gas/stimulum)*100
worth += C.air_contents.get_moles(GAS_HYPERNOB)*1000
- worth += C.air_contents.get_moles(GAS_TRITIUM)*5
+ worth += C.air_contents.get_moles(/datum/gas/tritium)*5
worth += C.air_contents.get_moles(GAS_PLUOXIUM)*5
return worth
diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm
index 3e03ebd316815..5e37198f32d2e 100644
--- a/code/modules/events/spacevine.dm
+++ b/code/modules/events/spacevine.dm
@@ -217,7 +217,7 @@
var/turf/open/floor/T = holder.loc
if(istype(T))
var/datum/gas_mixture/GM = T.air
- GM.set_moles(GAS_O2, max(GM.get_moles(GAS_O2) - severity * holder.energy, 0))
+ GM.set_moles(/datum/gas/oxygen, max(GM.get_moles(/datum/gas/oxygen) - severity * holder.energy, 0))
/datum/spacevine_mutation/nitro_eater
name = "nitrogen consuming"
@@ -229,7 +229,7 @@
var/turf/open/floor/T = holder.loc
if(istype(T))
var/datum/gas_mixture/GM = T.air
- GM.set_moles(GAS_N2, max(GM.get_moles(GAS_N2) - severity * holder.energy, 0))
+ GM.set_moles(/datum/gas/nitrogen, max(GM.get_moles(/datum/gas/nitrogen) - severity * holder.energy, 0))
/datum/spacevine_mutation/carbondioxide_eater
name = "CO2 consuming"
@@ -241,7 +241,7 @@
var/turf/open/floor/T = holder.loc
if(istype(T))
var/datum/gas_mixture/GM = T.air
- GM.set_moles(GAS_CO2, max(GM.get_moles(GAS_CO2) - severity * holder.energy, 0))
+ GM.set_moles(/datum/gas/carbon_dioxide, max(GM.get_moles(/datum/gas/carbon_dioxide) - severity * holder.energy, 0))
/datum/spacevine_mutation/plasma_eater
name = "toxins consuming"
@@ -253,7 +253,7 @@
var/turf/open/floor/T = holder.loc
if(istype(T))
var/datum/gas_mixture/GM = T.air
- GM.set_moles(GAS_PLASMA, max(GM.get_moles(GAS_PLASMA) - severity * holder.energy, 0))
+ GM.set_moles(/datum/gas/plasma, max(GM.get_moles(/datum/gas/plasma) - severity * holder.energy, 0))
/datum/spacevine_mutation/thorns
name = "thorny"
diff --git a/code/modules/events/supermatter_surge.dm b/code/modules/events/supermatter_surge.dm
index 0b1335ea5a3e5..fcf2a57bf81c8 100644
--- a/code/modules/events/supermatter_surge.dm
+++ b/code/modules/events/supermatter_surge.dm
@@ -42,12 +42,12 @@
// primarily so the supermatter doesn't tesla the instant these happen
supermatter.matter_power += power * power_proportion
var/datum/gas_mixture/gas_puff = new
- var/selected_gas = pick(4;GAS_CO2, 4;GAS_H2O, 1;GAS_BZ)
+ var/selected_gas = pick(4;/datum/gas/carbon_dioxide, 4;/datum/gas/water_vapor, 1;/datum/gas/bz)
gas_puff.set_moles(selected_gas, 500)
gas_puff.set_temperature(500)
var/energy_ratio = (power * 500 * (1-power_proportion)) / gas_puff.thermal_energy()
if(energy_ratio < 1) // energy output we want is lower than current energy, reduce the amount of gas we puff out
- gas_puff.set_moles(GAS_H2O, energy_ratio * 500)
+ gas_puff.set_moles(/datum/gas/water_vapor, energy_ratio * 500)
else // energy output we want is higher than current energy, increase its actual heat
gas_puff.set_temperature(energy_ratio * 500)
supermatter.assume_air(gas_puff)
diff --git a/code/modules/hydroponics/grown/towercap.dm b/code/modules/hydroponics/grown/towercap.dm
index 694593f8e28f7..1b779646c6c0a 100644
--- a/code/modules/hydroponics/grown/towercap.dm
+++ b/code/modules/hydroponics/grown/towercap.dm
@@ -245,7 +245,7 @@
if(isopenturf(loc))
var/turf/open/O = loc
if(O.air)
- if(O.air.get_moles(GAS_O2) > 13)
+ if(O.air.get_moles(/datum/gas/oxygen) > 13)
return TRUE
return FALSE
diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm
index ede9e50ccb3c2..df45775fac7e6 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(GAS_PLASMA)/breath.total_moles())*breath_pressure
+ var/toxins_pp = (breath.get_moles(/datum/gas/plasma)/breath.total_moles())*breath_pressure
if(toxins_pp > tox_detect_threshold) // Detect toxins in air
- adjustPlasma(breath.get_moles(GAS_PLASMA)*250)
+ adjustPlasma(breath.get_moles(/datum/gas/plasma)*250)
throw_alert("alien_tox", /atom/movable/screen/alert/alien_tox)
- toxins_used = breath.get_moles(GAS_PLASMA)
+ toxins_used = breath.get_moles(/datum/gas/plasma)
else
clear_alert("alien_tox")
//Breathe in toxins and out oxygen
- breath.adjust_moles(GAS_PLASMA, -toxins_used)
- breath.adjust_moles(GAS_O2, toxins_used)
+ breath.adjust_moles(/datum/gas/plasma, -toxins_used)
+ breath.adjust_moles(/datum/gas/oxygen, toxins_used)
//BREATH TEMPERATURE
handle_breath_temperature(breath)
diff --git a/code/modules/mob/living/carbon/human/species_types/oozelings.dm b/code/modules/mob/living/carbon/human/species_types/oozelings.dm
index a9b97156a964e..ef3fa67be015e 100644
--- a/code/modules/mob/living/carbon/human/species_types/oozelings.dm
+++ b/code/modules/mob/living/carbon/human/species_types/oozelings.dm
@@ -88,11 +88,11 @@
if(!atmos_sealed)
var/datum/gas_mixture/environment = H.loc.return_air()
if(environment?.total_moles())
- if(environment.get_moles(GAS_H2O) >= 1)
+ if(environment.get_moles(/datum/gas/water_vapor) >= 1)
H.blood_volume -= 15
if(prob(50))
to_chat(H, "Your ooze melts away rapidly in the water vapor!")
- if(H.blood_volume <= 672 && environment.get_moles(GAS_PLASMA) >= 1)
+ if(H.blood_volume <= 672 && environment.get_moles(/datum/gas/plasma) >= 1)
H.blood_volume += 15
if(H.blood_volume < BLOOD_VOLUME_OKAY && prob(5))
to_chat(H, "You feel drained!")
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 d6bf487d66f31..7226068ce0cb4 100644
--- a/code/modules/mob/living/carbon/human/species_types/plasmamen.dm
+++ b/code/modules/mob/living/carbon/human/species_types/plasmamen.dm
@@ -54,7 +54,7 @@
var/datum/gas_mixture/environment = H.loc.return_air()
if(environment)
if(environment.total_moles())
- if(environment.get_moles(GAS_O2) >= 1) //Same threshold that extinguishes fire
+ if(environment.get_moles(/datum/gas/oxygen) >= 1) //Same threshold that extinguishes fire
H.adjust_fire_stacks(0.5)
if(!H.on_fire && H.fire_stacks > 0)
H.visible_message("[H]'s body reacts with the atmosphere and bursts into flames!","Your body reacts with the atmosphere and bursts into flame!")
diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm
index d44fca0cd9dfc..41c48c0bb804c 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -183,9 +183,9 @@
var/oxygen_used = 0
var/moles = breath.total_moles()
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
+ var/O2_partialpressure = ((breath.get_moles(/datum/gas/oxygen)/moles)*breath_pressure) + (((breath.get_moles(GAS_PLUOXIUM)*8)/moles)*breath_pressure)
+ var/Toxins_partialpressure = (breath.get_moles(/datum/gas/plasma)/moles)*breath_pressure
+ var/CO2_partialpressure = (breath.get_moles(/datum/gas/carbon_dioxide)/moles)*breath_pressure
//OXYGEN
@@ -196,7 +196,7 @@
var/ratio = 1 - O2_partialpressure/safe_oxy_min
adjustOxyLoss(min(5*ratio, 3))
failed_last_breath = 1
- oxygen_used = breath.get_moles(GAS_O2)*ratio
+ oxygen_used = breath.get_moles(/datum/gas/oxygen)*ratio
else
adjustOxyLoss(3)
failed_last_breath = 1
@@ -206,11 +206,11 @@
failed_last_breath = 0
if(health >= crit_threshold)
adjustOxyLoss(-5)
- oxygen_used = breath.get_moles(GAS_O2)
+ oxygen_used = breath.get_moles(/datum/gas/oxygen)
clear_alert("not_enough_oxy")
- breath.adjust_moles(GAS_O2, -oxygen_used)
- breath.adjust_moles(GAS_CO2, oxygen_used)
+ breath.adjust_moles(/datum/gas/oxygen, -oxygen_used)
+ breath.adjust_moles(/datum/gas/carbon_dioxide, oxygen_used)
//CARBON DIOXIDE
if(CO2_partialpressure > safe_co2_max)
@@ -229,15 +229,15 @@
//TOXINS/PLASMA
if(Toxins_partialpressure > safe_tox_max)
- var/ratio = (breath.get_moles(GAS_PLASMA)/safe_tox_max) * 10
+ var/ratio = (breath.get_moles(/datum/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(GAS_NITROUS))
- var/SA_partialpressure = (breath.get_moles(GAS_NITROUS)/breath.total_moles())*breath_pressure
+ if(breath.get_moles(/datum/gas/nitrous_oxide))
+ var/SA_partialpressure = (breath.get_moles(/datum/gas/nitrous_oxide)/breath.total_moles())*breath_pressure
if(SA_partialpressure > SA_para_min)
Unconscious(60)
if(SA_partialpressure > SA_sleep_min)
@@ -250,21 +250,21 @@
SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "chemical_euphoria")
//BZ (Facepunch port of their Agent B)
- if(breath.get_moles(GAS_BZ))
- var/bz_partialpressure = (breath.get_moles(GAS_BZ)/breath.total_moles())*breath_pressure
+ if(breath.get_moles(/datum/gas/bz))
+ var/bz_partialpressure = (breath.get_moles(/datum/gas/bz)/breath.total_moles())*breath_pressure
if(bz_partialpressure > 1)
hallucination += 10
else if(bz_partialpressure > 0.01)
hallucination += 5
//TRITIUM
- if(breath.get_moles(GAS_TRITIUM))
- var/tritium_partialpressure = (breath.get_moles(GAS_TRITIUM)/breath.total_moles())*breath_pressure
+ if(breath.get_moles(/datum/gas/tritium))
+ var/tritium_partialpressure = (breath.get_moles(/datum/gas/tritium)/breath.total_moles())*breath_pressure
radiation += tritium_partialpressure/10
//NITRYL
- if(breath.get_moles(GAS_NITRYL))
- var/nitryl_partialpressure = (breath.get_moles(GAS_NITRYL)/breath.total_moles())*breath_pressure
+ if(breath.get_moles(/datum/gas/nitryl))
+ var/nitryl_partialpressure = (breath.get_moles(/datum/gas/nitryl)/breath.total_moles())*breath_pressure
adjustFireLoss(nitryl_partialpressure/4)
//BREATH TEMPERATURE
diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm
index f3e618c29e544..306ad87a7f605 100644
--- a/code/modules/mob/living/life.dm
+++ b/code/modules/mob/living/life.dm
@@ -96,7 +96,7 @@
ExtinguishMob()
return TRUE //mob was put out, on_fire = FALSE via ExtinguishMob(), no need to update everything down the chain.
var/datum/gas_mixture/G = loc.return_air() // Check if we're standing in an oxygenless environment
- if(G.get_moles(GAS_O2) < 1)
+ if(G.get_moles(/datum/gas/oxygen) < 1)
ExtinguishMob() //If there's no oxygen in the tile we're on, put out the fire
return TRUE
var/turf/location = get_turf(src)
diff --git a/code/modules/mob/living/simple_animal/bot/atmosbot.dm b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
index 9c0712e341b22..248ee76073eee 100644
--- a/code/modules/mob/living/simple_animal/bot/atmosbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
@@ -52,16 +52,16 @@
var/last_barrier_tick
//Gasses
var/list/gasses = list(
- GAS_BZ = 1,
- GAS_CO2 = 1,
+ /datum/gas/bz = 1,
+ /datum/gas/carbon_dioxide = 1,
GAS_HYPERNOB = 1,
- GAS_NITROUS = 1,
- GAS_NITRYL = 1,
- GAS_PLASMA = 1,
+ /datum/gas/nitrous_oxide = 1,
+ /datum/gas/nitryl = 1,
+ /datum/gas/plasma = 1,
GAS_PLUOXIUM = 0,
- GAS_STIMULUM = 0,
- GAS_TRITIUM = 1,
- GAS_H2O = 0,
+ /datum/gas/stimulum = 0,
+ /datum/gas/tritium = 1,
+ /datum/gas/water_vapor = 0,
)
// Have we spoken our alert yet?
var/has_spoken = FALSE
@@ -214,10 +214,10 @@
if(pressure_delta > 0)
var/transfer_moles = pressure_delta*environment.return_volume()/(T20C * R_IDEAL_GAS_EQUATION)
if(emagged == 2)
- environment.adjust_moles(GAS_CO2, transfer_moles)
+ environment.adjust_moles(/datum/gas/carbon_dioxide, transfer_moles)
else
- environment.adjust_moles(GAS_N2, transfer_moles * 0.7885)
- environment.adjust_moles(GAS_O2, transfer_moles * 0.2115)
+ environment.adjust_moles(/datum/gas/nitrogen, transfer_moles * 0.7885)
+ environment.adjust_moles(/datum/gas/oxygen, transfer_moles * 0.2115)
air_update_turf(FALSE, FALSE)
new /obj/effect/temp_visual/vent_wind(get_turf(src))
@@ -251,7 +251,7 @@
return ATMOSBOT_HIGH_TOXINS
//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(GAS_O2) * partial_pressure
+ var/oxygen_moles = gas_mix.get_moles(/datum/gas/oxygen) * partial_pressure
if(oxygen_moles < 20 || gas_mix.return_pressure() < WARNING_LOW_PRESSURE)
return ATMOSBOT_LOW_OXYGEN
//Check temperature
diff --git a/code/modules/mob/living/simple_animal/hostile/tree.dm b/code/modules/mob/living/simple_animal/hostile/tree.dm
index b982d548d502f..a7754183eba78 100644
--- a/code/modules/mob/living/simple_animal/hostile/tree.dm
+++ b/code/modules/mob/living/simple_animal/hostile/tree.dm
@@ -47,11 +47,11 @@
if(isopenturf(loc))
var/turf/open/T = src.loc
if(T.air)
- var/co2 = T.air.get_moles(GAS_CO2)
+ var/co2 = T.air.get_moles(/datum/gas/carbon_dioxide)
if(co2 > 0)
if(prob(25))
var/amt = min(co2, 9)
- T.air.adjust_moles(GAS_CO2, -amt)
+ T.air.adjust_moles(/datum/gas/carbon_dioxide, -amt)
T.atmos_spawn_air("o2=[amt];TEMP=293.15")
/mob/living/simple_animal/hostile/tree/festivus
diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm
index 263d12722d678..7c7d0505adb97 100644
--- a/code/modules/mob/living/simple_animal/simple_animal.dm
+++ b/code/modules/mob/living/simple_animal/simple_animal.dm
@@ -235,10 +235,10 @@
if(isturf(loc) && isopenturf(loc))
var/turf/open/ST = loc
if(ST.air)
- 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)
+ 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)
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 7eb8018945080..92418478c23bf 100644
--- a/code/modules/mob/living/simple_animal/slime/life.dm
+++ b/code/modules/mob/living/simple_animal/slime/life.dm
@@ -94,13 +94,13 @@
adjustBruteLoss(round(sqrt(bodytemperature)) * 2)
if(stat != DEAD)
- var/bz_percentage = environment.total_moles() ? (environment.get_moles(GAS_BZ) / environment.total_moles()) : 0
+ var/bz_percentage = environment.total_moles() ? (environment.get_moles(/datum/gas/bz) / environment.total_moles()) : 0
var/stasis = (bz_percentage >= 0.05 && bodytemperature < (T0C + 100)) || force_stasis
if(transformeffects & SLIME_EFFECT_DARK_PURPLE)
var/amt = is_adult ? 30 : 15
- var/plas_amt = min(amt,environment.get_moles(GAS_PLASMA))
- environment.adjust_moles(GAS_PLASMA, -plas_amt)
- environment.adjust_moles(GAS_O2, plas_amt)
+ var/plas_amt = min(amt,environment.get_moles(/datum/gas/plasma))
+ environment.adjust_moles(/datum/gas/plasma, -plas_amt)
+ environment.adjust_moles(/datum/gas/oxygen, plas_amt)
adjustBruteLoss(plas_amt ? -2 : 0)
switch(stat)
diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm
index 572611781c3dd..08a5ea1a669e9 100644
--- a/code/modules/power/singularity/collector.dm
+++ b/code/modules/power/singularity/collector.dm
@@ -50,28 +50,28 @@
if(!loaded_tank)
return
if(!bitcoinmining)
- if(loaded_tank.air_contents.get_moles(GAS_PLASMA) < 0.0001)
+ if(loaded_tank.air_contents.get_moles(/datum/gas/plasma) < 0.0001)
investigate_log("out of fuel.", INVESTIGATE_ENGINES)
playsound(src, 'sound/machines/ding.ogg', 50, 1)
var/msg = "Plasma depleted, recommend replacing tank."
radio.talk_into(src, msg, RADIO_CHANNEL_ENGINEERING)
eject()
else
- var/gasdrained = min(powerproduction_drain*drainratio*delta_time,loaded_tank.air_contents.get_moles(GAS_PLASMA))
- loaded_tank.air_contents.adjust_moles(GAS_PLASMA, -gasdrained)
- loaded_tank.air_contents.adjust_moles(GAS_TRITIUM, gasdrained)
+ var/gasdrained = min(powerproduction_drain*drainratio*delta_time,loaded_tank.air_contents.get_moles(/datum/gas/plasma))
+ loaded_tank.air_contents.adjust_moles(/datum/gas/plasma, -gasdrained)
+ loaded_tank.air_contents.adjust_moles(/datum/gas/tritium, gasdrained)
var/power_produced = RAD_COLLECTOR_OUTPUT
add_avail(power_produced)
stored_energy-=power_produced
else if(is_station_level(z) && SSresearch.science_tech)
- if(!loaded_tank.air_contents.get_moles(GAS_TRITIUM) || !loaded_tank.air_contents.get_moles(GAS_O2))
+ if(!loaded_tank.air_contents.get_moles(/datum/gas/tritium) || !loaded_tank.air_contents.get_moles(/datum/gas/oxygen))
playsound(src, 'sound/machines/ding.ogg', 50, 1)
eject()
else
var/gasdrained = bitcoinproduction_drain*drainratio*delta_time
- loaded_tank.air_contents.adjust_moles(GAS_TRITIUM, -gasdrained)
- loaded_tank.air_contents.adjust_moles(GAS_O2, -gasdrained)
- loaded_tank.air_contents.adjust_moles(GAS_CO2, gasdrained*2)
+ loaded_tank.air_contents.adjust_moles(/datum/gas/tritium, -gasdrained)
+ loaded_tank.air_contents.adjust_moles(/datum/gas/oxygen, -gasdrained)
+ loaded_tank.air_contents.adjust_moles(/datum/gas/carbon_dioxide, gasdrained*2)
var/bitcoins_mined = RAD_COLLECTOR_OUTPUT
var/datum/bank_account/D = SSeconomy.get_budget_account(ACCOUNT_ENG_ID)
if(D)
@@ -86,7 +86,7 @@
toggle_power()
user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \
"You turn the [src.name] [active? "on":"off"].")
- var/fuel = loaded_tank?.air_contents.get_moles(GAS_PLASMA)
+ var/fuel = loaded_tank?.air_contents.get_moles(/datum/gas/plasma)
investigate_log("turned [active?"on":"off"] by [key_name(user)]. [loaded_tank?"Fuel: [round(fuel/0.29)]%":"It is empty"].", INVESTIGATE_ENGINES)
return
else
diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm
index 4970113b34ccb..ec69ce353860d 100644
--- a/code/modules/power/supermatter/supermatter.dm
+++ b/code/modules/power/supermatter/supermatter.dm
@@ -457,15 +457,15 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
//Can cause an overestimation of mol count, should stabalize things though.
//Prevents huge bursts of gas/heat when a large amount of something is introduced
//They range between 0 and 1
- plasmacomp += clamp(max(removed.get_moles(GAS_PLASMA)/combined_gas, 0) - plasmacomp, -1, gas_change_rate)
- o2comp += clamp(max(removed.get_moles(GAS_O2)/combined_gas, 0) - o2comp, -1, gas_change_rate)
- co2comp += clamp(max(removed.get_moles(GAS_CO2)/combined_gas, 0) - co2comp, -1, gas_change_rate)
+ plasmacomp += clamp(max(removed.get_moles(/datum/gas/plasma)/combined_gas, 0) - plasmacomp, -1, gas_change_rate)
+ o2comp += clamp(max(removed.get_moles(/datum/gas/oxygen)/combined_gas, 0) - o2comp, -1, gas_change_rate)
+ co2comp += clamp(max(removed.get_moles(/datum/gas/carbon_dioxide)/combined_gas, 0) - co2comp, -1, gas_change_rate)
pluoxiumcomp += clamp(max(removed.get_moles(GAS_PLUOXIUM)/combined_gas, 0) - pluoxiumcomp, -1, gas_change_rate)
- tritiumcomp += clamp(max(removed.get_moles(GAS_TRITIUM)/combined_gas, 0) - tritiumcomp, -1, gas_change_rate)
- bzcomp += clamp(max(removed.get_moles(GAS_BZ)/combined_gas, 0) - bzcomp, -1, gas_change_rate)
+ tritiumcomp += clamp(max(removed.get_moles(/datum/gas/tritium)/combined_gas, 0) - tritiumcomp, -1, gas_change_rate)
+ bzcomp += clamp(max(removed.get_moles(/datum/gas/bz)/combined_gas, 0) - bzcomp, -1, gas_change_rate)
- n2ocomp += clamp(max(removed.get_moles(GAS_NITROUS)/combined_gas, 0) - n2ocomp, -1, gas_change_rate)
- n2comp += clamp(max(removed.get_moles(GAS_N2)/combined_gas, 0) - n2comp, -1, gas_change_rate)
+ n2ocomp += clamp(max(removed.get_moles(/datum/gas/nitrous_oxide)/combined_gas, 0) - n2ocomp, -1, gas_change_rate)
+ n2comp += clamp(max(removed.get_moles(/datum/gas/nitrogen)/combined_gas, 0) - n2comp, -1, gas_change_rate)
gasmix_power_ratio = min(max(plasmacomp + o2comp + co2comp + tritiumcomp + bzcomp - pluoxiumcomp - n2comp, 0), 1)
@@ -521,9 +521,9 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
removed.set_temperature(max(0, min(removed.return_temperature(), 2500 * dynamic_heat_modifier)))
//Calculate how much gas to release
- removed.adjust_moles(GAS_PLASMA, max((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER, 0))
+ removed.adjust_moles(/datum/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))
+ removed.adjust_moles(/datum/gas/oxygen, max(((device_energy + removed.return_temperature() * dynamic_heat_modifier) - T0C) / OXYGEN_RELEASE_MODIFIER, 0))
if(produces_gas)
env.merge(removed)
diff --git a/code/modules/research/xenobiology/crossbreeding/_structures.dm b/code/modules/research/xenobiology/crossbreeding/_structures.dm
index f98070baaedd7..b80f3343678e9 100644
--- a/code/modules/research/xenobiology/crossbreeding/_structures.dm
+++ b/code/modules/research/xenobiology/crossbreeding/_structures.dm
@@ -236,8 +236,8 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals)
var/turf/open/open_turf = T
var/datum/gas_mixture/air = open_turf.return_air()
- if(air.get_moles(GAS_PLASMA) > 15)
- air.adjust_moles(GAS_PLASMA, -15)
+ if(air.get_moles(/datum/gas/plasma) > 15)
+ air.adjust_moles(/datum/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 756522f4b1bc9..44c5c73ac6a4c 100644
--- a/code/modules/research/xenobiology/crossbreeding/chilling.dm
+++ b/code/modules/research/xenobiology/crossbreeding/chilling.dm
@@ -106,7 +106,7 @@ Chilling extracts:
for(var/turf/open/T in A)
var/datum/gas_mixture/G = T.air
if(istype(G))
- G.set_moles(GAS_PLASMA, 0)
+ G.set_moles(/datum/gas/plasma, 0)
filtered = TRUE
T.air_update_turf(FALSE, FALSE)
if(filtered)
diff --git a/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm b/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm
index 96603f6d019e0..6f73a531f3f14 100644
--- a/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm
+++ b/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm
@@ -20,7 +20,7 @@
if(!air_contents)
return
qdel(stack)
- air_contents.adjust_moles(GAS_PLASMA, moles_created)
+ air_contents.adjust_moles(/datum/gas/plasma, moles_created)
say("[moles_created] moles of plasma refined.")
return
@@ -35,12 +35,12 @@
/obj/machinery/atmospherics/components/unary/plasma_refiner/AltClick(mob/living/user)
var/datum/gas_mixture/air_contents = airs[1]
- var/plasmoles = air_contents.get_moles(GAS_PLASMA)
+ var/plasmoles = air_contents.get_moles(/datum/gas/plasma)
if(!air_contents)
return
if(plasmoles >= 100)
var/obj/item/stack/sheet/mineral/plasma/P = new(src.loc, 1)
- air_contents.adjust_moles(GAS_PLASMA, -100)
+ air_contents.adjust_moles(/datum/gas/plasma, -100)
say("100 moles of plasma consumed. A sheet of [P.name] has been created.")
else
say("Insufficient plasma. At least 100 moles of plasma are required. There are currently [plasmoles] moles of plasma.")
diff --git a/code/modules/station_goals/dna_vault.dm b/code/modules/station_goals/dna_vault.dm
index 8744c527ff00e..500ceb46d764a 100644
--- a/code/modules/station_goals/dna_vault.dm
+++ b/code/modules/station_goals/dna_vault.dm
@@ -263,7 +263,7 @@
to_chat(H, "You feel resistant to airborne 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.gas_max -= GAS_PLASMA
+ L.gas_max -= /datum/gas/plasma
ADD_TRAIT(H, TRAIT_VIRUSIMMUNE, "dna_vault")
if(VAULT_NOBREATH)
to_chat(H, "Your lungs feel great.")
diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index b8b0049847ce6..18a139742a7dd 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -29,8 +29,8 @@
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
+ /datum/gas/carbon_dioxide = 30, // Yes it's an arbitrary value who cares?
+ /datum/gas/plasma = MOLES_GAS_VISIBLE
)
var/list/gas_damage = list(
"default" = list(
@@ -38,7 +38,7 @@
max = MAX_TOXIC_GAS_DAMAGE,
damage_type = OXY
),
- GAS_PLASMA = list(
+ /datum/gas/plasma = list(
min = MIN_TOXIC_GAS_DAMAGE,
max = MAX_TOXIC_GAS_DAMAGE,
damage_type = TOX
@@ -254,7 +254,7 @@
// N2O
- var/SA_pp = PP(breath, GAS_NITROUS)
+ var/SA_pp = PP(breath, /datum/gas/nitrous_oxide)
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
@@ -268,7 +268,7 @@
// BZ
- var/bz_pp = PP(breath, GAS_BZ)
+ var/bz_pp = PP(breath, /datum/gas/bz)
if(bz_pp > BZ_brain_damage_min)
H.hallucination += 10
H.reagents.add_reagent(/datum/reagent/metabolite/bz,5)
@@ -280,7 +280,7 @@
H.reagents.add_reagent(/datum/reagent/metabolite/bz,1)
// Nitryl
- var/nitryl_pp = PP(breath,GAS_NITRYL)
+ var/nitryl_pp = PP(breath,/datum/gas/nitryl)
if (prob(nitryl_pp))
to_chat(H, "Your mouth feels like it's burning!")
if (nitryl_pp >40)
@@ -291,18 +291,18 @@
H.silent = max(H.silent, 3)
else
H.adjustFireLoss(nitryl_pp/4)
- gas_breathed = PP(breath,GAS_NITRYL)
+ gas_breathed = PP(breath,/datum/gas/nitryl)
if (gas_breathed > gas_stimulation_min)
H.reagents.add_reagent(/datum/reagent/nitryl,1)
- breath.adjust_moles(GAS_NITRYL, -gas_breathed)
+ breath.adjust_moles(/datum/gas/nitryl, -gas_breathed)
// Stimulum
- gas_breathed = PP(breath,GAS_STIMULUM)
+ gas_breathed = PP(breath,/datum/gas/stimulum)
if (gas_breathed > gas_stimulation_min)
var/existing = H.reagents.get_reagent_amount(/datum/reagent/stimulum)
H.reagents.add_reagent(/datum/reagent/stimulum, max(0, 5 - existing))
- breath.adjust_moles(GAS_STIMULUM, -gas_breathed)
+ breath.adjust_moles(/datum/gas/stimulum, -gas_breathed)
handle_breath_temperature(breath, H)
return TRUE
@@ -370,7 +370,7 @@
/obj/item/organ/lungs/plasmaman/populate_gas_info()
..()
- gas_max -= GAS_PLASMA
+ gas_max -= /datum/gas/plasma
/obj/item/organ/lungs/slime
name = "vacuole"
@@ -400,8 +400,8 @@
safe_breath_min = 4
safe_breath_max = 250
gas_max = list(
- GAS_PLASMA = 30,
- GAS_CO2 = 30
+ /datum/gas/plasma = 30,
+ /datum/gas/carbon_dioxide = 30
)
maxHealth = 2 * STANDARD_ORGAN_THRESHOLD
@@ -422,8 +422,8 @@
safe_breath_min = 4
safe_breath_max = 20
gas_max = list(
- GAS_CO2 = 45,
- GAS_PLASMA = MOLES_GAS_VISIBLE
+ /datum/gas/carbon_dioxide = 45,
+ /datum/gas/plasma = MOLES_GAS_VISIBLE
)
#undef PP
#undef PP_MOLES
diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm
index 57d405d02ab6f..b51f15e8028e0 100644
--- a/code/modules/vehicles/mecha/_mecha.dm
+++ b/code/modules/vehicles/mecha/_mecha.dm
@@ -328,8 +328,8 @@
cabin_air = new
cabin_air.set_temperature(T20C)
cabin_air.set_volume(200)
- 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()))
+ 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()))
return cabin_air
/obj/vehicle/sealed/mecha/proc/add_radio()
diff --git a/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm b/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm
index e0b80167c31e0..3a86351b40fcc 100644
--- a/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm
+++ b/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm
@@ -235,7 +235,7 @@
///What gasses we've S U C K E D
var/datum/gas_mixture/air_contents
///Gasses we can suck. Currently everything but, it's here if we need to blacklist in the future
- var/list/scrubbing = list(GAS_PLASMA, GAS_CO2, GAS_NITROUS, GAS_BZ, GAS_NITRYL, GAS_TRITIUM, GAS_HYPERNOB, GAS_H2O, GAS_O2, GAS_N2, GAS_STIMULUM, GAS_PLUOXIUM)
+ var/list/scrubbing = list(/datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz, /datum/gas/nitryl, /datum/gas/tritium, GAS_HYPERNOB, /datum/gas/water_vapor, /datum/gas/oxygen, /datum/gas/nitrogen, /datum/gas/stimulum, GAS_PLUOXIUM)
///Adjust for balance - I'm sure this will have no ramifications
var/volume = 1000000
var/volume_rate = 200000
From 8db536622d1f61503e22a91650358bd4f93ee95b Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Thu, 11 Jul 2024 00:14:23 +0200
Subject: [PATCH 013/114] kills set_temperature
---
code/datums/atmosphere/_atmosphere.dm | 2 +-
code/game/machinery/shuttle/shuttle_engine.dm | 2 +-
code/game/machinery/shuttle/shuttle_heater.dm | 2 +-
code/game/machinery/spaceheater.dm | 2 +-
.../effects/effect_system/effects_foam.dm | 4 ++--
.../effects/effect_system/effects_smoke.dm | 2 +-
.../objects/effects/spawners/bombspawner.dm | 4 ++--
code/game/objects/items/chrono_eraser.dm | 2 +-
code/game/objects/items/tanks/tanks.dm | 2 +-
.../transit_tubes/transit_tube_pod.dm | 2 +-
code/game/turfs/open/_open.dm | 2 +-
code/game/turfs/turf.dm | 1 -
code/modules/admin/verbs/debug.dm | 2 +-
.../gasmixtures/immutable_mixtures.dm | 2 +-
.../atmospherics/gasmixtures/reactions.dm | 22 +++++++++----------
.../binary_devices/temperature_pump.dm | 4 ++--
.../unary_devices/heat_exchanger.dm | 4 ++--
.../components/unary_devices/tank.dm | 2 +-
.../components/unary_devices/thermomachine.dm | 2 +-
.../atmospherics/machinery/other/miner.dm | 2 +-
.../machinery/pipes/heat_exchange/he_pipes.dm | 2 +-
.../machinery/portable/canister.dm | 4 ++--
.../portable/portable_atmospherics.dm | 2 +-
code/modules/events/supermatter_surge.dm | 4 ++--
code/modules/holodeck/holo_effect.dm | 2 +-
.../mob/living/simple_animal/bot/atmosbot.dm | 2 +-
code/modules/power/generator.dm | 4 ++--
code/modules/power/supermatter/supermatter.dm | 4 ++--
.../chemistry/reagents/food_reagents.dm | 4 ++--
.../chemistry/reagents/other_reagents.dm | 2 +-
.../reagents/pyrotechnic_reagents.dm | 2 +-
.../xenobiology/crossbreeding/_structures.dm | 2 +-
code/modules/vehicles/mecha/_mecha.dm | 8 +++----
.../traits/xenoartifact_malfunctions.dm | 2 +-
34 files changed, 55 insertions(+), 56 deletions(-)
diff --git a/code/datums/atmosphere/_atmosphere.dm b/code/datums/atmosphere/_atmosphere.dm
index df76b3f2a4111..50e28486eb674 100644
--- a/code/datums/atmosphere/_atmosphere.dm
+++ b/code/datums/atmosphere/_atmosphere.dm
@@ -23,7 +23,7 @@
// First let's set up the gasmix and base gases for this template
// We make the string from a gasmix in this proc because gases need to calculate their pressure
var/datum/gas_mixture/gasmix = new
- gasmix.set_temperature(rand(minimum_temp, maximum_temp))
+ gasmix.temperature = rand(minimum_temp, maximum_temp)
for(var/i in base_gases)
gasmix.set_moles(i, base_gases[i])
diff --git a/code/game/machinery/shuttle/shuttle_engine.dm b/code/game/machinery/shuttle/shuttle_engine.dm
index 320c7733e8b58..adfb6e6f269ec 100644
--- a/code/game/machinery/shuttle/shuttle_engine.dm
+++ b/code/game/machinery/shuttle/shuttle_engine.dm
@@ -123,7 +123,7 @@
var/deltaTemperature = req_power / heat_cap
if(deltaTemperature < 0)
return
- env.set_temperature(env.return_temperature() + deltaTemperature)
+ env.temperature = env.return_temperature() + deltaTemperature
air_update_turf(FALSE, FALSE)
/obj/machinery/shuttle/engine/attackby(obj/item/I, mob/living/user, params)
diff --git a/code/game/machinery/shuttle/shuttle_heater.dm b/code/game/machinery/shuttle/shuttle_heater.dm
index 98d4764e89ae9..6eba4376a51de 100644
--- a/code/game/machinery/shuttle/shuttle_heater.dm
+++ b/code/game/machinery/shuttle/shuttle_heater.dm
@@ -91,7 +91,7 @@
if(!air_contents)
return
air_contents.set_volume(gas_capacity)
- air_contents.set_temperature(T20C)
+ air_contents.temperature = T20C
/obj/machinery/atmospherics/components/unary/shuttle/heater/proc/hasFuel(var/required)
var/datum/gas_mixture/air_contents = airs[1]
diff --git a/code/game/machinery/spaceheater.dm b/code/game/machinery/spaceheater.dm
index 994be48b3eec8..e81f982dfa537 100644
--- a/code/game/machinery/spaceheater.dm
+++ b/code/game/machinery/spaceheater.dm
@@ -125,7 +125,7 @@
if(mode == HEATER_MODE_COOL)
delta_temperature *= -1
if(delta_temperature)
- environment.set_temperature(environment.return_temperature() + delta_temperature)
+ environment.temperature = environment.return_temperature() + delta_temperature
air_update_turf(FALSE, FALSE)
cell.use(required_energy / efficiency)
diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm
index 45d051709d309..d39e5129a4c2d 100644
--- a/code/game/objects/effects/effect_system/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/effects_foam.dm
@@ -48,7 +48,7 @@
G.adjust_moles(/datum/gas/plasma, -plas_amt)
absorbed_plasma += plas_amt
if(G.return_temperature() > T20C)
- G.set_temperature(max(G.return_temperature()/2,T20C))
+ G.temperature = max(G.return_temperature()/2,T20C)
T.air_update_turf(FALSE, FALSE)
/obj/effect/particle_effect/foam/firefighting/kill_foam()
@@ -336,7 +336,7 @@
O.ClearWet()
if(O.air)
var/datum/gas_mixture/G = O.air
- G.set_temperature(293.15)
+ G.temperature = 293.15
for(var/obj/effect/hotspot/H in O)
qdel(H)
for(var/I in G.get_gases())
diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm
index 1654e4b878a0e..e639b6803a808 100644
--- a/code/game/objects/effects/effect_system/effects_smoke.dm
+++ b/code/game/objects/effects/effect_system/effects_smoke.dm
@@ -175,7 +175,7 @@
if(T.air)
var/datum/gas_mixture/G = T.air
if(!distcheck || get_dist(T, location) < blast) // Otherwise we'll get silliness like people using Nanofrost to kill people through walls with cold air
- G.set_temperature(temperature)
+ G.temperature = temperature
T.air_update_turf(FALSE, FALSE)
for(var/obj/effect/hotspot/H in T)
qdel(H)
diff --git a/code/game/objects/effects/spawners/bombspawner.dm b/code/game/objects/effects/spawners/bombspawner.dm
index 0322878bb6ca9..607d5bb0dd4fe 100644
--- a/code/game/objects/effects/spawners/bombspawner.dm
+++ b/code/game/objects/effects/spawners/bombspawner.dm
@@ -20,10 +20,10 @@
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_temperature(CELSIUS_TO_KELVIN(temp_p))
+ PT.air_contents.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_temperature(CELSIUS_TO_KELVIN(temp_o))
+ OT.air_contents.temperature = CELSIUS_TO_KELVIN(temp_o)
V.tank_one = PT
V.tank_two = OT
diff --git a/code/game/objects/items/chrono_eraser.dm b/code/game/objects/items/chrono_eraser.dm
index 087e13b24e673..78da7c1538d7b 100644
--- a/code/game/objects/items/chrono_eraser.dm
+++ b/code/game/objects/items/chrono_eraser.dm
@@ -266,7 +266,7 @@
var/datum/gas_mixture/GM = new
GM.set_moles(/datum/gas/oxygen, MOLES_O2STANDARD)
GM.set_moles(/datum/gas/nitrogen, MOLES_N2STANDARD)
- GM.set_temperature(T20C)
+ GM.temperature = T20C
return GM
/obj/structure/chrono_field/singularity_act()
diff --git a/code/game/objects/items/tanks/tanks.dm b/code/game/objects/items/tanks/tanks.dm
index c41d6adf8b8bd..29508d60c1fb4 100644
--- a/code/game/objects/items/tanks/tanks.dm
+++ b/code/game/objects/items/tanks/tanks.dm
@@ -63,7 +63,7 @@
. = ..()
air_contents = new(volume) //liters
- air_contents.set_temperature(T20C)
+ air_contents.temperature = T20C
populate_gas()
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 151f9960a466f..bc7b3c4160a0c 100644
--- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
+++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
@@ -15,7 +15,7 @@
. = ..()
air_contents.set_moles(/datum/gas/oxygen, MOLES_O2STANDARD)
air_contents.set_moles(/datum/gas/nitrogen, MOLES_N2STANDARD)
- air_contents.set_temperature(T20C)
+ air_contents.temperature = T20C
/obj/structure/transit_tube_pod/Destroy()
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index d026edec08b2f..a3cd6f94279fb 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -195,7 +195,7 @@
. = air.return_temperature()
/turf/open/proc/TakeTemperature(temp)
- air.set_temperature(air.return_temperature() + temp)
+ air.temperature = air.return_temperature() + temp
air_update_turf(FALSE, FALSE)
/turf/open/proc/freeze_turf()
diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm
index b109d5eccc1c6..6c2bfe60ee2e8 100644
--- a/code/game/turfs/turf.dm
+++ b/code/game/turfs/turf.dm
@@ -158,7 +158,6 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists)
/turf/return_temperature()
-/turf/proc/set_temperature()
/// Initializes our adjacent turfs. If you want to avoid this, do not override it, instead set init_air to FALSE
/turf/proc/Initalize_Atmos(times_fired)
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index f4eaaecc68b59..28ca4e5a11ae2 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -956,7 +956,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
C.air_contents.set_moles(gas_to_add, amount)
- C.air_contents.set_temperature(temp)
+ C.air_contents.temperature = (temp)
C.update_icon()
message_admins("[key_name_admin(src)] modified \the [C.name] at [AREACOORD(C)] - Gas: [gas_to_add], Moles: [amount], Temp: [temp].")
diff --git a/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm b/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
index cebdfe7ae0c91..e566c4a167861 100644
--- a/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
+++ b/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
@@ -6,7 +6,7 @@
/datum/gas_mixture/immutable/New()
..()
- set_temperature(initial_temperature)
+ temperature = (initial_temperature)
populate()
mark_immutable()
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index d4233bedff176..fa8773136d295 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -116,7 +116,7 @@
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.temperature = ((temperature*old_heat_capacity + energy_released)/new_heat_capacity)
return REACTING
return NO_REACTION
@@ -173,7 +173,7 @@
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.temperature = ((temperature*old_heat_capacity + energy_released)/new_heat_capacity)
//let the floor know a fire is happening
if(istype(location))
@@ -241,7 +241,7 @@
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.temperature = ((temperature*old_heat_capacity + energy_released)/new_heat_capacity)
//let the floor know a fire is happening
if(istype(location))
@@ -324,7 +324,7 @@
var/final_energy = air.thermal_energy() + energy_released
for(var/result in burn_results)
air.adjust_moles(result, burn_results[result])
- air.set_temperature(final_energy / air.heat_capacity())
+ air.temperature = (final_energy / air.heat_capacity())
var/list/cached_results = air.reaction_results
cached_results["fire"] = min(total_fuel, oxidation_power) * 2
return cached_results["fire"] ? REACTING : NO_REACTION
@@ -417,12 +417,12 @@
radiation_pulse(location, max(2000 * 3 ** (log(10,standard_energy) - FUSION_RAD_MIDPOINT), 0))
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
- air.set_temperature(clamp(thermal_energy/new_heat_capacity, TCMB, INFINITY))
+ air.temperature = (clamp(thermal_energy/new_heat_capacity, TCMB, INFINITY))
return REACTING
else if(reaction_energy == 0 && instability <= FUSION_INSTABILITY_ENDOTHERMALITY)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
- air.set_temperature(clamp(thermal_energy/new_heat_capacity, TCMB, INFINITY)) //THIS SHOULD STAY OR FUSION WILL EAT YOUR FACE
+ air.temperature = (clamp(thermal_energy/new_heat_capacity, TCMB, INFINITY)) //THIS SHOULD STAY OR FUSION WILL EAT YOUR FACE
return REACTING
/datum/gas_reaction/nitrylformation //The formation of nitryl. Endothermic. Requires N2O as a catalyst.
@@ -453,7 +453,7 @@
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.temperature = (max(((temperature*old_heat_capacity - energy_used)/new_heat_capacity),TCMB))
return REACTING
/datum/gas_reaction/bzformation //Formation of BZ by combining plasma and tritium at low pressures. Exothermic.
@@ -489,7 +489,7 @@
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.temperature = (max(((temperature*old_heat_capacity + energy_released)/new_heat_capacity),TCMB))
return REACTING
/datum/gas_reaction/stimformation //Stimulum formation follows a strange pattern of how effective it will be at a given temperature, having some multiple peaks and some large dropoffs. Exo and endo thermic.
@@ -522,7 +522,7 @@
if(stim_energy_change)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
- air.set_temperature(max(((air.return_temperature()*old_heat_capacity + stim_energy_change)/new_heat_capacity),TCMB))
+ air.temperature = (max(((air.return_temperature()*old_heat_capacity + stim_energy_change)/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.
@@ -551,7 +551,7 @@
if (nob_formed)
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.temperature = (max(((air.return_temperature()*old_heat_capacity - energy_taken)/new_heat_capacity),TCMB))
/datum/gas_reaction/stim_ball
priority = 7
@@ -588,5 +588,5 @@
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.temperature = (clamp((air.return_temperature()*old_heat_capacity + energy_released)/new_heat_capacity,TCMB,INFINITY))
return REACTING
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 18da76771dc01..830431fd1ef25 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.dm
@@ -52,8 +52,8 @@
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))
- remove_output.set_temperature(max(remove_output.return_temperature() + (cooling_heat_amount / output_capacity), TCMB))
+ remove_input.temperature = (max(remove_input.return_temperature() - (cooling_heat_amount / input_capacity), TCMB))
+ remove_output.temperature = (max(remove_output.return_temperature() + (cooling_heat_amount / output_capacity), TCMB))
air_input.merge(remove_input)
air_output.merge(remove_output)
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 0021cebdc802a..3f1920d41f646 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm
@@ -72,8 +72,8 @@
var/combined_energy = partner_air_contents.return_temperature()*other_air_heat_capacity + air_heat_capacity*air_contents.return_temperature()
var/new_temperature = combined_energy/combined_heat_capacity
- air_contents.set_temperature(new_temperature)
- partner_air_contents.set_temperature(new_temperature)
+ air_contents.temperature = (new_temperature)
+ partner_air_contents.temperature = (new_temperature)
if(abs(old_temperature-air_contents.return_temperature()) > 1)
update_parents()
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
index 5b3f5ba7f6513..5afee78136bcf 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
@@ -18,7 +18,7 @@
..()
var/datum/gas_mixture/air_contents = airs[1]
air_contents.set_volume(volume)
- air_contents.set_temperature(T20C)
+ air_contents.temperature = (T20C)
if(gas_type)
air_contents.set_moles(gas_type, AIR_CONTENTS)
name = "[name] ([GLOB.gas_data.names[gas_type]])"
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm
index 41e2ce70afe5e..38bd7572b9a4f 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm
@@ -119,7 +119,7 @@
if(combined_heat_capacity > 0)
var/combined_energy = heat_capacity * target_temperature + air_heat_capacity * air_contents.return_temperature()
- air_contents.set_temperature(combined_energy/combined_heat_capacity)
+ air_contents.temperature = (combined_energy/combined_heat_capacity)
var/temperature_delta= abs(old_temperature - air_contents.return_temperature())
if(temperature_delta > 1)
diff --git a/code/modules/atmospherics/machinery/other/miner.dm b/code/modules/atmospherics/machinery/other/miner.dm
index 58fab5d1e1bff..696e9d92a08c2 100644
--- a/code/modules/atmospherics/machinery/other/miner.dm
+++ b/code/modules/atmospherics/machinery/other/miner.dm
@@ -135,7 +135,7 @@
return FALSE
var/datum/gas_mixture/merger = new
merger.set_moles(spawn_id, spawn_mol * delta_time)
- merger.set_temperature(spawn_temp)
+ merger.temperature = (spawn_temp)
O.assume_air(merger)
/obj/machinery/atmospherics/miner/attack_ai(mob/living/silicon/user)
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 c03e608a92018..cd22fab6eb2d0 100644
--- a/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm
+++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm
@@ -47,7 +47,7 @@
for(var/m in buckled_mobs)
var/mob/living/L = m
L.bodytemperature = avg_temp
- pipe_air.set_temperature(avg_temp)
+ pipe_air.temperature = (avg_temp)
/obj/machinery/atmospherics/pipe/heat_exchanging/process(delta_time)
if(!parent)
diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm
index 9ab565b148f4a..144befee74863 100644
--- a/code/modules/atmospherics/machinery/portable/canister.dm
+++ b/code/modules/atmospherics/machinery/portable/canister.dm
@@ -273,13 +273,13 @@
/obj/machinery/portable_atmospherics/canister/proc/create_gas()
if(gas_type)
if(starter_temp)
- air_contents.set_temperature(starter_temp)
+ air_contents.temperature = (starter_temp)
if(!air_contents.return_volume())
CRASH("Auxtools is failing somehow! Gas with pointer [air_contents._extools_pointer_gasmixture] is not valid.")
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()
- air_contents.set_temperature(starter_temp)
+ air_contents.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()))
diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
index d280d79690361..aefaa71dcc271 100644
--- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
+++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
@@ -17,7 +17,7 @@
/obj/machinery/portable_atmospherics/Initialize(mapload)
. = ..()
air_contents = new(volume)
- air_contents.set_temperature(T20C)
+ air_contents.temperature = (T20C)
SSair.start_processing_machine(src)
/obj/machinery/portable_atmospherics/Destroy()
diff --git a/code/modules/events/supermatter_surge.dm b/code/modules/events/supermatter_surge.dm
index fcf2a57bf81c8..74056ad1febb4 100644
--- a/code/modules/events/supermatter_surge.dm
+++ b/code/modules/events/supermatter_surge.dm
@@ -44,10 +44,10 @@
var/datum/gas_mixture/gas_puff = new
var/selected_gas = pick(4;/datum/gas/carbon_dioxide, 4;/datum/gas/water_vapor, 1;/datum/gas/bz)
gas_puff.set_moles(selected_gas, 500)
- gas_puff.set_temperature(500)
+ gas_puff.temperature = (500)
var/energy_ratio = (power * 500 * (1-power_proportion)) / gas_puff.thermal_energy()
if(energy_ratio < 1) // energy output we want is lower than current energy, reduce the amount of gas we puff out
gas_puff.set_moles(/datum/gas/water_vapor, energy_ratio * 500)
else // energy output we want is higher than current energy, increase its actual heat
- gas_puff.set_temperature(energy_ratio * 500)
+ gas_puff.temperature = (energy_ratio * 500)
supermatter.assume_air(gas_puff)
diff --git a/code/modules/holodeck/holo_effect.dm b/code/modules/holodeck/holo_effect.dm
index 9ec4c9776e9fa..20efa9a355fdb 100644
--- a/code/modules/holodeck/holo_effect.dm
+++ b/code/modules/holodeck/holo_effect.dm
@@ -66,7 +66,7 @@
var/datum/effect_system/spark_spread/s = new
s.set_up(3, 1, T)
s.start()
- T.set_temperature(5000)
+ T.temperature = (5000)
T.hotspot_expose(50000,50000,1)
/obj/effect/holodeck_effect/random_book
diff --git a/code/modules/mob/living/simple_animal/bot/atmosbot.dm b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
index 248ee76073eee..bf8422a00b23a 100644
--- a/code/modules/mob/living/simple_animal/bot/atmosbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
@@ -198,7 +198,7 @@
/mob/living/simple_animal/bot/atmosbot/proc/change_temperature()
var/turf/T = get_turf(src)
var/datum/gas_mixture/environment = T.return_air()
- environment.set_temperature(ideal_temperature)
+ environment.temperature = (ideal_temperature)
/mob/living/simple_animal/bot/atmosbot/proc/vent_air()
//Just start pumping out air
diff --git a/code/modules/power/generator.dm b/code/modules/power/generator.dm
index f40fe6e5364aa..a5e3d9a64b18d 100644
--- a/code/modules/power/generator.dm
+++ b/code/modules/power/generator.dm
@@ -80,8 +80,8 @@
var/heat = energy_transfer*(1-efficiency)
lastgen += energy_transfer*efficiency
- hot_air.set_temperature(hot_air.return_temperature() - energy_transfer/hot_air_heat_capacity)
- cold_air.set_temperature(cold_air.return_temperature() + heat/cold_air_heat_capacity)
+ hot_air.temperature = (hot_air.return_temperature() - energy_transfer/hot_air_heat_capacity)
+ cold_air.temperature = (cold_air.return_temperature() + heat/cold_air_heat_capacity)
//add_avail(lastgen) This is done in process now
// update icon overlays only if displayed level has changed
diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm
index ec69ce353860d..f03beb86808ae 100644
--- a/code/modules/power/supermatter/supermatter.dm
+++ b/code/modules/power/supermatter/supermatter.dm
@@ -516,9 +516,9 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
//Also keep in mind we are only adding this temperature to (efficiency)% of the one tile the rock
//is on. An increase of 4*C @ 25% efficiency here results in an increase of 1*C / (#tilesincore) overall.
- removed.set_temperature(removed.return_temperature() + ((device_energy * dynamic_heat_modifier) / THERMAL_RELEASE_MODIFIER))
+ removed.temperature = (removed.return_temperature() + ((device_energy * dynamic_heat_modifier) / THERMAL_RELEASE_MODIFIER))
- removed.set_temperature(max(0, min(removed.return_temperature(), 2500 * dynamic_heat_modifier)))
+ removed.temperature = (max(0, min(removed.return_temperature(), 2500 * dynamic_heat_modifier)))
//Calculate how much gas to release
removed.adjust_moles(/datum/gas/plasma, max((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER, 0))
diff --git a/code/modules/reagents/chemistry/reagents/food_reagents.dm b/code/modules/reagents/chemistry/reagents/food_reagents.dm
index 4dbd49cc71059..c8ea26e1c7acd 100755
--- a/code/modules/reagents/chemistry/reagents/food_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/food_reagents.dm
@@ -299,7 +299,7 @@
if(isopenturf(T))
var/turf/open/OT = T
OT.MakeSlippery(wet_setting=TURF_WET_ICE, min_wet_time=100, wet_time_to_add=reac_volume SECONDS) // Is less effective in high pressure/high heat capacity environments. More effective in low pressure.
- OT.air.set_temperature(OT.air.return_temperature() - MOLES_CELLSTANDARD*100*reac_volume/OT.air.heat_capacity()) // reduces environment temperature by 5K per unit.
+ OT.air.temperature = (OT.air.return_temperature() - MOLES_CELLSTANDARD*100*reac_volume/OT.air.heat_capacity()) // reduces environment temperature by 5K per unit.
/datum/reagent/consumable/condensedcapsaicin
name = "Condensed Capsaicin"
@@ -478,7 +478,7 @@
var/obj/effect/hotspot/hotspot = (locate(/obj/effect/hotspot) in T)
if(hotspot)
var/datum/gas_mixture/lowertemp = T.return_air()
- lowertemp.set_temperature(max( min(lowertemp.return_temperature()-2000,lowertemp.return_temperature() / 2) ,TCMB))
+ lowertemp.temperature = (max( min(lowertemp.return_temperature()-2000,lowertemp.return_temperature() / 2) ,TCMB))
lowertemp.react(src)
qdel(hotspot)
diff --git a/code/modules/reagents/chemistry/reagents/other_reagents.dm b/code/modules/reagents/chemistry/reagents/other_reagents.dm
index 0fdb0d7b1f881..1e6adf24ac5e9 100644
--- a/code/modules/reagents/chemistry/reagents/other_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/other_reagents.dm
@@ -187,7 +187,7 @@
if(hotspot && !isspaceturf(T))
if(T.air)
var/datum/gas_mixture/G = T.air
- G.set_temperature(max(min(G.return_temperature()-(CT*1000),G.return_temperature()/CT),TCMB))
+ G.temperature = (max(min(G.return_temperature()-(CT*1000),G.return_temperature()/CT),TCMB))
G.react(src)
qdel(hotspot)
var/obj/effect/acid/A = (locate(/obj/effect/acid) in T)
diff --git a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm
index 3d8aa24424613..0ee892f91af0c 100644
--- a/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm
+++ b/code/modules/reagents/chemistry/reagents/pyrotechnic_reagents.dm
@@ -322,7 +322,7 @@
if(T.air)
var/datum/gas_mixture/G = T.air
if(G.return_temperature() > T20C)
- G.set_temperature(max(G.return_temperature()/2,T20C))
+ G.temperature = (max(G.return_temperature()/2,T20C))
G.react(src)
qdel(hotspot)
diff --git a/code/modules/research/xenobiology/crossbreeding/_structures.dm b/code/modules/research/xenobiology/crossbreeding/_structures.dm
index b80f3343678e9..c14aca8e765d8 100644
--- a/code/modules/research/xenobiology/crossbreeding/_structures.dm
+++ b/code/modules/research/xenobiology/crossbreeding/_structures.dm
@@ -149,7 +149,7 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals)
if(!istype(T))
return
var/datum/gas_mixture/gas = T.return_air()
- gas.set_temperature(T0C + 200)
+ gas.temperature = (T0C + 200)
T.air_update_turf(FALSE, FALSE)
/obj/structure/slime_crystal/purple
diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm
index b51f15e8028e0..069ade730280a 100644
--- a/code/modules/vehicles/mecha/_mecha.dm
+++ b/code/modules/vehicles/mecha/_mecha.dm
@@ -326,7 +326,7 @@
/obj/vehicle/sealed/mecha/proc/add_cabin()
cabin_air = new
- cabin_air.set_temperature(T20C)
+ cabin_air.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()))
@@ -396,9 +396,9 @@
if(int_tank_air.return_pressure() > internal_tank.maximum_pressure && !(internal_damage & MECHA_INT_TANK_BREACH))
setInternalDamage(MECHA_INT_TANK_BREACH)
if(int_tank_air && int_tank_air.return_volume() > 0) //heat the air_contents
- int_tank_air.set_temperature(min(6000+T0C, int_tank_air.return_temperature()+rand(10,15)))
+ int_tank_air.temperature = (min(6000+T0C, int_tank_air.return_temperature()+rand(10,15)))
if(cabin_air && cabin_air.return_volume()>0)
- cabin_air.set_temperature(min(6000+T0C, cabin_air.return_temperature()+rand(10,15)))
+ cabin_air.temperature = (min(6000+T0C, cabin_air.return_temperature()+rand(10,15)))
if(cabin_air.return_temperature() > max_temperature/2)
take_damage(4/round(max_temperature/cabin_air.return_temperature(),0.1), BURN, 0, 0)
@@ -418,7 +418,7 @@
if(internal_temp_regulation)
if(cabin_air && cabin_air.return_volume() > 0)
var/delta = cabin_air.return_temperature() - T20C
- cabin_air.set_temperature(cabin_air.return_temperature() - max(-10, min(10, round(delta/4,0.1))))
+ cabin_air.temperature = (cabin_air.return_temperature() - max(-10, min(10, round(delta/4,0.1))))
if(internal_tank)
var/datum/gas_mixture/tank_air = internal_tank.return_air()
diff --git a/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm b/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm
index 3a86351b40fcc..4fe4141fce640 100644
--- a/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm
+++ b/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm
@@ -244,7 +244,7 @@
/datum/xenoartifact_trait/malfunction/absorbant/on_init(obj/item/xenoartifact/X)
air_contents = new(volume)
- air_contents.set_temperature(T20C)
+ air_contents.temperature = (T20C)
parent = X
/datum/xenoartifact_trait/malfunction/absorbant/activate(obj/item/xenoartifact/X, atom/target, atom/user, setup)
From 497928838e6060464bbe0f3caf705e7a58f616a3 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 15 Jul 2024 15:12:52 +0200
Subject: [PATCH 014/114] gootbye get_moles
---
code/__HELPERS/turfs.dm | 2 +-
code/datums/atmosphere/_atmosphere.dm | 10 +--
code/datums/elements/atmos_requirements.dm | 8 +-
code/game/atoms.dm | 2 +-
code/game/gamemodes/objective_items.dm | 2 +-
code/game/machinery/computer/atmos_control.dm | 6 +-
code/game/machinery/shuttle/shuttle_heater.dm | 2 +-
.../effects/effect_system/effects_foam.dm | 2 +-
.../effects/effect_system/effects_smoke.dm | 4 +-
code/game/objects/items/devices/scanners.dm | 34 ++++-----
code/game/objects/items/tanks/jetpack.dm | 12 +--
code/game/turfs/open/_open.dm | 8 +-
.../atmospherics/auxgm/breathing_classes.dm | 2 +-
.../atmospherics/gasmixtures/reactions.dm | 74 +++++++++----------
.../atmospherics/machinery/airalarm.dm | 8 +-
.../machinery/portable/canister.dm | 8 +-
.../atmospherics/machinery/portable/pump.dm | 4 +-
code/modules/cargo/bounties/engineering.dm | 2 +-
code/modules/cargo/exports/large_objects.dm | 10 +--
code/modules/events/spacevine.dm | 8 +-
code/modules/hydroponics/grown/towercap.dm | 2 +-
code/modules/mob/living/carbon/alien/life.dm | 6 +-
.../carbon/human/species_types/oozelings.dm | 4 +-
.../carbon/human/species_types/plasmamen.dm | 2 +-
code/modules/mob/living/carbon/life.dm | 28 +++----
code/modules/mob/living/life.dm | 2 +-
.../mob/living/simple_animal/bot/atmosbot.dm | 6 +-
.../mob/living/simple_animal/hostile/tree.dm | 2 +-
.../mob/living/simple_animal/simple_animal.dm | 8 +-
.../mob/living/simple_animal/slime/life.dm | 4 +-
code/modules/mob/mob.dm | 4 +-
.../file_system/programs/atmosscan.dm | 2 +-
code/modules/power/singularity/collector.dm | 8 +-
code/modules/power/supermatter/supermatter.dm | 20 ++---
.../xenobiology/crossbreeding/_structures.dm | 2 +-
.../loot/alien_artifact.dm | 2 +-
.../shuttle_components/plasma_refiner.dm | 2 +-
code/modules/surgery/organs/lungs.dm | 12 +--
.../traits/xenoartifact_majors.dm | 2 +-
39 files changed, 163 insertions(+), 163 deletions(-)
diff --git a/code/__HELPERS/turfs.dm b/code/__HELPERS/turfs.dm
index cf9796729c1b5..275c353c5b262 100644
--- a/code/__HELPERS/turfs.dm
+++ b/code/__HELPERS/turfs.dm
@@ -404,7 +404,7 @@ Turf and target are separate in case you want to teleport some distance from a t
if(id in GLOB.hardcoded_gases)
continue
return FALSE
- if(air.get_moles(/datum/gas/oxygen) < 16 || air.get_moles(/datum/gas/plasma) || air.get_moles(/datum/gas/carbon_dioxide) >= 10)
+ if(air.gases[/datum/gas/oxygen][MOLES] < 16 || air.gases[/datum/gas/plasma][MOLES] || air.gases[/datum/gas/carbon_dioxide][MOLES] >= 10)
return FALSE
var/temperature = air.return_temperature()
if(temperature <= 270 || temperature >= 360)
diff --git a/code/datums/atmosphere/_atmosphere.dm b/code/datums/atmosphere/_atmosphere.dm
index 50e28486eb674..b1bb042d072c6 100644
--- a/code/datums/atmosphere/_atmosphere.dm
+++ b/code/datums/atmosphere/_atmosphere.dm
@@ -37,23 +37,23 @@
else
gastype = pick(restricted_gases)
amount = restricted_gases[gastype]
- if(gasmix.get_moles(gastype))
+ if(gasmix.gases[gastype][MOLES])
continue
amount *= rand(50, 200) / 100 // Randomly modifes the amount from half to double the base for some variety
amount *= pressure_scalar // If we pick a really small target pressure we want roughly the same mix but less of it all
amount = CEILING(amount, 0.1)
- gasmix.set_moles(gastype, gasmix.get_moles(gastype) + amount)
+ gasmix.gases[gastype][MOLES] = gasmix.gases[gastype][MOLES] + amount
// That last one put us over the limit, remove some of it
while(gasmix.return_pressure() > target_pressure)
- gasmix.set_moles(gastype, gasmix.get_moles(gastype) - (gasmix.get_moles(gastype) * 0.1))
- gasmix.set_moles(gastype, FLOOR(gasmix.get_moles(gastype), 0.1))
+ gasmix.gases[gastype][MOLES] = gasmix.gases[gastype][MOLES] - (gasmix.gases[gastype][MOLES] * 0.1)
+ gasmix.gases[gastype][MOLES] = FLOOR(gasmix.gases[gastype][MOLES], 0.1)
// Now finally lets make that string
var/list/gas_string_builder = list()
for(var/i in gasmix.get_gases())
- gas_string_builder += "[GLOB.gas_data.ids[i]]=[gasmix.get_moles(i)]"
+ gas_string_builder += "[GLOB.gas_data.ids[i]]=[gasmix.gases[i][MOLES]]"
gas_string_builder += "TEMP=[gasmix.return_temperature()]"
gas_string = gas_string_builder.Join(";")
diff --git a/code/datums/elements/atmos_requirements.dm b/code/datums/elements/atmos_requirements.dm
index 99b29bd259d65..2c2eabd0d84c6 100644
--- a/code/datums/elements/atmos_requirements.dm
+++ b/code/datums/elements/atmos_requirements.dm
@@ -45,10 +45,10 @@
if(!ST.air && (atmos_requirements["min_oxy"] || atmos_requirements["min_tox"] || atmos_requirements["min_n2"] || atmos_requirements["min_co2"]))
return FALSE
- var/plas = 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/plas = ST.air.gases[/datum/gas/plasma][MOLES]
+ var/oxy = ST.air.gases[/datum/gas/oxygen][MOLES]
+ var/n2 = ST.air.gases[/datum/gas/nitrogen][MOLES]
+ var/co2 = ST.air.gases[/datum/gas/carbon_dioxide][MOLES]
. = TRUE
if(atmos_requirements["min_oxy"] && oxy < atmos_requirements["min_oxy"])
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index 9cac675790fb0..23917f40b0c01 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -1858,7 +1858,7 @@
/atom/proc/plasma_ignition(strength, mob/user, reagent_reaction)
var/turf/T = get_turf(src)
var/datum/gas_mixture/environment = T.return_air()
- if(environment.get_moles(/datum/gas/oxygen) >= PLASMA_MINIMUM_OXYGEN_NEEDED) //Flashpoint ignition can only occur with at least this much oxygen present
+ if(environment.gases[/datum/gas/oxygen][MOLES] >= PLASMA_MINIMUM_OXYGEN_NEEDED) //Flashpoint ignition can only occur with at least this much oxygen present
//no reason to alert admins or create an explosion if there's not enough power to actually make an explosion
if(strength > 1)
if(user)
diff --git a/code/game/gamemodes/objective_items.dm b/code/game/gamemodes/objective_items.dm
index e29221230f24e..4b5ac4b60713e 100644
--- a/code/game/gamemodes/objective_items.dm
+++ b/code/game/gamemodes/objective_items.dm
@@ -143,7 +143,7 @@
/datum/objective_item/steal/plasma/check_special_completion(obj/item/tank/T)
var/target_amount = text2num(name)
var/found_amount = 0
- found_amount += T.air_contents.get_moles(/datum/gas/plasma)
+ found_amount += T.air_contents.gases[/datum/gas/plasma][MOLES]
return found_amount>=target_amount
/datum/objective_item/steal/functionalai
diff --git a/code/game/machinery/computer/atmos_control.dm b/code/game/machinery/computer/atmos_control.dm
index 5b4734f272836..910edfd673213 100644
--- a/code/game/machinery/computer/atmos_control.dm
+++ b/code/game/machinery/computer/atmos_control.dm
@@ -67,9 +67,9 @@
))
var/total_moles = air_sample.total_moles()
if(total_moles)
- for(var/gas_id in air_sample.get_gases())
- var/gas_name = GLOB.gas_data.names[gas_id]
- signal.data["gases"][gas_name] = air_sample.get_moles(gas_id) / total_moles * 100
+ for(var/gas in air_sample.gases)
+ var/gas_name = GLOB.gas_data.names[gas]
+ signal.data["gases"][gas_name] = gas[MOLES] / total_moles * 100
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
diff --git a/code/game/machinery/shuttle/shuttle_heater.dm b/code/game/machinery/shuttle/shuttle_heater.dm
index 6eba4376a51de..98468620c0e92 100644
--- a/code/game/machinery/shuttle/shuttle_heater.dm
+++ b/code/game/machinery/shuttle/shuttle_heater.dm
@@ -84,7 +84,7 @@
/obj/machinery/atmospherics/components/unary/shuttle/heater/examine(mob/user)
. = ..()
var/datum/gas_mixture/air_contents = airs[1]
- . += "The engine heater's gas dial reads [air_contents.get_moles(gas_type)] moles of gas. "
+ . += "The engine heater's gas dial reads [air_contents.gases[gas_type][MOLES]] moles of gas. "
/obj/machinery/atmospherics/components/unary/shuttle/heater/proc/updateGasStats()
var/datum/gas_mixture/air_contents = airs[1]
diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm
index d39e5129a4c2d..903b93b74671e 100644
--- a/code/game/objects/effects/effect_system/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/effects_foam.dm
@@ -44,7 +44,7 @@
if(hotspot && istype(T) && T.air)
qdel(hotspot)
var/datum/gas_mixture/G = T.air
- var/plas_amt = min(30,G.get_moles(/datum/gas/plasma)) //Absorb some plasma
+ var/plas_amt = min(30,G.gases[/datum/gas/plasma][MOLES]) //Absorb some plasma
G.adjust_moles(/datum/gas/plasma, -plas_amt)
absorbed_plasma += plas_amt
if(G.return_temperature() > T20C)
diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm
index e639b6803a808..f5d1c664feaec 100644
--- a/code/game/objects/effects/effect_system/effects_smoke.dm
+++ b/code/game/objects/effects/effect_system/effects_smoke.dm
@@ -179,8 +179,8 @@
T.air_update_turf(FALSE, FALSE)
for(var/obj/effect/hotspot/H in T)
qdel(H)
- if(G.get_moles(/datum/gas/plasma))
- G.adjust_moles(/datum/gas/nitrogen, G.get_moles(/datum/gas/plasma))
+ if(G.gases[/datum/gas/plasma][MOLES])
+ G.adjust_moles(/datum/gas/nitrogen, G.gases[/datum/gas/plasma][MOLES])
G.set_moles(/datum/gas/plasma, 0)
if (weldvents)
for(var/obj/machinery/atmospherics/components/unary/U in T)
diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm
index 304be87c43e48..475bd75721623 100644
--- a/code/game/objects/items/devices/scanners.dm
+++ b/code/game/objects/items/devices/scanners.dm
@@ -662,9 +662,9 @@ GENE SCANNER
message += "Volume: [volume] L"
message += "Pressure: [round(pressure,0.01)] kPa"
- for(var/id in air_contents.get_gases())
- var/gas_concentration = air_contents.get_moles(id)/total_moles
- message += "[GLOB.gas_data.names[id]]: [round(gas_concentration*100, 0.01)] % ([round(air_contents.get_moles(id), 0.01)] mol)"
+ for(var/id in air_contents.gases)
+ var/gas_concentration = air_contents.gases[id][MOLES]/total_moles
+ message += "[GLOB.gas_data.names[id]]: [round(gas_concentration*100, 0.01)] % ([round(air_contents.gases[id][MOLES], 0.01)] mol)"
message += "Temperature: [round(temperature - T0C,0.01)] °C ([round(temperature, 0.01)] K)"
else
@@ -698,36 +698,36 @@ GENE SCANNER
else
message += "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.gases[/datum/gas/oxygen][MOLES]/total_moles
+ var/n2_concentration = environment.gases[/datum/gas/nitrogen][MOLES]/total_moles
+ var/co2_concentration = environment.gases[/datum/gas/carbon_dioxide][MOLES]/total_moles
+ var/plasma_concentration = environment.gases[/datum/gas/plasma][MOLES]/total_moles
if(abs(n2_concentration - N2STANDARD) < 20)
- message += "Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/nitrogen), 0.01)] mol)"
+ message += "Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/nitrogen][MOLES], 0.01)] mol)"
else
- message += "Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/nitrogen), 0.01)] mol)"
+ message += "Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/nitrogen][MOLES], 0.01)] mol)"
if(abs(o2_concentration - O2STANDARD) < 2)
- message += "Oxygen: [round(o2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/oxygen), 0.01)] mol)"
+ message += "Oxygen: [round(o2_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/oxygen][MOLES], 0.01)] mol)"
else
- message += "Oxygen: [round(o2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/oxygen), 0.01)] mol)"
+ message += "Oxygen: [round(o2_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/oxygen][MOLES], 0.01)] mol)"
if(co2_concentration > 0.01)
- message += "CO2: [round(co2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/carbon_dioxide), 0.01)] mol)"
+ message += "CO2: [round(co2_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/carbon_dioxide][MOLES], 0.01)] mol)"
else
- message += "CO2: [round(co2_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/carbon_dioxide), 0.01)] mol)"
+ message += "CO2: [round(co2_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/carbon_dioxide][MOLES], 0.01)] mol)"
if(plasma_concentration > 0.005)
- message += "Plasma: [round(plasma_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/plasma), 0.01)] mol)"
+ message += "Plasma: [round(plasma_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/plasma][MOLES], 0.01)] mol)"
else
- message += "Plasma: [round(plasma_concentration*100, 0.01)] % ([round(environment.get_moles(/datum/gas/plasma), 0.01)] mol)"
+ message += "Plasma: [round(plasma_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/plasma][MOLES], 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
- message += "[GLOB.gas_data.names[id]]: [round(gas_concentration*100, 0.01)] % ([round(environment.get_moles(id), 0.01)] mol)"
+ var/gas_concentration = environment.gases[id][MOLES]/total_moles
+ message += "[gases[id][GAS_META][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] % ([round(environment.gases[id][MOLES], 0.01)] mol)"
message += "Temperature: [round(environment.return_temperature()-T0C, 0.01)] °C ([round(environment.return_temperature(), 0.01)] K)"
to_chat(user, EXAMINE_BLOCK(jointext(message, "\n")))
diff --git a/code/game/objects/items/tanks/jetpack.dm b/code/game/objects/items/tanks/jetpack.dm
index 7c41df1ceb68e..eee7f182b07c3 100644
--- a/code/game/objects/items/tanks/jetpack.dm
+++ b/code/game/objects/items/tanks/jetpack.dm
@@ -350,12 +350,12 @@
// Also produces no waste products (CO2/Trit)
var/oxygen_burn_rate = (OXYGEN_BURN_RATE_BASE - 1)
var/plasma_burn_rate = 0
- if(air_contents.get_moles(/datum/gas/oxygen) > air_contents.get_moles(/datum/gas/plasma)*PLASMA_OXYGEN_FULLBURN)
- plasma_burn_rate = air_contents.get_moles(/datum/gas/plasma)/PLASMA_BURN_RATE_DELTA
+ if(air_contents.gases[/datum/gas/oxygen][MOLES] > air_contents.gases[/datum/gas/plasma][MOLES]*PLASMA_OXYGEN_FULLBURN)
+ plasma_burn_rate = air_contents.gases[/datum/gas/plasma][MOLES]/PLASMA_BURN_RATE_DELTA
else
- plasma_burn_rate = (air_contents.get_moles(/datum/gas/oxygen)/PLASMA_OXYGEN_FULLBURN)/PLASMA_BURN_RATE_DELTA
+ plasma_burn_rate = (air_contents.gases[/datum/gas/oxygen][MOLES]/PLASMA_OXYGEN_FULLBURN)/PLASMA_BURN_RATE_DELTA
if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY)
- plasma_burn_rate = min(plasma_burn_rate,air_contents.get_moles(/datum/gas/plasma),air_contents.get_moles(/datum/gas/oxygen)/oxygen_burn_rate) //Ensures matter is conserved properly
+ plasma_burn_rate = min(plasma_burn_rate,air_contents.gases[/datum/gas/plasma][MOLES],air_contents.gases[/datum/gas/oxygen][MOLES]/oxygen_burn_rate) //Ensures matter is conserved properly
potential_energy = FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate)
// Normalize thrust volume to joules
@@ -369,8 +369,8 @@
// Consume
if(use_fuel)
- air_contents.set_moles(/datum/gas/plasma, QUANTIZE(air_contents.get_moles(/datum/gas/plasma) - plasma_burn_rate))
- air_contents.set_moles(/datum/gas/oxygen, QUANTIZE(air_contents.get_moles(/datum/gas/oxygen) - (plasma_burn_rate * oxygen_burn_rate)))
+ air_contents.set_moles(/datum/gas/plasma, QUANTIZE(air_contents.gases[/datum/gas/plasma][MOLES] - plasma_burn_rate))
+ air_contents.set_moles(/datum/gas/oxygen, QUANTIZE(air_contents.gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate)))
update_fade(15)
update_lifespan(4)
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index a3cd6f94279fb..f1c1205ae30b6 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -284,10 +284,10 @@
/turf/open/rad_act(pulse_strength)
. = ..()
- if (air.get_moles(/datum/gas/carbon_dioxide) && air.get_moles(/datum/gas/oxygen))
- 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/1000),0))
- air.set_moles(/datum/gas/oxygen, max(air.get_moles(/datum/gas/oxygen)-(pulse_strength/2000),0))
+ if (air.gases[/datum/gas/carbon_dioxide][MOLES] && air.gases[/datum/gas/oxygen][MOLES])
+ pulse_strength = min(pulse_strength,air.gases[/datum/gas/carbon_dioxide][MOLES]*1000,air.gases[/datum/gas/oxygen][MOLES]*2000) //Ensures matter is conserved properly
+ air.set_moles(/datum/gas/carbon_dioxide, max(air.gases[/datum/gas/carbon_dioxide][MOLES]-(pulse_strength/1000),0))
+ air.set_moles(/datum/gas/oxygen, max(air.gases[/datum/gas/oxygen][MOLES]-(pulse_strength/2000),0))
air.adjust_moles(GAS_PLUOXIUM, pulse_strength/4000)
/turf/open/proc/break_tile(force, allow_base)
diff --git a/code/modules/atmospherics/auxgm/breathing_classes.dm b/code/modules/atmospherics/auxgm/breathing_classes.dm
index e9d4c13e38fe3..9ff70ed1e2863 100644
--- a/code/modules/atmospherics/auxgm/breathing_classes.dm
+++ b/code/modules/atmospherics/auxgm/breathing_classes.dm
@@ -17,7 +17,7 @@
/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]
+ mol += breath.gases[gas][MOLES] * gases[gas]
return (mol/breath.total_moles()) * breath.return_pressure()
/datum/breathing_class/oxygen
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index fa8773136d295..f108d27478c69 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -105,14 +105,14 @@
var/burned_fuel = 0
- burned_fuel = max(0,0.00002*(temperature-(0.00001*(temperature**2))))*air.get_moles(/datum/gas/nitrous_oxide)
- air.set_moles(/datum/gas/nitrous_oxide, air.get_moles(/datum/gas/nitrous_oxide) - burned_fuel)
+ burned_fuel = max(0,0.00002*(temperature-(0.00001*(temperature**2))))*air.gases[/datum/gas/nitrous_oxide][MOLES]
+ air.set_moles(/datum/gas/nitrous_oxide, air.gases[/datum/gas/nitrous_oxide][MOLES] - burned_fuel)
if(burned_fuel)
energy_released += (N2O_DECOMPOSITION_ENERGY_RELEASED * burned_fuel)
- air.set_moles(/datum/gas/oxygen, air.get_moles(/datum/gas/oxygen) + burned_fuel/2)
- air.set_moles(/datum/gas/nitrogen, air.get_moles(/datum/gas/nitrogen) + burned_fuel)
+ air.set_moles(/datum/gas/oxygen, air.gases[/datum/gas/oxygen][MOLES] + burned_fuel/2)
+ air.set_moles(/datum/gas/nitrogen, air.gases[/datum/gas/nitrogen][MOLES] + burned_fuel)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
@@ -149,15 +149,15 @@
cached_results["fire"] = 0
var/turf/open/location = isturf(holder) ? holder : null
var/burned_fuel = 0
- var/initial_trit = air.get_moles(/datum/gas/tritium)// Yogs
- if(air.get_moles(/datum/gas/oxygen) < initial_trit || MINIMUM_TRIT_OXYBURN_ENERGY > (temperature * old_heat_capacity))// Yogs -- Maybe a tiny performance boost? I'unno
- burned_fuel = air.get_moles(/datum/gas/oxygen)/TRITIUM_BURN_OXY_FACTOR
+ var/initial_trit = air.gases[/datum/gas/tritium][MOLES]// Yogs
+ if(air.gases[/datum/gas/oxygen][MOLES] < initial_trit || MINIMUM_TRIT_OXYBURN_ENERGY > (temperature * old_heat_capacity))// Yogs -- Maybe a tiny performance boost? I'unno
+ burned_fuel = air.gases[/datum/gas/oxygen][MOLES]/TRITIUM_BURN_OXY_FACTOR
if(burned_fuel > initial_trit) burned_fuel = initial_trit //Yogs -- prevents negative moles of Tritium
air.adjust_moles(/datum/gas/tritium, -burned_fuel)
else
burned_fuel = initial_trit // Yogs -- Conservation of Mass fix
- air.set_moles(/datum/gas/tritium, air.get_moles(/datum/gas/tritium) * (1 - 1/TRITIUM_BURN_TRIT_FACTOR)) // Yogs -- Maybe a tiny performance boost? I'unno
- air.adjust_moles(/datum/gas/oxygen, -air.get_moles(/datum/gas/tritium))
+ air.set_moles(/datum/gas/tritium, air.gases[/datum/gas/tritium][MOLES] * (1 - 1/TRITIUM_BURN_TRIT_FACTOR)) // Yogs -- Maybe a tiny performance boost? I'unno
+ air.adjust_moles(/datum/gas/oxygen, -air.gases[/datum/gas/tritium][MOLES])
energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel * (TRITIUM_BURN_TRIT_FACTOR - 1)) // Yogs -- Fixes low-energy tritium fires
if(burned_fuel)
@@ -218,17 +218,17 @@
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(air.gases[/datum/gas/oxygen][MOLES] / air.gases[/datum/gas/plasma][MOLES] > 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(air.gases[/datum/gas/oxygen][MOLES] > air.gases[/datum/gas/plasma][MOLES]*PLASMA_OXYGEN_FULLBURN)
+ plasma_burn_rate = (air.gases[/datum/gas/plasma][MOLES]*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*(air.gases[/datum/gas/oxygen][MOLES]/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,air.gases[/datum/gas/plasma][MOLES],air.gases[/datum/gas/oxygen][MOLES]/oxygen_burn_rate) //Ensures matter is conserved properly
+ air.set_moles(/datum/gas/plasma, QUANTIZE(air.gases[/datum/gas/plasma][MOLES] - plasma_burn_rate))
+ air.set_moles(/datum/gas/oxygen, QUANTIZE(air.gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate)))
if (super_saturation)
air.adjust_moles(/datum/gas/tritium, plasma_burn_rate)
else
@@ -290,13 +290,13 @@
var/oxidation_temp = oxidation_temps[G]
if(oxidation_temp && oxidation_temp > temperature)
var/temperature_scale = max(0, 1-(temperature / oxidation_temp))
- var/amt = air.get_moles(G) * temperature_scale
+ var/amt = air.gases[G][MOLES] * temperature_scale
oxidizers[G] = amt
oxidation_power += amt * oxidation_rates[G]
else
var/fuel_temp = fuel_temps[G]
if(fuel_temp && fuel_temp > temperature)
- var/amt = (air.get_moles(G) / fuel_rates[G]) * max(0, 1-(temperature / fuel_temp))
+ var/amt = (air.gases[G][MOLES] / fuel_rates[G]) * max(0, 1-(temperature / fuel_temp))
fuels[G] = amt // we have to calculate the actual amount we're using after we get all oxidation together
total_fuel += amt
if(oxidation_power <= 0 || total_fuel <= 0)
@@ -358,8 +358,8 @@
var/list/cached_scan_results = air.analyzer_results
var/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.gases[/datum/gas/plasma][MOLES]
+ var/initial_carbon = air.gases[/datum/gas/carbon_dioxide][MOLES]
var/scale_factor = max(air.return_volume() / FUSION_SCALE_DIVISOR, FUSION_MINIMAL_SCALE)
var/temperature_scale = log(10, air.return_temperature())
//The size of the phase space hypertorus
@@ -369,7 +369,7 @@
: 4 ** (temperature_scale-FUSION_BASE_TEMPSCALE) / FUSION_SLOPE_DIVISOR)
var/gas_power = 0
for (var/gas_id in air.get_gases())
- gas_power += (GLOB.gas_data.fusion_powers[gas_id]*air.get_moles(gas_id))
+ gas_power += (GLOB.gas_data.fusion_powers[gas_id]*air.gases[gas_id][MOLES])
var/instability = MODULUS((gas_power*INSTABILITY_GAS_POWER_FACTOR),toroidal_size) //Instability effects how chaotic the behavior of the reaction is
cached_scan_results[id] = instability//used for analyzer feedback
@@ -382,7 +382,7 @@
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 = min(initial_plasma - air.get_moles(/datum/gas/plasma), toroidal_size * scale_factor * 1.5)
+ var/delta_plasma = min(initial_plasma - air.gases[/datum/gas/plasma][MOLES], toroidal_size * scale_factor * 1.5)
//Energy is gained or lost corresponding to the creation or destruction of mass.
//Low instability prevents endothermality while higher instability acutally encourages it.
@@ -411,7 +411,7 @@
if(reaction_energy)
if(location)
- var/standard_energy = 400 * air.get_moles(/datum/gas/plasma) * air.return_temperature() //Prevents putting meaningless waste gases to achieve high rads.
+ var/standard_energy = 400 * air.gases[/datum/gas/plasma][MOLES] * air.return_temperature() //Prevents putting meaningless waste gases to achieve high rads.
if(prob(PERCENT(((PARTICLE_CHANCE_CONSTANT)/(reaction_energy-PARTICLE_CHANCE_CONSTANT)) + 1))) //Asymptopically approaches 100% as the energy of the reaction goes up.
location.fire_nuclear_particle(customize = TRUE, custompower = standard_energy)
radiation_pulse(location, max(2000 * 3 ** (log(10,standard_energy) - FUSION_RAD_MIDPOINT), 0))
@@ -442,9 +442,9 @@
var/temperature = air.return_temperature()
var/old_heat_capacity = air.heat_capacity()
- var/heat_efficency = min(temperature/(FIRE_MINIMUM_TEMPERATURE_TO_EXIST*60),air.get_moles(/datum/gas/oxygen),air.get_moles(/datum/gas/nitrogen))
+ var/heat_efficency = min(temperature/(FIRE_MINIMUM_TEMPERATURE_TO_EXIST*60),air.gases[/datum/gas/oxygen][MOLES],air.gases[/datum/gas/nitrogen][MOLES])
var/energy_used = heat_efficency*NITRYL_FORMATION_ENERGY
- if ((air.get_moles(/datum/gas/oxygen) - heat_efficency < 0 )|| (air.get_moles(/datum/gas/nitrogen) - heat_efficency < 0)) //Shouldn't produce gas from nothing.
+ if ((air.gases[/datum/gas/oxygen][MOLES] - heat_efficency < 0 )|| (air.gases[/datum/gas/nitrogen][MOLES] - heat_efficency < 0)) //Shouldn't produce gas from nothing.
return NO_REACTION
air.adjust_moles(/datum/gas/oxygen, -heat_efficency)
air.adjust_moles(/datum/gas/nitrogen, -heat_efficency)
@@ -472,12 +472,12 @@
var/temperature = air.return_temperature()
var/pressure = air.return_pressure()
var/old_heat_capacity = air.heat_capacity()
- var/reaction_efficency = min(1/((pressure/(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/reaction_efficency = min(1/((pressure/(0.5*ONE_ATMOSPHERE))*(max(air.gases[/datum/gas/plasma][MOLES]/air.gases[/datum/gas/nitrous_oxide][MOLES],1))),air.gases[/datum/gas/nitrous_oxide][MOLES],air.gases[/datum/gas/plasma][MOLES]/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 ((air.gases[/datum/gas/nitrous_oxide][MOLES] - reaction_efficency < 0 )|| (air.gases[/datum/gas/plasma][MOLES] - (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))
+ if(reaction_efficency == air.gases[/datum/gas/nitrous_oxide][MOLES])
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)
@@ -508,10 +508,10 @@
/datum/gas_reaction/stimformation/react(datum/gas_mixture/air)
var/old_heat_capacity = air.heat_capacity()
- var/heat_scale = min(air.return_temperature()/STIMULUM_HEAT_SCALE,air.get_moles(/datum/gas/plasma),air.get_moles(/datum/gas/nitryl))
+ var/heat_scale = min(air.return_temperature()/STIMULUM_HEAT_SCALE,air.gases[/datum/gas/plasma][MOLES],air.gases[/datum/gas/nitryl][MOLES])
var/stim_energy_change = heat_scale + STIMULUM_FIRST_RISE*(heat_scale**2) - STIMULUM_FIRST_DROP*(heat_scale**3) + STIMULUM_SECOND_RISE*(heat_scale**4) - STIMULUM_ABSOLUTE_DROP*(heat_scale**5)
- if ((air.get_moles(/datum/gas/plasma) - heat_scale < 0) || (air.get_moles(/datum/gas/nitryl) - heat_scale < 0) || (air.get_moles(/datum/gas/tritium) - heat_scale < 0)) //Shouldn't produce gas from nothing.
+ if ((air.gases[/datum/gas/plasma][MOLES] - heat_scale < 0) || (air.gases[/datum/gas/nitryl][MOLES] - heat_scale < 0) || (air.gases[/datum/gas/tritium][MOLES] - heat_scale < 0)) //Shouldn't produce gas from nothing.
return NO_REACTION
air.adjust_moles(/datum/gas/stimulum, heat_scale/10)
air.adjust_moles(/datum/gas/plasma, -heat_scale)
@@ -538,9 +538,9 @@
/datum/gas_reaction/nobliumformation/react(datum/gas_mixture/air)
var/old_heat_capacity = air.heat_capacity()
- var/nob_formed = min((air.get_moles(/datum/gas/nitrogen)+air.get_moles(/datum/gas/tritium))/100,air.get_moles(/datum/gas/tritium)/10,air.get_moles(/datum/gas/nitrogen)/20)
- var/energy_taken = nob_formed*(NOBLIUM_FORMATION_ENERGY/(max(air.get_moles(/datum/gas/bz),1)))
- if ((air.get_moles(/datum/gas/tritium) - 10*nob_formed < 0) || (air.get_moles(/datum/gas/nitrogen) - 20*nob_formed < 0))
+ var/nob_formed = min((air.gases[/datum/gas/nitrogen][MOLES]+air.gases[/datum/gas/tritium][MOLES])/100,air.gases[/datum/gas/tritium][MOLES]/10,air.gases[/datum/gas/nitrogen][MOLES]/20)
+ var/energy_taken = nob_formed*(NOBLIUM_FORMATION_ENERGY/(max(air.gases[/datum/gas/bz][MOLES],1)))
+ if ((air.gases[/datum/gas/tritium][MOLES] - 10*nob_formed < 0) || (air.gases[/datum/gas/nitrogen][MOLES] - 20*nob_formed < 0))
return NO_REACTION
air.adjust_moles(/datum/gas/tritium, -10*nob_formed)
air.adjust_moles(/datum/gas/nitrogen, -20*nob_formed)
@@ -575,16 +575,16 @@
location = get_turf(pick(pipenet.members))
else
location = get_turf(holder)
- var/ball_shot_angle = 180*cos(air.get_moles(/datum/gas/water_vapor)/air.get_moles(/datum/gas/nitryl))+180
- var/stim_used = min(STIM_BALL_GAS_AMOUNT/air.get_moles(/datum/gas/plasma),air.get_moles(/datum/gas/stimulum))
- var/pluox_used = min(STIM_BALL_GAS_AMOUNT/air.get_moles(/datum/gas/plasma),air.get_moles(GAS_PLUOXIUM))
+ var/ball_shot_angle = 180*cos(air.gases[/datum/gas/water_vapor][MOLES]/air.gases[/datum/gas/nitryl][MOLES])+180
+ var/stim_used = min(STIM_BALL_GAS_AMOUNT/air.gases[/datum/gas/plasma][MOLES],air.gases[/datum/gas/stimulum][MOLES])
+ var/pluox_used = min(STIM_BALL_GAS_AMOUNT/air.gases[/datum/gas/plasma][MOLES],air.gases[GAS_PLUOXIUM][MOLES])
var/energy_released = stim_used*STIMULUM_HEAT_SCALE//Stimulum has a lot of stored energy, and breaking it up releases some of it
location.fire_nuclear_particle(ball_shot_angle)
air.adjust_moles(/datum/gas/carbon_dioxide, 4*pluox_used)
air.adjust_moles(/datum/gas/nitrogen, 8*stim_used)
air.adjust_moles(GAS_PLUOXIUM, -pluox_used)
air.adjust_moles(/datum/gas/stimulum, -stim_used)
- air.adjust_moles(/datum/gas/plasma, max(-air.get_moles(/datum/gas/plasma)/2,-30))
+ air.adjust_moles(/datum/gas/plasma, max(-air.gases[/datum/gas/plasma][MOLES]/2,-30))
if(energy_released)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm
index c9827ac580a7d..af942501eee53 100644
--- a/code/modules/atmospherics/machinery/airalarm.dm
+++ b/code/modules/atmospherics/machinery/airalarm.dm
@@ -294,9 +294,9 @@
cur_tlv = TLV[gas_id]
data["environment_data"] += list(list(
"name" = GLOB.gas_data.names[gas_id],
- "value" = environment.get_moles(gas_id) / total_moles * 100,
+ "value" = environment.gases[gas_id][MOLES] / total_moles * 100,
"unit" = "%",
- "danger_level" = cur_tlv.get_danger_level(environment.get_moles(gas_id) * partial_pressure)
+ "danger_level" = cur_tlv.get_danger_level(environment.gases[gas_id][MOLES] * partial_pressure)
))
if(!locked || user.has_unlimited_silicon_privilege)
@@ -668,7 +668,7 @@
if(!(gas_id in TLV)) // We're not interested in this gas, it seems.
continue
cur_tlv = TLV[gas_id]
- gas_dangerlevel = max(gas_dangerlevel, cur_tlv.get_danger_level(environment.get_moles(gas_id) * partial_pressure))
+ gas_dangerlevel = max(gas_dangerlevel, cur_tlv.get_danger_level(environment.gases[gas_id][MOLES] * partial_pressure))
var/old_danger_level = danger_level
danger_level = max(pressure_dangerlevel, temperature_dangerlevel, gas_dangerlevel)
@@ -923,7 +923,7 @@
pressure.set_output(round(environment.return_pressure()))
temperature.set_output(round(environment.return_temperature()))
if(ispath(options_map[current_option]))
- gas_amount.set_output(round(environment.get_moles(current_option)))
+ gas_amount.set_output(round(environment.gases[current_option][MOLES]))
return
var/datum/tlv/settings = connected_alarm.TLV[options_map[current_option]]
diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm
index 144befee74863..f4fae2e328689 100644
--- a/code/modules/atmospherics/machinery/portable/canister.dm
+++ b/code/modules/atmospherics/machinery/portable/canister.dm
@@ -103,8 +103,8 @@
for(var/id in attached_can.air_contents.get_gases())
if(!(GLOB.gas_data.flags[id] & GAS_FLAG_DANGEROUS))
continue
- if(attached_can.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]] = attached_can.air_contents.get_moles(id) //ex. "plasma" = 20
+ if(attached_can.air_contents.gases[id][MOLES] > (GLOB.gas_data.visibility[id] || MOLES_GAS_VISIBLE)) //if moles_visible is undefined, default to default visibility
+ danger[GLOB.gas_data.names[id]] = attached_can.air_contents.gases[id][MOLES] //ex. "plasma" = 20
if(danger.len && attached_can.valve_open)
message_admins("[parent.get_creator_admin()]'s circuit opened a canister that contains the following at [ADMIN_VERBOSEJMP(attached_can)]:")
@@ -536,8 +536,8 @@
for(var/id in air_contents.get_gases())
if(!(GLOB.gas_data.flags[id] & GAS_FLAG_DANGEROUS))
continue
- 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(air_contents.gases[id][MOLES] > (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.gases[id][MOLES] //ex. "plasma" = 20
if(danger.len && user)
message_admins("[ADMIN_LOOKUPFLW(user)] opened a canister that contains the following at [ADMIN_VERBOSEJMP(src)]:")
diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm
index 879d49010bf47..d8e20de5056d2 100644
--- a/code/modules/atmospherics/machinery/portable/pump.dm
+++ b/code/modules/atmospherics/machinery/portable/pump.dm
@@ -178,8 +178,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.gases[/datum/gas/plasma][MOLES]
+ var/n2o = air_contents.gases[/datum/gas/nitrous_oxide][MOLES]
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/cargo/bounties/engineering.dm b/code/modules/cargo/bounties/engineering.dm
index b7026207c373d..6459916a755be 100644
--- a/code/modules/cargo/bounties/engineering.dm
+++ b/code/modules/cargo/bounties/engineering.dm
@@ -10,7 +10,7 @@
if(!..())
return FALSE
var/obj/item/tank/T = O
- return T.air_contents.get_moles(gas_type) >= moles_required
+ return T.air_contents.gases[gas_type][MOLES] >= moles_required
/datum/bounty/item/engineering/gas/nitryl_tank
name = "Full Tank of Nitryl"
diff --git a/code/modules/cargo/exports/large_objects.dm b/code/modules/cargo/exports/large_objects.dm
index 2da9b461cbf65..d3b58f71555dd 100644
--- a/code/modules/cargo/exports/large_objects.dm
+++ b/code/modules/cargo/exports/large_objects.dm
@@ -130,9 +130,9 @@
var/obj/machinery/portable_atmospherics/canister/C = O
var/worth = 10
- worth += C.air_contents.get_moles(/datum/gas/bz)*4
- worth += C.air_contents.get_moles(/datum/gas/stimulum)*100
- worth += C.air_contents.get_moles(GAS_HYPERNOB)*1000
- worth += C.air_contents.get_moles(/datum/gas/tritium)*5
- worth += C.air_contents.get_moles(GAS_PLUOXIUM)*5
+ worth += C.air_contents.gases[/datum/gas/bz][MOLES]*4
+ worth += C.air_contents.gases[/datum/gas/stimulum][MOLES]*100
+ worth += C.air_contents.gases[GAS_HYPERNOB][MOLES]*1000
+ worth += C.air_contents.gases[/datum/gas/tritium][MOLES]*5
+ worth += C.air_contents.gases[GAS_PLUOXIUM][MOLES]*5
return worth
diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm
index 5e37198f32d2e..8bd50075b8db4 100644
--- a/code/modules/events/spacevine.dm
+++ b/code/modules/events/spacevine.dm
@@ -217,7 +217,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(/datum/gas/oxygen, max(GM.gases[/datum/gas/oxygen][MOLES] - severity * holder.energy, 0))
/datum/spacevine_mutation/nitro_eater
name = "nitrogen consuming"
@@ -229,7 +229,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(/datum/gas/nitrogen, max(GM.gases[/datum/gas/nitrogen][MOLES] - severity * holder.energy, 0))
/datum/spacevine_mutation/carbondioxide_eater
name = "CO2 consuming"
@@ -241,7 +241,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(/datum/gas/carbon_dioxide, max(GM.gases[/datum/gas/carbon_dioxide][MOLES] - severity * holder.energy, 0))
/datum/spacevine_mutation/plasma_eater
name = "toxins consuming"
@@ -253,7 +253,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(/datum/gas/plasma, max(GM.gases[/datum/gas/plasma][MOLES] - severity * holder.energy, 0))
/datum/spacevine_mutation/thorns
name = "thorny"
diff --git a/code/modules/hydroponics/grown/towercap.dm b/code/modules/hydroponics/grown/towercap.dm
index 1b779646c6c0a..51ebe224ce92d 100644
--- a/code/modules/hydroponics/grown/towercap.dm
+++ b/code/modules/hydroponics/grown/towercap.dm
@@ -245,7 +245,7 @@
if(isopenturf(loc))
var/turf/open/O = loc
if(O.air)
- if(O.air.get_moles(/datum/gas/oxygen) > 13)
+ if(O.air.gases[/datum/gas/oxygen][MOLES] > 13)
return TRUE
return FALSE
diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm
index df45775fac7e6..3bb4dc553cb8e 100644
--- a/code/modules/mob/living/carbon/alien/life.dm
+++ b/code/modules/mob/living/carbon/alien/life.dm
@@ -15,13 +15,13 @@
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.gases[/datum/gas/plasma][MOLES]/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.gases[/datum/gas/plasma][MOLES]*250)
throw_alert("alien_tox", /atom/movable/screen/alert/alien_tox)
- toxins_used = breath.get_moles(/datum/gas/plasma)
+ toxins_used = breath.gases[/datum/gas/plasma][MOLES]
else
clear_alert("alien_tox")
diff --git a/code/modules/mob/living/carbon/human/species_types/oozelings.dm b/code/modules/mob/living/carbon/human/species_types/oozelings.dm
index ef3fa67be015e..267355dfa1c90 100644
--- a/code/modules/mob/living/carbon/human/species_types/oozelings.dm
+++ b/code/modules/mob/living/carbon/human/species_types/oozelings.dm
@@ -88,11 +88,11 @@
if(!atmos_sealed)
var/datum/gas_mixture/environment = H.loc.return_air()
if(environment?.total_moles())
- if(environment.get_moles(/datum/gas/water_vapor) >= 1)
+ if(environment.gases[/datum/gas/water_vapor][MOLES] >= 1)
H.blood_volume -= 15
if(prob(50))
to_chat(H, "Your ooze melts away rapidly in the water vapor!")
- if(H.blood_volume <= 672 && environment.get_moles(/datum/gas/plasma) >= 1)
+ if(H.blood_volume <= 672 && environment.gases[/datum/gas/plasma][MOLES] >= 1)
H.blood_volume += 15
if(H.blood_volume < BLOOD_VOLUME_OKAY && prob(5))
to_chat(H, "You feel drained!")
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 7226068ce0cb4..f2ebbb4d9511d 100644
--- a/code/modules/mob/living/carbon/human/species_types/plasmamen.dm
+++ b/code/modules/mob/living/carbon/human/species_types/plasmamen.dm
@@ -54,7 +54,7 @@
var/datum/gas_mixture/environment = H.loc.return_air()
if(environment)
if(environment.total_moles())
- if(environment.get_moles(/datum/gas/oxygen) >= 1) //Same threshold that extinguishes fire
+ if(environment.gases[/datum/gas/oxygen][MOLES] >= 1) //Same threshold that extinguishes fire
H.adjust_fire_stacks(0.5)
if(!H.on_fire && H.fire_stacks > 0)
H.visible_message("[H]'s body reacts with the atmosphere and bursts into flames!","Your body reacts with the atmosphere and bursts into flame!")
diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm
index 41c48c0bb804c..d1d2824c8f55c 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -183,9 +183,9 @@
var/oxygen_used = 0
var/moles = breath.total_moles()
var/breath_pressure = (moles*R_IDEAL_GAS_EQUATION*breath.return_temperature())/BREATH_VOLUME
- var/O2_partialpressure = ((breath.get_moles(/datum/gas/oxygen)/moles)*breath_pressure) + (((breath.get_moles(GAS_PLUOXIUM)*8)/moles)*breath_pressure)
- var/Toxins_partialpressure = (breath.get_moles(/datum/gas/plasma)/moles)*breath_pressure
- var/CO2_partialpressure = (breath.get_moles(/datum/gas/carbon_dioxide)/moles)*breath_pressure
+ var/O2_partialpressure = ((breath.gases[/datum/gas/oxygen][MOLES]/moles)*breath_pressure) + (((breath.gases[GAS_PLUOXIUM][MOLES]*8)/moles)*breath_pressure)
+ var/Toxins_partialpressure = (breath.gases[/datum/gas/plasma][MOLES]/moles)*breath_pressure
+ var/CO2_partialpressure = (breath.gases[/datum/gas/carbon_dioxide][MOLES]/moles)*breath_pressure
//OXYGEN
@@ -196,7 +196,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.gases[/datum/gas/oxygen][MOLES]*ratio
else
adjustOxyLoss(3)
failed_last_breath = 1
@@ -206,7 +206,7 @@
failed_last_breath = 0
if(health >= crit_threshold)
adjustOxyLoss(-5)
- oxygen_used = breath.get_moles(/datum/gas/oxygen)
+ oxygen_used = breath.gases[/datum/gas/oxygen][MOLES]
clear_alert("not_enough_oxy")
breath.adjust_moles(/datum/gas/oxygen, -oxygen_used)
@@ -229,15 +229,15 @@
//TOXINS/PLASMA
if(Toxins_partialpressure > safe_tox_max)
- var/ratio = (breath.get_moles(/datum/gas/plasma)/safe_tox_max) * 10
+ var/ratio = (breath.gases[/datum/gas/plasma][MOLES]/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.gases[/datum/gas/nitrous_oxide][MOLES])
+ var/SA_partialpressure = (breath.gases[/datum/gas/nitrous_oxide][MOLES]/breath.total_moles())*breath_pressure
if(SA_partialpressure > SA_para_min)
Unconscious(60)
if(SA_partialpressure > SA_sleep_min)
@@ -250,21 +250,21 @@
SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "chemical_euphoria")
//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.gases[/datum/gas/bz][MOLES])
+ var/bz_partialpressure = (breath.gases[/datum/gas/bz][MOLES]/breath.total_moles())*breath_pressure
if(bz_partialpressure > 1)
hallucination += 10
else if(bz_partialpressure > 0.01)
hallucination += 5
//TRITIUM
- if(breath.get_moles(/datum/gas/tritium))
- var/tritium_partialpressure = (breath.get_moles(/datum/gas/tritium)/breath.total_moles())*breath_pressure
+ if(breath.gases[/datum/gas/tritium][MOLES])
+ var/tritium_partialpressure = (breath.gases[/datum/gas/tritium][MOLES]/breath.total_moles())*breath_pressure
radiation += tritium_partialpressure/10
//NITRYL
- if(breath.get_moles(/datum/gas/nitryl))
- var/nitryl_partialpressure = (breath.get_moles(/datum/gas/nitryl)/breath.total_moles())*breath_pressure
+ if(breath.gases[/datum/gas/nitryl][MOLES])
+ var/nitryl_partialpressure = (breath.gases[/datum/gas/nitryl][MOLES]/breath.total_moles())*breath_pressure
adjustFireLoss(nitryl_partialpressure/4)
//BREATH TEMPERATURE
diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm
index 306ad87a7f605..74f625c5c0ef8 100644
--- a/code/modules/mob/living/life.dm
+++ b/code/modules/mob/living/life.dm
@@ -96,7 +96,7 @@
ExtinguishMob()
return TRUE //mob was put out, on_fire = FALSE via ExtinguishMob(), no need to update everything down the chain.
var/datum/gas_mixture/G = loc.return_air() // Check if we're standing in an oxygenless environment
- if(G.get_moles(/datum/gas/oxygen) < 1)
+ if(G.gases[/datum/gas/oxygen][MOLES] < 1)
ExtinguishMob() //If there's no oxygen in the tile we're on, put out the fire
return TRUE
var/turf/location = get_turf(src)
diff --git a/code/modules/mob/living/simple_animal/bot/atmosbot.dm b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
index bf8422a00b23a..adb685e584c92 100644
--- a/code/modules/mob/living/simple_animal/bot/atmosbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
@@ -229,7 +229,7 @@
var/datum/gas_mixture/environment = T.return_air()
for(var/G in gasses)
if(gasses[G])
- var/moles_in_atmos = environment.get_moles(G)
+ var/moles_in_atmos = environment.gases[G][MOLES]
environment.adjust_moles(G, -min(moles_in_atmos, ATMOSBOT_MAX_SCRUB_CHANGE))
/mob/living/simple_animal/bot/atmosbot/proc/deploy_holobarrier()
@@ -247,11 +247,11 @@
//Toxins in the air
if(emagged != 2)
for(var/G in gasses)
- if(gasses[G] && gas_mix.get_moles(G) > 0.2)
+ if(gasses[G] && gas_mix.gases[G][MOLES] > 0.2)
return ATMOSBOT_HIGH_TOXINS
//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.gases[/datum/gas/oxygen][MOLES] * partial_pressure
if(oxygen_moles < 20 || gas_mix.return_pressure() < WARNING_LOW_PRESSURE)
return ATMOSBOT_LOW_OXYGEN
//Check temperature
diff --git a/code/modules/mob/living/simple_animal/hostile/tree.dm b/code/modules/mob/living/simple_animal/hostile/tree.dm
index a7754183eba78..3ba55078d1f6e 100644
--- a/code/modules/mob/living/simple_animal/hostile/tree.dm
+++ b/code/modules/mob/living/simple_animal/hostile/tree.dm
@@ -47,7 +47,7 @@
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.gases[/datum/gas/carbon_dioxide][MOLES]
if(co2 > 0)
if(prob(25))
var/amt = min(co2, 9)
diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm
index 7c7d0505adb97..38ea2741db5bf 100644
--- a/code/modules/mob/living/simple_animal/simple_animal.dm
+++ b/code/modules/mob/living/simple_animal/simple_animal.dm
@@ -235,10 +235,10 @@
if(isturf(loc) && isopenturf(loc))
var/turf/open/ST = 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.gases[/datum/gas/plasma][MOLES]
+ var/oxy = ST.air.gases[/datum/gas/oxygen][MOLES]
+ var/n2 = ST.air.gases[/datum/gas/nitrogen][MOLES]
+ var/co2 = ST.air.gases[/datum/gas/carbon_dioxide][MOLES]
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 92418478c23bf..64eb1e5d403cd 100644
--- a/code/modules/mob/living/simple_animal/slime/life.dm
+++ b/code/modules/mob/living/simple_animal/slime/life.dm
@@ -94,11 +94,11 @@
adjustBruteLoss(round(sqrt(bodytemperature)) * 2)
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.gases[/datum/gas/bz][MOLES] / environment.total_moles()) : 0
var/stasis = (bz_percentage >= 0.05 && bodytemperature < (T0C + 100)) || force_stasis
if(transformeffects & SLIME_EFFECT_DARK_PURPLE)
var/amt = is_adult ? 30 : 15
- var/plas_amt = min(amt,environment.get_moles(/datum/gas/plasma))
+ var/plas_amt = min(amt,environment.gases[/datum/gas/plasma][MOLES])
environment.adjust_moles(/datum/gas/plasma, -plas_amt)
environment.adjust_moles(/datum/gas/oxygen, plas_amt)
adjustBruteLoss(plas_amt ? -2 : 0)
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index e92f4b0283722..8873e4cd30748 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -139,8 +139,8 @@
var/t = "Coordinates: [x],[y] \n"
t += "Temperature: [environment.return_temperature()] \n"
for(var/id in environment.get_gases())
- if(environment.get_moles(id))
- t+="[GLOB.gas_data.names[id]]: [environment.get_moles(id)] \n"
+ if(environment.gases[id][MOLES])
+ t+="[GLOB.gas_data.names[id]]: [environment.gases[id][MOLES]] \n"
to_chat(usr, t)
diff --git a/code/modules/modular_computers/file_system/programs/atmosscan.dm b/code/modules/modular_computers/file_system/programs/atmosscan.dm
index 10b2f2e7efc7d..c7f6b8fd026bf 100644
--- a/code/modules/modular_computers/file_system/programs/atmosscan.dm
+++ b/code/modules/modular_computers/file_system/programs/atmosscan.dm
@@ -31,7 +31,7 @@
data["AirTempK"] = round(environment.return_temperature())
if (total_moles)
for(var/id in environment.get_gases())
- var/gas_level = environment.get_moles(id)/total_moles
+ var/gas_level = environment.gases[id][MOLES]/total_moles
if(gas_level > 0)
airlist += list(list("name" = "[GLOB.gas_data.names[id]]", "percentage" = round(gas_level*100, 0.01)))
data["AirData"] = airlist
diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm
index 08a5ea1a669e9..f31c3f1b718ad 100644
--- a/code/modules/power/singularity/collector.dm
+++ b/code/modules/power/singularity/collector.dm
@@ -50,21 +50,21 @@
if(!loaded_tank)
return
if(!bitcoinmining)
- if(loaded_tank.air_contents.get_moles(/datum/gas/plasma) < 0.0001)
+ if(loaded_tank.air_contents.gases[/datum/gas/plasma][MOLES] < 0.0001)
investigate_log("out of fuel.", INVESTIGATE_ENGINES)
playsound(src, 'sound/machines/ding.ogg', 50, 1)
var/msg = "Plasma depleted, recommend replacing tank."
radio.talk_into(src, msg, RADIO_CHANNEL_ENGINEERING)
eject()
else
- var/gasdrained = min(powerproduction_drain*drainratio*delta_time,loaded_tank.air_contents.get_moles(/datum/gas/plasma))
+ var/gasdrained = min(powerproduction_drain*drainratio*delta_time,loaded_tank.air_contents.gases[/datum/gas/plasma][MOLES])
loaded_tank.air_contents.adjust_moles(/datum/gas/plasma, -gasdrained)
loaded_tank.air_contents.adjust_moles(/datum/gas/tritium, gasdrained)
var/power_produced = RAD_COLLECTOR_OUTPUT
add_avail(power_produced)
stored_energy-=power_produced
else if(is_station_level(z) && SSresearch.science_tech)
- if(!loaded_tank.air_contents.get_moles(/datum/gas/tritium) || !loaded_tank.air_contents.get_moles(/datum/gas/oxygen))
+ if(!loaded_tank.air_contents.gases[/datum/gas/tritium][MOLES] || !loaded_tank.air_contents.gases[/datum/gas/oxygen][MOLES])
playsound(src, 'sound/machines/ding.ogg', 50, 1)
eject()
else
@@ -86,7 +86,7 @@
toggle_power()
user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \
"You turn the [src.name] [active? "on":"off"].")
- var/fuel = loaded_tank?.air_contents.get_moles(/datum/gas/plasma)
+ var/fuel = loaded_tank?.air_contents.gases[/datum/gas/plasma][MOLES]
investigate_log("turned [active?"on":"off"] by [key_name(user)]. [loaded_tank?"Fuel: [round(fuel/0.29)]%":"It is empty"].", INVESTIGATE_ENGINES)
return
else
diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm
index f03beb86808ae..477745ffb1f70 100644
--- a/code/modules/power/supermatter/supermatter.dm
+++ b/code/modules/power/supermatter/supermatter.dm
@@ -225,7 +225,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
for(var/gasid in air.get_gases())
gasdata.Add(list(list(
"name"= GLOB.gas_data.names[gasid],
- "amount" = round(100*air.get_moles(gasid)/air.total_moles(),0.01))))
+ "amount" = round(100*air.gases[gasid][MOLES]/air.total_moles(),0.01))))
else
for(var/gasid in air.get_gases())
gasdata.Add(list(list(
@@ -457,15 +457,15 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
//Can cause an overestimation of mol count, should stabalize things though.
//Prevents huge bursts of gas/heat when a large amount of something is introduced
//They range between 0 and 1
- plasmacomp += clamp(max(removed.get_moles(/datum/gas/plasma)/combined_gas, 0) - plasmacomp, -1, gas_change_rate)
- o2comp += clamp(max(removed.get_moles(/datum/gas/oxygen)/combined_gas, 0) - o2comp, -1, gas_change_rate)
- co2comp += clamp(max(removed.get_moles(/datum/gas/carbon_dioxide)/combined_gas, 0) - co2comp, -1, gas_change_rate)
- pluoxiumcomp += clamp(max(removed.get_moles(GAS_PLUOXIUM)/combined_gas, 0) - pluoxiumcomp, -1, gas_change_rate)
- tritiumcomp += clamp(max(removed.get_moles(/datum/gas/tritium)/combined_gas, 0) - tritiumcomp, -1, gas_change_rate)
- bzcomp += clamp(max(removed.get_moles(/datum/gas/bz)/combined_gas, 0) - bzcomp, -1, gas_change_rate)
-
- n2ocomp += clamp(max(removed.get_moles(/datum/gas/nitrous_oxide)/combined_gas, 0) - n2ocomp, -1, gas_change_rate)
- n2comp += clamp(max(removed.get_moles(/datum/gas/nitrogen)/combined_gas, 0) - n2comp, -1, gas_change_rate)
+ plasmacomp += clamp(max(removed.gases[/datum/gas/plasma][MOLES]/combined_gas, 0) - plasmacomp, -1, gas_change_rate)
+ o2comp += clamp(max(removed.gases[/datum/gas/oxygen][MOLES]/combined_gas, 0) - o2comp, -1, gas_change_rate)
+ co2comp += clamp(max(removed.gases[/datum/gas/carbon_dioxide][MOLES]/combined_gas, 0) - co2comp, -1, gas_change_rate)
+ pluoxiumcomp += clamp(max(removed.gases[GAS_PLUOXIUM][MOLES]/combined_gas, 0) - pluoxiumcomp, -1, gas_change_rate)
+ tritiumcomp += clamp(max(removed.gases[/datum/gas/tritium][MOLES]/combined_gas, 0) - tritiumcomp, -1, gas_change_rate)
+ bzcomp += clamp(max(removed.gases[/datum/gas/bz][MOLES]/combined_gas, 0) - bzcomp, -1, gas_change_rate)
+
+ n2ocomp += clamp(max(removed.gases[/datum/gas/nitrous_oxide][MOLES]/combined_gas, 0) - n2ocomp, -1, gas_change_rate)
+ n2comp += clamp(max(removed.gases[/datum/gas/nitrogen][MOLES]/combined_gas, 0) - n2comp, -1, gas_change_rate)
gasmix_power_ratio = min(max(plasmacomp + o2comp + co2comp + tritiumcomp + bzcomp - pluoxiumcomp - n2comp, 0), 1)
diff --git a/code/modules/research/xenobiology/crossbreeding/_structures.dm b/code/modules/research/xenobiology/crossbreeding/_structures.dm
index c14aca8e765d8..49b15e02444a7 100644
--- a/code/modules/research/xenobiology/crossbreeding/_structures.dm
+++ b/code/modules/research/xenobiology/crossbreeding/_structures.dm
@@ -236,7 +236,7 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals)
var/turf/open/open_turf = T
var/datum/gas_mixture/air = open_turf.return_air()
- if(air.get_moles(/datum/gas/plasma) > 15)
+ if(air.gases[/datum/gas/plasma][MOLES] > 15)
air.adjust_moles(/datum/gas/plasma, -15)
new /obj/item/stack/sheet/mineral/plasma(open_turf)
diff --git a/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm b/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm
index c226d12f89403..c1d68051a6722 100644
--- a/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm
+++ b/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm
@@ -416,7 +416,7 @@ GLOBAL_LIST_EMPTY(destabliization_exits)
var/datum/gas_mixture/air = T.return_air()
var/input_id = initial(input.id)
var/output_id = initial(output.id)
- var/moles = min(air.get_moles(input_id), 5)
+ var/moles = min(air.gases[input_id][MOLES], 5)
if(moles)
air.adjust_moles(input_id, -moles)
air.adjust_moles(output_id, moles)
diff --git a/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm b/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm
index 6f73a531f3f14..7badedc3369c3 100644
--- a/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm
+++ b/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm
@@ -35,7 +35,7 @@
/obj/machinery/atmospherics/components/unary/plasma_refiner/AltClick(mob/living/user)
var/datum/gas_mixture/air_contents = airs[1]
- var/plasmoles = air_contents.get_moles(/datum/gas/plasma)
+ var/plasmoles = air_contents.gases[/datum/gas/plasma][MOLES]
if(!air_contents)
return
if(plasmoles >= 100)
diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index 18a139742a7dd..ff6f66515f3af 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -157,7 +157,7 @@
#define PP_MOLES(X) ((X / total_moles) * pressure)
- #define PP(air, gas) PP_MOLES(air.get_moles(gas))
+ #define PP(air, gas) PP_MOLES(air.gases[gas][MOLES])
var/gas_breathed = 0
@@ -180,7 +180,7 @@
alert_category = class.low_alert_category
alert_type = class.low_alert_datum
for(var/gas in gases)
- var/moles = breath.get_moles(gas)
+ var/moles = breath.gases[gas][MOLES]
var/multiplier = gases[gas]
mole_adjustments[gas] = (gas in mole_adjustments) ? mole_adjustments[gas] - moles : -moles
required_pp += PP_MOLES(moles) * multiplier
@@ -190,7 +190,7 @@
for(var/product in products)
mole_adjustments[product] = (product in mole_adjustments) ? mole_adjustments[product] + to_add : to_add
else
- required_moles = breath.get_moles(entry)
+ required_moles = breath.gases[entry][MOLES]
required_pp = PP_MOLES(required_moles)
if(entry in breath_alert_info)
var/list/alert = breath_alert_info[entry]["not_enough_alert"]
@@ -243,9 +243,9 @@
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) * R.molarity) // See next line
- H.reagents.add_reagent(R, breath.get_moles(gas) * 2) // 2 represents molarity of O2, we don't have citadel molarity
- mole_adjustments[gas] = (gas in mole_adjustments) ? mole_adjustments[gas] - breath.get_moles(gas) : -breath.get_moles(gas)
+ //H.reagents.add_reagent(R, breath.gases[gas][MOLES] * R.molarity) // See next line
+ H.reagents.add_reagent(R, breath.gases[gas][MOLES] * 2) // 2 represents molarity of O2, we don't have citadel molarity
+ mole_adjustments[gas] = (gas in mole_adjustments) ? mole_adjustments[gas] - breath.gases[gas][MOLES] : -breath.gases[gas][MOLES]
for(var/gas in mole_adjustments)
breath.adjust_moles(gas, mole_adjustments[gas])
diff --git a/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm b/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm
index fc565a78d4bb7..8273559498e7b 100644
--- a/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm
+++ b/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm
@@ -448,7 +448,7 @@
var/datum/gas_mixture/air = T.return_air()
var/input_id = initial(input.id)
var/output_id = initial(output.id)
- var/moles = min(air.get_moles(input_id), 5)
+ var/moles = min(air.gases[input_id][MOLES], 5)
if(moles)
air.adjust_moles(input_id, -moles)
air.adjust_moles(output_id, moles)
From 5aab9cafd9da2b165fa3582b555ac173ef2a3b48 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 15 Jul 2024 15:14:42 +0200
Subject: [PATCH 015/114] goodbye set_moles (thanks chat gee pee tee for the
regex)
---
code/datums/atmosphere/_atmosphere.dm | 3 +-
.../effects/effect_system/effects_foam.dm | 3 +-
.../effects/effect_system/effects_smoke.dm | 3 +-
.../objects/effects/spawners/bombspawner.dm | 6 ++-
code/game/objects/items/chrono_eraser.dm | 6 ++-
code/game/objects/items/tanks/jetpack.dm | 15 ++++---
code/game/objects/items/tanks/tank_types.dm | 39 ++++++++++++-------
.../transit_tubes/transit_tube_pod.dm | 6 ++-
code/game/turfs/open/_open.dm | 6 ++-
code/modules/admin/verbs/debug.dm | 6 ++-
.../atmospherics/gasmixtures/reactions.dm | 24 ++++++++----
.../components/unary_devices/tank.dm | 9 +++--
.../atmospherics/machinery/other/miner.dm | 3 +-
.../machinery/portable/canister.dm | 9 +++--
code/modules/events/spacevine.dm | 12 ++++--
code/modules/events/supermatter_surge.dm | 6 ++-
.../xenobiology/crossbreeding/chilling.dm | 3 +-
code/modules/vehicles/mecha/_mecha.dm | 6 ++-
18 files changed, 110 insertions(+), 55 deletions(-)
diff --git a/code/datums/atmosphere/_atmosphere.dm b/code/datums/atmosphere/_atmosphere.dm
index b1bb042d072c6..bcb82498c5504 100644
--- a/code/datums/atmosphere/_atmosphere.dm
+++ b/code/datums/atmosphere/_atmosphere.dm
@@ -25,7 +25,8 @@
var/datum/gas_mixture/gasmix = new
gasmix.temperature = rand(minimum_temp, maximum_temp)
for(var/i in base_gases)
- gasmix.set_moles(i, base_gases[i])
+ gasmix.gases[i][MOLES] = base_gases[i]
+
// Now let the random choices begin
var/datum/gas/gastype
diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm
index 903b93b74671e..cdcb2b2086158 100644
--- a/code/game/objects/effects/effect_system/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/effects_foam.dm
@@ -342,7 +342,8 @@
for(var/I in G.get_gases())
if(I == /datum/gas/oxygen || I == /datum/gas/nitrogen)
continue
- G.set_moles(I, 0)
+ G.gases[I][MOLES] = 0
+
for(var/obj/machinery/atmospherics/components/unary/U in O)
if(!U.welded)
U.welded = TRUE
diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm
index f5d1c664feaec..cb26989eb1286 100644
--- a/code/game/objects/effects/effect_system/effects_smoke.dm
+++ b/code/game/objects/effects/effect_system/effects_smoke.dm
@@ -181,7 +181,8 @@
qdel(H)
if(G.gases[/datum/gas/plasma][MOLES])
G.adjust_moles(/datum/gas/nitrogen, G.gases[/datum/gas/plasma][MOLES])
- G.set_moles(/datum/gas/plasma, 0)
+ G.gases[/datum/gas/plasma][MOLES] = 0
+
if (weldvents)
for(var/obj/machinery/atmospherics/components/unary/U in T)
if(!isnull(U.welded) && !U.welded) //must be an unwelded vent pump or vent scrubber.
diff --git a/code/game/objects/effects/spawners/bombspawner.dm b/code/game/objects/effects/spawners/bombspawner.dm
index 607d5bb0dd4fe..cfc4abeb7f40d 100644
--- a/code/game/objects/effects/spawners/bombspawner.dm
+++ b/code/game/objects/effects/spawners/bombspawner.dm
@@ -19,10 +19,12 @@
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.gases[/datum/gas/plasma][MOLES] = pressure_p*PT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_p
+))
PT.air_contents.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.gases[/datum/gas/oxygen][MOLES] = pressure_o*OT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o
+))
OT.air_contents.temperature = CELSIUS_TO_KELVIN(temp_o)
V.tank_one = PT
diff --git a/code/game/objects/items/chrono_eraser.dm b/code/game/objects/items/chrono_eraser.dm
index 78da7c1538d7b..1c2fef7c0d96a 100644
--- a/code/game/objects/items/chrono_eraser.dm
+++ b/code/game/objects/items/chrono_eraser.dm
@@ -264,8 +264,10 @@
/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.gases[/datum/gas/oxygen][MOLES] = MOLES_O2STANDARD
+
+ GM.gases[/datum/gas/nitrogen][MOLES] = MOLES_N2STANDARD
+
GM.temperature = T20C
return GM
diff --git a/code/game/objects/items/tanks/jetpack.dm b/code/game/objects/items/tanks/jetpack.dm
index eee7f182b07c3..501f40175e716 100644
--- a/code/game/objects/items/tanks/jetpack.dm
+++ b/code/game/objects/items/tanks/jetpack.dm
@@ -29,7 +29,8 @@
/obj/item/tank/jetpack/populate_gas()
if(gas_type)
- air_contents.set_moles(gas_type, ((6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C)))
+ air_contents.gases[gas_type][MOLES] = ((6 * ONE_ATMOSPHERE
+ * volume / (R_IDEAL_GAS_EQUATION * T20C)))
/obj/item/tank/jetpack/ui_action_click(mob/user, action)
if(istype(action, /datum/action/item_action/toggle_jetpack))
@@ -335,8 +336,10 @@
/obj/item/tank/jetpack/combustion/populate_gas()
var/moles_full = ((6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
var/ideal_o2_percent = (1 / PLASMA_OXYGEN_FULLBURN) * 2
- air_contents.set_moles(/datum/gas/plasma, moles_full * (1 - ideal_o2_percent))
- air_contents.set_moles(/datum/gas/oxygen, moles_full * ideal_o2_percent)
+ air_contents.gases[/datum/gas/plasma][MOLES] = moles_full * (1 - ideal_o2_percent
+)
+ air_contents.gases[/datum/gas/oxygen][MOLES] = moles_full * ideal_o2_percent
+
/obj/item/tank/jetpack/combustion/allow_thrust(num, mob/living/user, use_fuel = TRUE)
if(!on || !known_user)
@@ -369,8 +372,10 @@
// Consume
if(use_fuel)
- air_contents.set_moles(/datum/gas/plasma, QUANTIZE(air_contents.gases[/datum/gas/plasma][MOLES] - plasma_burn_rate))
- air_contents.set_moles(/datum/gas/oxygen, QUANTIZE(air_contents.gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate)))
+ air_contents.gases[/datum/gas/plasma][MOLES] = QUANTIZE(air_contents.gases[/datum/gas/plasma][MOLES] - plasma_burn_rate
+)
+ air_contents.gases[/datum/gas/oxygen][MOLES] = QUANTIZE(air_contents.gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate
+))
update_fade(15)
update_lifespan(4)
diff --git a/code/game/objects/items/tanks/tank_types.dm b/code/game/objects/items/tanks/tank_types.dm
index 992fe96c27369..b1bb66bfb3ce5 100644
--- a/code/game/objects/items/tanks/tank_types.dm
+++ b/code/game/objects/items/tanks/tank_types.dm
@@ -30,7 +30,8 @@
/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.gases[/datum/gas/oxygen][MOLES] = (6*ONE_ATMOSPHERE
+*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/oxygen/yellow
desc = "A tank of oxygen, this one is yellow."
@@ -56,8 +57,10 @@
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.gases[/datum/gas/oxygen][MOLES] = (3*ONE_ATMOSPHERE
+*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
+ air_contents.gases[/datum/gas/nitrous_oxide][MOLES] = (3*ONE_ATMOSPHERE
+*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
/*
* Air
@@ -71,8 +74,10 @@
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.gases[/datum/gas/oxygen][MOLES] = (6*ONE_ATMOSPHERE
+*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
+ air_contents.gases[/datum/gas/nitrogen][MOLES] = (6*ONE_ATMOSPHERE
+*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
/*
* Plasma
@@ -87,7 +92,8 @@
/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.gases[/datum/gas/plasma][MOLES] = (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))
@@ -103,7 +109,8 @@
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.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE
+*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasma/empty/populate_gas()
return
@@ -122,10 +129,12 @@
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.gases[/datum/gas/plasma][MOLES] = (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.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE
+*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasmaman/empty/populate_gas()
return
@@ -143,7 +152,8 @@
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.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE
+*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasmaman/belt/empty/populate_gas()
return
@@ -170,7 +180,8 @@
/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.gases[/datum/gas/oxygen][MOLES] = (10*ONE_ATMOSPHERE
+*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/emergency_oxygen/empty/populate_gas()
return
@@ -214,5 +225,7 @@
volume = 1
/obj/item/tank/internals/emergency_oxygen/clown/populate_gas()
- air_contents.set_moles(/datum/gas/oxygen, (9.99*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
- air_contents.set_moles(/datum/gas/nitrous_oxide, (0.01*ONE_ATMOSPHERE)*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.gases[/datum/gas/oxygen][MOLES] = (9.99*ONE_ATMOSPHERE
+*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.gases[/datum/gas/nitrous_oxide][MOLES] = (0.01*ONE_ATMOSPHERE
+*volume/(R_IDEAL_GAS_EQUATION*T20C))
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 bc7b3c4160a0c..fdbff8211fbed 100644
--- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
+++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
@@ -13,8 +13,10 @@
/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.gases[/datum/gas/oxygen][MOLES] = MOLES_O2STANDARD
+
+ air_contents.gases[/datum/gas/nitrogen][MOLES] = MOLES_N2STANDARD
+
air_contents.temperature = T20C
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index f1c1205ae30b6..cea09eb83dcd0 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -286,8 +286,10 @@
. = ..()
if (air.gases[/datum/gas/carbon_dioxide][MOLES] && air.gases[/datum/gas/oxygen][MOLES])
pulse_strength = min(pulse_strength,air.gases[/datum/gas/carbon_dioxide][MOLES]*1000,air.gases[/datum/gas/oxygen][MOLES]*2000) //Ensures matter is conserved properly
- air.set_moles(/datum/gas/carbon_dioxide, max(air.gases[/datum/gas/carbon_dioxide][MOLES]-(pulse_strength/1000),0))
- air.set_moles(/datum/gas/oxygen, max(air.gases[/datum/gas/oxygen][MOLES]-(pulse_strength/2000),0))
+ air.gases[/datum/gas/carbon_dioxide][MOLES] = max(air.gases[/datum/gas/carbon_dioxide][MOLES]-(pulse_strength/1000
+,0))
+ air.gases[/datum/gas/oxygen][MOLES] = max(air.gases[/datum/gas/oxygen][MOLES]-(pulse_strength/2000
+,0))
air.adjust_moles(GAS_PLUOXIUM, pulse_strength/4000)
/turf/open/proc/break_tile(force, allow_base)
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index 28ca4e5a11ae2..2008ff6d78e9b 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -624,7 +624,8 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
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.gases[/datum/gas/plasma][MOLES] = 70
+
Rad.drainratio = 0
Rad.loaded_tank = Plasma
Plasma.forceMove(Rad)
@@ -955,7 +956,8 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
var/temp = input(usr, "Choose the temperature (Kelvin).", "Choose the temp (K).", 0) as num
- C.air_contents.set_moles(gas_to_add, amount)
+ C.air_contents.gases[gas_to_add][MOLES] = amount
+
C.air_contents.temperature = (temp)
C.update_icon()
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index f108d27478c69..19c18cf46ffdf 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -106,13 +106,16 @@
burned_fuel = max(0,0.00002*(temperature-(0.00001*(temperature**2))))*air.gases[/datum/gas/nitrous_oxide][MOLES]
- air.set_moles(/datum/gas/nitrous_oxide, air.gases[/datum/gas/nitrous_oxide][MOLES] - burned_fuel)
+ air.gases[/datum/gas/nitrous_oxide][MOLES] = air.gases[/datum/gas/nitrous_oxide][MOLES] - burned_fuel
+
if(burned_fuel)
energy_released += (N2O_DECOMPOSITION_ENERGY_RELEASED * burned_fuel)
- air.set_moles(/datum/gas/oxygen, air.gases[/datum/gas/oxygen][MOLES] + burned_fuel/2)
- air.set_moles(/datum/gas/nitrogen, air.gases[/datum/gas/nitrogen][MOLES] + burned_fuel)
+ air.gases[/datum/gas/oxygen][MOLES] = air.gases[/datum/gas/oxygen][MOLES] + burned_fuel/2
+
+ air.gases[/datum/gas/nitrogen][MOLES] = air.gases[/datum/gas/nitrogen][MOLES] + burned_fuel
+
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
@@ -156,7 +159,8 @@
air.adjust_moles(/datum/gas/tritium, -burned_fuel)
else
burned_fuel = initial_trit // Yogs -- Conservation of Mass fix
- air.set_moles(/datum/gas/tritium, air.gases[/datum/gas/tritium][MOLES] * (1 - 1/TRITIUM_BURN_TRIT_FACTOR)) // Yogs -- Maybe a tiny performance boost? I'unno
+ air.gases[/datum/gas/tritium][MOLES] = air.gases[/datum/gas/tritium][MOLES] * (1 - 1/TRITIUM_BURN_TRIT_FACTOR
+) // Yogs -- Maybe a tiny performance boost? I'unno
air.adjust_moles(/datum/gas/oxygen, -air.gases[/datum/gas/tritium][MOLES])
energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel * (TRITIUM_BURN_TRIT_FACTOR - 1)) // Yogs -- Fixes low-energy tritium fires
@@ -227,8 +231,10 @@
if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY)
plasma_burn_rate = min(plasma_burn_rate,air.gases[/datum/gas/plasma][MOLES],air.gases[/datum/gas/oxygen][MOLES]/oxygen_burn_rate) //Ensures matter is conserved properly
- air.set_moles(/datum/gas/plasma, QUANTIZE(air.gases[/datum/gas/plasma][MOLES] - plasma_burn_rate))
- air.set_moles(/datum/gas/oxygen, QUANTIZE(air.gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate)))
+ air.gases[/datum/gas/plasma][MOLES] = QUANTIZE(air.gases[/datum/gas/plasma][MOLES] - plasma_burn_rate
+)
+ air.gases[/datum/gas/oxygen][MOLES] = QUANTIZE(air.gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate
+))
if (super_saturation)
air.adjust_moles(/datum/gas/tritium, plasma_burn_rate)
else
@@ -380,8 +386,10 @@
plasma = MODULUS(plasma - (instability*sin(TODEGREES(carbon))), toroidal_size)
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)
+ air.gases[/datum/gas/plasma][MOLES] = plasma*scale_factor + FUSION_MOLE_THRESHOLD
+//Scales the gases back up
+ air.gases[/datum/gas/carbon_dioxide][MOLES] = carbon*scale_factor + FUSION_MOLE_THRESHOLD
+
var/delta_plasma = min(initial_plasma - air.gases[/datum/gas/plasma][MOLES], toroidal_size * scale_factor * 1.5)
//Energy is gained or lost corresponding to the creation or destruction of mass.
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
index 5afee78136bcf..d612a4a07583c 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
@@ -20,7 +20,8 @@
air_contents.set_volume(volume)
air_contents.temperature = (T20C)
if(gas_type)
- air_contents.set_moles(gas_type, AIR_CONTENTS)
+ air_contents.gases[gas_type][MOLES] = AIR_CONTENTS
+
name = "[name] ([GLOB.gas_data.names[gas_type]])"
setPipingLayer(piping_layer)
@@ -32,8 +33,10 @@
/obj/machinery/atmospherics/components/unary/tank/air/New()
..()
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.gases[/datum/gas/oxygen][MOLES] = AIR_CONTENTS * 0.2
+
+ air_contents.gases[/datum/gas/nitrogen][MOLES] = AIR_CONTENTS * 0.8
+
/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide
gas_type = /datum/gas/carbon_dioxide
diff --git a/code/modules/atmospherics/machinery/other/miner.dm b/code/modules/atmospherics/machinery/other/miner.dm
index 696e9d92a08c2..17f7e71d96765 100644
--- a/code/modules/atmospherics/machinery/other/miner.dm
+++ b/code/modules/atmospherics/machinery/other/miner.dm
@@ -134,7 +134,8 @@
if(!isopenturf(O))
return FALSE
var/datum/gas_mixture/merger = new
- merger.set_moles(spawn_id, spawn_mol * delta_time)
+ merger.gases[spawn_id][MOLES] = spawn_mol * delta_time
+
merger.temperature = (spawn_temp)
O.assume_air(merger)
diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm
index f4fae2e328689..8aaf3f3992251 100644
--- a/code/modules/atmospherics/machinery/portable/canister.dm
+++ b/code/modules/atmospherics/machinery/portable/canister.dm
@@ -276,12 +276,15 @@
air_contents.temperature = (starter_temp)
if(!air_contents.return_volume())
CRASH("Auxtools is failing somehow! Gas with pointer [air_contents._extools_pointer_gasmixture] is not valid.")
- air_contents.set_moles(gas_type, (maximum_pressure * filled) * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature()))
+ air_contents.gases[gas_type][MOLES] = (maximum_pressure * filled
+ * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature()))
/obj/machinery/portable_atmospherics/canister/air/create_gas()
air_contents.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()))
+ air_contents.gases[/datum/gas/oxygen][MOLES] = (O2STANDARD * maximum_pressure * filled
+ * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature()))
+ air_contents.gases[/datum/gas/nitrogen][MOLES] = (N2STANDARD * maximum_pressure * filled
+ * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature()))
/obj/machinery/portable_atmospherics/canister/update_icon()
. = ..()
diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm
index 8bd50075b8db4..46a6b9cf19e76 100644
--- a/code/modules/events/spacevine.dm
+++ b/code/modules/events/spacevine.dm
@@ -217,7 +217,8 @@
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.gases[/datum/gas/oxygen][MOLES] - severity * holder.energy, 0))
+ GM.gases[/datum/gas/oxygen][MOLES] = max(GM.gases[/datum/gas/oxygen][MOLES] - severity * holder.energy, 0
+)
/datum/spacevine_mutation/nitro_eater
name = "nitrogen consuming"
@@ -229,7 +230,8 @@
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.gases[/datum/gas/nitrogen][MOLES] - severity * holder.energy, 0))
+ GM.gases[/datum/gas/nitrogen][MOLES] = max(GM.gases[/datum/gas/nitrogen][MOLES] - severity * holder.energy, 0
+)
/datum/spacevine_mutation/carbondioxide_eater
name = "CO2 consuming"
@@ -241,7 +243,8 @@
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.gases[/datum/gas/carbon_dioxide][MOLES] - severity * holder.energy, 0))
+ GM.gases[/datum/gas/carbon_dioxide][MOLES] = max(GM.gases[/datum/gas/carbon_dioxide][MOLES] - severity * holder.energy, 0
+)
/datum/spacevine_mutation/plasma_eater
name = "toxins consuming"
@@ -253,7 +256,8 @@
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.gases[/datum/gas/plasma][MOLES] - severity * holder.energy, 0))
+ GM.gases[/datum/gas/plasma][MOLES] = max(GM.gases[/datum/gas/plasma][MOLES] - severity * holder.energy, 0
+)
/datum/spacevine_mutation/thorns
name = "thorny"
diff --git a/code/modules/events/supermatter_surge.dm b/code/modules/events/supermatter_surge.dm
index 74056ad1febb4..16ba4719c47a2 100644
--- a/code/modules/events/supermatter_surge.dm
+++ b/code/modules/events/supermatter_surge.dm
@@ -43,11 +43,13 @@
supermatter.matter_power += power * power_proportion
var/datum/gas_mixture/gas_puff = new
var/selected_gas = pick(4;/datum/gas/carbon_dioxide, 4;/datum/gas/water_vapor, 1;/datum/gas/bz)
- gas_puff.set_moles(selected_gas, 500)
+ gas_puff.gases[selected_gas][MOLES] = 500
+
gas_puff.temperature = (500)
var/energy_ratio = (power * 500 * (1-power_proportion)) / gas_puff.thermal_energy()
if(energy_ratio < 1) // energy output we want is lower than current energy, reduce the amount of gas we puff out
- gas_puff.set_moles(/datum/gas/water_vapor, energy_ratio * 500)
+ gas_puff.gases[/datum/gas/water_vapor][MOLES] = energy_ratio * 500
+
else // energy output we want is higher than current energy, increase its actual heat
gas_puff.temperature = (energy_ratio * 500)
supermatter.assume_air(gas_puff)
diff --git a/code/modules/research/xenobiology/crossbreeding/chilling.dm b/code/modules/research/xenobiology/crossbreeding/chilling.dm
index 44c5c73ac6a4c..57a1ac0fb826f 100644
--- a/code/modules/research/xenobiology/crossbreeding/chilling.dm
+++ b/code/modules/research/xenobiology/crossbreeding/chilling.dm
@@ -106,7 +106,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.gases[/datum/gas/plasma][MOLES] = 0
+
filtered = TRUE
T.air_update_turf(FALSE, FALSE)
if(filtered)
diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm
index 069ade730280a..02cd7b683b7ee 100644
--- a/code/modules/vehicles/mecha/_mecha.dm
+++ b/code/modules/vehicles/mecha/_mecha.dm
@@ -328,8 +328,10 @@
cabin_air = new
cabin_air.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.gases[/datum/gas/oxygen][MOLES] = O2STANDARD*cabin_air.return_volume(
+/(R_IDEAL_GAS_EQUATION*cabin_air.return_temperature()))
+ cabin_air.gases[/datum/gas/nitrogen][MOLES] = N2STANDARD*cabin_air.return_volume(
+/(R_IDEAL_GAS_EQUATION*cabin_air.return_temperature()))
return cabin_air
/obj/vehicle/sealed/mecha/proc/add_radio()
From 705bb38e39949f80e2cb94f40374513b44072ae7 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 15 Jul 2024 15:16:21 +0200
Subject: [PATCH 016/114] goodbye get_gases (good ol search n replace)
---
code/__HELPERS/turfs.dm | 2 +-
code/datums/atmosphere/_atmosphere.dm | 2 +-
code/game/objects/effects/effect_system/effects_foam.dm | 2 +-
code/game/objects/items/devices/scanners.dm | 2 +-
code/modules/atmospherics/gasmixtures/reactions.dm | 4 ++--
code/modules/atmospherics/machinery/airalarm.dm | 4 ++--
code/modules/atmospherics/machinery/portable/canister.dm | 4 ++--
code/modules/mob/mob.dm | 2 +-
.../modular_computers/file_system/programs/atmosscan.dm | 2 +-
code/modules/power/supermatter/supermatter.dm | 4 ++--
code/modules/surgery/organs/lungs.dm | 2 +-
11 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/code/__HELPERS/turfs.dm b/code/__HELPERS/turfs.dm
index 275c353c5b262..877988ba28247 100644
--- a/code/__HELPERS/turfs.dm
+++ b/code/__HELPERS/turfs.dm
@@ -400,7 +400,7 @@ Turf and target are separate in case you want to teleport some distance from a t
if(QDELETED(air))
return FALSE
// Can most things breathe?
- for(var/id in air.get_gases())
+ for(var/id in air.gases)
if(id in GLOB.hardcoded_gases)
continue
return FALSE
diff --git a/code/datums/atmosphere/_atmosphere.dm b/code/datums/atmosphere/_atmosphere.dm
index bcb82498c5504..f2a97fc54c7b0 100644
--- a/code/datums/atmosphere/_atmosphere.dm
+++ b/code/datums/atmosphere/_atmosphere.dm
@@ -54,7 +54,7 @@
// Now finally lets make that string
var/list/gas_string_builder = list()
- for(var/i in gasmix.get_gases())
+ for(var/i in gasmix.gases)
gas_string_builder += "[GLOB.gas_data.ids[i]]=[gasmix.gases[i][MOLES]]"
gas_string_builder += "TEMP=[gasmix.return_temperature()]"
gas_string = gas_string_builder.Join(";")
diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm
index cdcb2b2086158..4b0918e3b1c91 100644
--- a/code/game/objects/effects/effect_system/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/effects_foam.dm
@@ -339,7 +339,7 @@
G.temperature = 293.15
for(var/obj/effect/hotspot/H in O)
qdel(H)
- for(var/I in G.get_gases())
+ for(var/I in G.gases)
if(I == /datum/gas/oxygen || I == /datum/gas/nitrogen)
continue
G.gases[I][MOLES] = 0
diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm
index 475bd75721623..e973ce2d5ebc7 100644
--- a/code/game/objects/items/devices/scanners.dm
+++ b/code/game/objects/items/devices/scanners.dm
@@ -723,7 +723,7 @@ GENE SCANNER
else
message += "Plasma: [round(plasma_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/plasma][MOLES], 0.01)] mol)"
- for(var/id in environment.get_gases())
+ for(var/id in environment.gases)
if(id in GLOB.hardcoded_gases)
continue
var/gas_concentration = environment.gases[id][MOLES]/total_moles
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index 19c18cf46ffdf..e82f5a99f8d52 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -292,7 +292,7 @@
var/list/fuel_temps = GLOB.gas_data.fire_temperatures
var/total_fuel = 0
var/energy_released = 0
- for(var/G in air.get_gases())
+ for(var/G in air.gases)
var/oxidation_temp = oxidation_temps[G]
if(oxidation_temp && oxidation_temp > temperature)
var/temperature_scale = max(0, 1-(temperature / oxidation_temp))
@@ -374,7 +374,7 @@
(temperature_scale-FUSION_BASE_TEMPSCALE) / FUSION_BUFFER_DIVISOR \
: 4 ** (temperature_scale-FUSION_BASE_TEMPSCALE) / FUSION_SLOPE_DIVISOR)
var/gas_power = 0
- for (var/gas_id in air.get_gases())
+ for (var/gas_id in air.gases)
gas_power += (GLOB.gas_data.fusion_powers[gas_id]*air.gases[gas_id][MOLES])
var/instability = MODULUS((gas_power*INSTABILITY_GAS_POWER_FACTOR),toroidal_size) //Instability effects how chaotic the behavior of the reaction is
cached_scan_results[id] = instability//used for analyzer feedback
diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm
index af942501eee53..cedd7bec3e5cf 100644
--- a/code/modules/atmospherics/machinery/airalarm.dm
+++ b/code/modules/atmospherics/machinery/airalarm.dm
@@ -288,7 +288,7 @@
))
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())
+ for(var/gas_id in environment.gases)
if(!(gas_id in TLV)) // We're not interested in this gas, it seems.
continue
cur_tlv = TLV[gas_id]
@@ -664,7 +664,7 @@
var/temperature_dangerlevel = cur_tlv.get_danger_level(environment.return_temperature())
var/gas_dangerlevel = 0
- for(var/gas_id in environment.get_gases())
+ for(var/gas_id in environment.gases)
if(!(gas_id in TLV)) // We're not interested in this gas, it seems.
continue
cur_tlv = TLV[gas_id]
diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm
index 8aaf3f3992251..ee3086ad658bf 100644
--- a/code/modules/atmospherics/machinery/portable/canister.dm
+++ b/code/modules/atmospherics/machinery/portable/canister.dm
@@ -100,7 +100,7 @@
logmsg = "Valve was toggled by [parent.get_creator_admin()]'s circuit, starting a transfer into \the [attached_can.holding || "air"]. "
if(!attached_can.holding)
var/list/danger = list()
- for(var/id in attached_can.air_contents.get_gases())
+ for(var/id in attached_can.air_contents.gases)
if(!(GLOB.gas_data.flags[id] & GAS_FLAG_DANGEROUS))
continue
if(attached_can.air_contents.gases[id][MOLES] > (GLOB.gas_data.visibility[id] || MOLES_GAS_VISIBLE)) //if moles_visible is undefined, default to default visibility
@@ -536,7 +536,7 @@
logmsg = "Valve was opened by [key_name(user)], starting a transfer into \the [holding || "air"]. "
if(!holding)
var/list/danger = list()
- for(var/id in air_contents.get_gases())
+ for(var/id in air_contents.gases)
if(!(GLOB.gas_data.flags[id] & GAS_FLAG_DANGEROUS))
continue
if(air_contents.gases[id][MOLES] > (GLOB.gas_data.visibility[id] || MOLES_GAS_VISIBLE)) //if moles_visible is undefined, default to default visibility
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index 8873e4cd30748..7f5b6398c3749 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -138,7 +138,7 @@
var/t = "Coordinates: [x],[y] \n"
t += "Temperature: [environment.return_temperature()] \n"
- for(var/id in environment.get_gases())
+ for(var/id in environment.gases)
if(environment.gases[id][MOLES])
t+="[GLOB.gas_data.names[id]]: [environment.gases[id][MOLES]] \n"
diff --git a/code/modules/modular_computers/file_system/programs/atmosscan.dm b/code/modules/modular_computers/file_system/programs/atmosscan.dm
index c7f6b8fd026bf..6d6d20c270fb5 100644
--- a/code/modules/modular_computers/file_system/programs/atmosscan.dm
+++ b/code/modules/modular_computers/file_system/programs/atmosscan.dm
@@ -30,7 +30,7 @@
data["AirTempC"] = round(environment.return_temperature() - T0C)
data["AirTempK"] = round(environment.return_temperature())
if (total_moles)
- for(var/id in environment.get_gases())
+ for(var/id in environment.gases)
var/gas_level = environment.gases[id][MOLES]/total_moles
if(gas_level > 0)
airlist += list(list("name" = "[GLOB.gas_data.names[id]]", "percentage" = round(gas_level*100, 0.01)))
diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm
index 477745ffb1f70..85c552562c8f9 100644
--- a/code/modules/power/supermatter/supermatter.dm
+++ b/code/modules/power/supermatter/supermatter.dm
@@ -222,12 +222,12 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
var/list/gasdata = list()
if(air.total_moles())
data["SM_moles"] = air.total_moles()
- for(var/gasid in air.get_gases())
+ for(var/gasid in air.gases)
gasdata.Add(list(list(
"name"= GLOB.gas_data.names[gasid],
"amount" = round(100*air.gases[gasid][MOLES]/air.total_moles(),0.01))))
else
- for(var/gasid in air.get_gases())
+ for(var/gasid in air.gases)
gasdata.Add(list(list(
"name"= GLOB.gas_data.names[gasid],
"amount" = 0)))
diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index ff6f66515f3af..4152bef73e0cf 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -240,7 +240,7 @@
else
clear_alert_for(H, alert_category)
var/list/breath_reagents = GLOB.gas_data.breath_reagents
- for(var/gas in breath.get_gases())
+ for(var/gas in breath.gases)
if(gas in breath_reagents)
var/datum/reagent/R = breath_reagents[gas]
//H.reagents.add_reagent(R, breath.gases[gas][MOLES] * R.molarity) // See next line
From fab3a244c9b71a5dcb0019f0811df4d7a233aeaa Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 15 Jul 2024 15:40:44 +0200
Subject: [PATCH 017/114] adjust_moles dood. wat nou?
---
.../effects/effect_system/effects_foam.dm | 2 +-
.../effects/effect_system/effects_smoke.dm | 2 +-
.../objects/effects/spawners/bombspawner.dm | 6 +-
code/game/objects/items/tanks/jetpack.dm | 3 +-
code/game/objects/items/tanks/tank_types.dm | 39 ++++------
code/game/turfs/open/_open.dm | 2 +-
.../atmospherics/auxgm/breathing_classes.dm | 2 +-
.../atmospherics/gasmixtures/reactions.dm | 72 +++++++++----------
.../atmospherics/machinery/airalarm.dm | 8 +--
.../atmospherics/machinery/other/miner.dm | 2 +-
.../machinery/portable/canister.dm | 11 ++-
code/modules/cargo/bounties/engineering.dm | 2 +-
code/modules/cargo/exports/large_objects.dm | 2 +-
code/modules/mob/living/carbon/alien/life.dm | 4 +-
code/modules/mob/living/carbon/life.dm | 6 +-
.../mob/living/simple_animal/bot/atmosbot.dm | 10 +--
.../mob/living/simple_animal/hostile/tree.dm | 2 +-
.../mob/living/simple_animal/slime/life.dm | 4 +-
code/modules/power/singularity/collector.dm | 10 +--
code/modules/power/supermatter/supermatter.dm | 6 +-
.../xenobiology/crossbreeding/_structures.dm | 2 +-
.../loot/alien_artifact.dm | 4 +-
.../shuttle_components/plasma_refiner.dm | 4 +-
code/modules/surgery/organs/lungs.dm | 6 +-
.../traits/xenoartifact_majors.dm | 4 +-
.../traits/xenoartifact_malfunctions.dm | 2 +-
26 files changed, 98 insertions(+), 119 deletions(-)
diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm
index 4b0918e3b1c91..7ef9f06d598d8 100644
--- a/code/game/objects/effects/effect_system/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/effects_foam.dm
@@ -45,7 +45,7 @@
qdel(hotspot)
var/datum/gas_mixture/G = T.air
var/plas_amt = min(30,G.gases[/datum/gas/plasma][MOLES]) //Absorb some plasma
- G.adjust_moles(/datum/gas/plasma, -plas_amt)
+ G.gases[/datum/gas/plasma][MOLES] += -plas_amt
absorbed_plasma += plas_amt
if(G.return_temperature() > T20C)
G.temperature = max(G.return_temperature()/2,T20C)
diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm
index cb26989eb1286..a969544c09669 100644
--- a/code/game/objects/effects/effect_system/effects_smoke.dm
+++ b/code/game/objects/effects/effect_system/effects_smoke.dm
@@ -180,7 +180,7 @@
for(var/obj/effect/hotspot/H in T)
qdel(H)
if(G.gases[/datum/gas/plasma][MOLES])
- G.adjust_moles(/datum/gas/nitrogen, G.gases[/datum/gas/plasma][MOLES])
+ G.gases[/datum/gas/nitrogen][MOLES] += G.gases[/datum/gas/plasma][MOLES]
G.gases[/datum/gas/plasma][MOLES] = 0
if (weldvents)
diff --git a/code/game/objects/effects/spawners/bombspawner.dm b/code/game/objects/effects/spawners/bombspawner.dm
index cfc4abeb7f40d..6d55471a4b9f0 100644
--- a/code/game/objects/effects/spawners/bombspawner.dm
+++ b/code/game/objects/effects/spawners/bombspawner.dm
@@ -19,12 +19,10 @@
var/obj/item/tank/internals/plasma/PT = new(V)
var/obj/item/tank/internals/oxygen/OT = new(V)
- PT.air_contents.gases[/datum/gas/plasma][MOLES] = pressure_p*PT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_p
-))
+ PT.air_contents.gases[/datum/gas/plasma][MOLES] = pressure_p*PT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_p))
PT.air_contents.temperature = CELSIUS_TO_KELVIN(temp_p)
- OT.air_contents.gases[/datum/gas/oxygen][MOLES] = pressure_o*OT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o
-))
+ OT.air_contents.gases[/datum/gas/oxygen][MOLES] = pressure_o*OT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o))
OT.air_contents.temperature = CELSIUS_TO_KELVIN(temp_o)
V.tank_one = PT
diff --git a/code/game/objects/items/tanks/jetpack.dm b/code/game/objects/items/tanks/jetpack.dm
index 501f40175e716..3a2e876c8f0c7 100644
--- a/code/game/objects/items/tanks/jetpack.dm
+++ b/code/game/objects/items/tanks/jetpack.dm
@@ -29,8 +29,7 @@
/obj/item/tank/jetpack/populate_gas()
if(gas_type)
- air_contents.gases[gas_type][MOLES] = ((6 * ONE_ATMOSPHERE
- * volume / (R_IDEAL_GAS_EQUATION * T20C)))
+ air_contents.gases[gas_type][MOLES] = ((6 * ONE_ATMOSPHERE * volume / (R_IDEAL_GAS_EQUATION * T20C)))
/obj/item/tank/jetpack/ui_action_click(mob/user, action)
if(istype(action, /datum/action/item_action/toggle_jetpack))
diff --git a/code/game/objects/items/tanks/tank_types.dm b/code/game/objects/items/tanks/tank_types.dm
index b1bb66bfb3ce5..fbeffd9195dc6 100644
--- a/code/game/objects/items/tanks/tank_types.dm
+++ b/code/game/objects/items/tanks/tank_types.dm
@@ -30,8 +30,7 @@
/obj/item/tank/internals/oxygen/populate_gas()
- air_contents.gases[/datum/gas/oxygen][MOLES] = (6*ONE_ATMOSPHERE
-*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.gases[/datum/gas/oxygen][MOLES] = (6*ONE_ATMOSPHERE *volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/oxygen/yellow
desc = "A tank of oxygen, this one is yellow."
@@ -57,10 +56,8 @@
force = 10
/obj/item/tank/internals/anesthetic/populate_gas()
- air_contents.gases[/datum/gas/oxygen][MOLES] = (3*ONE_ATMOSPHERE
-*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
- air_contents.gases[/datum/gas/nitrous_oxide][MOLES] = (3*ONE_ATMOSPHERE
-*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
+ air_contents.gases[/datum/gas/oxygen][MOLES] = (3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
+ air_contents.gases[/datum/gas/nitrous_oxide][MOLES] = (3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
/*
* Air
@@ -74,10 +71,8 @@
dog_fashion = /datum/dog_fashion/back
/obj/item/tank/internals/air/populate_gas()
- air_contents.gases[/datum/gas/oxygen][MOLES] = (6*ONE_ATMOSPHERE
-*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
- air_contents.gases[/datum/gas/nitrogen][MOLES] = (6*ONE_ATMOSPHERE
-*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
+ air_contents.gases[/datum/gas/oxygen][MOLES] = (6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
+ air_contents.gases[/datum/gas/nitrogen][MOLES] = (6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
/*
* Plasma
@@ -92,8 +87,7 @@
/obj/item/tank/internals/plasma/populate_gas()
- air_contents.gases[/datum/gas/plasma][MOLES] = (3*ONE_ATMOSPHERE
-*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.gases[/datum/gas/plasma][MOLES] = (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))
@@ -109,8 +103,7 @@
return ..()
/obj/item/tank/internals/plasma/full/populate_gas()
- air_contents.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE
-*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasma/empty/populate_gas()
return
@@ -129,12 +122,10 @@
distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE
/obj/item/tank/internals/plasmaman/populate_gas()
- air_contents.gases[/datum/gas/plasma][MOLES] = (3*ONE_ATMOSPHERE
-*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.gases[/datum/gas/plasma][MOLES] = (3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasmaman/full/populate_gas()
- air_contents.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE
-*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasmaman/empty/populate_gas()
return
@@ -152,8 +143,7 @@
w_class = WEIGHT_CLASS_SMALL //thanks i forgot this
/obj/item/tank/internals/plasmaman/belt/full/populate_gas()
- air_contents.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE
-*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasmaman/belt/empty/populate_gas()
return
@@ -180,8 +170,7 @@
/obj/item/tank/internals/emergency_oxygen/populate_gas()
- air_contents.gases[/datum/gas/oxygen][MOLES] = (10*ONE_ATMOSPHERE
-*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.gases[/datum/gas/oxygen][MOLES] = (10*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/emergency_oxygen/empty/populate_gas()
return
@@ -225,7 +214,5 @@
volume = 1
/obj/item/tank/internals/emergency_oxygen/clown/populate_gas()
- air_contents.gases[/datum/gas/oxygen][MOLES] = (9.99*ONE_ATMOSPHERE
-*volume/(R_IDEAL_GAS_EQUATION*T20C))
- air_contents.gases[/datum/gas/nitrous_oxide][MOLES] = (0.01*ONE_ATMOSPHERE
-*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.gases[/datum/gas/oxygen][MOLES] = (9.99*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ air_contents.gases[/datum/gas/nitrous_oxide][MOLES] = (0.01*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index cea09eb83dcd0..61f3ed18be686 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -290,7 +290,7 @@
,0))
air.gases[/datum/gas/oxygen][MOLES] = max(air.gases[/datum/gas/oxygen][MOLES]-(pulse_strength/2000
,0))
- air.adjust_moles(GAS_PLUOXIUM, pulse_strength/4000)
+ air.gases[/datum/gas/pluoxium][MOLES] += pulse_strength/4000
/turf/open/proc/break_tile(force, allow_base)
LAZYINITLIST(damage_overlays)
diff --git a/code/modules/atmospherics/auxgm/breathing_classes.dm b/code/modules/atmospherics/auxgm/breathing_classes.dm
index 9ff70ed1e2863..069251562472a 100644
--- a/code/modules/atmospherics/auxgm/breathing_classes.dm
+++ b/code/modules/atmospherics/auxgm/breathing_classes.dm
@@ -23,7 +23,7 @@
/datum/breathing_class/oxygen
gases = list(
/datum/gas/oxygen = 1,
- GAS_PLUOXIUM = 8,
+ /datum/gas/pluoxium = 8,
/datum/gas/carbon_dioxide = -0.7, // CO2 isn't actually toxic, just an asphyxiant
)
products = list(
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index e82f5a99f8d52..e071540263a65 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -82,7 +82,7 @@
consumed = MOLES_GAS_VISIBLE
if(consumed)
- air.adjust_moles(/datum/gas/water_vapor, -consumed)
+ air.gases[/datum/gas/water_vapor][MOLES] += -consumed
SET_REACTION_RESULTS(consumed)
. = REACTING
@@ -156,12 +156,12 @@
if(air.gases[/datum/gas/oxygen][MOLES] < initial_trit || MINIMUM_TRIT_OXYBURN_ENERGY > (temperature * old_heat_capacity))// Yogs -- Maybe a tiny performance boost? I'unno
burned_fuel = air.gases[/datum/gas/oxygen][MOLES]/TRITIUM_BURN_OXY_FACTOR
if(burned_fuel > initial_trit) burned_fuel = initial_trit //Yogs -- prevents negative moles of Tritium
- air.adjust_moles(/datum/gas/tritium, -burned_fuel)
+ air.gases[/datum/gas/tritium][MOLES] += -burned_fuel
else
burned_fuel = initial_trit // Yogs -- Conservation of Mass fix
air.gases[/datum/gas/tritium][MOLES] = air.gases[/datum/gas/tritium][MOLES] * (1 - 1/TRITIUM_BURN_TRIT_FACTOR
) // Yogs -- Maybe a tiny performance boost? I'unno
- air.adjust_moles(/datum/gas/oxygen, -air.gases[/datum/gas/tritium][MOLES])
+ air.gases[/datum/gas/oxygen][MOLES] += -air.gases[/datum/gas/tritium][MOLES]
energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel * (TRITIUM_BURN_TRIT_FACTOR - 1)) // Yogs -- Fixes low-energy tritium fires
if(burned_fuel)
@@ -170,7 +170,7 @@
radiation_pulse(location, energy_released/TRITIUM_BURN_RADIOACTIVITY_FACTOR)
//oxygen+more-or-less hydrogen=H2O
- air.adjust_moles(/datum/gas/water_vapor, burned_fuel )// Yogs -- Conservation of Mass
+ air.gases[/datum/gas/water_vapor][MOLES] += burned_fuel // Yogs -- Conservation of Mass
cached_results["fire"] += burned_fuel
@@ -231,14 +231,12 @@
if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY)
plasma_burn_rate = min(plasma_burn_rate,air.gases[/datum/gas/plasma][MOLES],air.gases[/datum/gas/oxygen][MOLES]/oxygen_burn_rate) //Ensures matter is conserved properly
- air.gases[/datum/gas/plasma][MOLES] = QUANTIZE(air.gases[/datum/gas/plasma][MOLES] - plasma_burn_rate
-)
- air.gases[/datum/gas/oxygen][MOLES] = QUANTIZE(air.gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate
-))
+ air.gases[/datum/gas/plasma][MOLES] = QUANTIZE(air.gases[/datum/gas/plasma][MOLES] - plasma_burn_rate)
+ air.gases[/datum/gas/oxygen][MOLES] = QUANTIZE(air.gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate))
if (super_saturation)
- air.adjust_moles(/datum/gas/tritium, plasma_burn_rate)
+ air.gases[/datum/gas/tritium][MOLES] += plasma_burn_rate
else
- air.adjust_moles(/datum/gas/carbon_dioxide, plasma_burn_rate)
+ air.gases[/datum/gas/carbon_dioxide][MOLES] += plasma_burn_rate
energy_released += FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate)
@@ -329,7 +327,7 @@
burn_results[product] += amt
var/final_energy = air.thermal_energy() + energy_released
for(var/result in burn_results)
- air.adjust_moles(result, burn_results[result])
+ air.gases[result][MOLES] += burn_results[result]
air.temperature = (final_energy / air.heat_capacity())
var/list/cached_results = air.reaction_results
cached_results["fire"] = min(total_fuel, oxidation_power) * 2
@@ -410,12 +408,12 @@
thermal_energy = middle_energy * 10 ** log(FUSION_ENERGY_TRANSLATION_EXPONENT, (thermal_energy + bowdlerized_reaction_energy) / middle_energy)
//The reason why you should set up a tritium production line.
- air.adjust_moles(/datum/gas/tritium, -FUSION_TRITIUM_MOLES_USED)
+ air.gases[/datum/gas/tritium][MOLES] += -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
var/standard_waste_gas_output = scale_factor * (FUSION_TRITIUM_CONVERSION_COEFFICIENT*FUSION_TRITIUM_MOLES_USED)
- delta_plasma > 0 ? air.adjust_moles(/datum/gas/water_vapor, standard_waste_gas_output) : air.adjust_moles(/datum/gas/bz, standard_waste_gas_output)
- air.adjust_moles(/datum/gas/oxygen, standard_waste_gas_output) //Oxygen is a bit touchy subject
+ delta_plasma > 0 ? air.gases[/datum/gas/water_vapor][MOLES] += standard_waste_gas_output : air.gases[/datum/gas/bz][MOLES] += standard_waste_gas_output
+ air.gases[/datum/gas/oxygen][MOLES] += standard_waste_gas_output //Oxygen is a bit touchy subject
if(reaction_energy)
if(location)
@@ -442,7 +440,7 @@
min_requirements = list(
/datum/gas/oxygen = 20,
/datum/gas/nitrogen = 20,
- GAS_PLUOXIUM = 5, //Gates Nitryl behind pluoxium to offset N2O burning up during formation
+ /datum/gas/pluoxium = 5, //Gates Nitryl behind pluoxium to offset N2O burning up during formation
"TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST*60
)
@@ -454,9 +452,9 @@
var/energy_used = heat_efficency*NITRYL_FORMATION_ENERGY
if ((air.gases[/datum/gas/oxygen][MOLES] - heat_efficency < 0 )|| (air.gases[/datum/gas/nitrogen][MOLES] - heat_efficency < 0)) //Shouldn't produce gas from nothing.
return NO_REACTION
- air.adjust_moles(/datum/gas/oxygen, -heat_efficency)
- air.adjust_moles(/datum/gas/nitrogen, -heat_efficency)
- air.adjust_moles(/datum/gas/nitryl, heat_efficency*2)
+ air.gases[/datum/gas/oxygen][MOLES] += -heat_efficency
+ air.gases[/datum/gas/nitrogen][MOLES] += -heat_efficency
+ air.gases[/datum/gas/nitryl][MOLES] += heat_efficency*2
if(energy_used > 0)
var/new_heat_capacity = air.heat_capacity()
@@ -484,12 +482,12 @@
var/energy_released = 2*reaction_efficency*FIRE_CARBON_ENERGY_RELEASED
if ((air.gases[/datum/gas/nitrous_oxide][MOLES] - reaction_efficency < 0 )|| (air.gases[/datum/gas/plasma][MOLES] - (2*reaction_efficency) < 0) || energy_released <= 0) //Shouldn't produce gas from nothing.
return NO_REACTION
- air.adjust_moles(/datum/gas/bz, reaction_efficency)
+ air.gases[/datum/gas/bz][MOLES] += reaction_efficency
if(reaction_efficency == air.gases[/datum/gas/nitrous_oxide][MOLES])
- 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.gases[/datum/gas/bz][MOLES] += -min(pressure,1)
+ air.gases[/datum/gas/oxygen][MOLES] += min(pressure,1)
+ air.gases[/datum/gas/nitrous_oxide][MOLES] += -reaction_efficency
+ air.gases[/datum/gas/plasma][MOLES] += -2*reaction_efficency
SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, min((reaction_efficency**2)*BZ_RESEARCH_SCALE,BZ_RESEARCH_MAX_AMOUNT))
SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DISCOVERY, min((reaction_efficency**2)*BZ_RESEARCH_SCALE,BZ_RESEARCH_MAX_AMOUNT)*0.5)
@@ -521,10 +519,10 @@
if ((air.gases[/datum/gas/plasma][MOLES] - heat_scale < 0) || (air.gases[/datum/gas/nitryl][MOLES] - heat_scale < 0) || (air.gases[/datum/gas/tritium][MOLES] - heat_scale < 0)) //Shouldn't produce gas from nothing.
return NO_REACTION
- air.adjust_moles(/datum/gas/stimulum, heat_scale/10)
- air.adjust_moles(/datum/gas/plasma, -heat_scale)
- air.adjust_moles(/datum/gas/nitryl, -heat_scale)
- air.adjust_moles(/datum/gas/tritium, -heat_scale)
+ air.gases[/datum/gas/stimulum][MOLES] += heat_scale/10
+ air.gases[/datum/gas/plasma][MOLES] += -heat_scale
+ air.gases[/datum/gas/nitryl][MOLES] += -heat_scale
+ air.gases[/datum/gas/tritium][MOLES] += -heat_scale
SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, STIMULUM_RESEARCH_AMOUNT*max(stim_energy_change,0))
SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DISCOVERY, STIMULUM_RESEARCH_AMOUNT*max(stim_energy_change,0)*0.5)
if(stim_energy_change)
@@ -550,9 +548,9 @@
var/energy_taken = nob_formed*(NOBLIUM_FORMATION_ENERGY/(max(air.gases[/datum/gas/bz][MOLES],1)))
if ((air.gases[/datum/gas/tritium][MOLES] - 10*nob_formed < 0) || (air.gases[/datum/gas/nitrogen][MOLES] - 20*nob_formed < 0))
return NO_REACTION
- air.adjust_moles(/datum/gas/tritium, -10*nob_formed)
- air.adjust_moles(/datum/gas/nitrogen, -20*nob_formed)
- air.adjust_moles(GAS_HYPERNOB, nob_formed)
+ air.gases[/datum/gas/tritium][MOLES] += -10*nob_formed
+ air.gases[/datum/gas/nitrogen][MOLES] += -20*nob_formed
+ air.gases[GAS_HYPERNOB][MOLES] += nob_formed
SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, nob_formed*NOBLIUM_RESEARCH_AMOUNT)
SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DISCOVERY, nob_formed*NOBLIUM_RESEARCH_AMOUNT*0.5)
@@ -568,7 +566,7 @@
/datum/gas_reaction/stim_ball/init_reqs()
min_requirements = list(
- GAS_PLUOXIUM = STIM_BALL_GAS_AMOUNT,
+ /datum/gas/pluoxium = STIM_BALL_GAS_AMOUNT,
/datum/gas/stimulum = STIM_BALL_GAS_AMOUNT,
/datum/gas/nitryl = MINIMUM_MOLE_COUNT,
/datum/gas/plasma = MINIMUM_MOLE_COUNT,
@@ -585,14 +583,14 @@
location = get_turf(holder)
var/ball_shot_angle = 180*cos(air.gases[/datum/gas/water_vapor][MOLES]/air.gases[/datum/gas/nitryl][MOLES])+180
var/stim_used = min(STIM_BALL_GAS_AMOUNT/air.gases[/datum/gas/plasma][MOLES],air.gases[/datum/gas/stimulum][MOLES])
- var/pluox_used = min(STIM_BALL_GAS_AMOUNT/air.gases[/datum/gas/plasma][MOLES],air.gases[GAS_PLUOXIUM][MOLES])
+ var/pluox_used = min(STIM_BALL_GAS_AMOUNT/air.gases[/datum/gas/plasma][MOLES],air.gases[/datum/gas/pluoxium][MOLES])
var/energy_released = stim_used*STIMULUM_HEAT_SCALE//Stimulum has a lot of stored energy, and breaking it up releases some of it
location.fire_nuclear_particle(ball_shot_angle)
- air.adjust_moles(/datum/gas/carbon_dioxide, 4*pluox_used)
- air.adjust_moles(/datum/gas/nitrogen, 8*stim_used)
- air.adjust_moles(GAS_PLUOXIUM, -pluox_used)
- air.adjust_moles(/datum/gas/stimulum, -stim_used)
- air.adjust_moles(/datum/gas/plasma, max(-air.gases[/datum/gas/plasma][MOLES]/2,-30))
+ air.gases[/datum/gas/carbon_dioxide][MOLES] += 4*pluox_used
+ air.gases[/datum/gas/nitrogen][MOLES] += 8*stim_used
+ air.gases[/datum/gas/pluoxium][MOLES] += -pluox_used
+ air.gases[/datum/gas/stimulum][MOLES] += -stim_used
+ air.gases[/datum/gas/plasma][MOLES] += max(-air.gases[/datum/gas/plasma][MOLES]/2,-30)
if(energy_released)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm
index cedd7bec3e5cf..4131ad7edf48c 100644
--- a/code/modules/atmospherics/machinery/airalarm.dm
+++ b/code/modules/atmospherics/machinery/airalarm.dm
@@ -103,7 +103,7 @@
/datum/gas/tritium = new/datum/tlv/dangerous,
/datum/gas/stimulum = new/datum/tlv/dangerous,
/datum/gas/nitryl = new/datum/tlv/dangerous,
- GAS_PLUOXIUM = new/datum/tlv(-1, -1, 5, 6), // Unlike oxygen, pluoxium does not fuel plasma/tritium fires
+ /datum/gas/pluoxium = new/datum/tlv(-1, -1, 5, 6), // Unlike oxygen, pluoxium does not fuel plasma/tritium fires
)
/obj/machinery/airalarm/server // No checks here.
@@ -121,7 +121,7 @@
/datum/gas/tritium = new/datum/tlv/no_checks,
/datum/gas/stimulum = new/datum/tlv/no_checks,
/datum/gas/nitryl = new/datum/tlv/no_checks,
- GAS_PLUOXIUM = new/datum/tlv/no_checks
+ /datum/gas/pluoxium = new/datum/tlv/no_checks
)
/obj/machinery/airalarm/kitchen_cold_room // Kitchen cold rooms start off at -20°C or 253.15 K.
@@ -139,7 +139,7 @@
/datum/gas/tritium = new/datum/tlv/dangerous,
/datum/gas/stimulum = new/datum/tlv/dangerous,
/datum/gas/nitryl = new/datum/tlv/dangerous,
- GAS_PLUOXIUM = new/datum/tlv(-1, -1, 1000, 1000) // Unlike oxygen, pluoxium does not fuel plasma/tritium fires
+ /datum/gas/pluoxium = new/datum/tlv(-1, -1, 1000, 1000) // Unlike oxygen, pluoxium does not fuel plasma/tritium fires
)
/obj/machinery/airalarm/unlocked
@@ -536,7 +536,7 @@
/datum/gas/tritium,
/datum/gas/bz,
/datum/gas/stimulum,
- GAS_PLUOXIUM
+ /datum/gas/pluoxium
),
"scrubbing" = 1,
"widenet" = 1
diff --git a/code/modules/atmospherics/machinery/other/miner.dm b/code/modules/atmospherics/machinery/other/miner.dm
index 17f7e71d96765..147837d122741 100644
--- a/code/modules/atmospherics/machinery/other/miner.dm
+++ b/code/modules/atmospherics/machinery/other/miner.dm
@@ -202,7 +202,7 @@
/obj/machinery/atmospherics/miner/pluoxium
name = "\improper Pluoxium Gas Miner"
overlay_color = "#c5c9b1"
- spawn_id = GAS_PLUOXIUM
+ spawn_id = /datum/gas/pluoxium
/obj/machinery/atmospherics/miner/station
power_draw = GASMINER_POWER_FULLSCALE
diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm
index ee3086ad658bf..8c8066f6f3173 100644
--- a/code/modules/atmospherics/machinery/portable/canister.dm
+++ b/code/modules/atmospherics/machinery/portable/canister.dm
@@ -184,7 +184,7 @@
/obj/machinery/portable_atmospherics/canister/pluoxium
name = "pluoxium canister"
desc = "Pluoxium. Like oxygen, but more bang for your buck."
- gas_type = GAS_PLUOXIUM
+ gas_type = /datum/gas/pluoxium
greyscale_config = /datum/greyscale_config/canister
greyscale_colors = "#2786e5"
@@ -276,15 +276,12 @@
air_contents.temperature = (starter_temp)
if(!air_contents.return_volume())
CRASH("Auxtools is failing somehow! Gas with pointer [air_contents._extools_pointer_gasmixture] is not valid.")
- air_contents.gases[gas_type][MOLES] = (maximum_pressure * filled
- * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature()))
+ air_contents.gases[gas_type][MOLES] = (maximum_pressure * filled* air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature()))
/obj/machinery/portable_atmospherics/canister/air/create_gas()
air_contents.temperature = (starter_temp)
- air_contents.gases[/datum/gas/oxygen][MOLES] = (O2STANDARD * maximum_pressure * filled
- * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature()))
- air_contents.gases[/datum/gas/nitrogen][MOLES] = (N2STANDARD * maximum_pressure * filled
- * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature()))
+ air_contents.gases[/datum/gas/oxygen][MOLES] = (O2STANDARD * maximum_pressure * filled * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature()))
+ air_contents.gases[/datum/gas/nitrogen][MOLES] = (N2STANDARD * maximum_pressure * filled * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature()))
/obj/machinery/portable_atmospherics/canister/update_icon()
. = ..()
diff --git a/code/modules/cargo/bounties/engineering.dm b/code/modules/cargo/bounties/engineering.dm
index 6459916a755be..32664d719e389 100644
--- a/code/modules/cargo/bounties/engineering.dm
+++ b/code/modules/cargo/bounties/engineering.dm
@@ -4,7 +4,7 @@
reward = 7500
wanted_types = list(/obj/item/tank)
var/moles_required = 20 // A full tank is 28 moles, but CentCom ignores that fact.
- var/gas_type = GAS_PLUOXIUM
+ var/gas_type = /datum/gas/pluoxium
/datum/bounty/item/engineering/gas/applies_to(obj/O)
if(!..())
diff --git a/code/modules/cargo/exports/large_objects.dm b/code/modules/cargo/exports/large_objects.dm
index d3b58f71555dd..f1f7a6ec5e74f 100644
--- a/code/modules/cargo/exports/large_objects.dm
+++ b/code/modules/cargo/exports/large_objects.dm
@@ -134,5 +134,5 @@
worth += C.air_contents.gases[/datum/gas/stimulum][MOLES]*100
worth += C.air_contents.gases[GAS_HYPERNOB][MOLES]*1000
worth += C.air_contents.gases[/datum/gas/tritium][MOLES]*5
- worth += C.air_contents.gases[GAS_PLUOXIUM][MOLES]*5
+ worth += C.air_contents.gases[/datum/gas/pluoxium][MOLES]*5
return worth
diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm
index 3bb4dc553cb8e..839e234d40721 100644
--- a/code/modules/mob/living/carbon/alien/life.dm
+++ b/code/modules/mob/living/carbon/alien/life.dm
@@ -27,8 +27,8 @@
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.gases[/datum/gas/plasma][MOLES] += -toxins_used
+ breath.gases[/datum/gas/oxygen][MOLES] += toxins_used
//BREATH TEMPERATURE
handle_breath_temperature(breath)
diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm
index d1d2824c8f55c..17b20c13348b2 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -183,7 +183,7 @@
var/oxygen_used = 0
var/moles = breath.total_moles()
var/breath_pressure = (moles*R_IDEAL_GAS_EQUATION*breath.return_temperature())/BREATH_VOLUME
- var/O2_partialpressure = ((breath.gases[/datum/gas/oxygen][MOLES]/moles)*breath_pressure) + (((breath.gases[GAS_PLUOXIUM][MOLES]*8)/moles)*breath_pressure)
+ var/O2_partialpressure = ((breath.gases[/datum/gas/oxygen][MOLES]/moles)*breath_pressure) + (((breath.gases[/datum/gas/pluoxium][MOLES]*8)/moles)*breath_pressure)
var/Toxins_partialpressure = (breath.gases[/datum/gas/plasma][MOLES]/moles)*breath_pressure
var/CO2_partialpressure = (breath.gases[/datum/gas/carbon_dioxide][MOLES]/moles)*breath_pressure
@@ -209,8 +209,8 @@
oxygen_used = breath.gases[/datum/gas/oxygen][MOLES]
clear_alert("not_enough_oxy")
- breath.adjust_moles(/datum/gas/oxygen, -oxygen_used)
- breath.adjust_moles(/datum/gas/carbon_dioxide, oxygen_used)
+ breath.gases[/datum/gas/oxygen][MOLES] += -oxygen_used
+ breath.gases[/datum/gas/carbon_dioxide][MOLES] += oxygen_used
//CARBON DIOXIDE
if(CO2_partialpressure > safe_co2_max)
diff --git a/code/modules/mob/living/simple_animal/bot/atmosbot.dm b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
index adb685e584c92..0e44919351322 100644
--- a/code/modules/mob/living/simple_animal/bot/atmosbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
@@ -58,7 +58,7 @@
/datum/gas/nitrous_oxide = 1,
/datum/gas/nitryl = 1,
/datum/gas/plasma = 1,
- GAS_PLUOXIUM = 0,
+ /datum/gas/pluoxium = 0,
/datum/gas/stimulum = 0,
/datum/gas/tritium = 1,
/datum/gas/water_vapor = 0,
@@ -214,10 +214,10 @@
if(pressure_delta > 0)
var/transfer_moles = pressure_delta*environment.return_volume()/(T20C * R_IDEAL_GAS_EQUATION)
if(emagged == 2)
- environment.adjust_moles(/datum/gas/carbon_dioxide, transfer_moles)
+ environment.gases[/datum/gas/carbon_dioxide][MOLES] += transfer_moles
else
- environment.adjust_moles(/datum/gas/nitrogen, transfer_moles * 0.7885)
- environment.adjust_moles(/datum/gas/oxygen, transfer_moles * 0.2115)
+ environment.gases[/datum/gas/nitrogen][MOLES] += transfer_moles * 0.7885
+ environment.gases[/datum/gas/oxygen][MOLES] += transfer_moles * 0.2115
air_update_turf(FALSE, FALSE)
new /obj/effect/temp_visual/vent_wind(get_turf(src))
@@ -230,7 +230,7 @@
for(var/G in gasses)
if(gasses[G])
var/moles_in_atmos = environment.gases[G][MOLES]
- environment.adjust_moles(G, -min(moles_in_atmos, ATMOSBOT_MAX_SCRUB_CHANGE))
+ environment.gases[G][MOLES] += -min(moles_in_atmos, ATMOSBOT_MAX_SCRUB_CHANGE)
/mob/living/simple_animal/bot/atmosbot/proc/deploy_holobarrier()
if(deployed_holobarrier)
diff --git a/code/modules/mob/living/simple_animal/hostile/tree.dm b/code/modules/mob/living/simple_animal/hostile/tree.dm
index 3ba55078d1f6e..70bd7e83b847a 100644
--- a/code/modules/mob/living/simple_animal/hostile/tree.dm
+++ b/code/modules/mob/living/simple_animal/hostile/tree.dm
@@ -51,7 +51,7 @@
if(co2 > 0)
if(prob(25))
var/amt = min(co2, 9)
- T.air.adjust_moles(/datum/gas/carbon_dioxide, -amt)
+ T.air.gases[/datum/gas/carbon_dioxide][MOLES] += -amt
T.atmos_spawn_air("o2=[amt];TEMP=293.15")
/mob/living/simple_animal/hostile/tree/festivus
diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm
index 64eb1e5d403cd..98088c90ad480 100644
--- a/code/modules/mob/living/simple_animal/slime/life.dm
+++ b/code/modules/mob/living/simple_animal/slime/life.dm
@@ -99,8 +99,8 @@
if(transformeffects & SLIME_EFFECT_DARK_PURPLE)
var/amt = is_adult ? 30 : 15
var/plas_amt = min(amt,environment.gases[/datum/gas/plasma][MOLES])
- environment.adjust_moles(/datum/gas/plasma, -plas_amt)
- environment.adjust_moles(/datum/gas/oxygen, plas_amt)
+ environment.gases[/datum/gas/plasma][MOLES] += -plas_amt
+ environment.gases[/datum/gas/oxygen][MOLES] += plas_amt
adjustBruteLoss(plas_amt ? -2 : 0)
switch(stat)
diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm
index f31c3f1b718ad..0e33dda798296 100644
--- a/code/modules/power/singularity/collector.dm
+++ b/code/modules/power/singularity/collector.dm
@@ -58,8 +58,8 @@
eject()
else
var/gasdrained = min(powerproduction_drain*drainratio*delta_time,loaded_tank.air_contents.gases[/datum/gas/plasma][MOLES])
- loaded_tank.air_contents.adjust_moles(/datum/gas/plasma, -gasdrained)
- loaded_tank.air_contents.adjust_moles(/datum/gas/tritium, gasdrained)
+ loaded_tank.air_contents.gases[/datum/gas/plasma][MOLES] += -gasdrained
+ loaded_tank.air_contents.gases[/datum/gas/tritium][MOLES] += gasdrained
var/power_produced = RAD_COLLECTOR_OUTPUT
add_avail(power_produced)
stored_energy-=power_produced
@@ -69,9 +69,9 @@
eject()
else
var/gasdrained = bitcoinproduction_drain*drainratio*delta_time
- loaded_tank.air_contents.adjust_moles(/datum/gas/tritium, -gasdrained)
- loaded_tank.air_contents.adjust_moles(/datum/gas/oxygen, -gasdrained)
- loaded_tank.air_contents.adjust_moles(/datum/gas/carbon_dioxide, gasdrained*2)
+ loaded_tank.air_contents.gases[/datum/gas/tritium][MOLES] += -gasdrained
+ loaded_tank.air_contents.gases[/datum/gas/oxygen][MOLES] += -gasdrained
+ loaded_tank.air_contents.gases[/datum/gas/carbon_dioxide][MOLES] += gasdrained*2
var/bitcoins_mined = RAD_COLLECTOR_OUTPUT
var/datum/bank_account/D = SSeconomy.get_budget_account(ACCOUNT_ENG_ID)
if(D)
diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm
index 85c552562c8f9..bf2579d33d0a1 100644
--- a/code/modules/power/supermatter/supermatter.dm
+++ b/code/modules/power/supermatter/supermatter.dm
@@ -460,7 +460,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
plasmacomp += clamp(max(removed.gases[/datum/gas/plasma][MOLES]/combined_gas, 0) - plasmacomp, -1, gas_change_rate)
o2comp += clamp(max(removed.gases[/datum/gas/oxygen][MOLES]/combined_gas, 0) - o2comp, -1, gas_change_rate)
co2comp += clamp(max(removed.gases[/datum/gas/carbon_dioxide][MOLES]/combined_gas, 0) - co2comp, -1, gas_change_rate)
- pluoxiumcomp += clamp(max(removed.gases[GAS_PLUOXIUM][MOLES]/combined_gas, 0) - pluoxiumcomp, -1, gas_change_rate)
+ pluoxiumcomp += clamp(max(removed.gases[/datum/gas/pluoxium][MOLES]/combined_gas, 0) - pluoxiumcomp, -1, gas_change_rate)
tritiumcomp += clamp(max(removed.gases[/datum/gas/tritium][MOLES]/combined_gas, 0) - tritiumcomp, -1, gas_change_rate)
bzcomp += clamp(max(removed.gases[/datum/gas/bz][MOLES]/combined_gas, 0) - bzcomp, -1, gas_change_rate)
@@ -521,9 +521,9 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
removed.temperature = (max(0, min(removed.return_temperature(), 2500 * dynamic_heat_modifier)))
//Calculate how much gas to release
- removed.adjust_moles(/datum/gas/plasma, max((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER, 0))
+ removed.gases[/datum/gas/plasma][MOLES] += 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.gases[/datum/gas/oxygen][MOLES] += max(((device_energy + removed.return_temperature( * dynamic_heat_modifier) - T0C) / OXYGEN_RELEASE_MODIFIER, 0))
if(produces_gas)
env.merge(removed)
diff --git a/code/modules/research/xenobiology/crossbreeding/_structures.dm b/code/modules/research/xenobiology/crossbreeding/_structures.dm
index 49b15e02444a7..4c462f91bb5da 100644
--- a/code/modules/research/xenobiology/crossbreeding/_structures.dm
+++ b/code/modules/research/xenobiology/crossbreeding/_structures.dm
@@ -237,7 +237,7 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals)
var/datum/gas_mixture/air = open_turf.return_air()
if(air.gases[/datum/gas/plasma][MOLES] > 15)
- air.adjust_moles(/datum/gas/plasma, -15)
+ air.gases[/datum/gas/plasma][MOLES] += -15
new /obj/item/stack/sheet/mineral/plasma(open_turf)
/obj/structure/slime_crystal/darkpurple/Destroy()
diff --git a/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm b/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm
index c1d68051a6722..a66a7e262a704 100644
--- a/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm
+++ b/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm
@@ -418,8 +418,8 @@ GLOBAL_LIST_EMPTY(destabliization_exits)
var/output_id = initial(output.id)
var/moles = min(air.gases[input_id][MOLES], 5)
if(moles)
- air.adjust_moles(input_id, -moles)
- air.adjust_moles(output_id, moles)
+ air.gases[input_id][MOLES] += -moles
+ air.gases[output_id][MOLES] += moles
//===================
// Recharger
diff --git a/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm b/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm
index 7badedc3369c3..8f9a18b0c62f0 100644
--- a/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm
+++ b/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm
@@ -20,7 +20,7 @@
if(!air_contents)
return
qdel(stack)
- air_contents.adjust_moles(/datum/gas/plasma, moles_created)
+ air_contents.gases[/datum/gas/plasma][MOLES] += moles_created
say("[moles_created] moles of plasma refined.")
return
@@ -40,7 +40,7 @@
return
if(plasmoles >= 100)
var/obj/item/stack/sheet/mineral/plasma/P = new(src.loc, 1)
- air_contents.adjust_moles(/datum/gas/plasma, -100)
+ air_contents.gases[/datum/gas/plasma][MOLES] += -100
say("100 moles of plasma consumed. A sheet of [P.name] has been created.")
else
say("Insufficient plasma. At least 100 moles of plasma are required. There are currently [plasmoles] moles of plasma.")
diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index 4152bef73e0cf..7f320a5295717 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -248,7 +248,7 @@
mole_adjustments[gas] = (gas in mole_adjustments) ? mole_adjustments[gas] - breath.gases[gas][MOLES] : -breath.gases[gas][MOLES]
for(var/gas in mole_adjustments)
- breath.adjust_moles(gas, mole_adjustments[gas])
+ breath.gases[gas][MOLES] += mole_adjustments[gas]
if(breath) // If there's some other shit in the air lets deal with it here.
@@ -295,14 +295,14 @@
if (gas_breathed > gas_stimulation_min)
H.reagents.add_reagent(/datum/reagent/nitryl,1)
- breath.adjust_moles(/datum/gas/nitryl, -gas_breathed)
+ breath.gases[/datum/gas/nitryl][MOLES] += -gas_breathed
// Stimulum
gas_breathed = PP(breath,/datum/gas/stimulum)
if (gas_breathed > gas_stimulation_min)
var/existing = H.reagents.get_reagent_amount(/datum/reagent/stimulum)
H.reagents.add_reagent(/datum/reagent/stimulum, max(0, 5 - existing))
- breath.adjust_moles(/datum/gas/stimulum, -gas_breathed)
+ breath.gases[/datum/gas/stimulum][MOLES] += -gas_breathed
handle_breath_temperature(breath, H)
return TRUE
diff --git a/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm b/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm
index 8273559498e7b..2911ca4813d31 100644
--- a/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm
+++ b/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm
@@ -450,8 +450,8 @@
var/output_id = initial(output.id)
var/moles = min(air.gases[input_id][MOLES], 5)
if(moles)
- air.adjust_moles(input_id, -moles)
- air.adjust_moles(output_id, moles)
+ air.gases[input_id][MOLES] += -moles
+ air.gases[output_id][MOLES] += moles
///============
/// Destabilizing, teleports the victim to that weird place from the exploration meme.
diff --git a/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm b/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm
index 4fe4141fce640..4e4330a7c925d 100644
--- a/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm
+++ b/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm
@@ -235,7 +235,7 @@
///What gasses we've S U C K E D
var/datum/gas_mixture/air_contents
///Gasses we can suck. Currently everything but, it's here if we need to blacklist in the future
- var/list/scrubbing = list(/datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz, /datum/gas/nitryl, /datum/gas/tritium, GAS_HYPERNOB, /datum/gas/water_vapor, /datum/gas/oxygen, /datum/gas/nitrogen, /datum/gas/stimulum, GAS_PLUOXIUM)
+ var/list/scrubbing = list(/datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz, /datum/gas/nitryl, /datum/gas/tritium, GAS_HYPERNOB, /datum/gas/water_vapor, /datum/gas/oxygen, /datum/gas/nitrogen, /datum/gas/stimulum, /datum/gas/pluoxium)
///Adjust for balance - I'm sure this will have no ramifications
var/volume = 1000000
var/volume_rate = 200000
From 5ecdd55237cf85152fe10e2205354f31e8cf959a Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 15 Jul 2024 15:56:07 +0200
Subject: [PATCH 018/114] squashing bullshit
---
code/modules/atmospherics/gasmixtures/reactions.dm | 5 ++++-
code/modules/power/supermatter/supermatter.dm | 4 ++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index e071540263a65..f21a216bf7615 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -412,7 +412,10 @@
//The decay of the tritium and the reaction's energy produces waste gases, different ones depending on whether the reaction is endo or exothermic
var/standard_waste_gas_output = scale_factor * (FUSION_TRITIUM_CONVERSION_COEFFICIENT*FUSION_TRITIUM_MOLES_USED)
- delta_plasma > 0 ? air.gases[/datum/gas/water_vapor][MOLES] += standard_waste_gas_output : air.gases[/datum/gas/bz][MOLES] += standard_waste_gas_output
+ if(delta_plasma > 0)
+ air.gases[/datum/gas/water_vapor][MOLES] += standard_waste_gas_output
+ else
+ air.gases[/datum/gas/bz][MOLES] += standard_waste_gas_output
air.gases[/datum/gas/oxygen][MOLES] += standard_waste_gas_output //Oxygen is a bit touchy subject
if(reaction_energy)
diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm
index bf2579d33d0a1..afb2c047d92a1 100644
--- a/code/modules/power/supermatter/supermatter.dm
+++ b/code/modules/power/supermatter/supermatter.dm
@@ -521,9 +521,9 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
removed.temperature = (max(0, min(removed.return_temperature(), 2500 * dynamic_heat_modifier)))
//Calculate how much gas to release
- removed.gases[/datum/gas/plasma][MOLES] += max((device_energy * dynamic_heat_modifier / PLASMA_RELEASE_MODIFIER, 0))
+ removed.gases[/datum/gas/plasma][MOLES] += max((device_energy * dynamic_heat_modifier) / PLASMA_RELEASE_MODIFIER, 0)
- removed.gases[/datum/gas/oxygen][MOLES] += max(((device_energy + removed.return_temperature( * dynamic_heat_modifier) - T0C) / OXYGEN_RELEASE_MODIFIER, 0))
+ removed.gases[/datum/gas/oxygen][MOLES] += max(((device_energy + removed.return_temperature() * dynamic_heat_modifier) - T0C) / OXYGEN_RELEASE_MODIFIER, 0)
if(produces_gas)
env.merge(removed)
From 04599b2a3fa059b17c299818960fd29d1165ff34 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 15 Jul 2024 16:38:37 +0200
Subject: [PATCH 019/114] temperature (half-way done i think)
---
_maps/RandomZLevels/moonoutpost19.dmm | 192 +++++++++---------
_maps/RandomZLevels/snowdin.dmm | 30 +--
_maps/RandomZLevels/undergroundoutpost45.dmm | 100 ++++-----
.../map_files/Deltastation/DeltaStation2.dmm | 4 +-
code/game/turfs/closed/minerals.dm | 2 +-
code/game/turfs/open/floor/fancy_floor.dm | 2 +-
.../turfs/open/floor/plating/misc_plating.dm | 12 +-
code/game/turfs/open/space/space.dm | 2 +-
code/game/turfs/turf.dm | 2 +-
.../atmospherics/environmental/LINDA_fire.dm | 6 +-
.../awaymissions/mission_code/snowdin.dm | 2 +-
11 files changed, 176 insertions(+), 178 deletions(-)
diff --git a/_maps/RandomZLevels/moonoutpost19.dmm b/_maps/RandomZLevels/moonoutpost19.dmm
index 2127b1c7224c4..fc04c4295088f 100644
--- a/_maps/RandomZLevels/moonoutpost19.dmm
+++ b/_maps/RandomZLevels/moonoutpost19.dmm
@@ -566,7 +566,7 @@
/turf/open/floor/plating{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"bY" = (
@@ -593,7 +593,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"ca" = (
@@ -601,7 +601,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cd" = (
@@ -615,7 +615,7 @@
heat_capacity = 1e+006;
icon_state = "floorscorched2";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"ce" = (
@@ -629,7 +629,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cf" = (
@@ -643,7 +643,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cg" = (
@@ -656,7 +656,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"ci" = (
@@ -727,7 +727,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cp" = (
@@ -773,7 +773,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cw" = (
@@ -839,7 +839,7 @@
/turf/open/floor/plating{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cD" = (
@@ -856,7 +856,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cG" = (
@@ -922,7 +922,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cR" = (
@@ -931,7 +931,7 @@
heat_capacity = 1e+006;
icon_state = "damaged4";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cT" = (
@@ -967,7 +967,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cW" = (
@@ -976,7 +976,7 @@
heat_capacity = 1e+006;
icon_state = "damaged2";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cX" = (
@@ -985,7 +985,7 @@
heat_capacity = 1e+006;
icon_state = "damaged3";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cY" = (
@@ -1002,7 +1002,7 @@
dir = 1;
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cZ" = (
@@ -1068,7 +1068,7 @@
/turf/open/floor/plating{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"df" = (
@@ -1090,7 +1090,7 @@
dir = 1;
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dh" = (
@@ -1142,7 +1142,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dm" = (
@@ -1153,7 +1153,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dn" = (
@@ -1163,7 +1163,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"do" = (
@@ -1172,7 +1172,7 @@
heat_capacity = 1e+006;
icon_state = "damaged1";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dq" = (
@@ -1260,7 +1260,7 @@
/turf/open/floor/plating{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dx" = (
@@ -1282,7 +1282,7 @@
/turf/open/floor/plating{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dz" = (
@@ -1311,7 +1311,7 @@
/turf/open/floor/plating{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dD" = (
@@ -1323,7 +1323,7 @@
/turf/open/floor/plating{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dE" = (
@@ -1387,7 +1387,7 @@
icon_plating = "asteroidplating";
icon_state = "asteroidplating";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dJ" = (
@@ -1413,7 +1413,7 @@
icon_plating = "asteroidplating";
icon_state = "asteroidplating";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dM" = (
@@ -1422,7 +1422,7 @@
icon_plating = "asteroidplating";
icon_state = "asteroidplating";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/main)
"dN" = (
@@ -4083,7 +4083,7 @@
heat_capacity = 1e+006;
icon_state = "floorscorched2";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kd" = (
@@ -4095,7 +4095,7 @@
heat_capacity = 1e+006;
icon_state = "damaged1";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"ke" = (
@@ -4107,7 +4107,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kf" = (
@@ -4121,7 +4121,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kg" = (
@@ -4133,7 +4133,7 @@
heat_capacity = 1e+006;
icon_state = "floorscorched1";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"ki" = (
@@ -4145,7 +4145,7 @@
heat_capacity = 1e+006;
icon_state = "damaged3";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kj" = (
@@ -4332,7 +4332,7 @@
heat_capacity = 1e+006;
icon_state = "damaged2";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kC" = (
@@ -4351,7 +4351,7 @@
heat_capacity = 1e+006;
icon_state = "damaged4";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kE" = (
@@ -4359,7 +4359,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kF" = (
@@ -4368,7 +4368,7 @@
heat_capacity = 1e+006;
icon_state = "damaged5";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kG" = (
@@ -4377,7 +4377,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kH" = (
@@ -4558,7 +4558,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"lm" = (
@@ -4612,7 +4612,7 @@
"lv" = (
/turf/open/floor/iron/showroomfloor{
heat_capacity = 1e+006;
- initial_temperature = 273.15
+ temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"lw" = (
@@ -4623,7 +4623,7 @@
},
/turf/open/floor/iron/showroomfloor{
heat_capacity = 1e+006;
- initial_temperature = 273.15
+ temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"lx" = (
@@ -4635,7 +4635,7 @@
/obj/item/clothing/under/suit/waiter,
/turf/open/floor/iron/showroomfloor{
heat_capacity = 1e+006;
- initial_temperature = 273.15
+ temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"ly" = (
@@ -4662,7 +4662,7 @@
},
/turf/open/floor/plating{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"lE" = (
@@ -4705,7 +4705,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"lJ" = (
@@ -4715,7 +4715,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"lK" = (
@@ -4783,7 +4783,7 @@
/obj/item/gun/ballistic/shotgun/sc_pump,
/turf/open/floor/iron/showroomfloor{
heat_capacity = 1e+006;
- initial_temperature = 273.15
+ temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"lV" = (
@@ -4863,7 +4863,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"mi" = (
@@ -4893,7 +4893,7 @@
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron/showroomfloor{
heat_capacity = 1e+006;
- initial_temperature = 273.15
+ temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"mn" = (
@@ -4908,7 +4908,7 @@
/obj/item/food/meat/slab/monkey,
/turf/open/floor/iron/showroomfloor{
heat_capacity = 1e+006;
- initial_temperature = 273.15
+ temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"mo" = (
@@ -4923,7 +4923,7 @@
/obj/item/storage/fancy/egg_box,
/turf/open/floor/iron/showroomfloor{
heat_capacity = 1e+006;
- initial_temperature = 273.15
+ temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"mp" = (
@@ -4988,7 +4988,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"my" = (
@@ -5156,7 +5156,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"mQ" = (
@@ -5170,7 +5170,7 @@
heat_capacity = 1e+006;
icon_state = "floorscorched2";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"mR" = (
@@ -5247,7 +5247,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"na" = (
@@ -5300,7 +5300,7 @@
heat_capacity = 1e+006;
icon_state = "floorscorched2";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nj" = (
@@ -5313,7 +5313,7 @@
heat_capacity = 1e+006;
icon_state = "damaged2";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nk" = (
@@ -5372,7 +5372,7 @@
heat_capacity = 1e+006;
icon_state = "damaged1";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"ns" = (
@@ -5397,7 +5397,7 @@
icon_plating = "asteroidplating";
icon_state = "asteroidplating";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"ny" = (
@@ -5410,7 +5410,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nz" = (
@@ -5460,7 +5460,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nG" = (
@@ -5473,7 +5473,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nH" = (
@@ -5529,7 +5529,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nO" = (
@@ -5573,7 +5573,7 @@
heat_capacity = 1e+006;
icon_state = "damaged1";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nT" = (
@@ -5610,7 +5610,7 @@
icon_plating = "asteroidplating";
icon_state = "asteroidplating";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nX" = (
@@ -5623,7 +5623,7 @@
heat_capacity = 1e+006;
icon_state = "floorscorched2";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nY" = (
@@ -5635,7 +5635,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nZ" = (
@@ -5645,7 +5645,7 @@
icon_plating = "asteroidplating";
icon_state = "asteroidplating";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/main)
"oa" = (
@@ -5667,7 +5667,7 @@
icon_plating = "asteroidplating";
icon_state = "asteroidplating";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/main)
"od" = (
@@ -5749,7 +5749,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"ql" = (
@@ -5891,7 +5891,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"vq" = (
@@ -5900,7 +5900,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"vM" = (
@@ -5925,7 +5925,7 @@
heat_capacity = 1e+006;
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"vV" = (
@@ -5959,7 +5959,7 @@
heat_capacity = 1e+006;
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"xg" = (
@@ -6069,7 +6069,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"zZ" = (
@@ -6118,7 +6118,7 @@
heat_capacity = 1e+006;
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"CF" = (
@@ -6165,7 +6165,7 @@
heat_capacity = 1e+006;
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"DR" = (
@@ -6177,7 +6177,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"DU" = (
@@ -6291,7 +6291,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"GN" = (
@@ -6300,7 +6300,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"Hc" = (
@@ -6369,7 +6369,7 @@
heat_capacity = 1e+006;
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"In" = (
@@ -6397,7 +6397,7 @@
heat_capacity = 1e+006;
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"II" = (
@@ -6414,7 +6414,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"Jk" = (
@@ -6424,7 +6424,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"JH" = (
@@ -6453,7 +6453,7 @@
/turf/open/floor/iron/cafeteria{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"LE" = (
@@ -6517,7 +6517,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"NJ" = (
@@ -6526,7 +6526,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"Ot" = (
@@ -6537,7 +6537,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"Oy" = (
@@ -6575,7 +6575,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"QP" = (
@@ -6594,7 +6594,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"RA" = (
@@ -6602,7 +6602,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"RD" = (
@@ -6657,7 +6657,7 @@
heat_capacity = 1e+006;
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"Ul" = (
@@ -6675,7 +6675,7 @@
/turf/open/floor/iron{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"Uo" = (
@@ -6737,7 +6737,7 @@
/turf/open/floor/iron/cafeteria{
heat_capacity = 1e+006;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"Xd" = (
diff --git a/_maps/RandomZLevels/snowdin.dmm b/_maps/RandomZLevels/snowdin.dmm
index d6a54b3619525..05a2c1f37eef0 100644
--- a/_maps/RandomZLevels/snowdin.dmm
+++ b/_maps/RandomZLevels/snowdin.dmm
@@ -1897,14 +1897,14 @@
"gc" = (
/turf/open/floor/engine/cult{
initial_gas_mix = "n2=82;plasma=24;TEMP=120";
- initial_temperature = 120
+ temperature = 120
},
/area/awaymission/snowdin/cave/cavern)
"gd" = (
/obj/effect/spawner/lootdrop/crate_spawner,
/turf/open/floor/engine/cult{
initial_gas_mix = "n2=82;plasma=24;TEMP=120";
- initial_temperature = 120
+ temperature = 120
},
/area/awaymission/snowdin/cave/cavern)
"ge" = (
@@ -1915,7 +1915,7 @@
/obj/effect/spawner/lootdrop/snowdin/dungeonheavy,
/turf/open/floor/engine/cult{
initial_gas_mix = "n2=82;plasma=24;TEMP=120";
- initial_temperature = 120
+ temperature = 120
},
/area/awaymission/snowdin/cave/cavern)
"gg" = (
@@ -2186,14 +2186,14 @@
/obj/effect/decal/remains/human,
/turf/open/floor/engine/cult{
initial_gas_mix = "n2=82;plasma=24;TEMP=120";
- initial_temperature = 120
+ temperature = 120
},
/area/awaymission/snowdin/cave/cavern)
"gV" = (
/obj/effect/decal/cleanable/blood/old,
/turf/open/floor/engine/cult{
initial_gas_mix = "n2=82;plasma=24;TEMP=120";
- initial_temperature = 120
+ temperature = 120
},
/area/awaymission/snowdin/cave/cavern)
"gW" = (
@@ -2418,7 +2418,7 @@
/obj/structure/destructible/cult/pylon,
/turf/open/floor/engine/cult{
initial_gas_mix = "n2=82;plasma=24;TEMP=120";
- initial_temperature = 120
+ temperature = 120
},
/area/awaymission/snowdin/cave/cavern)
"hG" = (
@@ -2628,7 +2628,7 @@
/obj/effect/spawner/lootdrop/snowdin/dungeonmid,
/turf/open/floor/engine/cult{
initial_gas_mix = "n2=82;plasma=24;TEMP=120";
- initial_temperature = 120
+ temperature = 120
},
/area/awaymission/snowdin/cave/cavern)
"im" = (
@@ -2638,7 +2638,7 @@
},
/turf/open/floor/engine/cult{
initial_gas_mix = "n2=82;plasma=24;TEMP=120";
- initial_temperature = 120
+ temperature = 120
},
/area/awaymission/snowdin/cave/cavern)
"in" = (
@@ -2648,7 +2648,7 @@
},
/turf/open/floor/engine/cult{
initial_gas_mix = "n2=82;plasma=24;TEMP=120";
- initial_temperature = 120
+ temperature = 120
},
/area/awaymission/snowdin/cave/cavern)
"io" = (
@@ -3222,7 +3222,7 @@
},
/turf/open/floor/engine/cult{
initial_gas_mix = "n2=82;plasma=24;TEMP=120";
- initial_temperature = 120
+ temperature = 120
},
/area/awaymission/snowdin/cave/cavern)
"jP" = (
@@ -4203,7 +4203,7 @@
/obj/effect/spawner/lootdrop/snowdin/dungeonlite,
/turf/open/floor/engine/cult{
initial_gas_mix = "n2=82;plasma=24;TEMP=120";
- initial_temperature = 120
+ temperature = 120
},
/area/awaymission/snowdin/cave/cavern)
"lU" = (
@@ -5579,7 +5579,7 @@
/obj/structure/flora/rock/pile/icy,
/turf/open/floor/engine/cult{
initial_gas_mix = "n2=82;plasma=24;TEMP=120";
- initial_temperature = 120
+ temperature = 120
},
/area/awaymission/snowdin/cave/cavern)
"qh" = (
@@ -9755,7 +9755,7 @@
/turf/open/floor/mineral/plastitanium{
initial_gas_mix = "o2=22;n2=82;TEMP=180";
planetary_atmos = 1;
- initial_temperature = 180
+ temperature = 180
},
/area/awaymission/snowdin/cave)
"EF" = (
@@ -9767,7 +9767,7 @@
/turf/open/floor/mineral/plastitanium{
initial_gas_mix = "o2=22;n2=82;TEMP=180";
planetary_atmos = 1;
- initial_temperature = 180
+ temperature = 180
},
/area/awaymission/snowdin/cave)
"EG" = (
@@ -9781,7 +9781,7 @@
/turf/open/floor/mineral/plastitanium{
initial_gas_mix = "o2=22;n2=82;TEMP=180";
planetary_atmos = 1;
- initial_temperature = 180
+ temperature = 180
},
/area/awaymission/snowdin/cave)
"EH" = (
diff --git a/_maps/RandomZLevels/undergroundoutpost45.dmm b/_maps/RandomZLevels/undergroundoutpost45.dmm
index a6ed5f6bbb517..1a3bb9f471121 100644
--- a/_maps/RandomZLevels/undergroundoutpost45.dmm
+++ b/_maps/RandomZLevels/undergroundoutpost45.dmm
@@ -517,7 +517,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 351.9;
+ temperature = 351.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -525,7 +525,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 351.9;
+ temperature = 351.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -789,7 +789,7 @@
"cM" = (
/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden{
dir = 5;
-
+
},
/turf/open/floor/plating{
heat_capacity = 1e+006
@@ -1251,7 +1251,7 @@
icon_plating = "asteroidplating";
icon_state = "asteroidplating";
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9
+ temperature = 363.9
},
/area/awaymission/undergroundoutpost45/caves)
"ev" = (
@@ -1338,7 +1338,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -1452,7 +1452,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/central)
@@ -1629,7 +1629,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/central)
@@ -1797,7 +1797,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -1933,7 +1933,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/crew_quarters)
@@ -2136,7 +2136,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/research)
@@ -2147,7 +2147,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/crew_quarters)
@@ -2179,7 +2179,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/crew_quarters)
@@ -2376,7 +2376,7 @@
"hU" = (
/obj/machinery/atmospherics/pipe/simple/supply/hidden{
dir = 4;
-
+
},
/obj/structure/table,
/obj/item/book/manual/chef_recipes,
@@ -2389,7 +2389,7 @@
/obj/effect/spawner/structure/window/reinforced,
/obj/machinery/atmospherics/pipe/simple/supply/hidden{
dir = 4;
-
+
},
/turf/open/floor/plating{
heat_capacity = 1e+006
@@ -3077,7 +3077,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/gateway)
@@ -3111,7 +3111,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/research)
@@ -4479,7 +4479,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/gateway)
@@ -5660,7 +5660,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -5671,7 +5671,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -5683,7 +5683,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/engineering)
@@ -5928,7 +5928,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -6149,7 +6149,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -6160,7 +6160,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -6171,7 +6171,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -6624,7 +6624,7 @@
},
/obj/machinery/atmospherics/pipe/simple/supply/hidden{
dir = 4;
-
+
},
/obj/machinery/door/airlock/maintenance{
name = "Research Maintenance";
@@ -7772,7 +7772,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/crew_quarters)
@@ -8242,7 +8242,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -8432,7 +8432,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/research)
@@ -8697,7 +8697,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/mining)
@@ -9466,7 +9466,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/mining)
@@ -9475,7 +9475,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9484,7 +9484,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9495,7 +9495,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9505,7 +9505,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9516,7 +9516,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9526,7 +9526,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9535,7 +9535,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9545,7 +9545,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9555,7 +9555,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9564,7 +9564,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9573,7 +9573,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9583,7 +9583,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9593,7 +9593,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9603,7 +9603,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9612,7 +9612,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9622,7 +9622,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9631,7 +9631,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9641,7 +9641,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9652,7 +9652,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -9674,7 +9674,7 @@
/turf/open/floor/plating/asteroid{
heat_capacity = 1e+006;
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
diff --git a/_maps/map_files/Deltastation/DeltaStation2.dmm b/_maps/map_files/Deltastation/DeltaStation2.dmm
index 24fd21dd3a187..edecdc85d95c7 100644
--- a/_maps/map_files/Deltastation/DeltaStation2.dmm
+++ b/_maps/map_files/Deltastation/DeltaStation2.dmm
@@ -78398,7 +78398,7 @@
},
/turf/open/floor/plating{
initial_gas_mix = "o2=0.01;n2=0.01;TEMP=2.7";
- initial_temperature = 2.7;
+ temperature = 2.7;
luminosity = 2
},
/area/security/brig)
@@ -92934,7 +92934,7 @@
},
/turf/open/floor/plating{
initial_gas_mix = "o2=0.01;n2=0.01;TEMP=2.7";
- initial_temperature = 2.7;
+ temperature = 2.7;
luminosity = 2
},
/area/security/brig)
diff --git a/code/game/turfs/closed/minerals.dm b/code/game/turfs/closed/minerals.dm
index d7a063e34936d..ba034d7375b2e 100644
--- a/code/game/turfs/closed/minerals.dm
+++ b/code/game/turfs/closed/minerals.dm
@@ -15,7 +15,7 @@
opacity = TRUE
density = TRUE
layer = EDGED_TURF_LAYER
- initial_temperature = 293.15
+ temperature = 293.15
max_integrity = 200
var/environment_type = "asteroid"
var/turf/open/floor/plating/turf_type = /turf/open/floor/plating/asteroid/airless
diff --git a/code/game/turfs/open/floor/fancy_floor.dm b/code/game/turfs/open/floor/fancy_floor.dm
index eeb9afba4ebae..01d446ec90e42 100644
--- a/code/game/turfs/open/floor/fancy_floor.dm
+++ b/code/game/turfs/open/floor/fancy_floor.dm
@@ -97,7 +97,7 @@
return make_plating()
/turf/open/floor/wood/cold
- initial_temperature = 255.37
+ temperature = 255.37
/turf/open/floor/wood/airless
initial_gas_mix = AIRLESS_ATMOS
diff --git a/code/game/turfs/open/floor/plating/misc_plating.dm b/code/game/turfs/open/floor/plating/misc_plating.dm
index 821f628207fcc..ca8401dcb2bde 100644
--- a/code/game/turfs/open/floor/plating/misc_plating.dm
+++ b/code/game/turfs/open/floor/plating/misc_plating.dm
@@ -329,7 +329,7 @@
icon = 'icons/turf/floors/ice_turf.dmi'
icon_state = "ice-0"
initial_gas_mix = FROZEN_ATMOS
- initial_temperature = 180
+ temperature = 180
planetary_atmos = TRUE
baseturfs = /turf/open/floor/plating/ice
slowdown = 1
@@ -360,10 +360,10 @@
base_icon_state = "red_ice"
/turf/open/floor/plating/ice/colder
- initial_temperature = 140
+ temperature = 140
/turf/open/floor/plating/ice/temperate
- initial_temperature = 255.37
+ temperature = 255.37
/turf/open/floor/plating/ice/break_tile()
return
@@ -378,7 +378,7 @@
icon = 'icons/turf/snow.dmi'
icon_state = "snowplating"
initial_gas_mix = FROZEN_ATMOS
- initial_temperature = 180
+ temperature = 180
attachment_holes = FALSE
planetary_atmos = TRUE
footstep = FOOTSTEP_SAND
@@ -399,10 +399,10 @@
canSmoothWith = list(SMOOTH_GROUP_FLOOR_SNOWED)
/turf/open/floor/plating/snowed/colder
- initial_temperature = 140
+ temperature = 140
/turf/open/floor/plating/snowed/temperatre
- initial_temperature = 255.37
+ temperature = 255.37
/turf/open/floor/plating/elevatorshaft
name = "elevator shaft"
diff --git a/code/game/turfs/open/space/space.dm b/code/game/turfs/open/space/space.dm
index 62ef458980fb7..cedbc016227f2 100644
--- a/code/game/turfs/open/space/space.dm
+++ b/code/game/turfs/open/space/space.dm
@@ -13,7 +13,7 @@
allow_z_travel = TRUE
- initial_temperature = TCMB
+ temperature = TCMB
thermal_conductivity = 0
heat_capacity = 700000
diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm
index 6c2bfe60ee2e8..519308a068ae7 100644
--- a/code/game/turfs/turf.dm
+++ b/code/game/turfs/turf.dm
@@ -20,7 +20,7 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists)
var/list/baseturfs = /turf/baseturf_bottom
/// How hot the turf is, in kelvin
- var/initial_temperature = T20C
+ var/temperature = T20C
/// Used for fire, if a melting temperature was reached, it will be destroyed
var/to_be_destroyed = 0
diff --git a/code/modules/atmospherics/environmental/LINDA_fire.dm b/code/modules/atmospherics/environmental/LINDA_fire.dm
index 1ec6048e79f12..a2295be3570ac 100644
--- a/code/modules/atmospherics/environmental/LINDA_fire.dm
+++ b/code/modules/atmospherics/environmental/LINDA_fire.dm
@@ -23,18 +23,16 @@
var/tox = . ? .[MOLES] : 0
. = air_gases[/datum/gas/tritium]
var/trit = . ? .[MOLES] : 0
- . = air_gases[/datum/gas/hydrogen]
- var/h2 = . ? .[MOLES] : 0
if(active_hotspot)
if(soh)
- if(tox > 0.5 || trit > 0.5 || h2 > 0.5)
+ if(tox > 0.5 || trit > 0.5)
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) && (tox > 0.5 || trit > 0.5 ))
active_hotspot = new /obj/effect/hotspot(src, exposed_volume*25, exposed_temperature)
diff --git a/code/modules/awaymissions/mission_code/snowdin.dm b/code/modules/awaymissions/mission_code/snowdin.dm
index df8eade196a78..a026041b08a62 100644
--- a/code/modules/awaymissions/mission_code/snowdin.dm
+++ b/code/modules/awaymissions/mission_code/snowdin.dm
@@ -140,7 +140,7 @@
/turf/open/floor/iron/dark/snowdin
initial_gas_mix = FROZEN_ATMOS
planetary_atmos = 1
- initial_temperature = 180
+ temperature = 180
/turf/open/lava/plasma
name = "liquid plasma"
From f34254479bc09f802e343d0a1088799018cdad06 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 15 Jul 2024 16:50:17 +0200
Subject: [PATCH 020/114] Revert "Removes blocks_air (#8264)"
This reverts commit 59537a44a92035d059bf03c4e04ebc15c8775731.
---
_maps/RandomRuins/LavaRuins/lavaland_surface_pride.dmm | 4 +++-
_maps/RandomRuins/LavaRuins/lavaland_surface_sloth.dmm | 5 +++++
code/__HELPERS/areas.dm | 4 ++--
code/game/turfs/closed/_closed.dm | 1 +
code/game/turfs/open/_open.dm | 8 +++++++-
code/game/turfs/turf.dm | 3 +++
code/modules/admin/admin_verbs.dm | 3 +++
.../machinery/pipes/heat_exchange/he_pipes.dm | 2 +-
code/modules/mob/living/simple_animal/bot/atmosbot.dm | 2 +-
9 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/_maps/RandomRuins/LavaRuins/lavaland_surface_pride.dmm b/_maps/RandomRuins/LavaRuins/lavaland_surface_pride.dmm
index b46f581539b68..cf4938f3690b1 100644
--- a/_maps/RandomRuins/LavaRuins/lavaland_surface_pride.dmm
+++ b/_maps/RandomRuins/LavaRuins/lavaland_surface_pride.dmm
@@ -73,7 +73,9 @@
/area/ruin/powered/pride)
"Y" = (
/obj/machinery/door/airlock/diamond,
-/turf/open/floor/mineral/silver,
+/turf/open/floor/mineral/silver{
+ blocks_air = 1
+ },
/area/ruin/powered/pride)
(1,1,1) = {"
diff --git a/_maps/RandomRuins/LavaRuins/lavaland_surface_sloth.dmm b/_maps/RandomRuins/LavaRuins/lavaland_surface_sloth.dmm
index 2089bc287fb1e..d07c93e33bf85 100644
--- a/_maps/RandomRuins/LavaRuins/lavaland_surface_sloth.dmm
+++ b/_maps/RandomRuins/LavaRuins/lavaland_surface_sloth.dmm
@@ -8,17 +8,20 @@
"c" = (
/obj/item/paper/fluff/stations/lavaland/sloth/note,
/turf/open/floor/sepia{
+ blocks_air = 0;
slowdown = 10
},
/area/ruin/unpowered)
"d" = (
/turf/open/floor/sepia{
+ blocks_air = 0;
slowdown = 10
},
/area/ruin/unpowered)
"e" = (
/obj/machinery/door/airlock/wood,
/turf/open/floor/sepia{
+ blocks_air = 0;
slowdown = 10
},
/area/ruin/unpowered)
@@ -26,6 +29,7 @@
/obj/structure/table/wood,
/obj/item/food/grown/citrus/orange,
/turf/open/floor/sepia{
+ blocks_air = 0;
slowdown = 10
},
/area/ruin/unpowered)
@@ -33,6 +37,7 @@
/obj/structure/bed,
/obj/item/bedsheet/brown,
/turf/open/floor/sepia{
+ blocks_air = 0;
slowdown = 10
},
/area/ruin/unpowered)
diff --git a/code/__HELPERS/areas.dm b/code/__HELPERS/areas.dm
index bb1e1321e8768..0ecb014e67ac1 100644
--- a/code/__HELPERS/areas.dm
+++ b/code/__HELPERS/areas.dm
@@ -11,7 +11,7 @@ GLOBAL_LIST_INIT(typecache_powerfailure_safe_areas, typecacheof(/area/engine/eng
// break_if_found is a typecache of turf/area types to return false if found
// Please keep this proc type agnostic. If you need to restrict it do it elsewhere or add an arg.
/proc/detect_room(turf/origin, list/break_if_found)
- if(isclosedturf(origin))
+ if(origin.blocks_air)
return list(origin)
. = list()
@@ -34,7 +34,7 @@ GLOBAL_LIST_INIT(typecache_powerfailure_safe_areas, typecacheof(/area/engine/eng
if(break_if_found[checkT.type] || break_if_found[checkT.loc.type])
return FALSE
var/static/list/cardinal_cache = list("[NORTH]"=TRUE, "[EAST]"=TRUE, "[SOUTH]"=TRUE, "[WEST]"=TRUE)
- if(!cardinal_cache["[dir]"] || isclosedturf(checkT) || !CANATMOSPASS(sourceT, checkT))
+ if(!cardinal_cache["[dir]"] || checkT.blocks_air || !CANATMOSPASS(sourceT, checkT))
continue
found_turfs += checkT // Since checkT is connected, add it to the list to be processed
diff --git a/code/game/turfs/closed/_closed.dm b/code/game/turfs/closed/_closed.dm
index 739d65c64f941..9b77cdb16426b 100644
--- a/code/game/turfs/closed/_closed.dm
+++ b/code/game/turfs/closed/_closed.dm
@@ -3,6 +3,7 @@
opacity = TRUE
density = TRUE
init_air = FALSE
+ blocks_air = TRUE
rad_flags = RAD_PROTECT_CONTENTS | RAD_NO_CONTAMINATE
rad_insulation = RAD_MEDIUM_INSULATION
pass_flags_self = PASSCLOSEDTURF
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index 61f3ed18be686..1c2b5ee2529c6 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -171,12 +171,18 @@
/turf/open/indestructible/airblock
icon_state = "bluespace"
+ blocks_air = TRUE
baseturfs = /turf/open/indestructible/airblock
- CanAtmosPass = ATMOS_PASS_NO
init_air = FALSE
/turf/open/Initalize_Atmos(times_fired)
excited = FALSE
+ 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)
+
update_visuals()
current_cycle = times_fired
ImmediateCalculateAdjacentTurfs()
diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm
index 519308a068ae7..42a69b3b4ba7b 100644
--- a/code/game/turfs/turf.dm
+++ b/code/game/turfs/turf.dm
@@ -33,6 +33,9 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists)
//If true, turf will allow users to float up and down in 0 grav.
var/allow_z_travel = FALSE
+ /// Whether the turf blocks atmos from passing through it or not
+ var/blocks_air = FALSE
+
flags_1 = CAN_BE_DIRTY_1
/// For the station blueprints, images of objects eg: pipes
diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm
index 9ff0afaa39ec6..f0493a958711c 100644
--- a/code/modules/admin/admin_verbs.dm
+++ b/code/modules/admin/admin_verbs.dm
@@ -813,6 +813,9 @@ GLOBAL_PROTECT(admin_verbs_hideable)
var/datum/gas_mixture/GM = new
for(var/turf/open/F in view())
+ if(F.blocks_air)
+ //skip walls
+ continue
GM.parse_gas_string(F.initial_gas_mix)
F.copy_air(GM)
F.update_visuals()
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 cd22fab6eb2d0..153967bc5207c 100644
--- a/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm
+++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm
@@ -25,7 +25,7 @@
var/turf/T = loc
if(istype(T))
- if(isclosedturf(T))
+ if(T.blocks_air)
environment_temperature = T.return_temperature()
else
var/turf/open/OT = T
diff --git a/code/modules/mob/living/simple_animal/bot/atmosbot.dm b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
index 0e44919351322..c24509a46026a 100644
--- a/code/modules/mob/living/simple_animal/bot/atmosbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
@@ -276,7 +276,7 @@
/mob/living/simple_animal/bot/atmosbot/proc/return_nearest_breach()
var/turf/origin = get_turf(src)
- if(isclosedturf(origin))
+ if(origin.blocks_air)
return null
var/room_limit = ATMOSBOT_MAX_AREA_SCAN
From b2bbeab812ba7bb54108dcfef51b0a36f937cd12 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 15 Jul 2024 17:14:24 +0200
Subject: [PATCH 021/114] Reverts
https://github.com/BeeStation/BeeStation-Hornet/pull/3210 (For compat, again)
---
code/modules/admin/verbs/atmosdebug.dm | 7 -------
code/modules/atmospherics/environmental/LINDA_fire.dm | 2 +-
.../machinery/components/binary_devices/valve.dm | 10 ----------
.../machinery/components/trinary_devices/mixer.dm | 6 +++---
.../machinery/portable/portable_atmospherics.dm | 3 ++-
code/modules/shuttle/on_move.dm | 2 +-
6 files changed, 7 insertions(+), 23 deletions(-)
diff --git a/code/modules/admin/verbs/atmosdebug.dm b/code/modules/admin/verbs/atmosdebug.dm
index 0a4abfd033111..48434dba49ee4 100644
--- a/code/modules/admin/verbs/atmosdebug.dm
+++ b/code/modules/admin/verbs/atmosdebug.dm
@@ -21,13 +21,6 @@
if(pipe.z && (!pipe.nodes || !pipe.nodes.len || (null in pipe.nodes)))
to_chat(usr, "Unconnected [pipe.name] located at [ADMIN_VERBOSEJMP(pipe)]")
- //Erroneous Connections, e.g. duplicate pipes
- //This uses pipeline_expansion(), so you can detect some atmos machineries causing problems at pipenet code.
- for (var/obj/machinery/atmospherics/AM in GLOB.machines)
- for (var/obj/machinery/atmospherics/AMT in AM.pipeline_expansion())
- if (!(AM in AMT.pipeline_expansion()))
- to_chat(usr, "Errorneous connections around [AM.name]. Duplicate or rogue pipes suspected at or around [ADMIN_VERBOSEJMP(AM)]")
-
/client/proc/powerdebug()
set category = "Mapping"
set name = "Check Power"
diff --git a/code/modules/atmospherics/environmental/LINDA_fire.dm b/code/modules/atmospherics/environmental/LINDA_fire.dm
index a2295be3570ac..dfa005bd02b05 100644
--- a/code/modules/atmospherics/environmental/LINDA_fire.dm
+++ b/code/modules/atmospherics/environmental/LINDA_fire.dm
@@ -175,7 +175,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(/datum/gas/plasma) && INSUFFICIENT(/datum/gas/tritium)) || INSUFFICIENT(/datum/gas/oxygen))
qdel(src)
return
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm
index d751f7f9dad35..ba1d7403ea844 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm
@@ -24,16 +24,6 @@ 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
- . = ..()
-
/obj/machinery/atmospherics/components/binary/valve/update_icon_nopipes(animation = FALSE)
normalize_cardinal_directions()
if(animation)
diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
index 95b8c979d37d0..c7b83d6a70ca0 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
@@ -116,15 +116,15 @@
if(transfer_moles1)
air1.transfer_to(air3, transfer_moles1)
var/datum/pipeline/parent1 = parents[1]
- parent1.update = PIPENET_UPDATE_STATUS_RECONCILE_NEEDED
+ parent1.update = TRUE
if(transfer_moles2)
air2.transfer_to(air3, transfer_moles2)
var/datum/pipeline/parent2 = parents[2]
- parent2.update = PIPENET_UPDATE_STATUS_RECONCILE_NEEDED
+ parent2.update = TRUE
var/datum/pipeline/parent3 = parents[3]
- parent3.update = PIPENET_UPDATE_STATUS_RECONCILE_NEEDED
+ parent3.update = TRUE
/obj/machinery/atmospherics/components/trinary/mixer/ui_state(mob/user)
diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
index aefaa71dcc271..bbf17b311a8f2 100644
--- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
+++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
@@ -65,7 +65,8 @@
//Perform the connection
connected_port = new_port
connected_port.connected_device = src
- connected_port.parents[1].update = PIPENET_UPDATE_STATUS_RECONCILE_NEEDED
+ var/datum/pipeline/connected_port_parent = connected_port.parents[1]
+ connected_port_parent.reconcile_air()
set_anchored(TRUE) //Prevent movement
pixel_x = new_port.pixel_x
diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm
index b7f644b73a92f..6a256244e5e26 100644
--- a/code/modules/shuttle/on_move.dm
+++ b/code/modules/shuttle/on_move.dm
@@ -33,7 +33,7 @@ All ShuttleMove procs go here
if(M.pulledby)
M.pulledby.stop_pulling()
M.stop_pulling()
- M.visible_message("[shuttle] slams into [M]!")
+ M.visible_message("")
SSblackbox.record_feedback("tally", "shuttle_gib", 1, M.type)
M.gib()
From f76f1fdfabf86de5d11bd8542f8656c377a950bd Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 15 Jul 2024 17:20:12 +0200
Subject: [PATCH 022/114] Fixes something i somehow deleted
---
code/__DEFINES/atmospherics.dm | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm
index 6af9647e727ea..3fdc28a5a48a0 100644
--- a/code/__DEFINES/atmospherics.dm
+++ b/code/__DEFINES/atmospherics.dm
@@ -172,6 +172,20 @@
/// The body temperature limit the human body can take before it will take wound damage.
#define BODYTEMP_HEAT_WOUND_LIMIT (BODYTEMP_NORMAL + 90) // 400.5 k
+// Body temperature warning icons
+/// The temperature the red icon is displayed.
+#define BODYTEMP_HEAT_WARNING_3 (BODYTEMP_HEAT_DAMAGE_LIMIT + 360) //+700k
+/// The temperature the orange icon is displayed.
+#define BODYTEMP_HEAT_WARNING_2 (BODYTEMP_HEAT_DAMAGE_LIMIT + 120) //460K
+/// The temperature the yellow icon is displayed.
+#define BODYTEMP_HEAT_WARNING_1 (BODYTEMP_HEAT_DAMAGE_LIMIT) //340K
+/// The temperature the light green icon is displayed.
+#define BODYTEMP_COLD_WARNING_1 (BODYTEMP_COLD_DAMAGE_LIMIT) //270k
+/// The temperature the cyan icon is displayed.
+#define BODYTEMP_COLD_WARNING_2 (BODYTEMP_COLD_DAMAGE_LIMIT - 70) //200k
+/// The temperature the blue icon is displayed.
+#define BODYTEMP_COLD_WARNING_3 (BODYTEMP_COLD_DAMAGE_LIMIT - 150) //120k
+
/// what min_cold_protection_temperature is set to for space-helmet quality headwear. MUST NOT BE 0.
#define SPACE_HELM_MIN_TEMP_PROTECT 2.0
/// Thermal insulation works both ways /Malkevin
From 6765110e7cc475dfb5c953e0dd6ff6241fc76700 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 15 Jul 2024 17:22:19 +0200
Subject: [PATCH 023/114] Missed hypernob
---
code/modules/atmospherics/gasmixtures/reactions.dm | 4 ++--
code/modules/atmospherics/machinery/airalarm.dm | 8 ++++----
code/modules/atmospherics/machinery/other/miner.dm | 2 +-
code/modules/atmospherics/machinery/portable/canister.dm | 2 +-
code/modules/atmospherics/machinery/portable/scrubber.dm | 2 +-
code/modules/cargo/exports/large_objects.dm | 2 +-
code/modules/mob/living/simple_animal/bot/atmosbot.dm | 2 +-
.../xenoarchaeology/traits/xenoartifact_malfunctions.dm | 2 +-
8 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index f21a216bf7615..31036b6b89b12 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -49,7 +49,7 @@
id = "nobstop"
/datum/gas_reaction/nobliumsupression/init_reqs()
- min_requirements = list(GAS_HYPERNOB = REACTION_OPPRESSION_THRESHOLD)
+ min_requirements = list(/datum/gas/hypernoblium = REACTION_OPPRESSION_THRESHOLD)
/datum/gas_reaction/nobliumsupression/react()
return STOP_REACTIONS
@@ -553,7 +553,7 @@
return NO_REACTION
air.gases[/datum/gas/tritium][MOLES] += -10*nob_formed
air.gases[/datum/gas/nitrogen][MOLES] += -20*nob_formed
- air.gases[GAS_HYPERNOB][MOLES] += nob_formed
+ air.gases[/datum/gas/hypernoblium][MOLES] += nob_formed
SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, nob_formed*NOBLIUM_RESEARCH_AMOUNT)
SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DISCOVERY, nob_formed*NOBLIUM_RESEARCH_AMOUNT*0.5)
diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm
index 4131ad7edf48c..b66a0b5af3720 100644
--- a/code/modules/atmospherics/machinery/airalarm.dm
+++ b/code/modules/atmospherics/machinery/airalarm.dm
@@ -98,7 +98,7 @@
/datum/gas/plasma = new/datum/tlv/dangerous,
/datum/gas/nitrous_oxide = new/datum/tlv/dangerous,
/datum/gas/bz = new/datum/tlv/dangerous,
- GAS_HYPERNOB = new/datum/tlv(-1, -1, 1000, 1000), // Hyper-Noblium is inert and nontoxic
+ /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/stimulum = new/datum/tlv/dangerous,
@@ -116,7 +116,7 @@
/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,
- GAS_HYPERNOB = 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/stimulum = new/datum/tlv/no_checks,
@@ -134,7 +134,7 @@
/datum/gas/plasma = new/datum/tlv/dangerous,
/datum/gas/nitrous_oxide = new/datum/tlv/dangerous,
/datum/gas/bz = new/datum/tlv/dangerous,
- GAS_HYPERNOB = new/datum/tlv(-1, -1, 1000, 1000), // Hyper-Noblium is inert and nontoxic
+ /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/stimulum = new/datum/tlv/dangerous,
@@ -530,7 +530,7 @@
/datum/gas/carbon_dioxide,
/datum/gas/plasma,
/datum/gas/water_vapor,
- GAS_HYPERNOB,
+ /datum/gas/hypernoblium,
/datum/gas/nitrous_oxide,
/datum/gas/nitryl,
/datum/gas/tritium,
diff --git a/code/modules/atmospherics/machinery/other/miner.dm b/code/modules/atmospherics/machinery/other/miner.dm
index 147837d122741..b470238c7e7e7 100644
--- a/code/modules/atmospherics/machinery/other/miner.dm
+++ b/code/modules/atmospherics/machinery/other/miner.dm
@@ -187,7 +187,7 @@
/obj/machinery/atmospherics/miner/hypernoblium
name = "\improper Hypernoblium Gas Miner"
overlay_color = "#00a6e7"
- spawn_id = GAS_HYPERNOB
+ spawn_id = /datum/gas/hypernoblium
/obj/machinery/atmospherics/miner/nitryl
name = "\improper Nitryl Gas Miner"
diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm
index 8c8066f6f3173..565c0de8e8899 100644
--- a/code/modules/atmospherics/machinery/portable/canister.dm
+++ b/code/modules/atmospherics/machinery/portable/canister.dm
@@ -170,7 +170,7 @@
/obj/machinery/portable_atmospherics/canister/nob
name = "hyper-noblium canister"
desc = "Hyper-Noblium. More noble than all other gases."
- gas_type = GAS_HYPERNOB
+ gas_type = /datum/gas/hypernoblium
greyscale_config = /datum/greyscale_config/canister/double_stripe
greyscale_colors = "#6399fc#b2b2b2"
diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm
index 2157cca1cad11..7f4f3b8ff548d 100644
--- a/code/modules/atmospherics/machinery/portable/scrubber.dm
+++ b/code/modules/atmospherics/machinery/portable/scrubber.dm
@@ -11,7 +11,7 @@
var/overpressure_m = 80
volume = 1000
- var/list/scrubbing = list(/datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz, /datum/gas/nitryl, /datum/gas/tritium, GAS_HYPERNOB, /datum/gas/water_vapor)
+ var/list/scrubbing = list(/datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz, /datum/gas/nitryl, /datum/gas/tritium, /datum/gas/hypernoblium, /datum/gas/water_vapor)
/obj/machinery/portable_atmospherics/scrubber/Destroy()
var/turf/T = get_turf(src)
diff --git a/code/modules/cargo/exports/large_objects.dm b/code/modules/cargo/exports/large_objects.dm
index f1f7a6ec5e74f..17e2b75fba01d 100644
--- a/code/modules/cargo/exports/large_objects.dm
+++ b/code/modules/cargo/exports/large_objects.dm
@@ -132,7 +132,7 @@
worth += C.air_contents.gases[/datum/gas/bz][MOLES]*4
worth += C.air_contents.gases[/datum/gas/stimulum][MOLES]*100
- worth += C.air_contents.gases[GAS_HYPERNOB][MOLES]*1000
+ worth += C.air_contents.gases[/datum/gas/hypernoblium][MOLES]*1000
worth += C.air_contents.gases[/datum/gas/tritium][MOLES]*5
worth += C.air_contents.gases[/datum/gas/pluoxium][MOLES]*5
return worth
diff --git a/code/modules/mob/living/simple_animal/bot/atmosbot.dm b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
index c24509a46026a..05a008155fbce 100644
--- a/code/modules/mob/living/simple_animal/bot/atmosbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
@@ -54,7 +54,7 @@
var/list/gasses = list(
/datum/gas/bz = 1,
/datum/gas/carbon_dioxide = 1,
- GAS_HYPERNOB = 1,
+ /datum/gas/hypernoblium = 1,
/datum/gas/nitrous_oxide = 1,
/datum/gas/nitryl = 1,
/datum/gas/plasma = 1,
diff --git a/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm b/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm
index 4e4330a7c925d..7245f2a5c05a4 100644
--- a/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm
+++ b/code/modules/xenoarchaeology/traits/xenoartifact_malfunctions.dm
@@ -235,7 +235,7 @@
///What gasses we've S U C K E D
var/datum/gas_mixture/air_contents
///Gasses we can suck. Currently everything but, it's here if we need to blacklist in the future
- var/list/scrubbing = list(/datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz, /datum/gas/nitryl, /datum/gas/tritium, GAS_HYPERNOB, /datum/gas/water_vapor, /datum/gas/oxygen, /datum/gas/nitrogen, /datum/gas/stimulum, /datum/gas/pluoxium)
+ var/list/scrubbing = list(/datum/gas/plasma, /datum/gas/carbon_dioxide, /datum/gas/nitrous_oxide, /datum/gas/bz, /datum/gas/nitryl, /datum/gas/tritium, /datum/gas/hypernoblium, /datum/gas/water_vapor, /datum/gas/oxygen, /datum/gas/nitrogen, /datum/gas/stimulum, /datum/gas/pluoxium)
///Adjust for balance - I'm sure this will have no ramifications
var/volume = 1000000
var/volume_rate = 200000
From 2cf1f09e156221efa2c391d41b2f5748a545a63b Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 15 Jul 2024 17:29:18 +0200
Subject: [PATCH 024/114] Nabs TG's immutable mixture thing
---
code/__DEFINES/atmospherics.dm | 2 +-
.../gasmixtures/immutable_mixtures.dm | 54 ++++++++++++++-----
2 files changed, 41 insertions(+), 15 deletions(-)
diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm
index 3fdc28a5a48a0..026ddb6e10a2d 100644
--- a/code/__DEFINES/atmospherics.dm
+++ b/code/__DEFINES/atmospherics.dm
@@ -317,7 +317,7 @@
//LAVALAND
/// what pressure you have to be under to increase the effect of equipment meant for lavaland
-#define LAVALAND_EQUIPMENT_EFFECT_PRESSURE 50
+#define MAXIMUM_LAVALAND_EQUIPMENT_EFFECT_PRESSURE 90
//ATMOS MIX IDS
#define LAVALAND_DEFAULT_ATMOS "LAVALAND_ATMOS"
diff --git a/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm b/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
index e566c4a167861..a0661810c5996 100644
--- a/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
+++ b/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
@@ -2,30 +2,57 @@
//it can be changed, but any changes will ultimately be undone before they can have any effect
/datum/gas_mixture/immutable
- var/initial_temperature = 0
+ var/initial_temperature
+ gc_share = TRUE
/datum/gas_mixture/immutable/New()
..()
- temperature = (initial_temperature)
- populate()
- mark_immutable()
+ garbage_collect()
-/datum/gas_mixture/immutable/proc/populate()
- return
+/datum/gas_mixture/immutable/garbage_collect()
+ temperature = initial_temperature
+ temperature_archived = initial_temperature
+ gases.Cut()
+
+/datum/gas_mixture/immutable/archive()
+ return TRUE //nothing changes, so we do nothing and the archive is successful
+
+/datum/gas_mixture/immutable/merge()
+ return FALSE //we're immutable.
+
+/datum/gas_mixture/immutable/share(datum/gas_mixture/sharer, our_coeff, sharer_coeff)
+ . = ..()
+ sharer.temperature = initial_temperature
+ garbage_collect()
+
+/datum/gas_mixture/immutable/react()
+ return FALSE //we're immutable.
+
+/datum/gas_mixture/immutable/copy()
+ return new type //we're immutable, so we can just return a new instance.
+
+/datum/gas_mixture/immutable/copy_from()
+ return FALSE //we're immutable.
+
+/datum/gas_mixture/immutable/copy_from_ratio()
+ return FALSE //we're immutable.
+
+/datum/gas_mixture/immutable/temperature_share(datum/gas_mixture/sharer, conduction_coefficient, sharer_temperature, sharer_heat_capacity)
+ . = ..()
+ temperature = initial_temperature
//used by space tiles
/datum/gas_mixture/immutable/space
initial_temperature = TCMB
-/datum/gas_mixture/immutable/space/populate()
- set_min_heat_capacity(HEAT_CAPACITY_VACUUM)
+/datum/gas_mixture/immutable/space/heat_capacity()
+ return HEAT_CAPACITY_VACUUM
-//used by cloners
-/datum/gas_mixture/immutable/cloner
- initial_temperature = T20C
+/datum/gas_mixture/immutable/space/remove()
+ return copy() //we're always empty, so we can just return a copy.
-/datum/gas_mixture/immutable/cloner/populate()
- set_moles(/datum/gas/nitrogen, MOLES_O2STANDARD + MOLES_N2STANDARD)
+/datum/gas_mixture/immutable/space/remove_ratio()
+ return copy() //we're always empty, so we can just return a copy.
//planet side stuff
/datum/gas_mixture/immutable/planetary
@@ -62,4 +89,3 @@
ADD_GAS(id, gases)
gases[id][MOLES] = mix[id][MOLES]
gases[id][ARCHIVE] = mix[id][MOLES]
-
From c1e1b9f9df9804cfa3de0883879a80f14ab87c3d Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 15 Jul 2024 19:21:58 +0200
Subject: [PATCH 025/114] Some missing defines
---
code/__DEFINES/atmospherics.dm | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm
index 026ddb6e10a2d..cef8cf3f7a973 100644
--- a/code/__DEFINES/atmospherics.dm
+++ b/code/__DEFINES/atmospherics.dm
@@ -186,6 +186,11 @@
/// The temperature the blue icon is displayed.
#define BODYTEMP_COLD_WARNING_3 (BODYTEMP_COLD_DAMAGE_LIMIT - 150) //120k
+
+//Emergency skinsuits
+#define EMERGENCY_HELM_MIN_TEMP_PROTECT 2.0 //The helmet is pressurized with air from the oxygen tank. If they don't take damage from that they won't take damage here
+#define EMERGENCY_SUIT_MIN_TEMP_PROTECT 237 //This is the approximate average temperature of Mt. Everest in the winter
+
/// what min_cold_protection_temperature is set to for space-helmet quality headwear. MUST NOT BE 0.
#define SPACE_HELM_MIN_TEMP_PROTECT 2.0
/// Thermal insulation works both ways /Malkevin
@@ -328,9 +333,9 @@
#define ATMOS_GAS_MONITOR_OUTPUT_O2 "o2_out"
#define ATMOS_GAS_MONITOR_SENSOR_O2 "o2_sensor"
-#define ATMOS_GAS_MONITOR_INPUT_TOX "tox_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_TOX "tox_out"
-#define ATMOS_GAS_MONITOR_SENSOR_TOX "tox_sensor"
+#define ATMOS_GAS_MONITOR_INPUT_PLASMA "plasma_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_PLASMA "plasma_out"
+#define ATMOS_GAS_MONITOR_SENSOR_PLASMA "plasma_sensor"
#define ATMOS_GAS_MONITOR_INPUT_AIR "air_in"
#define ATMOS_GAS_MONITOR_OUTPUT_AIR "air_out"
@@ -430,6 +435,18 @@
#define ATMOS_GAS_MONITOR_WASTE_ENGINE "engine-waste_out"
#define ATMOS_GAS_MONITOR_WASTE_ATMOS "atmos-waste_out"
+#define ATMOS_GAS_MONITOR_INPUT_SM "sm_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_SM "sm_out"
+#define ATMOS_GAS_MONITOR_SENSOR_SM "sm_sense"
+
+#define ATMOS_GAS_MONITOR_INPUT_SM_WASTE "sm_waste_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_SM_WASTE "sm_waste_out"
+#define ATMOS_GAS_MONITOR_SENSOR_SM_WASTE "sm_waste_sense"
+
+#define ATMOS_GAS_MONITOR_INPUT_TOXINS_WASTE "toxins_waste_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_TOXINS_WASTE "toxins_waste_out"
+#define ATMOS_GAS_MONITOR_SENSOR_TOXINS_WASTE "toxins_waste_sense"
+
//AIRLOCK CONTROLLER TAGS
//RnD toxins burn chamber
From bf1c1f3c821cc062bec28035bf32f62b87e150aa Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 15 Jul 2024 19:31:25 +0200
Subject: [PATCH 026/114] kill set_volume
---
code/controllers/subsystem/explosion.dm | 3 +--
code/game/machinery/shuttle/shuttle_heater.dm | 2 +-
code/game/objects/items/devices/transfer_valve.dm | 6 +++---
.../machinery/components/binary_devices/dp_vent_pump.dm | 4 ++--
.../machinery/components/trinary_devices/mixer.dm | 2 +-
.../components/unary_devices/portables_connector.dm | 2 +-
.../atmospherics/machinery/components/unary_devices/tank.dm | 2 +-
.../machinery/components/unary_devices/vent_pump.dm | 2 +-
code/modules/mob/living/carbon/alien/life.dm | 2 +-
code/modules/mob/living/carbon/life.dm | 2 +-
code/modules/vehicles/mecha/_mecha.dm | 2 +-
11 files changed, 14 insertions(+), 15 deletions(-)
diff --git a/code/controllers/subsystem/explosion.dm b/code/controllers/subsystem/explosion.dm
index b3aefebebff7e..fd00956d76df7 100644
--- a/code/controllers/subsystem/explosion.dm
+++ b/code/controllers/subsystem/explosion.dm
@@ -33,7 +33,7 @@ SUBSYSTEM_DEF(explosions)
var/list/explosions = list()
- var/currentpart = SSAIR_REBUILD_PIPENETS
+ var/currentpart = SSAIR_REBUILD_PIPELINE
/datum/controller/subsystem/explosions/stat_entry(msg)
@@ -623,4 +623,3 @@ SUBSYSTEM_DEF(explosions)
currentpart = SSEXPLOSIONS_TURFS
-#undef SSAIR_REBUILD_PIPENETS
diff --git a/code/game/machinery/shuttle/shuttle_heater.dm b/code/game/machinery/shuttle/shuttle_heater.dm
index 98468620c0e92..65a0480a1635c 100644
--- a/code/game/machinery/shuttle/shuttle_heater.dm
+++ b/code/game/machinery/shuttle/shuttle_heater.dm
@@ -90,7 +90,7 @@
var/datum/gas_mixture/air_contents = airs[1]
if(!air_contents)
return
- air_contents.set_volume(gas_capacity)
+ air_contents.volume = gas_capacity
air_contents.temperature = T20C
/obj/machinery/atmospherics/components/unary/shuttle/heater/proc/hasFuel(var/required)
diff --git a/code/game/objects/items/devices/transfer_valve.dm b/code/game/objects/items/devices/transfer_valve.dm
index 8b6d1ad9d75a1..9704d7d978555 100644
--- a/code/game/objects/items/devices/transfer_valve.dm
+++ b/code/game/objects/items/devices/transfer_valve.dm
@@ -134,8 +134,8 @@
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_one.air_contents.return_volume())
+ target.volume = target.return_volume() + tank_two.air_contents.return_volume()
+ target.volume = target.return_volume() + tank_one.air_contents.return_volume()
tank_one.air_contents.transfer_ratio_to(target, 1)
if(!target_self)
tank_two.air_contents.transfer_ratio_to(target, 1)
@@ -145,7 +145,7 @@
return
var/ratio1 = tank_one.air_contents.return_volume()/tank_two.air_contents.return_volume()
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())
+ tank_two.air_contents.volume tank_two.air_contents.return_volume() - tank_one.air_contents.return_volume()
/*
Exadv1: I know this isn't how it's going to work, but this was just to check
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 92bcca1b77fd2..296eb5bd7449c 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
@@ -219,8 +219,8 @@
..()
var/datum/gas_mixture/air1 = airs[1]
var/datum/gas_mixture/air2 = airs[2]
- air1.set_volume(1000)
- air2.set_volume(1000)
+ air1.volume = 1000
+ air2.volume = 1000
// Mapping
diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
index c7b83d6a70ca0..fd75fff07f301 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
@@ -58,7 +58,7 @@
/obj/machinery/atmospherics/components/trinary/mixer/New()
..()
var/datum/gas_mixture/air3 = airs[3]
- air3.set_volume(300)
+ air3.volume = 300
airs[3] = air3
/obj/machinery/atmospherics/components/trinary/mixer/process_atmos()
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 2fc2804e60a60..819b7d4918421 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm
@@ -21,7 +21,7 @@
/obj/machinery/atmospherics/components/unary/portables_connector/New()
..()
var/datum/gas_mixture/air_contents = airs[1]
- air_contents.set_volume(0)
+ air_contents.volume = 0
/obj/machinery/atmospherics/components/unary/portables_connector/Destroy()
if(connected_device)
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
index d612a4a07583c..2e2516adf7439 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
@@ -17,7 +17,7 @@
/obj/machinery/atmospherics/components/unary/tank/New()
..()
var/datum/gas_mixture/air_contents = airs[1]
- air_contents.set_volume(volume)
+ air_contents.volume = volume
air_contents.temperature = (T20C)
if(gas_type)
air_contents.gases[gas_type][MOLES] = AIR_CONTENTS
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 7a1fdaaa9d4a7..2425a207dcaaf 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
@@ -303,7 +303,7 @@
/obj/machinery/atmospherics/components/unary/vent_pump/high_volume/New()
..()
var/datum/gas_mixture/air_contents = airs[1]
- air_contents.set_volume(1000)
+ air_contents.volume = 1000
// mapping
diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm
index 839e234d40721..9c99be1edd409 100644
--- a/code/modules/mob/living/carbon/alien/life.dm
+++ b/code/modules/mob/living/carbon/alien/life.dm
@@ -50,7 +50,7 @@
breath = loc.remove_air_ratio(breath_ratio)
if(breath)
- breath.set_volume(BREATH_VOLUME)
+ breath.volume = BREATH_VOLUME
check_breath(breath)
/mob/living/carbon/alien/handle_status_effects(delta_time)
diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm
index 17b20c13348b2..e567deae5d383 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -141,7 +141,7 @@
loc_as_obj.handle_internal_lifeform(src,0)
if(breath)
- breath.set_volume(BREATH_VOLUME)
+ breath.volume = BREATH_VOLUME
check_breath(breath)
if(breath)
diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm
index 02cd7b683b7ee..c9aacdefb1491 100644
--- a/code/modules/vehicles/mecha/_mecha.dm
+++ b/code/modules/vehicles/mecha/_mecha.dm
@@ -327,7 +327,7 @@
/obj/vehicle/sealed/mecha/proc/add_cabin()
cabin_air = new
cabin_air.temperature = (T20C)
- cabin_air.set_volume(200)
+ cabin_air.volume = 200
cabin_air.gases[/datum/gas/oxygen][MOLES] = O2STANDARD*cabin_air.return_volume(
/(R_IDEAL_GAS_EQUATION*cabin_air.return_temperature()))
cabin_air.gases[/datum/gas/nitrogen][MOLES] = N2STANDARD*cabin_air.return_volume(
From f22201bbdc1d5d9756b5d3a4320308be4e654a36 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 15 Jul 2024 19:43:55 +0200
Subject: [PATCH 027/114] goodbye adjust heat
---
code/modules/research/experimentor.dm | 4 ++--
code/modules/research/server.dm | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm
index 4e90298ce3a9f..4e22c5ac4e5ac 100644
--- a/code/modules/research/experimentor.dm
+++ b/code/modules/research/experimentor.dm
@@ -373,7 +373,7 @@
else if(prob(EFFECT_PROB_MEDIUM-badThingCoeff))
visible_message("[src] malfunctions, melting [exp_on] and leaking hot air!")
var/datum/gas_mixture/env = loc.return_air()
- env.adjust_heat(100000)
+ env.temperature += 100000/env.heat_capacity()
air_update_turf(FALSE, FALSE)
investigate_log("Experimentor has released hot air.", INVESTIGATE_EXPERIMENTOR)
ejectItem(TRUE)
@@ -412,7 +412,7 @@
else if(prob(EFFECT_PROB_LOW-badThingCoeff))
visible_message("[src] malfunctions, shattering [exp_on] and leaking cold air!")
var/datum/gas_mixture/env = loc.return_air()
- env.adjust_heat(-75000)
+ env.temperature += -75000/env.heat_capacity()
air_update_turf(FALSE, FALSE)
investigate_log("Experimentor has released cold air.", INVESTIGATE_EXPERIMENTOR)
ejectItem(TRUE)
diff --git a/code/modules/research/server.dm b/code/modules/research/server.dm
index 312c09a28147e..44b222b4062f1 100644
--- a/code/modules/research/server.dm
+++ b/code/modules/research/server.dm
@@ -91,7 +91,7 @@
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)
+ env.temperature = (heating_power * perc * heat_gen) / env.heat_capacity()
air_update_turf(FALSE, FALSE)
src.air_update_turf(FALSE, FALSE)
else
From 9fe91e497ac5366cfe46a30d84aa8c042a847d2c Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Thu, 18 Jul 2024 15:15:24 +0200
Subject: [PATCH 028/114] Misc fixes.
---
code/__DEFINES/atmospherics.dm | 2 +-
code/game/objects/effects/overlays.dm | 11 +++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm
index cef8cf3f7a973..91f3cb9df689e 100644
--- a/code/__DEFINES/atmospherics.dm
+++ b/code/__DEFINES/atmospherics.dm
@@ -507,7 +507,7 @@
///Used to check if a machinery is visible. Called by update_pipe_vision(). On by default for all except cryo.
#define VENTCRAWL_CAN_SEE (1<<2)
-GLOBAL_LIST_INIT(pipe_paint_colors, sortList(list(
+GLOBAL_LIST_INIT(pipe_paint_colors, sort_list(list(
"amethyst" = rgb(130,43,255), //supplymain
"blue" = rgb(0,0,255),
"brown" = rgb(178,100,56),
diff --git a/code/game/objects/effects/overlays.dm b/code/game/objects/effects/overlays.dm
index 85c8babc56308..38f1f609ff235 100644
--- a/code/game/objects/effects/overlays.dm
+++ b/code/game/objects/effects/overlays.dm
@@ -83,3 +83,14 @@
layer = FLOAT_LAYER
vis_flags = VIS_INHERIT_ID
appearance_flags = KEEP_TOGETHER | LONG_GLIDE | PIXEL_SCALE
+
+/obj/effect/overlay/atmos_excited
+ name = "excited group"
+ icon = null
+ icon_state = null
+ anchored = TRUE // should only appear in vis_contents, but to be safe
+ appearance_flags = RESET_TRANSFORM | TILE_BOUND
+ invisibility = INVISIBILITY_ABSTRACT
+ mouse_opacity = MOUSE_OPACITY_TRANSPARENT
+ vis_flags = VIS_INHERIT_PLANE
+ plane = HIGH_GAME_PLANE
From 6729aa313a35f4f38375e5454de6ae44573c04e5 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Tue, 23 Jul 2024 14:54:58 +0200
Subject: [PATCH 029/114] Z-Pausing
---
code/controllers/subsystem/air.dm | 54 +++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index 8c8659a6119c9..d87e6947d9ef9 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -47,6 +47,14 @@ SUBSYSTEM_DEF(air)
var/list/queued_for_activation
var/display_all_groups = FALSE
+ // Supercruise Z-pausing
+ var/list/paused_z_levels //Paused z-levels will not add turfs to active
+ var/list/unpausing_z_levels = list()
+ var/list/unpause_processing = list()
+
+ var/list/pausing_z_levels = list()
+ var/list/pause_processing = list()
+
/datum/controller/subsystem/air/stat_entry(msg)
msg += "C:{"
@@ -87,6 +95,41 @@ SUBSYSTEM_DEF(air)
/datum/controller/subsystem/air/fire(resumed = FALSE)
var/timer = TICK_USAGE_REAL
+ //If we have unpausing z-level, process them first
+ if(length(unpausing_z_levels) && !length(unpause_processing))
+ var/z_value = unpausing_z_levels[1]
+ unpausing_z_levels.Remove(z_value)
+ unpause_processing = block(locate(1, 1, z_value), locate(world.maxx, world.maxy, z_value))
+
+ while(length(unpause_processing))
+ var/turf/T = unpause_processing[length(unpause_processing)]
+ if(!isspaceturf(T)) //Skip space turfs, since they won't have atmos
+ T.Initalize_Atmos()
+ //Goodbye
+ unpause_processing.len --
+ //We overran this tick, stop processing
+ //This may result in a very brief atmos freeze when running unpause_z at high loads
+ //but that is better than freezing the entire MC
+ if(MC_TICK_CHECK)
+ return
+
+ //If we have unpausing z-level, process them first
+ if(length(pausing_z_levels) && !length(pause_processing))
+ var/z_value = pausing_z_levels[1]
+ pausing_z_levels.Remove(z_value)
+ pause_processing = block(locate(1, 1, z_value), locate(world.maxx, world.maxy, z_value))
+
+ while(length(pause_processing))
+ var/turf/T = pause_processing[length(pause_processing)]
+ T.ImmediateDisableAdjacency()
+ //Goodbye
+ pause_processing.len --
+ //We overran this tick, stop processing
+ //This may result in a very brief atmos freeze when running unpause_z at high loads
+ //but that is better than freezing the entire MC
+ if(MC_TICK_CHECK)
+ return
+
//Rebuilds can happen at any time, so this needs to be done outside of the normal system
cost_rebuilds = 0
@@ -727,3 +770,14 @@ GLOBAL_LIST_EMPTY(colored_images)
ui.user.client.images -= GLOB.colored_images
plane.alpha = 0
return TRUE
+
+// Supercruise Z-pausing
+/datum/controller/subsystem/air/proc/pause_z(z_level)
+ LAZYADD(paused_z_levels, z_level)
+ unpausing_z_levels -= z_level
+ pausing_z_levels |= z_level
+
+/datum/controller/subsystem/air/proc/unpause_z(z_level)
+ pausing_z_levels -= z_level
+ unpausing_z_levels |= z_level
+ LAZYREMOVE(paused_z_levels, z_level)
From a6fe1d529ff64bb2ff1de0e80fc6ba20fd3b76fd Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 12 Aug 2024 03:02:00 +0200
Subject: [PATCH 030/114] Today's misc fixes
---
beestation.dme | 1 +
code/_globalvars/lists/color.dm | 7 +++++++
code/controllers/subsystem/air.dm | 1 -
code/datums/atmosphere/_atmosphere.dm | 2 +-
code/game/machinery/doors/airlock_types.dm | 2 +-
code/game/machinery/doors/door.dm | 2 +-
code/game/objects/effects/spawners/bombspawner.dm | 2 +-
code/game/objects/items/devices/scanners.dm | 4 ++--
code/game/objects/structures/aliens.dm | 2 +-
code/game/objects/structures/transit_tubes/station.dm | 7 ++++---
code/modules/admin/verbs/debug.dm | 2 +-
code/modules/antagonists/blob/structures/_blob.dm | 2 +-
code/modules/antagonists/cult/runes.dm | 2 +-
code/modules/atmospherics/environmental/LINDA_fire.dm | 2 +-
14 files changed, 23 insertions(+), 15 deletions(-)
create mode 100644 code/_globalvars/lists/color.dm
diff --git a/beestation.dme b/beestation.dme
index 2cf4be02cb505..4191d2618d811 100644
--- a/beestation.dme
+++ b/beestation.dme
@@ -318,6 +318,7 @@
#include "code\_globalvars\lists\admin.dm"
#include "code\_globalvars\lists\ambience.dm"
#include "code\_globalvars\lists\client.dm"
+#include "code\_globalvars\lists\color.dm"
#include "code\_globalvars\lists\flavor_misc.dm"
#include "code\_globalvars\lists\jobs.dm"
#include "code\_globalvars\lists\maintenance_loot.dm"
diff --git a/code/_globalvars/lists/color.dm b/code/_globalvars/lists/color.dm
new file mode 100644
index 0000000000000..26c0d89b9f188
--- /dev/null
+++ b/code/_globalvars/lists/color.dm
@@ -0,0 +1,7 @@
+GLOBAL_LIST_INIT(contrast_colors, list(
+ COLOR_BLACK,
+ COLOR_DARK_CYAN,
+ COLOR_RED,
+ COLOR_TAN_ORANGE,
+ COLOR_VIOLET,
+))
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index d87e6947d9ef9..194f58b780984 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -734,7 +734,6 @@ GLOBAL_LIST_EMPTY(colored_images)
if(!target)
return
usr.forceMove(target)
- usr.update_parallax_contents()
if("toggle-freeze")
can_fire = !can_fire
return TRUE
diff --git a/code/datums/atmosphere/_atmosphere.dm b/code/datums/atmosphere/_atmosphere.dm
index f2a97fc54c7b0..7747391caeaa8 100644
--- a/code/datums/atmosphere/_atmosphere.dm
+++ b/code/datums/atmosphere/_atmosphere.dm
@@ -55,6 +55,6 @@
// Now finally lets make that string
var/list/gas_string_builder = list()
for(var/i in gasmix.gases)
- gas_string_builder += "[GLOB.gas_data.ids[i]]=[gasmix.gases[i][MOLES]]"
+ gas_string_builder += "[gasmix.gases[i][GAS_META][META_GAS_ID]]=[gasmix.gases[i][MOLES]]"
gas_string_builder += "TEMP=[gasmix.return_temperature()]"
gas_string = gas_string_builder.Join(";")
diff --git a/code/game/machinery/doors/airlock_types.dm b/code/game/machinery/doors/airlock_types.dm
index 06a3ab6af3d4f..12bfa5067ab41 100644
--- a/code/game/machinery/doors/airlock_types.dm
+++ b/code/game/machinery/doors/airlock_types.dm
@@ -244,7 +244,7 @@
DA.update_icon()
DA.update_name()
-/obj/machinery/door/airlock/plasma/BlockThermalConductivity() //we don't stop the heat~
+/obj/machinery/door/airlock/plasma/BlockSuperconductivity() //we don't stop the heat~
return 0
/obj/machinery/door/airlock/plasma/attackby(obj/item/C, mob/user, params)
diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm
index d064629674ee2..5ae0693a5e97a 100644
--- a/code/game/machinery/doors/door.dm
+++ b/code/game/machinery/doors/door.dm
@@ -397,7 +397,7 @@
if(!glass && GLOB.cameranet)
GLOB.cameranet.updateVisibility(src, 0)
-/obj/machinery/door/BlockThermalConductivity() // All non-glass airlocks block heat, this is intended.
+/obj/machinery/door/BlockSuperconductivity() // All non-glass airlocks block heat, this is intended.
if(opacity || heat_proof)
return 1
return 0
diff --git a/code/game/objects/effects/spawners/bombspawner.dm b/code/game/objects/effects/spawners/bombspawner.dm
index 6d55471a4b9f0..64e0cf6a8ca12 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.gas_data.specific_heats[/datum/gas/plasma]) / (((PRESSURE_P) * GLOB.gas_data.specific_heats[/datum/gas/plasma] + (PRESSURE_O) * GLOB.gas_data.specific_heats[/datum/gas/oxygen]) / PLASMA_UPPER_TEMPERATURE - (PRESSURE_O) * GLOB.gas_data.specific_heats[/datum/gas/oxygen] / CELSIUS_TO_KELVIN(TEMP_O)))
+#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_RATIO(PRESSURE_P,PRESSURE_O,TEMP_O) (CELSIUS_TO_KELVIN(TEMP_O) * PLASMA_OXYGEN_FULLBURN * (PRESSURE_P) / (PRESSURE_O))
/obj/effect/spawner/newbomb
diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm
index e973ce2d5ebc7..0347a3fe810bc 100644
--- a/code/game/objects/items/devices/scanners.dm
+++ b/code/game/objects/items/devices/scanners.dm
@@ -664,7 +664,7 @@ GENE SCANNER
for(var/id in air_contents.gases)
var/gas_concentration = air_contents.gases[id][MOLES]/total_moles
- message += "[GLOB.gas_data.names[id]]: [round(gas_concentration*100, 0.01)] % ([round(air_contents.gases[id][MOLES], 0.01)] mol)"
+ message += "[[air_contents.gases[id][GAS_META][META_GAS_NAME]]]: [round(gas_concentration*100, 0.01)] % ([round(air_contents.gases[id][MOLES], 0.01)] mol)"
message += "Temperature: [round(temperature - T0C,0.01)] °C ([round(temperature, 0.01)] K)"
else
@@ -727,7 +727,7 @@ GENE SCANNER
if(id in GLOB.hardcoded_gases)
continue
var/gas_concentration = environment.gases[id][MOLES]/total_moles
- message += "[gases[id][GAS_META][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] % ([round(environment.gases[id][MOLES], 0.01)] mol)"
+ message += "[environment.gases[id][GAS_META][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] % ([round(environment.gases[id][MOLES], 0.01)] mol)"
message += "Temperature: [round(environment.return_temperature()-T0C, 0.01)] °C ([round(environment.return_temperature(), 0.01)] K)"
to_chat(user, EXAMINE_BLOCK(jointext(message, "\n")))
diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm
index b458bea80e71a..e9ba9ff3aed15 100644
--- a/code/game/objects/structures/aliens.dm
+++ b/code/game/objects/structures/aliens.dm
@@ -88,7 +88,7 @@
smoothing_groups = list(SMOOTH_GROUP_ALIEN_RESIN, SMOOTH_GROUP_ALIEN_WALLS)
canSmoothWith = list(SMOOTH_GROUP_ALIEN_WALLS)
-/obj/structure/alien/resin/wall/BlockThermalConductivity()
+/obj/structure/alien/resin/wall/BlockSuperconductivity()
return 1
/obj/structure/alien/resin/membrane
diff --git a/code/game/objects/structures/transit_tubes/station.dm b/code/game/objects/structures/transit_tubes/station.dm
index e867c501447a1..ebf695a4448e0 100644
--- a/code/game/objects/structures/transit_tubes/station.dm
+++ b/code/game/objects/structures/transit_tubes/station.dm
@@ -152,9 +152,10 @@
sleep(OPEN_DURATION + 2)
pod_moving = 0
if(!QDELETED(pod))
- var/datum/gas_mixture/floor_mixture = loc.return_air()
- equalize_all_gases_in_list(list(pod.air_contents,floor_mixture))
- air_update_turf(FALSE, FALSE)
+ return
+ var/datum/gas_mixture/floor_mixture = loc.return_air()
+ pod.air_contents.equalize(floor_mixture)
+ air_update_turf(FALSE, FALSE)
/obj/structure/transit_tube/station/init_tube_dirs()
switch(dir)
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index 2008ff6d78e9b..63e101b094d6a 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -951,7 +951,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
if(!check_rights(R_DEBUG) || !C)
return
- var/gas_to_add = input(usr, "Choose a gas to modify.", "Choose a gas.") as null|anything in GLOB.gas_data.ids
+ var/gas_to_add = input(usr, "Choose a gas to modify.", "Choose a gas.") as null|anything in subtypesof(/datum/gas)
var/amount = input(usr, "Choose the amount of moles.", "Choose the amount.", 0) as num
var/temp = input(usr, "Choose the temperature (Kelvin).", "Choose the temp (K).", 0) as num
diff --git a/code/modules/antagonists/blob/structures/_blob.dm b/code/modules/antagonists/blob/structures/_blob.dm
index a77b11b5ce668..9019d0543b3bd 100644
--- a/code/modules/antagonists/blob/structures/_blob.dm
+++ b/code/modules/antagonists/blob/structures/_blob.dm
@@ -65,7 +65,7 @@
result++
. -= result - 1
-/obj/structure/blob/BlockThermalConductivity()
+/obj/structure/blob/BlockSuperconductivity()
return atmosblock
/obj/structure/blob/CanAtmosPass(turf/T)
diff --git a/code/modules/antagonists/cult/runes.dm b/code/modules/antagonists/cult/runes.dm
index b5f983fb2db9e..1f7a20cebcc09 100644
--- a/code/modules/antagonists/cult/runes.dm
+++ b/code/modules/antagonists/cult/runes.dm
@@ -684,7 +684,7 @@ structure_check() searches for nearby cultist structures required for the invoca
GLOB.wall_runes -= src
return ..()
-/obj/effect/rune/wall/BlockThermalConductivity()
+/obj/effect/rune/wall/BlockSuperconductivity()
return density
/obj/effect/rune/wall/invoke(var/list/invokers)
diff --git a/code/modules/atmospherics/environmental/LINDA_fire.dm b/code/modules/atmospherics/environmental/LINDA_fire.dm
index dfa005bd02b05..adf0caf795cb1 100644
--- a/code/modules/atmospherics/environmental/LINDA_fire.dm
+++ b/code/modules/atmospherics/environmental/LINDA_fire.dm
@@ -137,7 +137,7 @@
var/mutable_appearance/fusion_overlay = mutable_appearance('icons/effects/atmospherics.dmi', "fusion_gas")
fusion_overlay.blend_mode = BLEND_ADD
fusion_overlay.alpha = fusion_amt * 255
- var/mutable_appearance/rainbow_overlay = mutable_appearance('icons/hud/screen_gen.dmi', "druggy")
+ var/mutable_appearance/rainbow_overlay = mutable_appearance('icons/mob/screen_gen.dmi', "druggy")
rainbow_overlay.blend_mode = BLEND_ADD
rainbow_overlay.alpha = fusion_amt * 255
rainbow_overlay.appearance_flags = RESET_COLOR
From 237d42467d8dc4b727d49b068f7a0ca031a1ccf2 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 12 Aug 2024 17:22:16 +0200
Subject: [PATCH 031/114] Today's fixes (117 errors!)
---
code/__DEFINES/atmospherics.dm | 2 ++
code/game/machinery/computer/atmos_control.dm | 2 +-
.../objects/items/devices/transfer_valve.dm | 2 +-
code/game/turfs/change_turf.dm | 1 -
code/game/turfs/open/_open.dm | 1 -
.../game/turfs/open/floor/plating/asteroid.dm | 2 --
.../turfs/open/floor/plating/misc_plating.dm | 1 -
code/game/turfs/open/space/space.dm | 1 -
code/game/turfs/turf.dm | 1 -
.../atmospherics/gasmixtures/gas_mixture.dm | 10 ++++++
.../gasmixtures/immutable_mixtures.dm | 6 ++++
.../atmospherics/machinery/airalarm.dm | 10 +++---
.../components/binary_devices/pump.dm | 16 +++------
.../components/trinary_devices/filter.dm | 4 +--
.../components/unary_devices/cryo.dm | 35 ++++++++-----------
.../components/unary_devices/passive_vent.dm | 18 +++-------
.../components/unary_devices/tank.dm | 2 +-
.../components/unary_devices/vent_scrubber.dm | 4 +--
.../atmospherics/machinery/pipes/pipes.dm | 2 +-
.../machinery/portable/canister.dm | 15 ++++----
.../machinery/portable/scrubber.dm | 4 +--
.../mob/living/simple_animal/bot/atmosbot.dm | 2 +-
code/modules/mob/mob.dm | 2 +-
.../file_system/programs/atmosscan.dm | 2 +-
code/modules/power/supermatter/supermatter.dm | 4 +--
code/modules/shuttle/on_move.dm | 3 --
code/modules/vehicles/mecha/_mecha.dm | 6 ++--
27 files changed, 69 insertions(+), 89 deletions(-)
diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm
index 91f3cb9df689e..f2470a214f17e 100644
--- a/code/__DEFINES/atmospherics.dm
+++ b/code/__DEFINES/atmospherics.dm
@@ -84,6 +84,7 @@
#define MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION (T20C+80)
#define MINIMUM_TEMPERATURE_START_SUPERCONDUCTION (T20C+400)
+
//HEAT TRANSFER COEFFICIENTS
//Must be between 0 and 1. Values closer to 1 equalize temperature faster
//Should not exceed 0.4 else strange heat flow occur
@@ -580,3 +581,4 @@ GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
#define TURFS_CAN_SHARE(T1, T2) (LAZYACCESS(T2.atmos_adjacent_turfs, T1) || LAZYLEN(T1.atmos_adjacent_turfs & T2.atmos_adjacent_turfs))
//Use this to see if a turf is fully blocked or not, think windows or firelocks. Fails with 1x1 non full tile windows, but it's not worth the cost.
#define TURF_SHARES(T) (LAZYLEN(T.atmos_adjacent_turfs))
+
diff --git a/code/game/machinery/computer/atmos_control.dm b/code/game/machinery/computer/atmos_control.dm
index 910edfd673213..84911fc8e5c3e 100644
--- a/code/game/machinery/computer/atmos_control.dm
+++ b/code/game/machinery/computer/atmos_control.dm
@@ -68,7 +68,7 @@
var/total_moles = air_sample.total_moles()
if(total_moles)
for(var/gas in air_sample.gases)
- var/gas_name = GLOB.gas_data.names[gas]
+ var/gas_name = air_sample.gases[gas][META][META_GAS_NAME]
signal.data["gases"][gas_name] = gas[MOLES] / total_moles * 100
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
diff --git a/code/game/objects/items/devices/transfer_valve.dm b/code/game/objects/items/devices/transfer_valve.dm
index 9704d7d978555..ff14f5f63b4e1 100644
--- a/code/game/objects/items/devices/transfer_valve.dm
+++ b/code/game/objects/items/devices/transfer_valve.dm
@@ -145,7 +145,7 @@
return
var/ratio1 = tank_one.air_contents.return_volume()/tank_two.air_contents.return_volume()
tank_two.air_contents.transfer_ratio_to(tank_one.air_contents, ratio1)
- tank_two.air_contents.volume tank_two.air_contents.return_volume() - tank_one.air_contents.return_volume()
+ tank_two.air_contents.volume = tank_two.air_contents.return_volume() - tank_one.air_contents.return_volume()
/*
Exadv1: I know this isn't how it's going to work, but this was just to check
diff --git a/code/game/turfs/change_turf.dm b/code/game/turfs/change_turf.dm
index 6f89885f81b73..e2d8ff20cce2f 100644
--- a/code/game/turfs/change_turf.dm
+++ b/code/game/turfs/change_turf.dm
@@ -168,7 +168,6 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
return
var/turf/open/newTurf = .
newTurf.air.copy_from(stashed_air)
- update_air_ref(planetary_atmos ? 1 : 2)
QDEL_NULL(stashed_air)
newTurf.excited = stashed_state
newTurf.excited_group = stashed_group
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index 1c2b5ee2529c6..e1bbf8dd4e9b2 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -181,7 +181,6 @@
if(!istype(air,/datum/gas_mixture/turf))
air = new(2500,src)
air.copy_from_turf(src)
- update_air_ref(planetary_atmos ? 1 : 2)
update_visuals()
current_cycle = times_fired
diff --git a/code/game/turfs/open/floor/plating/asteroid.dm b/code/game/turfs/open/floor/plating/asteroid.dm
index 8d7c381635533..f7a5008e783da 100644
--- a/code/game/turfs/open/floor/plating/asteroid.dm
+++ b/code/game/turfs/open/floor/plating/asteroid.dm
@@ -92,7 +92,6 @@
GM = new
. = ..()
air = GM
- update_air_ref(2)
return
/turf/open/floor/plating/lavaland_baseturf
@@ -150,7 +149,6 @@
GM = new
. = ..()
air = GM
- update_air_ref(2)
return
/turf/open/floor/plating/asteroid/airless
diff --git a/code/game/turfs/open/floor/plating/misc_plating.dm b/code/game/turfs/open/floor/plating/misc_plating.dm
index ca8401dcb2bde..393fbc15d5feb 100644
--- a/code/game/turfs/open/floor/plating/misc_plating.dm
+++ b/code/game/turfs/open/floor/plating/misc_plating.dm
@@ -132,7 +132,6 @@
GM = new
. = ..()
air = GM
- update_air_ref(2)
return
/turf/open/floor/plating/beach
diff --git a/code/game/turfs/open/space/space.dm b/code/game/turfs/open/space/space.dm
index cedbc016227f2..961a124b98a4d 100644
--- a/code/game/turfs/open/space/space.dm
+++ b/code/game/turfs/open/space/space.dm
@@ -60,7 +60,6 @@
if(!space_gas)
space_gas = new
air = space_gas
- update_air_ref(0)
if(flags_1 & INITIALIZED_1)
stack_trace("Warning: [src]([type]) initialized multiple times!")
diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm
index 42a69b3b4ba7b..351b017164f51 100644
--- a/code/game/turfs/turf.dm
+++ b/code/game/turfs/turf.dm
@@ -147,7 +147,6 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists)
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()))
//Handle turf texture
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index 16058a899efe1..fe37dc93bcc25 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -558,3 +558,13 @@ get_true_breath_pressure(pp) --> gas_pp = pp/breath_pp*total_moles()
return TRUE
return FALSE
+
+/datum/gas_mixture/proc/scrub_into(datum/gas_mixture/target, ratio, list/gases)
+ for (var/gas in gases)
+ transfer_ratio_to(target, ratio)
+
+/datum/gas_mixture/proc/transfer_to(datum/gas_mixture/receiver, var/moles)
+ return receiver.merge(remove(moles))
+
+/datum/gas_mixture/proc/transfer_ratio_to(datum/gas_mixture/receiver, var/ratio)
+ return receiver.merge(remove_ratio(ratio))
diff --git a/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm b/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
index a0661810c5996..1f262d88ba369 100644
--- a/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
+++ b/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
@@ -54,6 +54,12 @@
/datum/gas_mixture/immutable/space/remove_ratio()
return copy() //we're always empty, so we can just return a copy.
+//used by cloners
+/datum/gas_mixture/immutable/cloner
+ initial_temperature = T20C
+/datum/gas_mixture/immutable/cloner/populate()
+ set_moles(GAS_N2, MOLES_O2STANDARD + MOLES_N2STANDARD)
+
//planet side stuff
/datum/gas_mixture/immutable/planetary
var/list/initial_gas = list()
diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm
index b66a0b5af3720..0014d4cfeda90 100644
--- a/code/modules/atmospherics/machinery/airalarm.dm
+++ b/code/modules/atmospherics/machinery/airalarm.dm
@@ -293,7 +293,7 @@
continue
cur_tlv = TLV[gas_id]
data["environment_data"] += list(list(
- "name" = GLOB.gas_data.names[gas_id],
+ "name" = GLOB.meta_gas_info[gas_id][META_GAS_NAME],
"value" = environment.gases[gas_id][MOLES] / total_moles * 100,
"unit" = "%",
"danger_level" = cur_tlv.get_danger_level(environment.gases[gas_id][MOLES] * partial_pressure)
@@ -363,11 +363,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.gas_data.names)
+ for(var/gas_id in subtypesof(/datum/gas))
if(!(gas_id in TLV)) // We're not interested in this gas, it seems.
continue
selected = TLV[gas_id]
- thresholds += list(list("name" = GLOB.gas_data.names[gas_id], "settings" = list()))
+ thresholds += list(list("name" = GLOB.meta_gas_info[gas_id][META_GAS_NAME], "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))
@@ -896,8 +896,8 @@
"Temperature" = "temperature"
)
- for(var/gas_id in GLOB.gas_data.ids)
- component_options[GLOB.gas_data.names[gas_id]] = gas_id
+ for(var/gas in subtypesof(/datum/gas))
+ component_options[GLOB.meta_gas_info[gas][META_GAS_NAME]] = GLOB.meta_gas_info[gas][META_GAS_ID]
air_alarm_options = add_option_port("Air Alarm Options", component_options)
options_map = component_options
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
index 7496fa99b06d6..aff25fd25b68b 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
@@ -62,19 +62,11 @@
// ..()
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)
-
- air1.transfer_to(air2,transfer_moles)
+ var/datum/gas_mixture/input_air = airs[1]
+ var/datum/gas_mixture/output_air = airs[2]
+ var/datum/gas_mixture/output_pipenet_air = parents[2].air
+ if(input_air.pump_gas_to(output_air, target_pressure, output_pipenet_air = output_pipenet_air))
update_parents()
/obj/machinery/atmospherics/components/binary/pump/proc/set_on(active)
diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
index 214f4b5df4eb1..275460d236432 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
@@ -138,8 +138,8 @@
data["filter_types"] = list()
data["filter_types"] += list(list("name" = "Nothing", "id" = "", "selected" = !filter_type))
- for(var/id in GLOB.gas_data.ids)
- data["filter_types"] += list(list("name" = GLOB.gas_data.names[id], "id" = id, "selected" = (id == filter_type)))
+ for(var/id in subtypesof(/datum/gas))
+ data["filter_types"] += list(list("name" = GLOB.meta_gas_info[id][META_GAS_NAME], "id" = id, "selected" = (id == filter_type)))
return data
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
index aa40107f02adb..8b842cff5ca30 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
@@ -1,6 +1,9 @@
#define CRYOMOBS 'icons/obj/cryo_mobs.dmi'
#define CRYO_MULTIPLY_FACTOR 1.5 // Multiply factor is used with efficiency to multiply Tx quantity and how much extra is transfered to occupant magically.
#define CRYO_TX_QTY 0.4 // Tx quantity is how much volume should be removed from the cell's beaker - multiplied by delta_time
+#define CRYO_MIN_GAS_MOLES 5
+#define MAX_TEMPERATURE 4000
+
/obj/machinery/atmospherics/components/unary/cryo_cell
name = "cryo cell"
@@ -233,45 +236,33 @@
var/datum/gas_mixture/air1 = airs[1]
- if(!nodes[1] || !airs[1] || !air1.gases.len || air1.gases[/datum/gas/oxygen][MOLES] < CRYO_MIN_GAS_MOLES) // Turn off if the machine won't work.
- var/msg = "Insufficient cryogenic gas, shutting down."
+ if(!nodes[1] || !airs[1] || air1.gases[/datum/gas/oxygen][MOLES] < 5) // Turn off if the machine won't work due to not having enough moles to operate.
+ on = FALSE
+ update_icon()
+ var/msg = "Aborting. Not enough gas present to operate."
radio.talk_into(src, msg, radio_channel)
- set_on(FALSE)
return
if(occupant)
var/mob/living/mob_occupant = occupant
var/cold_protection = 0
- var/temperature_delta = air1.temperature - mob_occupant.bodytemperature // The only semi-realistic thing here: share temperature between the cell and the occupant.
+ var/temperature_delta = air1.return_temperature() - mob_occupant.bodytemperature // The only semi-realistic thing here: share temperature between the cell and the occupant.
if(ishuman(mob_occupant))
var/mob/living/carbon/human/H = mob_occupant
- cold_protection = H.get_cold_protection(air1.temperature)
+ cold_protection = H.get_cold_protection(air1.return_temperature())
if(abs(temperature_delta) > 1)
var/air_heat_capacity = air1.heat_capacity()
var/heat = ((1 - cold_protection) * 0.1 + conduction_coefficient) * temperature_delta * (air_heat_capacity * heat_capacity / (air_heat_capacity + heat_capacity))
- air1.temperature = clamp(air1.temperature - heat / air_heat_capacity, TCMB, MAX_TEMPERATURE)
+ air1.temperature = max(air1.return_temperature() - heat / air_heat_capacity, TCMB)
mob_occupant.adjust_bodytemperature(heat / heat_capacity, TCMB)
- //lets have the core temp match the body temp in humans
- if(ishuman(mob_occupant))
- var/mob/living/carbon/human/humi = mob_occupant
- humi.adjust_coretemperature(humi.bodytemperature - humi.coretemperature)
-
- if(consume_gas) // Transferring reagent costs us extra gas
- air1.gases[/datum/gas/oxygen][MOLES] -= max(0, 2 / efficiency + 1 / efficiency) // Magically consume gas? Why not, we run on cryo magic.
- consume_gas = FALSE
- if(!consume_gas)
- air1.gases[/datum/gas/oxygen][MOLES] -= max(0, 2 / efficiency)
- air1.garbage_collect()
-
- if(air1.temperature > 2000)
- take_damage(clamp((air1.temperature)/200, 10, 20), BURN)
+ air1.gases[/datum/gas/oxygen][MOLES] = max(0,air1.gases[/datum/gas/oxygen][MOLES] - 0.5 / efficiency) // Magically consume gas? Why not, we run on cryo magic.
- update_parents()
+ update_parents()
/obj/machinery/atmospherics/components/unary/cryo_cell/open_machine(drop = FALSE)
if(!state_open && !panel_open)
@@ -493,3 +484,5 @@
#undef CRYOMOBS
#undef CRYO_MULTIPLY_FACTOR
#undef CRYO_TX_QTY
+#undef CRYO_MIN_GAS_MOLES
+#undef MAX_TEMPERATURE
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 306b15289c105..dbb3bedc882a2 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm
@@ -20,24 +20,14 @@
icon_state = "passive_vent"
/obj/machinery/atmospherics/components/unary/passive_vent/process_atmos()
- ..()
- if(isclosedturf(loc))
+ var/turf/location = get_turf(loc)
+ if(isclosedturf(location))
return
- var/active = FALSE
- var/datum/gas_mixture/external = loc.return_air()
+ 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(active)
+ if(internal.equalize(external))
air_update_turf(FALSE, FALSE)
update_parents()
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
index 2e2516adf7439..529491c396c06 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
@@ -22,7 +22,7 @@
if(gas_type)
air_contents.gases[gas_type][MOLES] = AIR_CONTENTS
- name = "[name] ([GLOB.gas_data.names[gas_type]])"
+ name = "[name] ([GLOB.meta_gas_info[gas_type][META_GAS_NAME]])"
setPipingLayer(piping_layer)
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 c250f3ea8fe49..0b622fcf12a89 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
@@ -97,8 +97,8 @@
return FALSE
var/list/f_types = list()
- 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)))
+ for(var/id in subtypesof(/datum/gas))
+ f_types += list(list("gas_id" = id, "gas_name" = GLOB.meta_gas_info[id][META_GAS_NAME], "enabled" = (id in filter_types)))
var/datum/signal/signal = new(list(
"tag" = id_tag,
diff --git a/code/modules/atmospherics/machinery/pipes/pipes.dm b/code/modules/atmospherics/machinery/pipes/pipes.dm
index f97100dc8b213..cf2a83542be00 100644
--- a/code/modules/atmospherics/machinery/pipes/pipes.dm
+++ b/code/modules/atmospherics/machinery/pipes/pipes.dm
@@ -12,7 +12,7 @@
//Buckling
can_buckle = TRUE
buckle_requires_restraints = TRUE
- buckle_lying = NO_BUCKLE_LYING
+ buckle_lying = -1
/obj/machinery/atmospherics/pipe/New()
add_atom_colour(pipe_color, FIXED_COLOUR_PRIORITY)
diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm
index 565c0de8e8899..2997c03169b7f 100644
--- a/code/modules/atmospherics/machinery/portable/canister.dm
+++ b/code/modules/atmospherics/machinery/portable/canister.dm
@@ -101,10 +101,10 @@
if(!attached_can.holding)
var/list/danger = list()
for(var/id in attached_can.air_contents.gases)
- if(!(GLOB.gas_data.flags[id] & GAS_FLAG_DANGEROUS))
+ if(!(GLOB.meta_gas_info[id][META_GAS_DANGER]))
continue
- if(attached_can.air_contents.gases[id][MOLES] > (GLOB.gas_data.visibility[id] || MOLES_GAS_VISIBLE)) //if moles_visible is undefined, default to default visibility
- danger[GLOB.gas_data.names[id]] = attached_can.air_contents.gases[id][MOLES] //ex. "plasma" = 20
+ if(attached_can.air_contents.gases[id][MOLES] > (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]] = attached_can.air_contents.gases[id][MOLES] //ex. "plasma" = 20
if(danger.len && attached_can.valve_open)
message_admins("[parent.get_creator_admin()]'s circuit opened a canister that contains the following at [ADMIN_VERBOSEJMP(attached_can)]:")
@@ -274,8 +274,7 @@
if(gas_type)
if(starter_temp)
air_contents.temperature = (starter_temp)
- if(!air_contents.return_volume())
- CRASH("Auxtools is failing somehow! Gas with pointer [air_contents._extools_pointer_gasmixture] is not valid.")
+
air_contents.gases[gas_type][MOLES] = (maximum_pressure * filled* air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature()))
/obj/machinery/portable_atmospherics/canister/air/create_gas()
@@ -534,10 +533,10 @@
if(!holding)
var/list/danger = list()
for(var/id in air_contents.gases)
- if(!(GLOB.gas_data.flags[id] & GAS_FLAG_DANGEROUS))
+ if(!(GLOB.meta_gas_info[id][META_GAS_DANGER]))
continue
- if(air_contents.gases[id][MOLES] > (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.gases[id][MOLES] //ex. "plasma" = 20
+ if(air_contents.gases[id][MOLES] > (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.gases[id][MOLES] //ex. "plasma" = 20
if(danger.len && user)
message_admins("[ADMIN_LOOKUPFLW(user)] opened a canister that contains the following at [ADMIN_VERBOSEJMP(src)]:")
diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm
index 7f4f3b8ff548d..b7564a8d2e434 100644
--- a/code/modules/atmospherics/machinery/portable/scrubber.dm
+++ b/code/modules/atmospherics/machinery/portable/scrubber.dm
@@ -75,8 +75,8 @@
data["id_tag"] = -1 //must be defined in order to reuse code between portable and vent scrubbers
data["filter_types"] = list()
- 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)))
+ for(var/gas_type in subtypesof(/datum/gas))
+ data["filter_types"] += list(list("gas_id" = meta_gas_info[gas_type][META_GAS_ID], "gas_name" = GLOB.meta_gas_info[gas_type][META_GAS_NAME], "enabled" = (id in scrubbing)))
if(holding)
data["holding"] = list()
diff --git a/code/modules/mob/living/simple_animal/bot/atmosbot.dm b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
index 05a008155fbce..afe01b67a9289 100644
--- a/code/modules/mob/living/simple_animal/bot/atmosbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
@@ -327,7 +327,7 @@
dat += "Gas Scrubbing Controls "
for(var/gas_id in gasses)
var/gas_enabled = gasses[gas_id]
- dat += "[GLOB.gas_data.names[gas_id]]: [gas_enabled?"Scrubbing":"Not Scrubbing"] "
+ dat += "[GLOB.meta_gas_info[gas_id][META_GAS_NAME]]: [gas_enabled?"Scrubbing":"Not Scrubbing"] "
dat += "Patrol Station: [auto_patrol ? "Yes" : "No"] "
return dat
diff --git a/code/modules/mob/mob.dm b/code/modules/mob/mob.dm
index 7f5b6398c3749..e587777cdc4a6 100644
--- a/code/modules/mob/mob.dm
+++ b/code/modules/mob/mob.dm
@@ -140,7 +140,7 @@
t += "Temperature: [environment.return_temperature()] \n"
for(var/id in environment.gases)
if(environment.gases[id][MOLES])
- t+="[GLOB.gas_data.names[id]]: [environment.gases[id][MOLES]] \n"
+ t+="[GLOB.meta_gas_info[id][META_GAS_NAME]]: [environment.gases[id][MOLES]] \n"
to_chat(usr, t)
diff --git a/code/modules/modular_computers/file_system/programs/atmosscan.dm b/code/modules/modular_computers/file_system/programs/atmosscan.dm
index 6d6d20c270fb5..99c55919cbf73 100644
--- a/code/modules/modular_computers/file_system/programs/atmosscan.dm
+++ b/code/modules/modular_computers/file_system/programs/atmosscan.dm
@@ -33,7 +33,7 @@
for(var/id in environment.gases)
var/gas_level = environment.gases[id][MOLES]/total_moles
if(gas_level > 0)
- airlist += list(list("name" = "[GLOB.gas_data.names[id]]", "percentage" = round(gas_level*100, 0.01)))
+ airlist += list(list("name" = "[GLOB.meta_gas_info[id][META_GAS_NAME]]", "percentage" = round(gas_level*100, 0.01)))
data["AirData"] = airlist
else
data["AirPressure"] = 0
diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm
index afb2c047d92a1..4be4621dce70a 100644
--- a/code/modules/power/supermatter/supermatter.dm
+++ b/code/modules/power/supermatter/supermatter.dm
@@ -224,12 +224,12 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
data["SM_moles"] = air.total_moles()
for(var/gasid in air.gases)
gasdata.Add(list(list(
- "name"= GLOB.gas_data.names[gasid],
+ "name"= air.gases[gasid][GAS_META][META_GAS_NAME],
"amount" = round(100*air.gases[gasid][MOLES]/air.total_moles(),0.01))))
else
for(var/gasid in air.gases)
gasdata.Add(list(list(
- "name"= GLOB.gas_data.names[gasid],
+ "name"= air.gases[gasid][GAS_META][META_GAS_NAME],
"amount" = 0)))
data["gases"] = gasdata
return data
diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm
index 6a256244e5e26..4e9defeb8a6c7 100644
--- a/code/modules/shuttle/on_move.dm
+++ b/code/modules/shuttle/on_move.dm
@@ -73,9 +73,6 @@ All ShuttleMove procs go here
if(isopenturf(src))
var/turf/open/after_src_terf = src
- update_air_ref(isspaceturf(src) ? 0 : (after_src_terf.planetary_atmos ? 1 : 2))
- else
- update_air_ref(-1)
//Air stuff
newT.air_update_turf(TRUE, FALSE)
diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm
index c9aacdefb1491..bd067af63d11d 100644
--- a/code/modules/vehicles/mecha/_mecha.dm
+++ b/code/modules/vehicles/mecha/_mecha.dm
@@ -328,10 +328,8 @@
cabin_air = new
cabin_air.temperature = (T20C)
cabin_air.volume = 200
- cabin_air.gases[/datum/gas/oxygen][MOLES] = O2STANDARD*cabin_air.return_volume(
-/(R_IDEAL_GAS_EQUATION*cabin_air.return_temperature()))
- cabin_air.gases[/datum/gas/nitrogen][MOLES] = N2STANDARD*cabin_air.return_volume(
-/(R_IDEAL_GAS_EQUATION*cabin_air.return_temperature()))
+ cabin_air.gases[/datum/gas/oxygen][MOLES] = O2STANDARD*cabin_air.return_volume()/(R_IDEAL_GAS_EQUATION*cabin_air.return_temperature())
+ cabin_air.gases[/datum/gas/nitrogen][MOLES] = N2STANDARD*cabin_air.return_volume()/(R_IDEAL_GAS_EQUATION*cabin_air.return_temperature())
return cabin_air
/obj/vehicle/sealed/mecha/proc/add_radio()
From fee100cf508ecd8532bf538c1e0d66fb26e956ca Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sun, 18 Aug 2024 13:12:32 +0200
Subject: [PATCH 032/114] kills generic fire
---
code/__DEFINES/colors.dm | 2 +
code/game/machinery/computer/atmos_control.dm | 2 +-
.../atmospherics/gasmixtures/reactions.dm | 78 -------------------
.../components/trinary_devices/filter.dm | 6 +-
4 files changed, 6 insertions(+), 82 deletions(-)
diff --git a/code/__DEFINES/colors.dm b/code/__DEFINES/colors.dm
index b9ea20e1c6d97..3d91146dce07d 100644
--- a/code/__DEFINES/colors.dm
+++ b/code/__DEFINES/colors.dm
@@ -79,6 +79,8 @@
#define COLOR_DARK_ORANGE "#C3630C"
#define COLOR_BEIGE "#CEB689"
#define COLOR_DARK_MODERATE_ORANGE "#8B633B"
+#define COLOR_TAN_ORANGE "#FF7B00"
+
#define COLOR_BROWN "#BA9F6D"
#define COLOR_DARK_BROWN "#997C4F"
diff --git a/code/game/machinery/computer/atmos_control.dm b/code/game/machinery/computer/atmos_control.dm
index 84911fc8e5c3e..53811b7529f86 100644
--- a/code/game/machinery/computer/atmos_control.dm
+++ b/code/game/machinery/computer/atmos_control.dm
@@ -68,7 +68,7 @@
var/total_moles = air_sample.total_moles()
if(total_moles)
for(var/gas in air_sample.gases)
- var/gas_name = air_sample.gases[gas][META][META_GAS_NAME]
+ var/gas_name = air_sample.gases[gas][GAS_META][META_GAS_NAME]
signal.data["gases"][gas_name] = gas[MOLES] / total_moles * 100
radio_connection.post_signal(src, signal, filter = RADIO_ATMOSIA)
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index 31036b6b89b12..d5e20d5c030ec 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -255,84 +255,6 @@
return cached_results["fire"] ? REACTING : NO_REACTION
-/datum/gas_reaction/genericfire
- priority = -3 // very last reaction
- name = "Combustion"
- id = "genericfire"
-
-/datum/gas_reaction/genericfire/init_reqs()
- var/lowest_fire_temp = INFINITY
- var/list/fire_temperatures = GLOB.gas_data.fire_temperatures
- for(var/gas in fire_temperatures)
- lowest_fire_temp = min(lowest_fire_temp, fire_temperatures[gas])
- var/lowest_oxi_temp = INFINITY
- var/list/oxidation_temperatures = GLOB.gas_data.oxidation_temperatures
- for(var/gas in oxidation_temperatures)
- lowest_oxi_temp = min(lowest_oxi_temp, oxidation_temperatures[gas])
- min_requirements = list(
- "TEMP" = max(lowest_oxi_temp, lowest_fire_temp),
- "FIRE_REAGENTS" = MINIMUM_MOLE_COUNT
- )
-
-// no requirements, always runs
-// bad idea? maybe
-// this is overridden by auxmos but, hey, good idea to have it readable
-
-/datum/gas_reaction/genericfire/react(datum/gas_mixture/air, datum/holder)
- var/temperature = air.return_temperature()
- var/list/oxidation_temps = GLOB.gas_data.oxidation_temperatures
- var/list/oxidation_rates = GLOB.gas_data.oxidation_rates
- var/oxidation_power = 0
- var/list/burn_results = list()
- var/list/fuels = list()
- var/list/oxidizers = list()
- var/list/fuel_rates = GLOB.gas_data.fire_burn_rates
- var/list/fuel_temps = GLOB.gas_data.fire_temperatures
- var/total_fuel = 0
- var/energy_released = 0
- for(var/G in air.gases)
- var/oxidation_temp = oxidation_temps[G]
- if(oxidation_temp && oxidation_temp > temperature)
- var/temperature_scale = max(0, 1-(temperature / oxidation_temp))
- var/amt = air.gases[G][MOLES] * temperature_scale
- oxidizers[G] = amt
- oxidation_power += amt * oxidation_rates[G]
- else
- var/fuel_temp = fuel_temps[G]
- if(fuel_temp && fuel_temp > temperature)
- var/amt = (air.gases[G][MOLES] / fuel_rates[G]) * max(0, 1-(temperature / fuel_temp))
- fuels[G] = amt // we have to calculate the actual amount we're using after we get all oxidation together
- total_fuel += amt
- if(oxidation_power <= 0 || total_fuel <= 0)
- return NO_REACTION
- var/oxidation_ratio = oxidation_power / total_fuel
- if(oxidation_ratio > 1)
- for(var/oxidizer in oxidizers)
- oxidizers[oxidizer] /= oxidation_ratio
- else if(oxidation_ratio < 1)
- for(var/fuel in fuels)
- fuels[fuel] *= oxidation_ratio
- fuels += oxidizers
- var/list/fire_products = GLOB.gas_data.fire_products
- var/list/fire_enthalpies = GLOB.gas_data.enthalpies
- for(var/fuel in fuels + oxidizers)
- var/amt = fuels[fuel]
- if(!burn_results[fuel])
- burn_results[fuel] = 0
- burn_results[fuel] -= amt
- energy_released += amt * fire_enthalpies[fuel]
- for(var/product in fire_products[fuel])
- if(!burn_results[product])
- burn_results[product] = 0
- burn_results[product] += amt
- var/final_energy = air.thermal_energy() + energy_released
- for(var/result in burn_results)
- air.gases[result][MOLES] += burn_results[result]
- air.temperature = (final_energy / air.heat_capacity())
- var/list/cached_results = air.reaction_results
- cached_results["fire"] = min(total_fuel, oxidation_power) * 2
- return cached_results["fire"] ? REACTING : NO_REACTION
-
//fusion: a terrible idea that was fun but broken. Now reworked to be less broken and more interesting. Again (and again, and again). Again!
//Fusion Rework Counter: Please increment this if you make a major overhaul to this system again.
//6 reworks
diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
index 275460d236432..0153679c66b77 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
@@ -169,10 +169,10 @@
if("filter")
filter_type = null
var/filter_name = "nothing"
- var/gas = params["mode"]
- if(gas in GLOB.gas_data.names)
+ var/gas = gas_id2path(params["mode"])
+ if(gas in subtypesof(/datum/gas))
filter_type = gas
- filter_name = GLOB.gas_data.names[gas]
+ filter_name = GLOB.meta_gas_info[gas][META_GAS_NAME]
investigate_log("was set to filter [filter_name] by [key_name(usr)]", INVESTIGATE_ATMOS)
. = TRUE
if(.)
From bb2e9a4c5e8a709cfeaf3184451cf0587842ab2e Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sun, 18 Aug 2024 14:30:18 +0200
Subject: [PATCH 033/114] Still at 81 problems gonna start merging up to date
before proceeding
---
code/__DEFINES/atmospherics.dm | 4 +
code/__DEFINES/layers.dm | 2 +
code/__DEFINES/reactions.dm | 5 +
code/game/objects/items/devices/scanners.dm | 2 +-
code/game/turfs/open/_open.dm | 6 +-
.../atmospherics/gasmixtures/gas_mixture.dm | 19 +-
.../gasmixtures/immutable_mixtures.dm | 2 -
.../atmospherics/gasmixtures/reactions.dm | 372 ++++++++++--------
.../components/binary_devices/pump.dm | 3 +-
.../machinery/portable/scrubber.dm | 2 +-
10 files changed, 234 insertions(+), 183 deletions(-)
diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm
index f2470a214f17e..eed196e0f653e 100644
--- a/code/__DEFINES/atmospherics.dm
+++ b/code/__DEFINES/atmospherics.dm
@@ -551,6 +551,10 @@ GLOBAL_LIST_INIT(pipe_paint_colors, sort_list(list(
#define ASSERT_GAS(gas_id, gas_mixture) if (!gas_mixture.gases[gas_id]) { ADD_GAS(gas_id, gas_mixture.gases) };
+///Adds a gas to a gas LIST but checks if is already present, accepts a list instead of a datum, so faster if the list is locally cached
+#define ASSERT_GAS_IN_LIST(gas_id, gases) if (!gases[gas_id]) { ADD_GAS(gas_id, gases) };
+
+
//prefer this to gas_mixture/total_moles in performance critical areas
#define TOTAL_MOLES(cached_gases, out_var)\
out_var = 0;\
diff --git a/code/__DEFINES/layers.dm b/code/__DEFINES/layers.dm
index 74a138a72b8cd..8c7bdd7fb20d7 100644
--- a/code/__DEFINES/layers.dm
+++ b/code/__DEFINES/layers.dm
@@ -139,6 +139,8 @@
///AI Camera Static
#define CAMERA_STATIC_PLANE 200
+#define HIGH_GAME_PLANE 300
+
///Popup Chat Messages
#define RUNECHAT_PLANE 650
/// Plane for balloon text (text that fades up)
diff --git a/code/__DEFINES/reactions.dm b/code/__DEFINES/reactions.dm
index fd0dc83d6ad36..837d7f8d0f513 100644
--- a/code/__DEFINES/reactions.dm
+++ b/code/__DEFINES/reactions.dm
@@ -57,3 +57,8 @@
#define FUSION_RAD_MIDPOINT 15 //! If you decrease this by one, the fusion rads will *triple* and vice versa
#define FUSION_MIDDLE_ENERGY_REFERENCE 1e6 //! This number is deceptively dangerous; sort of tied to TOROID_CALCULATED_THRESHOLD
#define FUSION_BUFFER_DIVISOR 1 //! Increase this to cull unrobust fusions faster
+
+#define PRIORITY_PRE_FORMATION 1
+#define PRIORITY_FORMATION 2
+#define PRIORITY_POST_FORMATION 3
+#define PRIORITY_FIRE 4
diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm
index 0347a3fe810bc..bfd0683fdc85a 100644
--- a/code/game/objects/items/devices/scanners.dm
+++ b/code/game/objects/items/devices/scanners.dm
@@ -664,7 +664,7 @@ GENE SCANNER
for(var/id in air_contents.gases)
var/gas_concentration = air_contents.gases[id][MOLES]/total_moles
- message += "[[air_contents.gases[id][GAS_META][META_GAS_NAME]]]: [round(gas_concentration*100, 0.01)] % ([round(air_contents.gases[id][MOLES], 0.01)] mol)"
+ message += "[air_contents.gases[id][GAS_META][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] % ([round(air_contents.gases[id][MOLES], 0.01)] mol)"
message += "Temperature: [round(temperature - T0C,0.01)] °C ([round(temperature, 0.01)] K)"
else
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index e1bbf8dd4e9b2..367a5e5e92676 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -291,10 +291,8 @@
. = ..()
if (air.gases[/datum/gas/carbon_dioxide][MOLES] && air.gases[/datum/gas/oxygen][MOLES])
pulse_strength = min(pulse_strength,air.gases[/datum/gas/carbon_dioxide][MOLES]*1000,air.gases[/datum/gas/oxygen][MOLES]*2000) //Ensures matter is conserved properly
- air.gases[/datum/gas/carbon_dioxide][MOLES] = max(air.gases[/datum/gas/carbon_dioxide][MOLES]-(pulse_strength/1000
-,0))
- air.gases[/datum/gas/oxygen][MOLES] = max(air.gases[/datum/gas/oxygen][MOLES]-(pulse_strength/2000
-,0))
+ air.gases[/datum/gas/carbon_dioxide][MOLES] = max(air.gases[/datum/gas/carbon_dioxide][MOLES]-(pulse_strength/1000),0)
+ air.gases[/datum/gas/oxygen][MOLES] = max(air.gases[/datum/gas/oxygen][MOLES]-(pulse_strength/2000),0)
air.gases[/datum/gas/pluoxium][MOLES] += pulse_strength/4000
/turf/open/proc/break_tile(force, allow_base)
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index fe37dc93bcc25..715f3defc9037 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -289,6 +289,23 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
return 1
+
+///Copies variables from sample, moles multiplicated by partial
+///Returns: TRUE if we are mutable, FALSE otherwise
+/datum/gas_mixture/proc/copy_from_ratio(datum/gas_mixture/sample, partial = 1)
+ var/list/cached_gases = gases //accessing datum vars is slower than proc vars
+ var/list/sample_gases = sample.gases
+
+ //remove all gases not in the sample
+ cached_gases &= sample_gases
+
+ temperature = sample.temperature
+ for(var/id in sample_gases)
+ ASSERT_GAS_IN_LIST(id, cached_gases)
+ cached_gases[id][MOLES] = sample_gases[id][MOLES] * partial
+
+ return TRUE
+
///Copies all gas info from the turf into the gas list along with temperature
///Returns: TRUE if we are mutable, FALSE otherwise
/datum/gas_mixture/proc/copy_from_turf(turf/model)
@@ -472,7 +489,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
for(var/r in reactions)
var/datum/gas_reaction/reaction = r
- var/list/min_reqs = reaction.min_requirements
+ var/list/min_reqs = reaction.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"])
diff --git a/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm b/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
index 1f262d88ba369..864700f5d7ca9 100644
--- a/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
+++ b/code/modules/atmospherics/gasmixtures/immutable_mixtures.dm
@@ -57,8 +57,6 @@
//used by cloners
/datum/gas_mixture/immutable/cloner
initial_temperature = T20C
-/datum/gas_mixture/immutable/cloner/populate()
- set_moles(GAS_N2, MOLES_O2STANDARD + MOLES_N2STANDARD)
//planet side stuff
/datum/gas_mixture/immutable/planetary
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index d5e20d5c030ec..e6620c1a97aac 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -2,36 +2,51 @@
#define SET_REACTION_RESULTS(amount) air.reaction_results[type] = amount
/proc/init_gas_reactions()
- . = list()
-
- for(var/r in subtypesof(/datum/gas_reaction))
- var/datum/gas_reaction/reaction = r
+ var/list/priority_reactions = list()
+
+ //Builds a list of gas id to reaction group
+ for(var/gas_id in GLOB.meta_gas_info)
+ priority_reactions[gas_id] = list(
+ PRIORITY_PRE_FORMATION = list(),
+ PRIORITY_FORMATION = list(),
+ PRIORITY_POST_FORMATION = list(),
+ PRIORITY_FIRE = list()
+ )
+
+ for(var/datum/gas_reaction/reaction as anything in subtypesof(/datum/gas_reaction))
if(initial(reaction.exclude))
continue
- reaction = new r
- . += reaction
- sortTim(., GLOBAL_PROC_REF(cmp_gas_reactions))
-
-/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
+ reaction = new reaction
+ var/datum/gas/reaction_key
+ for (var/req in reaction.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.major_gas = reaction_key
+ priority_reactions[reaction_key][reaction.priority_group] += reaction
+
+ //Culls empty gases
+ for(var/gas_id in GLOB.meta_gas_info)
+ var/passed = FALSE
+ for(var/list/priority_grouping in priority_reactions[gas_id])
+ if(length(priority_grouping))
+ passed = TRUE
+ break
+ if(passed)
+ continue
+ priority_reactions[gas_id] = null
+
+ return priority_reactions
/datum/gas_reaction
- //regarding the requirements lists: the minimum or maximum requirements must be non-zero.
+ //regarding the requirements list: the minimum or maximum requirements must be non-zero.
//when in doubt, use MINIMUM_MOLE_COUNT.
- var/list/min_requirements
- var/list/max_requirements
+ var/list/requirements
+ var/major_gas //the highest rarity gas used in the reaction.
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
+ ///The priority group this reaction is a part of. You can think of these as processing in batches, put your reaction into the one that's most fitting
+ var/priority_group
var/name = "reaction"
var/id = "r"
@@ -49,161 +64,161 @@
id = "nobstop"
/datum/gas_reaction/nobliumsupression/init_reqs()
- min_requirements = list(/datum/gas/hypernoblium = REACTION_OPPRESSION_THRESHOLD)
+ requirements = list(/datum/gas/hypernoblium = REACTION_OPPRESSION_THRESHOLD)
/datum/gas_reaction/nobliumsupression/react()
return STOP_REACTIONS
//water vapor: puts out fires?
/datum/gas_reaction/water_vapor
- priority = 1
+ priority = PRIORITY_POST_FORMATION
name = "Water Vapor"
id = "vapor"
/datum/gas_reaction/water_vapor/init_reqs()
- min_requirements = list(
- /datum/gas/water_vapor = MOLES_GAS_VISIBLE,
- "MAX_TEMP" = WATER_VAPOR_CONDENSATION_POINT,
- )
+ requirements = list(/datum/gas/water_vapor = MOLES_GAS_VISIBLE)
/datum/gas_reaction/water_vapor/react(datum/gas_mixture/air, datum/holder)
+ var/turf/open/location = isturf(holder) ? holder : null
. = NO_REACTION
- if(!isturf(holder))
- return
-
- var/turf/open/location = holder
- var/consumed = 0
- switch(air.return_temperature())
- if(-INFINITY to WATER_VAPOR_DEPOSITION_POINT)
- if(location?.freeze_turf())
- consumed = MOLES_GAS_VISIBLE
- if(WATER_VAPOR_DEPOSITION_POINT to WATER_VAPOR_CONDENSATION_POINT)
- location.water_vapor_gas_act()
- consumed = MOLES_GAS_VISIBLE
-
- if(consumed)
- air.gases[/datum/gas/water_vapor][MOLES] += -consumed
- SET_REACTION_RESULTS(consumed)
- . = REACTING
+ if (air.temperature <= WATER_VAPOR_FREEZE)
+ if(location?.freon_gas_act())
+ . = REACTING
+ else if(air.temperature <= T20C + 10)
+ if(location?.water_vapor_gas_act())
+ air.gases[/datum/gas/water_vapor][MOLES] -= MOLES_GAS_VISIBLE
+ . = REACTING
//tritium combustion: combustion of oxygen and tritium (treated as hydrocarbons). creates hotspots. exothermic
/datum/gas_reaction/nitrous_decomp
- priority = 0
+ priority_group = PRIORITY_POST_FORMATION
name = "Nitrous Oxide Decomposition"
id = "nitrous_decomp"
/datum/gas_reaction/nitrous_decomp/init_reqs()
- min_requirements = list(
- "TEMP" = N2O_DECOMPOSITION_MIN_ENERGY,
- /datum/gas/nitrous_oxide = MINIMUM_MOLE_COUNT
+ requirements = list(
+ /datum/gas/nitrous_oxide = MINIMUM_MOLE_COUNT,
+ "MIN_TEMP" = N2O_DECOMPOSITION_MIN_ENERGY
)
/datum/gas_reaction/nitrous_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/old_heat_capacity = air.heat_capacity()
+ var/list/cached_gases = air.gases //this speeds things up because accessing datum vars is slow
+ var/temperature = air.temperature
var/burned_fuel = 0
- burned_fuel = max(0,0.00002*(temperature-(0.00001*(temperature**2))))*air.gases[/datum/gas/nitrous_oxide][MOLES]
- air.gases[/datum/gas/nitrous_oxide][MOLES] = air.gases[/datum/gas/nitrous_oxide][MOLES] - burned_fuel
-
+ burned_fuel = max(0,0.00002 * (temperature - (0.00001 * (temperature**2)))) * cached_gases[/datum/gas/nitrous_oxide][MOLES]
+ if(cached_gases[/datum/gas/nitrous_oxide][MOLES] - burned_fuel < 0)
+ return NO_REACTION
+ cached_gases[/datum/gas/nitrous_oxide][MOLES] -= burned_fuel
if(burned_fuel)
energy_released += (N2O_DECOMPOSITION_ENERGY_RELEASED * burned_fuel)
- air.gases[/datum/gas/oxygen][MOLES] = air.gases[/datum/gas/oxygen][MOLES] + burned_fuel/2
-
- air.gases[/datum/gas/nitrogen][MOLES] = air.gases[/datum/gas/nitrogen][MOLES] + burned_fuel
-
+ ASSERT_GAS(/datum/gas/oxygen, air)
+ cached_gases[/datum/gas/oxygen][MOLES] += burned_fuel * 0.5
+ ASSERT_GAS(/datum/gas/nitrogen, air)
+ cached_gases[/datum/gas/nitrogen][MOLES] += burned_fuel
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
- air.temperature = ((temperature*old_heat_capacity + energy_released)/new_heat_capacity)
+ air.temperature = (temperature * old_heat_capacity + energy_released) / new_heat_capacity
return REACTING
return NO_REACTION
+
//tritium combustion: combustion of oxygen and tritium (treated as hydrocarbons). creates hotspots. exothermic
/datum/gas_reaction/tritfire
- priority = -1 //fire should ALWAYS be last, but tritium fires happen before plasma fires
+ priority_group = PRIORITY_FIRE
name = "Tritium Combustion"
id = "tritfire"
/datum/gas_reaction/tritfire/init_reqs()
- min_requirements = list(
- "TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST,
+ requirements = list(
/datum/gas/tritium = MINIMUM_MOLE_COUNT,
- /datum/gas/oxygen = MINIMUM_MOLE_COUNT
+ /datum/gas/oxygen = MINIMUM_MOLE_COUNT,
+ "MIN_TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST
)
-/proc/fire_expose(turf/open/location, datum/gas_mixture/air, temperature)
- if(istype(location) && temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
- location.hotspot_expose(temperature, CELL_VOLUME)
-
-/proc/radiation_burn(turf/open/location, energy_released)
- if(istype(location) && prob(10))
- radiation_pulse(location, energy_released/TRITIUM_BURN_RADIOACTIVITY_FACTOR)
-
/datum/gas_reaction/tritfire/react(datum/gas_mixture/air, datum/holder)
var/energy_released = 0
var/old_heat_capacity = air.heat_capacity()
- var/temperature = air.return_temperature()
+ var/list/cached_gases = air.gases //this speeds things up because accessing datum vars is slow
+ var/temperature = air.temperature
var/list/cached_results = air.reaction_results
cached_results["fire"] = 0
var/turf/open/location = isturf(holder) ? holder : null
var/burned_fuel = 0
- var/initial_trit = air.gases[/datum/gas/tritium][MOLES]// Yogs
- if(air.gases[/datum/gas/oxygen][MOLES] < initial_trit || MINIMUM_TRIT_OXYBURN_ENERGY > (temperature * old_heat_capacity))// Yogs -- Maybe a tiny performance boost? I'unno
- burned_fuel = air.gases[/datum/gas/oxygen][MOLES]/TRITIUM_BURN_OXY_FACTOR
- if(burned_fuel > initial_trit) burned_fuel = initial_trit //Yogs -- prevents negative moles of Tritium
- air.gases[/datum/gas/tritium][MOLES] += -burned_fuel
- else
- burned_fuel = initial_trit // Yogs -- Conservation of Mass fix
- air.gases[/datum/gas/tritium][MOLES] = air.gases[/datum/gas/tritium][MOLES] * (1 - 1/TRITIUM_BURN_TRIT_FACTOR
-) // Yogs -- Maybe a tiny performance boost? I'unno
- air.gases[/datum/gas/oxygen][MOLES] += -air.gases[/datum/gas/tritium][MOLES]
- energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel * (TRITIUM_BURN_TRIT_FACTOR - 1)) // Yogs -- Fixes low-energy tritium fires
- if(burned_fuel)
- energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel)
- if(location && prob(10) && burned_fuel > TRITIUM_MINIMUM_RADIATION_ENERGY) //woah there let's not crash the server
- radiation_pulse(location, energy_released/TRITIUM_BURN_RADIOACTIVITY_FACTOR)
+ if(cached_gases[/datum/gas/oxygen][MOLES] < cached_gases[/datum/gas/tritium][MOLES] || MINIMUM_TRIT_OXYBURN_ENERGY > air.thermal_energy())
+ burned_fuel = cached_gases[/datum/gas/oxygen][MOLES] / TRITIUM_BURN_OXY_FACTOR
+ cached_gases[/datum/gas/tritium][MOLES] -= burned_fuel
- //oxygen+more-or-less hydrogen=H2O
- air.gases[/datum/gas/water_vapor][MOLES] += burned_fuel // Yogs -- Conservation of Mass
+ ASSERT_GAS(/datum/gas/water_vapor, air) //oxygen+more-or-less hydrogen=H2O
+ cached_gases[/datum/gas/water_vapor][MOLES] += burned_fuel / TRITIUM_BURN_OXY_FACTOR
+ energy_released += (FIRE_HYDROGEN_ENERGY_WEAK * burned_fuel)
cached_results["fire"] += burned_fuel
+ else
+ burned_fuel = cached_gases[/datum/gas/tritium][MOLES]
+
+ cached_gases[/datum/gas/tritium][MOLES] -= burned_fuel / TRITIUM_BURN_TRIT_FACTOR
+ cached_gases[/datum/gas/oxygen][MOLES] -= burned_fuel
+
+ ASSERT_GAS(/datum/gas/water_vapor, air) //oxygen+more-or-less hydrogen=H2O
+ cached_gases[/datum/gas/water_vapor][MOLES] += burned_fuel / TRITIUM_BURN_TRIT_FACTOR
+
+ energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel)
+ cached_results["fire"] += burned_fuel * 10
+
+ if(burned_fuel)
+ if(location && prob(10) && burned_fuel > TRITIUM_MINIMUM_RADIATION_ENERGY) //woah there let's not crash the server
+ radiation_pulse(location, energy_released / TRITIUM_BURN_RADIOACTIVITY_FACTOR)
+
if(energy_released > 0)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
- air.temperature = ((temperature*old_heat_capacity + energy_released)/new_heat_capacity)
+ air.temperature = (temperature * old_heat_capacity + energy_released) / new_heat_capacity
//let the floor know a fire is happening
if(istype(location))
- temperature = air.return_temperature()
+ temperature = air.temperature
if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
location.hotspot_expose(temperature, CELL_VOLUME)
return cached_results["fire"] ? REACTING : NO_REACTION
+/proc/fire_expose(turf/open/location, datum/gas_mixture/air, temperature)
+ if(istype(location) && temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
+ location.hotspot_expose(temperature, CELL_VOLUME)
+
+/proc/radiation_burn(turf/open/location, energy_released)
+ if(istype(location) && prob(10))
+ radiation_pulse(location, energy_released/TRITIUM_BURN_RADIOACTIVITY_FACTOR)
+
+
+
//plasma combustion: combustion of oxygen and plasma (treated as hydrocarbons). creates hotspots. exothermic
/datum/gas_reaction/plasmafire
- priority = -2 //fire should ALWAYS be last, but plasma fires happen after tritium fires
+ priority_group = PRIORITY_FIRE
name = "Plasma Combustion"
id = "plasmafire"
/datum/gas_reaction/plasmafire/init_reqs()
- min_requirements = list(
- "TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST,
+ requirements = list(
/datum/gas/plasma = MINIMUM_MOLE_COUNT,
- /datum/gas/oxygen = MINIMUM_MOLE_COUNT
+ /datum/gas/oxygen = MINIMUM_MOLE_COUNT,
+ "MIN_TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST
)
/datum/gas_reaction/plasmafire/react(datum/gas_mixture/air, datum/holder)
var/energy_released = 0
var/old_heat_capacity = air.heat_capacity()
- var/temperature = air.return_temperature()
+ var/list/cached_gases = air.gases //this speeds things up because accessing datum vars is slow
+ var/temperature = air.temperature
var/list/cached_results = air.reaction_results
cached_results["fire"] = 0
var/turf/open/location = isturf(holder) ? holder : null
@@ -219,37 +234,41 @@
if(temperature > PLASMA_UPPER_TEMPERATURE)
temperature_scale = 1
else
- temperature_scale = (temperature-PLASMA_MINIMUM_BURN_TEMPERATURE)/(PLASMA_UPPER_TEMPERATURE-PLASMA_MINIMUM_BURN_TEMPERATURE)
+ temperature_scale = (temperature - PLASMA_MINIMUM_BURN_TEMPERATURE) / (PLASMA_UPPER_TEMPERATURE-PLASMA_MINIMUM_BURN_TEMPERATURE)
if(temperature_scale > 0)
oxygen_burn_rate = OXYGEN_BURN_RATE_BASE - temperature_scale
- if(air.gases[/datum/gas/oxygen][MOLES] / air.gases[/datum/gas/plasma][MOLES] > SUPER_SATURATION_THRESHOLD) //supersaturation. Form Tritium.
+ if(cached_gases[/datum/gas/oxygen][MOLES] / cached_gases[/datum/gas/plasma][MOLES] > SUPER_SATURATION_THRESHOLD) //supersaturation. Form Tritium.
super_saturation = TRUE
- if(air.gases[/datum/gas/oxygen][MOLES] > air.gases[/datum/gas/plasma][MOLES]*PLASMA_OXYGEN_FULLBURN)
- plasma_burn_rate = (air.gases[/datum/gas/plasma][MOLES]*temperature_scale)/PLASMA_BURN_RATE_DELTA
+ if(cached_gases[/datum/gas/oxygen][MOLES] > cached_gases[/datum/gas/plasma][MOLES] * PLASMA_OXYGEN_FULLBURN)
+ plasma_burn_rate = (cached_gases[/datum/gas/plasma][MOLES] * temperature_scale) / PLASMA_BURN_RATE_DELTA
else
- plasma_burn_rate = (temperature_scale*(air.gases[/datum/gas/oxygen][MOLES]/PLASMA_OXYGEN_FULLBURN))/PLASMA_BURN_RATE_DELTA
+ plasma_burn_rate = (temperature_scale * (cached_gases[/datum/gas/oxygen][MOLES] / PLASMA_OXYGEN_FULLBURN)) / PLASMA_BURN_RATE_DELTA
if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY)
- plasma_burn_rate = min(plasma_burn_rate,air.gases[/datum/gas/plasma][MOLES],air.gases[/datum/gas/oxygen][MOLES]/oxygen_burn_rate) //Ensures matter is conserved properly
- air.gases[/datum/gas/plasma][MOLES] = QUANTIZE(air.gases[/datum/gas/plasma][MOLES] - plasma_burn_rate)
- air.gases[/datum/gas/oxygen][MOLES] = QUANTIZE(air.gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate))
+ plasma_burn_rate = min(plasma_burn_rate, cached_gases[/datum/gas/plasma][MOLES], cached_gases[/datum/gas/oxygen][MOLES]/oxygen_burn_rate) //Ensures matter is conserved properly
+ cached_gases[/datum/gas/plasma][MOLES] = QUANTIZE(cached_gases[/datum/gas/plasma][MOLES] - plasma_burn_rate)
+ cached_gases[/datum/gas/oxygen][MOLES] = QUANTIZE(cached_gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate))
if (super_saturation)
- air.gases[/datum/gas/tritium][MOLES] += plasma_burn_rate
+ ASSERT_GAS(/datum/gas/tritium, air)
+ cached_gases[/datum/gas/tritium][MOLES] += plasma_burn_rate
else
- air.gases[/datum/gas/carbon_dioxide][MOLES] += plasma_burn_rate
+ ASSERT_GAS(/datum/gas/carbon_dioxide,air)
+ ASSERT_GAS(/datum/gas/water_vapor,air)
+ cached_gases[/datum/gas/carbon_dioxide][MOLES] += plasma_burn_rate * 0.75
+ cached_gases[/datum/gas/water_vapor][MOLES] += plasma_burn_rate * 0.25
energy_released += FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate)
- cached_results["fire"] += (plasma_burn_rate)*(1+oxygen_burn_rate)
+ cached_results["fire"] += (plasma_burn_rate) * (1 + oxygen_burn_rate)
if(energy_released > 0)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
- air.temperature = ((temperature*old_heat_capacity + energy_released)/new_heat_capacity)
+ air.temperature = (temperature*old_heat_capacity + energy_released)/new_heat_capacity
//let the floor know a fire is happening
if(istype(location))
- temperature = air.return_temperature()
+ temperature = air.temperature
if(temperature > FIRE_MINIMUM_TEMPERATURE_TO_EXIST)
location.hotspot_expose(temperature, CELL_VOLUME)
@@ -266,8 +285,8 @@
id = "fusion"
/datum/gas_reaction/fusion/init_reqs()
- min_requirements = list(
- "TEMP" = FUSION_TEMPERATURE_THRESHOLD,
+ requirements = list(
+ "MIN_TEMP" = FUSION_TEMPERATURE_THRESHOLD,
/datum/gas/tritium = FUSION_TRITIUM_MOLES_USED,
/datum/gas/plasma = FUSION_MOLE_THRESHOLD,
/datum/gas/carbon_dioxide = FUSION_MOLE_THRESHOLD)
@@ -356,133 +375,142 @@
air.temperature = (clamp(thermal_energy/new_heat_capacity, TCMB, INFINITY)) //THIS SHOULD STAY OR FUSION WILL EAT YOUR FACE
return REACTING
-/datum/gas_reaction/nitrylformation //The formation of nitryl. Endothermic. Requires N2O as a catalyst.
- priority = 3
+
+/datum/gas_reaction/nitrylformation //The formation of nitryl. Endothermic. Requires bz.
+ priority_group = PRIORITY_FORMATION
name = "Nitryl formation"
id = "nitrylformation"
/datum/gas_reaction/nitrylformation/init_reqs()
- min_requirements = list(
- /datum/gas/oxygen = 20,
- /datum/gas/nitrogen = 20,
- /datum/gas/pluoxium = 5, //Gates Nitryl behind pluoxium to offset N2O burning up during formation
- "TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST*60
+ requirements = list(
+ /datum/gas/oxygen = 10,
+ /datum/gas/nitrogen = 10,
+ /datum/gas/bz = 5,
+ "MIN_TEMP" = 1500,
+ "MAX_TEMP" = 10000
)
/datum/gas_reaction/nitrylformation/react(datum/gas_mixture/air)
- var/temperature = air.return_temperature()
+ var/list/cached_gases = air.gases
+ var/temperature = air.temperature
var/old_heat_capacity = air.heat_capacity()
- var/heat_efficency = min(temperature/(FIRE_MINIMUM_TEMPERATURE_TO_EXIST*60),air.gases[/datum/gas/oxygen][MOLES],air.gases[/datum/gas/nitrogen][MOLES])
- var/energy_used = heat_efficency*NITRYL_FORMATION_ENERGY
- if ((air.gases[/datum/gas/oxygen][MOLES] - heat_efficency < 0 )|| (air.gases[/datum/gas/nitrogen][MOLES] - heat_efficency < 0)) //Shouldn't produce gas from nothing.
+ var/heat_efficency = min(temperature / (FIRE_MINIMUM_TEMPERATURE_TO_EXIST * 8), cached_gases[/datum/gas/oxygen][MOLES], cached_gases[/datum/gas/nitrogen][MOLES])
+ var/energy_used = heat_efficency * NITRYL_FORMATION_ENERGY
+ ASSERT_GAS(/datum/gas/nitryl, air)
+ if ((cached_gases[/datum/gas/oxygen][MOLES] - heat_efficency < 0 ) || (cached_gases[/datum/gas/nitrogen][MOLES] - heat_efficency < 0) || (cached_gases[/datum/gas/bz][MOLES] - heat_efficency * 0.05 < 0)) //Shouldn't produce gas from nothing.
return NO_REACTION
- air.gases[/datum/gas/oxygen][MOLES] += -heat_efficency
- air.gases[/datum/gas/nitrogen][MOLES] += -heat_efficency
- air.gases[/datum/gas/nitryl][MOLES] += heat_efficency*2
+
+ ASSERT_GAS(/datum/gas/nitryl, air)
+ cached_gases[/datum/gas/oxygen][MOLES] -= heat_efficency
+ cached_gases[/datum/gas/nitrogen][MOLES] -= heat_efficency
+ cached_gases[/datum/gas/bz][MOLES] -= heat_efficency * 0.05 //bz gets consumed to balance the nitryl production and not make it too common and/or easy
+ cached_gases[/datum/gas/nitryl][MOLES] += heat_efficency
if(energy_used > 0)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
- air.temperature = (max(((temperature*old_heat_capacity - energy_used)/new_heat_capacity),TCMB))
+ air.temperature = max(((temperature * old_heat_capacity - energy_used) / new_heat_capacity), TCMB) //the air cools down when reacting
return REACTING
/datum/gas_reaction/bzformation //Formation of BZ by combining plasma and tritium at low pressures. Exothermic.
- priority = 4
+ priority_group = PRIORITY_FORMATION
name = "BZ Gas formation"
id = "bzformation"
/datum/gas_reaction/bzformation/init_reqs()
- min_requirements = list(
+ requirements = list(
/datum/gas/nitrous_oxide = 10,
/datum/gas/plasma = 10
)
-
/datum/gas_reaction/bzformation/react(datum/gas_mixture/air)
- var/temperature = air.return_temperature()
+ var/list/cached_gases = air.gases
+ var/temperature = air.temperature
var/pressure = air.return_pressure()
var/old_heat_capacity = air.heat_capacity()
- var/reaction_efficency = min(1/((pressure/(0.5*ONE_ATMOSPHERE))*(max(air.gases[/datum/gas/plasma][MOLES]/air.gases[/datum/gas/nitrous_oxide][MOLES],1))),air.gases[/datum/gas/nitrous_oxide][MOLES],air.gases[/datum/gas/plasma][MOLES]/2)
- var/energy_released = 2*reaction_efficency*FIRE_CARBON_ENERGY_RELEASED
- if ((air.gases[/datum/gas/nitrous_oxide][MOLES] - reaction_efficency < 0 )|| (air.gases[/datum/gas/plasma][MOLES] - (2*reaction_efficency) < 0) || energy_released <= 0) //Shouldn't produce gas from nothing.
+ var/reaction_efficency = min(1 / ((pressure / (0.1 * ONE_ATMOSPHERE)) * (max(cached_gases[/datum/gas/plasma][MOLES] / cached_gases[/datum/gas/nitrous_oxide][MOLES], 1))), cached_gases[/datum/gas/nitrous_oxide][MOLES], cached_gases[/datum/gas/plasma][MOLES] * 0.5)
+ var/energy_released = 2 * reaction_efficency * FIRE_CARBON_ENERGY_RELEASED
+ if ((cached_gases[/datum/gas/nitrous_oxide][MOLES] - reaction_efficency < 0 )|| (cached_gases[/datum/gas/plasma][MOLES] - (2 * reaction_efficency) < 0) || energy_released <= 0) //Shouldn't produce gas from nothing.
return NO_REACTION
- air.gases[/datum/gas/bz][MOLES] += reaction_efficency
- if(reaction_efficency == air.gases[/datum/gas/nitrous_oxide][MOLES])
- air.gases[/datum/gas/bz][MOLES] += -min(pressure,1)
- air.gases[/datum/gas/oxygen][MOLES] += min(pressure,1)
- air.gases[/datum/gas/nitrous_oxide][MOLES] += -reaction_efficency
- air.gases[/datum/gas/plasma][MOLES] += -2*reaction_efficency
- SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, min((reaction_efficency**2)*BZ_RESEARCH_SCALE,BZ_RESEARCH_MAX_AMOUNT))
- SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DISCOVERY, min((reaction_efficency**2)*BZ_RESEARCH_SCALE,BZ_RESEARCH_MAX_AMOUNT)*0.5)
+ ASSERT_GAS(/datum/gas/bz, air)
+ cached_gases[/datum/gas/bz][MOLES] += reaction_efficency * 2.5
+ if(reaction_efficency == cached_gases[/datum/gas/nitrous_oxide][MOLES])
+ ASSERT_GAS(/datum/gas/oxygen, air)
+ cached_gases[/datum/gas/bz][MOLES] -= min(pressure,0.5)
+ cached_gases[/datum/gas/oxygen][MOLES] += min(pressure,0.5)
+ cached_gases[/datum/gas/nitrous_oxide][MOLES] -= reaction_efficency
+ cached_gases[/datum/gas/plasma][MOLES] -= 2 * reaction_efficency
if(energy_released > 0)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
- air.temperature = (max(((temperature*old_heat_capacity + energy_released)/new_heat_capacity),TCMB))
+ air.temperature = max(((temperature * old_heat_capacity + energy_released) / new_heat_capacity), TCMB)
return REACTING
/datum/gas_reaction/stimformation //Stimulum formation follows a strange pattern of how effective it will be at a given temperature, having some multiple peaks and some large dropoffs. Exo and endo thermic.
- priority = 5
+ priority_group = PRIORITY_FORMATION
name = "Stimulum formation"
id = "stimformation"
/datum/gas_reaction/stimformation/init_reqs()
- min_requirements = list(
+ requirements = list(
/datum/gas/tritium = 30,
- /datum/gas/plasma = 10,
/datum/gas/bz = 20,
/datum/gas/nitryl = 30,
- "TEMP" = STIMULUM_HEAT_SCALE/2)
+ "MIN_TEMP" = 1500)
/datum/gas_reaction/stimformation/react(datum/gas_mixture/air)
+ var/list/cached_gases = air.gases
var/old_heat_capacity = air.heat_capacity()
- var/heat_scale = min(air.return_temperature()/STIMULUM_HEAT_SCALE,air.gases[/datum/gas/plasma][MOLES],air.gases[/datum/gas/nitryl][MOLES])
+ var/heat_scale = min(air.temperature/STIMULUM_HEAT_SCALE,cached_gases[/datum/gas/tritium][MOLES],cached_gases[/datum/gas/plasma][MOLES],cached_gases[/datum/gas/nitryl][MOLES])
var/stim_energy_change = heat_scale + STIMULUM_FIRST_RISE*(heat_scale**2) - STIMULUM_FIRST_DROP*(heat_scale**3) + STIMULUM_SECOND_RISE*(heat_scale**4) - STIMULUM_ABSOLUTE_DROP*(heat_scale**5)
-
- if ((air.gases[/datum/gas/plasma][MOLES] - heat_scale < 0) || (air.gases[/datum/gas/nitryl][MOLES] - heat_scale < 0) || (air.gases[/datum/gas/tritium][MOLES] - heat_scale < 0)) //Shouldn't produce gas from nothing.
+ ASSERT_GAS(/datum/gas/stimulum, air)
+ if ((cached_gases[/datum/gas/tritium][MOLES] - heat_scale < 0 ) || (cached_gases[/datum/gas/nitryl][MOLES] - heat_scale < 0)) //Shouldn't produce gas from nothing.
return NO_REACTION
- air.gases[/datum/gas/stimulum][MOLES] += heat_scale/10
- air.gases[/datum/gas/plasma][MOLES] += -heat_scale
- air.gases[/datum/gas/nitryl][MOLES] += -heat_scale
- air.gases[/datum/gas/tritium][MOLES] += -heat_scale
- SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, STIMULUM_RESEARCH_AMOUNT*max(stim_energy_change,0))
- SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DISCOVERY, STIMULUM_RESEARCH_AMOUNT*max(stim_energy_change,0)*0.5)
+ cached_gases[/datum/gas/stimulum][MOLES] += heat_scale * 0.75
+ cached_gases[/datum/gas/tritium][MOLES] -= heat_scale
+ cached_gases[/datum/gas/nitryl][MOLES] -= heat_scale
+
if(stim_energy_change)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
- air.temperature = (max(((air.return_temperature()*old_heat_capacity + stim_energy_change)/new_heat_capacity),TCMB))
+ air.temperature = max(((air.temperature * old_heat_capacity + stim_energy_change) / 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 = 6
+ priority_group = PRIORITY_FORMATION
name = "Hyper-Noblium condensation"
id = "nobformation"
/datum/gas_reaction/nobliumformation/init_reqs()
- min_requirements = list(
+ requirements = list(
/datum/gas/nitrogen = 10,
/datum/gas/tritium = 5,
- "TEMP" = 5000000)
+ "MIN_TEMP" = TCMB,
+ "MAX_TEMP" = 15
+ )
/datum/gas_reaction/nobliumformation/react(datum/gas_mixture/air)
+ var/list/cached_gases = air.gases
+ air.assert_gases(/datum/gas/hypernoblium, /datum/gas/bz)
var/old_heat_capacity = air.heat_capacity()
- var/nob_formed = min((air.gases[/datum/gas/nitrogen][MOLES]+air.gases[/datum/gas/tritium][MOLES])/100,air.gases[/datum/gas/tritium][MOLES]/10,air.gases[/datum/gas/nitrogen][MOLES]/20)
- var/energy_taken = nob_formed*(NOBLIUM_FORMATION_ENERGY/(max(air.gases[/datum/gas/bz][MOLES],1)))
- if ((air.gases[/datum/gas/tritium][MOLES] - 10*nob_formed < 0) || (air.gases[/datum/gas/nitrogen][MOLES] - 20*nob_formed < 0))
+ var/nob_formed = min((cached_gases[/datum/gas/nitrogen][MOLES] + cached_gases[/datum/gas/tritium][MOLES]) * 0.01, cached_gases[/datum/gas/tritium][MOLES] * 0.1, cached_gases[/datum/gas/nitrogen][MOLES] * 0.2)
+ var/energy_produced = nob_formed * (NOBLIUM_FORMATION_ENERGY / (max(cached_gases[/datum/gas/bz][MOLES], 1)))
+ if ((cached_gases[/datum/gas/tritium][MOLES] - 5 * nob_formed < 0) || (cached_gases[/datum/gas/nitrogen][MOLES] - 10 * nob_formed < 0))
return NO_REACTION
- air.gases[/datum/gas/tritium][MOLES] += -10*nob_formed
- air.gases[/datum/gas/nitrogen][MOLES] += -20*nob_formed
- air.gases[/datum/gas/hypernoblium][MOLES] += nob_formed
- SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DEFAULT, nob_formed*NOBLIUM_RESEARCH_AMOUNT)
- SSresearch.science_tech.add_point_type(TECHWEB_POINT_TYPE_DISCOVERY, nob_formed*NOBLIUM_RESEARCH_AMOUNT*0.5)
+
+ cached_gases[/datum/gas/tritium][MOLES] -= 5 * nob_formed
+ cached_gases[/datum/gas/nitrogen][MOLES] -= 10 * nob_formed
+ cached_gases[/datum/gas/hypernoblium][MOLES] += nob_formed
if (nob_formed)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
- air.temperature = (max(((air.return_temperature()*old_heat_capacity - energy_taken)/new_heat_capacity),TCMB))
+ air.temperature = max(((air.temperature * old_heat_capacity + energy_produced) / new_heat_capacity), TCMB)
+ return REACTING
/datum/gas_reaction/stim_ball
priority = 7
@@ -490,12 +518,12 @@
id = "stimball"
/datum/gas_reaction/stim_ball/init_reqs()
- min_requirements = list(
+ requirements = list(
/datum/gas/pluoxium = STIM_BALL_GAS_AMOUNT,
/datum/gas/stimulum = STIM_BALL_GAS_AMOUNT,
/datum/gas/nitryl = MINIMUM_MOLE_COUNT,
/datum/gas/plasma = MINIMUM_MOLE_COUNT,
- "TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST
+ "MIN_TEMP" = FIRE_MINIMUM_TEMPERATURE_TO_EXIST
)
/datum/gas_reaction/stim_ball/react(datum/gas_mixture/air, datum/holder)
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
index aff25fd25b68b..31bd3e8cdcfc7 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
@@ -64,9 +64,8 @@
return
var/datum/gas_mixture/input_air = airs[1]
var/datum/gas_mixture/output_air = airs[2]
- var/datum/gas_mixture/output_pipenet_air = parents[2].air
- if(input_air.pump_gas_to(output_air, target_pressure, output_pipenet_air = output_pipenet_air))
+ if(input_air.pump_gas_to(output_air, target_pressure))
update_parents()
/obj/machinery/atmospherics/components/binary/pump/proc/set_on(active)
diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm
index b7564a8d2e434..10b98979b7307 100644
--- a/code/modules/atmospherics/machinery/portable/scrubber.dm
+++ b/code/modules/atmospherics/machinery/portable/scrubber.dm
@@ -76,7 +76,7 @@
data["id_tag"] = -1 //must be defined in order to reuse code between portable and vent scrubbers
data["filter_types"] = list()
for(var/gas_type in subtypesof(/datum/gas))
- data["filter_types"] += list(list("gas_id" = meta_gas_info[gas_type][META_GAS_ID], "gas_name" = GLOB.meta_gas_info[gas_type][META_GAS_NAME], "enabled" = (id in scrubbing)))
+ data["filter_types"] += list(list("gas_id" = GLOB.meta_gas_info[gas_type][META_GAS_ID], "gas_name" = GLOB.meta_gas_info[gas_type][META_GAS_NAME], "enabled" = (id in scrubbing)))
if(holding)
data["holding"] = list()
From 72420c5c0f398cfe66438c55f0a1f2077c134a2c Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 19 Aug 2024 16:30:13 +0200
Subject: [PATCH 034/114] Ports
https://github.com/tgstation/tgstation/pull/58418/files
---
code/controllers/subsystem/air.dm | 13 ++-
code/game/gamemodes/objective_items.dm | 3 +-
code/game/machinery/_machinery.dm | 3 +
code/game/machinery/shuttle/shuttle_heater.dm | 2 +-
.../objects/effects/spawners/bombspawner.dm | 17 ++-
.../objects/items/devices/transfer_valve.dm | 30 +++--
code/game/objects/items/flamethrower.dm | 8 +-
code/game/objects/items/pneumaticCannon.dm | 2 +-
code/game/objects/items/powerfist.dm | 4 +-
code/game/objects/items/tanks/jetpack.dm | 26 +++--
code/game/objects/items/tanks/tanks.dm | 106 ++++++++++++------
.../crates_lockers/crates/critter.dm | 2 +-
.../transit_tubes/transit_tube_pod.dm | 4 +-
code/modules/admin/verbs/debug.dm | 5 +-
code/modules/atmospherics/Atmospherics.md | 10 +-
.../atmospherics/gasmixtures/gas_mixture.dm | 53 +++++----
.../atmospherics/gasmixtures/reactions.dm | 7 +-
.../binary_devices/temperature_pump.dm | 3 +-
.../components/binary_devices/volume_pump.dm | 3 +
.../components/trinary_devices/filter.dm | 2 +-
.../atmospherics/machinery/datum_pipeline.dm | 11 +-
.../machinery/portable/canister.dm | 23 ++--
.../portable/portable_atmospherics.dm | 20 +++-
.../atmospherics/machinery/portable/pump.dm | 21 +++-
.../machinery/portable/scrubber.dm | 20 +++-
code/modules/cargo/bounties/engineering.dm | 5 +-
code/modules/cargo/exports/large_objects.dm | 15 ++-
code/modules/mob/living/carbon/human/human.dm | 3 +-
code/modules/power/singularity/collector.dm | 19 ++--
code/modules/recycling/disposal/holder.dm | 2 +-
code/modules/surgery/organs/augments_chest.dm | 5 +-
.../mecha/equipment/tools/other_tools.dm | 4 +-
32 files changed, 293 insertions(+), 158 deletions(-)
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index 194f58b780984..4c5f876f22eaa 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -296,8 +296,10 @@ SUBSYSTEM_DEF(air)
while(currentrun.len)
var/obj/machinery/M = currentrun[currentrun.len]
currentrun.len--
- if(!M || (M.process_atmos() == PROCESS_KILL))
- atmos_machinery.Remove(M)
+ if(!M)
+ atmos_machinery -= M
+ if(M.process_atmos() == PROCESS_KILL)
+ stop_processing_machine(M)
if(MC_TICK_CHECK)
return
@@ -655,7 +657,9 @@ GLOBAL_LIST_EMPTY(colored_images)
* * machine - The machine to start processing. Can be any /obj/machinery.
*/
/datum/controller/subsystem/air/proc/start_processing_machine(obj/machinery/machine)
- atmos_machinery += machine
+ if(machine.atmos_processing)
+ return
+ machine.atmos_processing = TRUE
/**
* Removes a given machine to the processing system for SSAIR_ATMOSMACHINERY processing.
@@ -668,6 +672,9 @@ GLOBAL_LIST_EMPTY(colored_images)
* * machine - The machine to stop processing.
*/
/datum/controller/subsystem/air/proc/stop_processing_machine(obj/machinery/machine)
+ if(!machine.atmos_processing)
+ return
+ machine.atmos_processing = FALSE
atmos_machinery -= machine
// If we're currently processing atmos machines, there's a chance this machine is in
diff --git a/code/game/gamemodes/objective_items.dm b/code/game/gamemodes/objective_items.dm
index 4b5ac4b60713e..ce1fa7fcc47bd 100644
--- a/code/game/gamemodes/objective_items.dm
+++ b/code/game/gamemodes/objective_items.dm
@@ -143,7 +143,8 @@
/datum/objective_item/steal/plasma/check_special_completion(obj/item/tank/T)
var/target_amount = text2num(name)
var/found_amount = 0
- found_amount += T.air_contents.gases[/datum/gas/plasma][MOLES]
+ var/datum/gas_mixture/mix = T.return_air()
+ found_amount += mix.gases[/datum/gas/plasma] ? mix.gases[/datum/gas/plasma][MOLES] : 0
return found_amount>=target_amount
/datum/objective_item/steal/functionalai
diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm
index ca03a01466159..9cc9fcd0fcf16 100644
--- a/code/game/machinery/_machinery.dm
+++ b/code/game/machinery/_machinery.dm
@@ -145,6 +145,9 @@ Class Procs:
/// Maximum time an EMP will disable this machine for
var/emp_disable_time = 2 MINUTES
+ ///Is this machine currently in the atmos machinery queue?
+ 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, STAMINA = 0)
diff --git a/code/game/machinery/shuttle/shuttle_heater.dm b/code/game/machinery/shuttle/shuttle_heater.dm
index 65a0480a1635c..c8ab5d4ab88bb 100644
--- a/code/game/machinery/shuttle/shuttle_heater.dm
+++ b/code/game/machinery/shuttle/shuttle_heater.dm
@@ -100,7 +100,7 @@
/obj/machinery/atmospherics/components/unary/shuttle/heater/proc/consumeFuel(var/amount)
var/datum/gas_mixture/air_contents = airs[1]
- air_contents.remove(amount)
+ remove_air(amount)
return
/obj/machinery/atmospherics/components/unary/shuttle/heater/attackby(obj/item/I, mob/living/user, params)
diff --git a/code/game/objects/effects/spawners/bombspawner.dm b/code/game/objects/effects/spawners/bombspawner.dm
index 64e0cf6a8ca12..6dd0fd43fadb3 100644
--- a/code/game/objects/effects/spawners/bombspawner.dm
+++ b/code/game/objects/effects/spawners/bombspawner.dm
@@ -16,14 +16,19 @@
/obj/effect/spawner/newbomb/Initialize(mapload)
. = ..()
var/obj/item/transfer_valve/V = new(src.loc)
- var/obj/item/tank/internals/plasma/PT = new(V)
- var/obj/item/tank/internals/oxygen/OT = new(V)
+ var/obj/item/tank/internals/plasma/plasma_tank = new(V)
+ var/obj/item/tank/internals/oxygen/oxygen_tank = new(V)
- PT.air_contents.gases[/datum/gas/plasma][MOLES] = pressure_p*PT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_p))
- PT.air_contents.temperature = CELSIUS_TO_KELVIN(temp_p)
+ var/datum/gas_mixture/plasma_mix = plasma_tank.return_air()
+ var/datum/gas_mixture/oxygen_mix = oxygen_tank.return_air()
- OT.air_contents.gases[/datum/gas/oxygen][MOLES] = pressure_o*OT.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o))
- OT.air_contents.temperature = CELSIUS_TO_KELVIN(temp_o)
+ plasma_mix.assert_gas(/datum/gas/plasma)
+ plasma_mix.gases[/datum/gas/plasma][MOLES] = pressure_p*plasma_mix.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_p))
+ plasma_mix.temperature = CELSIUS_TO_KELVIN(temp_p)
+
+ oxygen_mix.assert_gas(/datum/gas/oxygen)
+ oxygen_mix.gases[/datum/gas/oxygen][MOLES] = pressure_o*oxygen_mix.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o))
+ oxygen_mix.temperature = CELSIUS_TO_KELVIN(temp_o)
V.tank_one = PT
V.tank_two = OT
diff --git a/code/game/objects/items/devices/transfer_valve.dm b/code/game/objects/items/devices/transfer_valve.dm
index ff14f5f63b4e1..b3389bfee5973 100644
--- a/code/game/objects/items/devices/transfer_valve.dm
+++ b/code/game/objects/items/devices/transfer_valve.dm
@@ -128,24 +128,34 @@
/obj/item/transfer_valve/proc/merge_gases(datum/gas_mixture/target, change_volume = TRUE)
var/target_self = FALSE
- if(!target || (target == tank_one.air_contents))
- target = tank_two.air_contents
- if(target == tank_two.air_contents)
+ var/datum/gas_mixture/mix_one = tank_one.return_air()
+ var/datum/gas_mixture/mix_two = tank_two.return_air()
+ if(!target || (target == mix_one))
+ target = mix_two
+ if(target == mix_two)
target_self = TRUE
if(change_volume)
if(!target_self)
- target.volume = target.return_volume() + tank_two.air_contents.return_volume()
- target.volume = target.return_volume() + tank_one.air_contents.return_volume()
- tank_one.air_contents.transfer_ratio_to(target, 1)
+ target.volume += tank_two.volume
+ target.volume += mix_one.volume
+ var/datum/gas_mixture/temp
+ temp = mix_one.remove_ratio(1)
+ target.merge(temp)
if(!target_self)
- tank_two.air_contents.transfer_ratio_to(target, 1)
+ temp = mix_two.remove_ratio(1)
+ target.merge(temp)
/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()
- tank_two.air_contents.transfer_ratio_to(tank_one.air_contents, ratio1)
- tank_two.air_contents.volume = tank_two.air_contents.return_volume() - tank_one.air_contents.return_volume()
+ var/datum/gas_mixture/mix_one = tank_one.return_air()
+ var/datum/gas_mixture/mix_two = tank_two.return_air()
+
+ var/volume_ratio = mix_one.volume/mix_two.volume
+ var/datum/gas_mixture/temp
+ temp = mix_two.remove_ratio(volume_ratio)
+ mix_one.merge(temp)
+ mix_two.volume -= mix_one.volume
/*
Exadv1: I know this isn't how it's going to work, but this was just to check
diff --git a/code/game/objects/items/flamethrower.dm b/code/game/objects/items/flamethrower.dm
index 8e6a54c736a32..a82b7a9dd0292 100644
--- a/code/game/objects/items/flamethrower.dm
+++ b/code/game/objects/items/flamethrower.dm
@@ -217,12 +217,14 @@
/obj/item/flamethrower/proc/default_ignite(turf/target, release_amount = 0.05)
//TODO: DEFERRED Consider checking to make sure tank pressure is high enough before doing this...
//Transfer 5% of current tank air contents to turf
- var/datum/gas_mixture/air_transfer = ptank.air_contents.remove_ratio(release_amount)
+ var/datum/gas_mixture/tank_mix = ptank.return_air()
+ var/datum/gas_mixture/air_transfer = tank_mix.remove_ratio(release_amount)
+
if(air_transfer.gases[/datum/gas/plasma])
- air_transfer.gases[/datum/gas/plasma][MOLES] *= 5
+ air_transfer.gases[/datum/gas/plasma][MOLES] *= 5 //Suffering
target.assume_air(air_transfer)
//Burn it based on transfered gas
- target.hotspot_expose((ptank.air_contents.temperature*2) + 380,500)
+ target.hotspot_expose((tank_mix.temperature*2) + 380,500)
//location.hotspot_expose(1000,500,1)
SSair.add_to_active(target)
diff --git a/code/game/objects/items/pneumaticCannon.dm b/code/game/objects/items/pneumaticCannon.dm
index bf8a8eb6691ac..bac60ecc3a600 100644
--- a/code/game/objects/items/pneumaticCannon.dm
+++ b/code/game/objects/items/pneumaticCannon.dm
@@ -150,7 +150,7 @@
if(!tank && checktank)
to_chat(user, "\The [src] can't fire without a source of gas.")
return
- if(tank && !tank.air_contents.remove(gasPerThrow * pressureSetting))
+ if(tank && !tank.remove_air(gasPerThrow * pressureSetting))
to_chat(user, "\The [src] lets out a weak hiss and doesn't react!")
return
if(HAS_TRAIT(user, TRAIT_CLUMSY) && prob(75) && clumsyCheck && iscarbon(user))
diff --git a/code/game/objects/items/powerfist.dm b/code/game/objects/items/powerfist.dm
index fdea15b4f2d62..a670aff702805 100644
--- a/code/game/objects/items/powerfist.dm
+++ b/code/game/objects/items/powerfist.dm
@@ -29,7 +29,7 @@
return
if(tank)
. += "[icon2html(tank, user)] It has \a [tank] mounted onto it."
- . += "Its pressure gauge reads [round(tank.air_contents.total_moles(), 0.01)] mol at [round(tank.air_contents.return_pressure(),0.01)] kPa."
+ . += "Its pressure gauge reads [round(tank.return_air().total_moles(), 0.01)] mol at [round(tank.air_contents.return_pressure(),0.01)] kPa."
/obj/item/melee/powerfist/attackby(obj/item/W, mob/user, params)
@@ -77,7 +77,7 @@
if(!tank)
to_chat(user, "\The [src] can't operate without a source of gas!")
return
- var/datum/gas_mixture/gasused = tank.air_contents.remove(gasperfist * fisto_setting)
+ var/datum/gas_mixture/gasused = tank.remove_air(gasperfist * fisto_setting)
var/turf/T = get_turf(src)
if(!T)
return
diff --git a/code/game/objects/items/tanks/jetpack.dm b/code/game/objects/items/tanks/jetpack.dm
index 3a2e876c8f0c7..ee6e25cc15698 100644
--- a/code/game/objects/items/tanks/jetpack.dm
+++ b/code/game/objects/items/tanks/jetpack.dm
@@ -335,9 +335,13 @@
/obj/item/tank/jetpack/combustion/populate_gas()
var/moles_full = ((6 * ONE_ATMOSPHERE) * volume / (R_IDEAL_GAS_EQUATION * T20C))
var/ideal_o2_percent = (1 / PLASMA_OXYGEN_FULLBURN) * 2
- air_contents.gases[/datum/gas/plasma][MOLES] = moles_full * (1 - ideal_o2_percent
-)
- air_contents.gases[/datum/gas/oxygen][MOLES] = moles_full * ideal_o2_percent
+ var/datum/gas_mixture/temp_air_contents = return_air()
+
+ temp_air_contents.assert_gas(/datum/gas/plasma)
+ temp_air_contents.gases[/datum/gas/plasma][MOLES] = moles_full * (1 - ideal_o2_percent)
+
+ temp_air_contents.assert_gas(/datum/gas/oxygen)
+ temp_air_contents.gases[/datum/gas/oxygen][MOLES] = moles_full * ideal_o2_percent
/obj/item/tank/jetpack/combustion/allow_thrust(num, mob/living/user, use_fuel = TRUE)
@@ -348,16 +352,17 @@
return
var/potential_energy = 0
+ var/datum/gas_mixture/our_mix = return_air()
// Minified version of plasmafire burn reaction, with a "controlled" burnrate adjustment due to the high energy output of the reaction
// Also produces no waste products (CO2/Trit)
var/oxygen_burn_rate = (OXYGEN_BURN_RATE_BASE - 1)
var/plasma_burn_rate = 0
- if(air_contents.gases[/datum/gas/oxygen][MOLES] > air_contents.gases[/datum/gas/plasma][MOLES]*PLASMA_OXYGEN_FULLBURN)
- plasma_burn_rate = air_contents.gases[/datum/gas/plasma][MOLES]/PLASMA_BURN_RATE_DELTA
+ if(our_mix.gases[/datum/gas/oxygen][MOLES] > our_mix.gases[/datum/gas/plasma][MOLES]*PLASMA_OXYGEN_FULLBURN)
+ plasma_burn_rate = our_mix.gases[/datum/gas/plasma][MOLES]/PLASMA_BURN_RATE_DELTA
else
- plasma_burn_rate = (air_contents.gases[/datum/gas/oxygen][MOLES]/PLASMA_OXYGEN_FULLBURN)/PLASMA_BURN_RATE_DELTA
+ plasma_burn_rate = (our_mix.gases[/datum/gas/oxygen][MOLES]/PLASMA_OXYGEN_FULLBURN)/PLASMA_BURN_RATE_DELTA
if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY)
- plasma_burn_rate = min(plasma_burn_rate,air_contents.gases[/datum/gas/plasma][MOLES],air_contents.gases[/datum/gas/oxygen][MOLES]/oxygen_burn_rate) //Ensures matter is conserved properly
+ plasma_burn_rate = min(plasma_burn_rate,our_mix.gases[/datum/gas/plasma][MOLES],our_mix.gases[/datum/gas/oxygen][MOLES]/oxygen_burn_rate) //Ensures matter is conserved properly
potential_energy = FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate)
// Normalize thrust volume to joules
@@ -371,9 +376,10 @@
// Consume
if(use_fuel)
- air_contents.gases[/datum/gas/plasma][MOLES] = QUANTIZE(air_contents.gases[/datum/gas/plasma][MOLES] - plasma_burn_rate
+ var/datum/gas_mixture/our_mix = return_air()
+ our_mix.gases[/datum/gas/plasma][MOLES] = QUANTIZE(our_mix.gases[/datum/gas/plasma][MOLES] - plasma_burn_rate
)
- air_contents.gases[/datum/gas/oxygen][MOLES] = QUANTIZE(air_contents.gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate
+ our_mix.gases[/datum/gas/oxygen][MOLES] = QUANTIZE(our_mix.gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate
))
update_fade(15)
update_lifespan(4)
@@ -434,7 +440,7 @@
return
var/mob/living/carbon/human/H = user
tank = H.s_store
- air_contents = tank.air_contents
+ air_contents = tank.return_air()
RegisterSignals(tank, list(COMSIG_ITEM_DROPPED, COMSIG_PARENT_QDELETING), PROC_REF(on_tank_drop))
START_PROCESSING(SSobj, src)
..()
diff --git a/code/game/objects/items/tanks/tanks.dm b/code/game/objects/items/tanks/tanks.dm
index 29508d60c1fb4..2684bf5e57dd9 100644
--- a/code/game/objects/items/tanks/tanks.dm
+++ b/code/game/objects/items/tanks/tanks.dm
@@ -18,12 +18,15 @@
custom_materials = list(/datum/material/iron = 500)
actions_types = list(/datum/action/item_action/set_internals)
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 10, BIO = 0, RAD = 0, FIRE = 80, ACID = 30, STAMINA = 0)
+ /// The gases this tank contains. Don't modify this directly, use return_air() to get it instead
var/datum/gas_mixture/air_contents = null
var/distribute_pressure = ONE_ATMOSPHERE
var/integrity = 3
var/volume = 70
/// Mob that is currently breathing from the tank.
var/mob/living/carbon/breathing_mob = null
+ ///Used by process() to track if there's a reason to process each tick
+ var/excited = TRUE
/obj/item/tank/dropped(mob/living/user, silent)
. = ..()
@@ -91,7 +94,7 @@
. += "The gauge reads [round(air_contents.total_moles(), 0.01)] mol at [round(src.air_contents.return_pressure(),0.01)] kPa." //yogs can read mols
- var/celsius_temperature = src.air_contents.return_temperature()-T0C
+ var/celsius_temperature = air_contents.return_temperature()-T0C
var/descriptive
if (celsius_temperature < 20)
@@ -208,22 +211,24 @@
distribute_pressure = clamp(round(pressure), TANK_MIN_RELEASE_PRESSURE, TANK_MAX_RELEASE_PRESSURE)
/obj/item/tank/remove_air(amount)
+ START_PROCESSING(SSobj, src)
return air_contents.remove(amount)
/obj/item/tank/remove_air_ratio(ratio)
- return air_contents.remove_ratio(ratio)
+ return remove_air_ratio(ratio)
/obj/item/tank/return_air()
+ START_PROCESSING(SSobj, src)
return air_contents
/obj/item/tank/return_analyzable_air()
return air_contents
/obj/item/tank/assume_air(datum/gas_mixture/giver)
+ START_PROCESSING(SSobj, src)
air_contents.merge(giver)
-
- check_status()
- return 1
+ handle_tolerances(ASSUME_AIR_DT_FACTOR)
+ return TRUE
/obj/item/tank/assume_air_moles(datum/gas_mixture/giver, moles)
giver.transfer_to(air_contents, moles)
@@ -249,19 +254,61 @@
return remove_air(moles_needed)
-/obj/item/tank/process()
+
+/obj/item/tank/process(delta_time)
+ if(!air_contents)
+ return
+
//Allow for reactions
- air_contents.react(src)
- check_status()
+ excited = (excited | air_contents.react(src))
+ excited = (excited | handle_tolerances(delta_time))
+ excited = (excited | leaking)
-/obj/item/tank/proc/check_status()
- //Handle exploding, leaking, and rupturing of the tank
+ if(!excited)
+ STOP_PROCESSING(SSobj, src)
+ excited = FALSE
+ if(QDELETED(src) || !leaking || !air_contents)
+ return
+ var/atom/location = loc
+ if(!location)
+ return
+ var/datum/gas_mixture/leaked_gas = air_contents.remove_ratio(0.25)
+ location.assume_air(leaked_gas)
+ location.air_update_turf(FALSE, FALSE)
+
+/**
+ * Handles the minimum and maximum pressure tolerances of the tank.
+ *
+ * Returns true if it did anything of significance, false otherwise
+ * Arguments:
+ * - delta_time: How long has passed between ticks.
+ */
+/obj/item/tank/proc/handle_tolerances(delta_time)
if(!air_contents)
- return 0
+ return FALSE
var/pressure = air_contents.return_pressure()
var/temperature = air_contents.return_temperature()
+ if(temperature >= TANK_MELT_TEMPERATURE)
+ var/temperature_damage_ratio = (temperature - TANK_MELT_TEMPERATURE) / temperature
+ take_damage(max_integrity * temperature_damage_ratio * delta_time, BURN, FIRE, FALSE, NONE)
+ if(QDELETED(src))
+ return TRUE
+
+ if(pressure >= TANK_LEAK_PRESSURE)
+ var/pressure_damage_ratio = (pressure - TANK_LEAK_PRESSURE) / (TANK_RUPTURE_PRESSURE - TANK_LEAK_PRESSURE)
+ take_damage(max_integrity * pressure_damage_ratio * delta_time, BRUTE, BOMB, FALSE, NONE)
+ return TRUE
+ return FALSE
+
+/// Handles rupturing and fragmenting
+/obj/item/tank/obj_destruction(damage_flag)
+ if(!air_contents)
+ return ..()
+
+ /// Handle fragmentation
+ var/pressure = air_contents.return_pressure()
if(pressure > TANK_FRAGMENT_PRESSURE)
var/explosion_mod = 1
@@ -283,29 +330,22 @@
else
qdel(src)
- else if(pressure > TANK_RUPTURE_PRESSURE || temperature > TANK_MELT_TEMPERATURE)
- if(integrity <= 0)
- var/turf/T = get_turf(src)
- if(!T)
- return
- T.assume_air(air_contents)
- playsound(src.loc, 'sound/effects/spray.ogg', 10, 1, -3)
- qdel(src)
- else
- integrity--
-
- else if(pressure > TANK_LEAK_PRESSURE)
- if(integrity <= 0)
- var/turf/T = get_turf(src)
- if(!T)
- return
- var/datum/gas_mixture/leaked_gas = air_contents.remove_ratio(0.25)
- T.assume_air(leaked_gas)
- else
- integrity--
+ return ..()
+
+/// Handles the tank springing a leak.
+/obj/item/tank/obj_break(damage_flag)
+ . = ..()
+ if(leaking)
+ return
+
+ leaking = TRUE
+ START_PROCESSING(SSobj, src)
+
+ if(obj_integrity < 0) // So we don't play the alerts while we are exploding or rupturing.
+ return
+ visible_message("[src] springs a leak!")
+ playsound(src, 'sound/effects/spray.ogg', 10, TRUE, -3)
- else if(integrity < 3)
- integrity++
#undef TTV_NO_CASING_MOD
#undef REACTIONS_BEFORE_EXPLOSION
diff --git a/code/game/objects/structures/crates_lockers/crates/critter.dm b/code/game/objects/structures/crates_lockers/crates/critter.dm
index 2fda6f1ebc050..bae75aa791f76 100644
--- a/code/game/objects/structures/crates_lockers/crates/critter.dm
+++ b/code/game/objects/structures/crates_lockers/crates/critter.dm
@@ -69,7 +69,7 @@
/obj/structure/closet/crate/critter/return_air()
if(tank)
- return tank.air_contents
+ return tank.return_air()
else
return loc.return_air()
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 fdbff8211fbed..5145be075b40d 100644
--- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
+++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
@@ -171,10 +171,10 @@
return giver.transfer_ratio_to(air_contents, ratio)
/obj/structure/transit_tube_pod/remove_air(amount)
- return air_contents.remove(amount)
+ return remove_air(amount)
/obj/structure/transit_tube_pod/remove_air_ratio(ratio)
- return air_contents.remove_ratio(ratio)
+ return remove_air_ratio(ratio)
/obj/structure/transit_tube_pod/transfer_air(datum/gas_mixture/taker, moles)
return air_contents.transfer_to(taker, moles)
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index 63e101b094d6a..5bf303ad3039c 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -955,10 +955,11 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
var/amount = input(usr, "Choose the amount of moles.", "Choose the amount.", 0) as num
var/temp = input(usr, "Choose the temperature (Kelvin).", "Choose the temp (K).", 0) as num
+ var/datum/gas_mixture/C_air = C.return_air()
- C.air_contents.gases[gas_to_add][MOLES] = amount
+ C_air.gases[gas_to_add][MOLES] = amount
- C.air_contents.temperature = (temp)
+ C_air.temperature = (temp)
C.update_icon()
message_admins("[key_name_admin(src)] modified \the [C.name] at [AREACOORD(C)] - Gas: [gas_to_add], Moles: [amount], Temp: [temp].")
diff --git a/code/modules/atmospherics/Atmospherics.md b/code/modules/atmospherics/Atmospherics.md
index 592923c72a9bc..f342bcda23e8e 100644
--- a/code/modules/atmospherics/Atmospherics.md
+++ b/code/modules/atmospherics/Atmospherics.md
@@ -38,7 +38,7 @@ Now then, into the breach.
The air controller is, at its core, quite simple, yet it is absolutely fundamental to the atmospheric system. The air controller is the clock which triggers all continuous actions within the atmos system, such as vents distributing air or gas moving between tiles. The actions taken by the air controller are quite simple, and will be enumerated here. Much of the substance of the air ticker is due to the game's master controller, whose intricacies I will not delve into for this document. I will however go into more detail about how SSAir in particular works in Chapter 6. In any case, this is a simplified list of the air controller's actions in a single tick:
1. Rebuild Pipenets
- Runs each time SSAir processes, sometimes out of order. It ensures that no pipeline sit unresolved or unbuilt
- - Processes the `rebuild_queue` list into the `expansion_queue` list, and then builds a full pipeline piecemeal. We do a ton of fenagling here to reduce overrun
+ - Processes the `rebuild_queue` list into the `expansion_queue` list, and then builds a full pipeline piecemeal. We do a ton of fenagling here to reduce overrun
2. Pipenets
- Updates the internal gasmixes of attached pipe machinery, and reacts the gases in a pipeline
- Calls `process()` on each `/datum/pipenet` in the `networks` list
@@ -391,6 +391,14 @@ This is for the oddballs, the one offs, the half useless things. Things that are
These are the atmos machines you can move around. They interface with connectors to talk to pipelines, and can contain tanks. Not a whole lot more to discuss here.
+## 9. A word on processing
+
+You may have noticed that a large portion of the optimizations we do are focused around not checking to see if we need to do work.
+
+This is essentially what active turfs are built around, and it's a somewhat unfinished project. There's still quite a few things in atmos, mostly machinery, that check each fire to see if they should be doing work. There's a general pattern to solving this sort of thing by the way, centralize the ways a bit of outside code can interact with a "thing", and then when the outside code does something that might warrant processing, start processing.
+
+This attitude needs to be applied to a few large targets, and you may see it crop up when reading through the code. Keep this in mind, and make sure to respect the rules that describe how to work with the object, or things will go to shit.
+
## Appendix A - Glossary
* *LINDA* - Our environmental gas system, created by Aranclanos, Beautiful in Spanish
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index 715f3defc9037..8f451ebec252c 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -471,45 +471,52 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
var/list/cached_gases = gases
if(!length(cached_gases))
return
- var/list/reactions = list()
- for(var/G in SSair.gas_reactions)
- var/datum/gas_reaction/reaction = G
- if(cached_gases[reaction.major_gas])
- reactions += G
+
+ var/lis/maximum = list()
+ var/list/pre_formation = list()
+ var/list/mid_formation = list()
+ var/list/post_formation = list()
+ var/list/fires = list()
+ var/list/gas_reactions = SSair.gas_reactions
+ for(var/gas_id in cached_gases)
+ var/list/reaction_set = gas_reactions[gas_id]
+ if(!reaction_set)
+ continue
+ pre_formation += reaction_set[1]
+ mid_formation += reaction_set[2]
+ post_formation += reaction_set[3]
+ fires += reaction_set[4]
+
+ var/list/reactions = pre_formation + mid_formation + post_formation + fires
if(!length(reactions))
return
+ //Fuck you
+ if(cached_gases[/datum/gas/hypernoblium] && cached_gases[/datum/gas/hypernoblium][MOLES] >= REACTION_OPPRESSION_THRESHOLD && temperature > 20)
+ return STOP_REACTIONS
+
reaction_results = new
- //It might be worth looking into updating these after each reaction, but it changes things a lot, so be careful
+ //It might be worth looking into updating these after each reaction, but that makes us care more about order of operations, so be careful
var/temp = temperature
- var/ener = THERMAL_ENERGY(src)
-
reaction_loop:
- for(var/r in reactions)
- var/datum/gas_reaction/reaction = r
-
- var/list/min_reqs = reaction.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"])
- )
+ for(var/datum/gas_reaction/reaction as anything in reactions)
+
+ var/list/reqs = reaction.requirements
+ if((reqs["MIN_TEMP"] && temp < reqs["MIN_TEMP"]) || (reqs["MAX_TEMP"] && temp > reqs["MAX_TEMP"]))
continue
- for(var/id in min_reqs)
- if (id == "TEMP" || id == "ENER" || id == "MAX_TEMP")
+ for(var/id in reqs)
+ if (id == "MIN_TEMP" || id == "MAX_TEMP")
continue
- if(!cached_gases[id] || cached_gases[id][MOLES] < min_reqs[id])
+ if(!cached_gases[id] || cached_gases[id][MOLES] < 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
- if(.) //If we changed the mix to any degree, or if we stopped reacting
+ if(.) //If we changed the mix to any degree
garbage_collect()
///Takes the amount of the gas you want to PP as an argument
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index e6620c1a97aac..13a37aade2503 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -58,11 +58,6 @@
/datum/gas_reaction/proc/react(datum/gas_mixture/air, atom/location)
return NO_REACTION
-/datum/gas_reaction/nobliumsupression
- priority = INFINITY
- name = "Hyper-Noblium Reaction Suppression"
- id = "nobstop"
-
/datum/gas_reaction/nobliumsupression/init_reqs()
requirements = list(/datum/gas/hypernoblium = REACTION_OPPRESSION_THRESHOLD)
@@ -71,7 +66,7 @@
//water vapor: puts out fires?
/datum/gas_reaction/water_vapor
- priority = PRIORITY_POST_FORMATION
+ priority_group = PRIORITY_POST_FORMATION
name = "Water Vapor"
id = "vapor"
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 830431fd1ef25..8ac870339f3a0 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/temperature_pump.dm
@@ -54,11 +54,12 @@
var/cooling_heat_amount = (heat_transfer_rate * 0.01) * coolant_temperature_delta * (input_capacity * output_capacity / (input_capacity + output_capacity))
remove_input.temperature = (max(remove_input.return_temperature() - (cooling_heat_amount / input_capacity), TCMB))
remove_output.temperature = (max(remove_output.return_temperature() + (cooling_heat_amount / output_capacity), TCMB))
+ update_parents()
+
air_input.merge(remove_input)
air_output.merge(remove_output)
- update_parents()
/obj/machinery/atmospherics/components/binary/temperature_pump/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
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 519134df2a4b0..d457af1c7076e 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
@@ -76,6 +76,9 @@
var/datum/gas_mixture/removed = air1.remove_ratio(transfer_ratio)
+ if(!removed.total_moles())
+ return
+
if(overclocked)//Some of the gas from the mixture leaks to the environment when overclocked
var/turf/open/T = loc
if(istype(T))
diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
index 0153679c66b77..eec363237a04a 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
@@ -89,7 +89,7 @@
var/datum/gas_mixture/removed = air1.remove_ratio(transfer_ratio)
- if(!removed)
+ if(!removed || !removed.total_moles())
return
var/filtering = TRUE
diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm
index 29702d3d3da80..45a5555ac88d3 100644
--- a/code/modules/atmospherics/machinery/datum_pipeline.dm
+++ b/code/modules/atmospherics/machinery/datum_pipeline.dm
@@ -32,11 +32,10 @@
return ..()
/datum/pipeline/process()
- if(building)
+ if(!update || building)
return
- if(update)
- update = FALSE
- reconcile_air()
+
+ reconcile_air()
update = air.react(src)
///Preps a pipeline for rebuilding, insterts it into the rebuild queue
@@ -266,7 +265,7 @@
else if (istype(atmosmch, /obj/machinery/atmospherics/components/unary/portables_connector))
var/obj/machinery/atmospherics/components/unary/portables_connector/considered_connector = atmosmch
if(considered_connector.connected_device)
- gas_mixture_list += considered_connector.connected_device.air_contents
+ gas_mixture_list += considered_connector.connected_device.return_air()
var/total_thermal_energy = 0
var/total_heat_capacity = 0
@@ -293,7 +292,7 @@
total_gas_mixture.temperature = total_heat_capacity ? (total_thermal_energy / total_heat_capacity) : 0
total_gas_mixture.garbage_collect()
-
+
if(total_gas_mixture.volume > 0)
//Update individual gas_mixtures by volume ratio
for(var/mixture in gas_mixture_list)
diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm
index 2997c03169b7f..2455abda4295b 100644
--- a/code/modules/atmospherics/machinery/portable/canister.dm
+++ b/code/modules/atmospherics/machinery/portable/canister.dm
@@ -100,11 +100,12 @@
logmsg = "Valve was toggled by [parent.get_creator_admin()]'s circuit, starting a transfer into \the [attached_can.holding || "air"]. "
if(!attached_can.holding)
var/list/danger = list()
- for(var/id in attached_can.air_contents.gases)
+ var/datum/gas_mixture/attached_can_air = attached_can.return_air()
+ for(var/id in attached_can_air.gases)
if(!(GLOB.meta_gas_info[id][META_GAS_DANGER]))
continue
- if(attached_can.air_contents.gases[id][MOLES] > (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]] = attached_can.air_contents.gases[id][MOLES] //ex. "plasma" = 20
+ if(attached_can_air.gases[id][MOLES] > (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]] = attached_can_air.gases[id][MOLES] //ex. "plasma" = 20
if(danger.len && attached_can.valve_open)
message_admins("[parent.get_creator_admin()]'s circuit opened a canister that contains the following at [ADMIN_VERBOSEJMP(attached_can)]:")
@@ -272,15 +273,18 @@
/obj/machinery/portable_atmospherics/canister/proc/create_gas()
if(gas_type)
+ air_contents.add_gas(gas_type)
if(starter_temp)
air_contents.temperature = (starter_temp)
-
air_contents.gases[gas_type][MOLES] = (maximum_pressure * filled* air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature()))
+ SSair.start_processing_machine(src)
/obj/machinery/portable_atmospherics/canister/air/create_gas()
+ air_contents.add_gases(/datum/gas/oxygen, /datum/gas/nitrogen)
air_contents.temperature = (starter_temp)
air_contents.gases[/datum/gas/oxygen][MOLES] = (O2STANDARD * maximum_pressure * filled * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature()))
air_contents.gases[/datum/gas/nitrogen][MOLES] = (N2STANDARD * maximum_pressure * filled * air_contents.return_volume() / (R_IDEAL_GAS_EQUATION * air_contents.return_temperature()))
+ SSair.start_processing_machine(src)
/obj/machinery/portable_atmospherics/canister/update_icon()
. = ..()
@@ -314,7 +318,7 @@
return
/obj/machinery/portable_atmospherics/canister/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
- return exposed_temperature > temperature_resistance * mode
+ return exposed_temperature > temperature_resistance
/obj/machinery/portable_atmospherics/canister/atmos_expose(datum/gas_mixture/air, exposed_temperature)
take_damage(5, BURN, 0)
@@ -380,7 +384,6 @@
user.investigate_log("started a transfer into [holding].", INVESTIGATE_ATMOS)
/obj/machinery/portable_atmospherics/canister/process_atmos()
- ..()
if(machine_stat & BROKEN)
return PROCESS_KILL
if(timing && valve_timer < world.time)
@@ -390,12 +393,14 @@
// Handle gas transfer.
if(valve_open)
var/turf/T = get_turf(src)
- var/datum/gas_mixture/target_air = holding ? holding.air_contents : T.return_air()
+ var/datum/gas_mixture/target_air = holding ? holding.return_air() : T.return_air()
if(air_contents.release_gas_to(target_air, release_pressure) && !holding)
air_update_turf(FALSE, FALSE)
update_icon()
+ return ..()
+
/obj/machinery/portable_atmospherics/canister/ui_status(mob/user)
. = ..()
if(. > UI_UPDATE && !allowed(user))
@@ -433,9 +438,10 @@
data["hasHoldingTank"] = holding ? 1 : 0
if (holding)
+ var/datum/gas_mixture/holding_mix = holding.return_air()
data["holdingTank"] = list()
data["holdingTank"]["name"] = holding.name
- data["holdingTank"]["tankPressure"] = round(holding.air_contents.return_pressure())
+ data["holdingTank"]["tankPressure"] = round(holding.holding_mix.return_pressure())
return data
/obj/machinery/portable_atmospherics/canister/ui_act(action, params)
@@ -517,6 +523,7 @@
if("eject")
if(holding)
if(valve_open)
+ SSair.start_processing_machine(src)
message_admins("[ADMIN_LOOKUPFLW(usr)] removed [holding] from [src] with valve still open at [ADMIN_VERBOSEJMP(src)] releasing contents into the air.")
usr.investigate_log(" removed the [holding], leaving the valve open and transferring into the air.", INVESTIGATE_ATMOS)
replace_tank(usr, FALSE)
diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
index bbf17b311a8f2..d63373de7ddef 100644
--- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
+++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
@@ -7,13 +7,18 @@
anchored = FALSE
interacts_with_air = TRUE
+ ///Stores the gas mixture of the portable component. Don't access this directly, use return_air() so you support the temporary processing it provides
var/datum/gas_mixture/air_contents
+
var/obj/machinery/atmospherics/components/unary/portables_connector/connected_port
var/obj/item/tank/holding
var/volume = 0
var/maximum_pressure = 90 * ONE_ATMOSPHERE
+ ///Used to track if anything of note has happen while running process_atmos()
+ var/excited = TRUE
+
/obj/machinery/portable_atmospherics/Initialize(mapload)
. = ..()
air_contents = new(volume)
@@ -23,8 +28,7 @@
/obj/machinery/portable_atmospherics/Destroy()
SSair.stop_processing_machine(src)
disconnect()
- qdel(air_contents)
- air_contents = null
+ QDEL_NULL(air_contents)
return ..()
/obj/machinery/portable_atmospherics/ex_act(severity, target)
@@ -44,10 +48,14 @@
return atmosanalyzer_scan(user, holding, TRUE)
/obj/machinery/portable_atmospherics/process_atmos()
- if(!connected_port && air_contents != null && src != null) // Pipe network handles reactions if connected.
- air_contents.react(src)
+ if(!connected_port) // Pipe network handles reactions if connected, and we can't stop processing if there's a port effecting our mix
+ excited = (excited | air_contents.react(src))
+ if(!excited)
+ return PROCESS_KILL
+ excited = FALSE
/obj/machinery/portable_atmospherics/return_air()
+ SSair.start_processing_machine(src)
return air_contents
/obj/machinery/portable_atmospherics/return_analyzable_air()
@@ -72,6 +80,7 @@
pixel_x = new_port.pixel_x
pixel_y = new_port.pixel_y
+ SSair.start_processing_machine(src)
update_appearance()
return TRUE
@@ -89,6 +98,7 @@
pixel_x = 0
pixel_y = 0
+ SSair.start_processing_machine(src)
update_appearance()
return TRUE
@@ -117,6 +127,8 @@
holding = null
if(new_tank)
holding = new_tank
+
+ SSair.start_processing_machine(src)
update_appearance()
return TRUE
diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm
index d8e20de5056d2..1031492e4aea8 100644
--- a/code/modules/atmospherics/machinery/portable/pump.dm
+++ b/code/modules/atmospherics/machinery/portable/pump.dm
@@ -100,24 +100,28 @@
add_overlay("siphon-connector")
/obj/machinery/portable_atmospherics/pump/process_atmos()
- ..()
if(!on)
pump.airs[1] = null
pump.airs[2] = null
return
var/turf/T = get_turf(src)
+ var/datum/gas_mixture/temp_air_contents = return_air()
+ var/datum/gas_mixture/temp_holding_air_contents = holding_return_air()
if(direction == PUMP_OUT) // Hook up the internal pump.
- pump.airs[1] = holding ? holding.air_contents : air_contents
- pump.airs[2] = holding ? air_contents : T.return_air()
+ pump.airs[1] = holding ? temp_holding_air_contents : temp_air_contents
+ pump.airs[2] = holding ? temp_air_contents : T.return_air()
else
- pump.airs[1] = holding ? air_contents : T.return_air()
- pump.airs[2] = holding ? holding.air_contents : air_contents
+ pump.airs[1] = holding ? temp_air_contents : T.return_air()
+ pump.airs[2] = holding ? temp_holding_air_contents : temp_air_contents
pump.process_atmos() // Pump gas.
if(!holding)
air_update_turf(FALSE, FALSE) // Update the environment if needed.
+ return ..()
+
+
/obj/machinery/portable_atmospherics/pump/emp_act(severity)
. = ..()
if(. & EMP_PROTECT_SELF)
@@ -125,6 +129,8 @@
if(is_operational)
if(prob(50 / severity))
on = !on
+ if(on)
+ SSair.start_processing_machine(src)
if(prob(100 / severity))
direction = PUMP_OUT
pump.target_pressure = rand(0, 100 * ONE_ATMOSPHERE)
@@ -166,7 +172,8 @@
if(holding)
data["holding"] = list()
data["holding"]["name"] = holding.name
- data["holding"]["pressure"] = round(holding.air_contents.return_pressure())
+ var/datum/gas_mixture/holding_mix = holding.return_air()
+ data["holding"]["pressure"] = round(holding_mix.return_pressure())
else
data["holding"] = null
return data
@@ -177,6 +184,8 @@
switch(action)
if("power")
on = !on
+ if(on)
+ SSair.start_processing_machine(src)
if(on && !holding)
var/plasma = air_contents.gases[/datum/gas/plasma][MOLES]
var/n2o = air_contents.gases[/datum/gas/nitrous_oxide][MOLES]
diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm
index 10b98979b7307..d4f4dcbf805af 100644
--- a/code/modules/atmospherics/machinery/portable/scrubber.dm
+++ b/code/modules/atmospherics/machinery/portable/scrubber.dm
@@ -29,16 +29,17 @@
add_overlay("scrubber-connector")
/obj/machinery/portable_atmospherics/scrubber/process_atmos()
- ..()
+ . = ..()
if(!on)
return
if(holding)
- scrub(holding.air_contents)
+ scrub(holding.return_air())
else
var/turf/T = get_turf(src)
scrub(T.return_air())
+
/obj/machinery/portable_atmospherics/scrubber/proc/scrub(var/datum/gas_mixture/mixture)
if(air_contents.return_pressure() >= overpressure_m * ONE_ATMOSPHERE)
return
@@ -54,6 +55,8 @@
if(is_operational)
if(prob(50 / severity))
on = !on
+ if(on)
+ SSair.start_processing_machine(src)
update_appearance()
@@ -81,7 +84,8 @@
if(holding)
data["holding"] = list()
data["holding"]["name"] = holding.name
- data["holding"]["pressure"] = round(holding.air_contents.return_pressure())
+ var/datum/gas_mixture/holding_mix = holding.return_air()
+ data["holding"]["pressure"] = round(holding_mix.return_pressure())
else
data["holding"] = null
return data
@@ -102,6 +106,8 @@
switch(action)
if("power")
on = !on
+ if(on)
+ SSair.start_processing_machine(src)
. = TRUE
if("eject")
if(holding)
@@ -137,15 +143,19 @@
on = FALSE
update_icon()
use_power = on ? ACTIVE_POWER_USE : IDLE_POWER_USE
+
if(!on)
- return
+ return ..()
+
+ excited = TRUE
- ..()
if(!holding)
var/turf/T = get_turf(src)
for(var/turf/AT in T.GetAtmosAdjacentTurfs(alldir = TRUE))
scrub(AT.return_air())
+ return ..()
+
/obj/machinery/portable_atmospherics/scrubber/huge/attackby(obj/item/W, mob/user)
if(default_unfasten_wrench(user, W))
if(!movable)
diff --git a/code/modules/cargo/bounties/engineering.dm b/code/modules/cargo/bounties/engineering.dm
index 32664d719e389..4d28ae30967d5 100644
--- a/code/modules/cargo/bounties/engineering.dm
+++ b/code/modules/cargo/bounties/engineering.dm
@@ -10,7 +10,10 @@
if(!..())
return FALSE
var/obj/item/tank/T = O
- return T.air_contents.gases[gas_type][MOLES] >= moles_required
+ var/datum/gas_mixture/our_mix = T.return_air()
+ if(!our_mix.gases[gas_type])
+ return FALSE
+ return our_mix.gases[gas_type][MOLES] >= moles_required
/datum/bounty/item/engineering/gas/nitryl_tank
name = "Full Tank of Nitryl"
diff --git a/code/modules/cargo/exports/large_objects.dm b/code/modules/cargo/exports/large_objects.dm
index 17e2b75fba01d..a94f351d1404d 100644
--- a/code/modules/cargo/exports/large_objects.dm
+++ b/code/modules/cargo/exports/large_objects.dm
@@ -129,10 +129,13 @@
/datum/export/large/gas_canister/get_cost(obj/O)
var/obj/machinery/portable_atmospherics/canister/C = O
var/worth = 10
-
- worth += C.air_contents.gases[/datum/gas/bz][MOLES]*4
- worth += C.air_contents.gases[/datum/gas/stimulum][MOLES]*100
- worth += C.air_contents.gases[/datum/gas/hypernoblium][MOLES]*1000
- worth += C.air_contents.gases[/datum/gas/tritium][MOLES]*5
- worth += C.air_contents.gases[/datum/gas/pluoxium][MOLES]*5
+ var/datum/gas_mixture/canister_mix = C.return_air()
+ var/canister_gas = canister_mix.gases
+ worth += canister_gas[/datum/gas/bz][MOLES]*4
+ worth += canister_gas[/datum/gas/stimulum][MOLES]*100
+ worth += canister_gas[/datum/gas/hypernoblium][MOLES]*1000
+ worth += canister_gas[/datum/gas/tritium][MOLES]*5
+ worth += canister_gas[/datum/gas/pluoxium][MOLES]*5
+
+ canister_mix.garbage_collect()
return worth
diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm
index 9d7d6ad030128..2feddf9640372 100644
--- a/code/modules/mob/living/carbon/human/human.dm
+++ b/code/modules/mob/living/carbon/human/human.dm
@@ -113,8 +113,9 @@
var/list/tab_data = ..()
var/obj/item/tank/target_tank = internal || external
if(target_tank)
+ var/datum/gas_mixture/target_tank_air = target_tank.return_air()
tab_data["Internal Atmosphere Info"] = GENERATE_STAT_TEXT("[target_tank.name]")
- tab_data["Tank Pressure"] = GENERATE_STAT_TEXT("[target_tank.air_contents.return_pressure()]")
+ tab_data["Tank Pressure"] = GENERATE_STAT_TEXT("[target_tank_air.return_pressure()]")
tab_data["Distribution Pressure"] = GENERATE_STAT_TEXT("[target_tank.distribute_pressure]")
if(mind)
diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm
index 0e33dda798296..e9c6af9e9689b 100644
--- a/code/modules/power/singularity/collector.dm
+++ b/code/modules/power/singularity/collector.dm
@@ -49,29 +49,30 @@
/obj/machinery/power/rad_collector/process(delta_time)
if(!loaded_tank)
return
+ var/datum/gas_mixture/loaded_tank_air = loaded_tank.return_air()
if(!bitcoinmining)
- if(loaded_tank.air_contents.gases[/datum/gas/plasma][MOLES] < 0.0001)
+ if(loaded_tank_air.gases[/datum/gas/plasma][MOLES] < 0.0001)
investigate_log("out of fuel.", INVESTIGATE_ENGINES)
playsound(src, 'sound/machines/ding.ogg', 50, 1)
var/msg = "Plasma depleted, recommend replacing tank."
radio.talk_into(src, msg, RADIO_CHANNEL_ENGINEERING)
eject()
else
- var/gasdrained = min(powerproduction_drain*drainratio*delta_time,loaded_tank.air_contents.gases[/datum/gas/plasma][MOLES])
- loaded_tank.air_contents.gases[/datum/gas/plasma][MOLES] += -gasdrained
- loaded_tank.air_contents.gases[/datum/gas/tritium][MOLES] += gasdrained
+ var/gasdrained = min(powerproduction_drain*drainratio*delta_time,loaded_tank_air.gases[/datum/gas/plasma][MOLES])
+ loaded_tank_air.gases[/datum/gas/plasma][MOLES] += -gasdrained
+ loaded_tank_air.gases[/datum/gas/tritium][MOLES] += gasdrained
var/power_produced = RAD_COLLECTOR_OUTPUT
add_avail(power_produced)
stored_energy-=power_produced
else if(is_station_level(z) && SSresearch.science_tech)
- if(!loaded_tank.air_contents.gases[/datum/gas/tritium][MOLES] || !loaded_tank.air_contents.gases[/datum/gas/oxygen][MOLES])
+ if(!loaded_tank_air.gases[/datum/gas/tritium][MOLES] || !loaded_tank_air.gases[/datum/gas/oxygen][MOLES])
playsound(src, 'sound/machines/ding.ogg', 50, 1)
eject()
else
var/gasdrained = bitcoinproduction_drain*drainratio*delta_time
- loaded_tank.air_contents.gases[/datum/gas/tritium][MOLES] += -gasdrained
- loaded_tank.air_contents.gases[/datum/gas/oxygen][MOLES] += -gasdrained
- loaded_tank.air_contents.gases[/datum/gas/carbon_dioxide][MOLES] += gasdrained*2
+ loaded_tank_air.gases[/datum/gas/tritium][MOLES] += -gasdrained
+ loaded_tank_air.gases[/datum/gas/oxygen][MOLES] += -gasdrained
+ loaded_tank_air.gases[/datum/gas/carbon_dioxide][MOLES] += gasdrained*2
var/bitcoins_mined = RAD_COLLECTOR_OUTPUT
var/datum/bank_account/D = SSeconomy.get_budget_account(ACCOUNT_ENG_ID)
if(D)
@@ -86,7 +87,7 @@
toggle_power()
user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \
"You turn the [src.name] [active? "on":"off"].")
- var/fuel = loaded_tank?.air_contents.gases[/datum/gas/plasma][MOLES]
+ var/fuel = loaded_tank_air.gases[/datum/gas/plasma][MOLES]
investigate_log("turned [active?"on":"off"] by [key_name(user)]. [loaded_tank?"Fuel: [round(fuel/0.29)]%":"It is empty"].", INVESTIGATE_ENGINES)
return
else
diff --git a/code/modules/recycling/disposal/holder.dm b/code/modules/recycling/disposal/holder.dm
index 93aac3adb4d3b..752736623f3c1 100644
--- a/code/modules/recycling/disposal/holder.dm
+++ b/code/modules/recycling/disposal/holder.dm
@@ -28,7 +28,7 @@
/obj/structure/disposalholder/proc/init(obj/machinery/disposal/D)
if(!istype(D))
return //Why check for things that don't exist?
- gas = D.air_contents// transfer gas resv. into holder object
+ gas = D.return_air()// transfer gas resv. into holder object
//Check for any living mobs trigger hasmob.
//hasmob effects whether the package goes to cargo or its tagged destination.
diff --git a/code/modules/surgery/organs/augments_chest.dm b/code/modules/surgery/organs/augments_chest.dm
index eca93f0723ede..96a49f1bebf48 100644
--- a/code/modules/surgery/organs/augments_chest.dm
+++ b/code/modules/surgery/organs/augments_chest.dm
@@ -198,8 +198,9 @@
// Priority 3: use internals tank.
var/obj/item/tank/I = owner.internal
- if(I && I.air_contents && I.air_contents.total_moles() >= num && use_fuel)
- T.assume_air_moles(I.air_contents, num)
+ var/datum/gas_mixture/I_air = I.return_air()
+ if(I && I_air && I_air.total_moles() >= num && use_fuel)
+ T.assume_air_moles(I_air, num)
toggle(silent = TRUE)
return 0
diff --git a/code/modules/vehicles/mecha/equipment/tools/other_tools.dm b/code/modules/vehicles/mecha/equipment/tools/other_tools.dm
index 52faec6cd5390..82f3ef0cfdce3 100644
--- a/code/modules/vehicles/mecha/equipment/tools/other_tools.dm
+++ b/code/modules/vehicles/mecha/equipment/tools/other_tools.dm
@@ -542,9 +542,9 @@
return FALSE
var/moles = chassis.internal_tank.air_contents.total_moles()
if(moles < move_cost)
- chassis.internal_tank.air_contents.remove(moles)
+ chassis.internal_tank.remove_air(moles)
return FALSE
- chassis.internal_tank.air_contents.remove(move_cost)
+ chassis.internal_tank.remove_air(move_cost)
generate_effect(movement_dir)
return TRUE
From 7bd92e9691b410a7782c9030c8a46a1d6cbddec4 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 19 Aug 2024 16:30:58 +0200
Subject: [PATCH 035/114] Missed a single thing
---
code/modules/admin/verbs/debug.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index 5bf303ad3039c..52bf7d6bdb081 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -624,7 +624,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
if(Rad.anchored)
if(!Rad.loaded_tank)
var/obj/item/tank/internals/plasma/Plasma = new/obj/item/tank/internals/plasma(Rad)
- Plasma.air_contents.gases[/datum/gas/plasma][MOLES] = 70
+ Plasma.return_air().gases[/datum/gas/plasma][MOLES] = 70
Rad.drainratio = 0
Rad.loaded_tank = Plasma
From 594784629786333ba146aca608d182bab0d46eec Mon Sep 17 00:00:00 2001
From: vincentiusvin <54709710+vincentiusvin@users.noreply.github.com>
Date: Sat, 5 Jun 2021 20:51:50 +0700
Subject: [PATCH 036/114] Hotspots / LINDA_fire docs. (#59493)
Writes some documentation on hotspot itself, perform_exposure, hotspot_expose, and process.
---
.../atmospherics/environmental/LINDA_fire.dm | 47 +++++++++++++++++--
.../atmospherics/gasmixtures/gas_mixture.dm | 7 ++-
2 files changed, 49 insertions(+), 5 deletions(-)
diff --git a/code/modules/atmospherics/environmental/LINDA_fire.dm b/code/modules/atmospherics/environmental/LINDA_fire.dm
index adf0caf795cb1..65c445992fa52 100644
--- a/code/modules/atmospherics/environmental/LINDA_fire.dm
+++ b/code/modules/atmospherics/environmental/LINDA_fire.dm
@@ -8,7 +8,11 @@
/turf/proc/hotspot_expose(exposed_temperature, exposed_volume, soh = 0)
return
-
+/**
+ * Handles the creation of hotspots and initial activation of turfs.
+ * Setting the conditions for the reaction to actually happen for gasmixtures
+ * is handled by the hotspot itself, specifically perform_exposure().
+ */
/turf/open/hotspot_expose(exposed_temperature, exposed_volume, soh)
//If the air doesn't exist we just return false
var/list/air_gases = air?.gases
@@ -40,7 +44,11 @@
//remove just_spawned protection if no longer processing this cell
SSair.add_to_active(src)
-//This is the icon for fire on turfs, also helps for nurturing small fires until they are full tile
+
+/**
+ * Hotspot objects interfaces with the temperature of turf gasmixtures while also providing visual effects.
+ * One important thing to note about hotspots are that they can roughly be divided into two categories based on the bypassing variable.
+ */
/obj/effect/hotspot
anchored = TRUE
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
@@ -53,9 +61,17 @@
light_power = 1
light_color = LIGHT_COLOR_FIRE
+ /**
+ * Volume is the representation of how big and healthy a fire is.
+ * Hotspot volume will be divided by turf volume to get the ratio for temperature setting on non bypassing mode.
+ * Also some visual stuffs for fainter fires.
+ */
var/volume = 125
+ /// Temperature handles the initial ignition and the colouring.
var/temperature = FIRE_MINIMUM_TEMPERATURE_TO_EXIST
+ /// Whether the hotspot is new or not. Used for bypass logic.
var/just_spawned = TRUE
+ /// Whether the hotspot becomes passive and follows the gasmix temp instead of changing it.
var/bypassing = FALSE
var/visual_update_tick = 0
@@ -71,6 +87,19 @@
setDir(pick(GLOB.cardinals))
air_update_turf(FALSE, FALSE)
+/**
+ * Perform interactions between the hotspot and the gasmixture.
+ *
+ * For the first tick, hotspots will take a sample of the air in the turf,
+ * set the temperature equal to a certain amount, and then reacts it.
+ * In some implementations the ratio comes out to around 1, so all of the air in the turf.
+ *
+ * Afterwards if the reaction is big enough it mostly just tags along the fire,
+ * copying the temperature and handling the colouring.
+ * If the reaction is too small it will perform like the first tick.
+ *
+ * Also calls fire_act() which handles burning.
+ */
/obj/effect/hotspot/proc/perform_exposure()
var/turf/open/location = loc
if(!istype(location) || !(location.air))
@@ -80,9 +109,11 @@
bypassing = !just_spawned && (volume > CELL_VOLUME*0.95)
+ //Passive mode
if(bypassing)
volume = location.air.reaction_results["fire"]*FIRE_GROWTH_RATE
temperature = location.air.temperature
+ //Active mode
else
var/datum/gas_mixture/affected = location.air.remove_ratio(volume/location.air.volume)
if(affected) //in case volume is 0
@@ -92,12 +123,14 @@
volume = affected.reaction_results["fire"]*FIRE_GROWTH_RATE
location.assume_air(affected)
+ // Handles the burning of atoms.
for(var/A in location)
var/atom/AT = A
if(!QDELETED(AT) && AT != src)
AT.fire_act(temperature, volume)
return
+/// Mathematics to be used for color calculation.
/obj/effect/hotspot/proc/gauss_lerp(x, x1, x2)
var/b = (x1 + x2) * 0.5
var/c = (x2 - x1) / 6
@@ -157,6 +190,14 @@
alpha = heat_a
#define INSUFFICIENT(path) (!location.air.gases[path] || location.air.gases[path][MOLES] < 0.5)
+
+/**
+ * Regular process proc for hotspots governed by the controller.
+ * Handles the calling of perform_exposure() which handles the bulk of temperature processing.
+ * Burning or fire_act() are also called by perform_exposure().
+ * Also handles the dying and qdeletion of the hotspot and hotspot creations on adjacent cardinal turfs.
+ * And some visual stuffs too! Colors and fainter icons for specific conditions.
+ */
/obj/effect/hotspot/process()
if(just_spawned)
just_spawned = FALSE
@@ -185,7 +226,7 @@
icon_state = "3"
location.burn_tile()
- //Possible spread due to radiated heat
+ //Possible spread due to radiated heat.
if(location.air.temperature > FIRE_MINIMUM_TEMPERATURE_TO_SPREAD)
var/radiated_temperature = location.air.temperature*FIRE_SPREAD_RADIOSITY_SCALE
for(var/t in location.atmos_adjacent_turfs)
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index 8f451ebec252c..7a0258157cf2e 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -37,9 +37,12 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
var/tmp/temperature_archived = 0
var/volume = CELL_VOLUME //liters
var/last_share = 0
+ /// The fire key contains information that might determine the volume of hotspots.
var/list/reaction_results
- var/list/analyzer_results //used for analyzer feedback - not initialized until its used
- var/gc_share = FALSE // Whether to call garbage_collect() on the sharer during shares, used for immutable mixtures
+ /// Used for analyzer feedback - not initialized until its used
+ var/list/analyzer_results
+ /// Whether to call garbage_collect() on the sharer during shares, used for immutable mixtures
+ var/gc_share = FALSE
/datum/gas_mixture/New(volume)
gases = new
From 7d95c7e298254aff38a1920fa4cbf99a39bb8228 Mon Sep 17 00:00:00 2001
From: Emmett Gaines
Date: Sun, 15 Aug 2021 02:01:29 -0400
Subject: [PATCH 037/114] Removes a source of nonexistent parent pipenets
during update (#60853)
Shouldn't have any visible effects. Atmos machines would occasionally complain about parent pipenets not existing during an update and this should resolve a category of those kinds of warning.
(This is a pain side effect of rebuilding being non instant, shoulda been dealt with a long time ago. Thank you -Lemon)
---
code/controllers/subsystem/air.dm | 5 +----
.../modules/atmospherics/machinery/atmosmachinery.dm | 8 ++++++++
.../machinery/components/components_base.dm | 12 ++++++++++++
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index 4c5f876f22eaa..39325b25918a9 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -381,10 +381,7 @@ SUBSYSTEM_DEF(air)
currentrun.len--
if (!remake)
continue
- var/list/targets = remake.get_rebuild_targets()
- remake.rebuilding = FALSE //It's allowed to renter the queue now
- for(var/datum/pipeline/build_off as anything in targets)
- build_off.build_pipeline(remake) //This'll add to the expansion queue
+ remake.rebuild_pipes()
if (MC_TICK_CHECK)
return
diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm
index 200f0b52de99e..ffe4de6aa9338 100644
--- a/code/modules/atmospherics/machinery/atmosmachinery.dm
+++ b/code/modules/atmospherics/machinery/atmosmachinery.dm
@@ -82,6 +82,14 @@
/obj/machinery/atmospherics/proc/destroy_network()
return
+/// This should only be called by SSair as part of the rebuild queue.
+/// Handles rebuilding pipelines after init or they've been changed.
+/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
+
/**
* Returns a list of new pipelines that need to be built up
*/
diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm
index a5039825dc7f0..de50ae8584207 100644
--- a/code/modules/atmospherics/machinery/components/components_base.dm
+++ b/code/modules/atmospherics/machinery/components/components_base.dm
@@ -11,6 +11,8 @@
var/shift_underlay_only = TRUE
///Stores the component pipeline
var/list/datum/pipeline/parents
+ ///If this is queued for a rebuild this var signifies whether parents should be updated after it's done
+ var/update_parents_after_rebuild = FALSE
///Stores the component gas mixture
var/list/datum/gas_mixture/airs
@@ -99,6 +101,11 @@
..()
update_parents()
+/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)
@@ -192,6 +199,11 @@
* This way gases won't get stuck
*/
/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)
From 9320505d814b1a673f38f304b09954e6ed046461 Mon Sep 17 00:00:00 2001
From: Ghilker <42839747+Ghilker@users.noreply.github.com>
Date: Sun, 29 Aug 2021 10:05:20 +0200
Subject: [PATCH 038/114] Atmos re-Defined (#60855)
This PR takes the atmospherics.dm in _DEFINES and split it into several files to lower the mess, increase readability and improve on the code for later uses
Also added some docs here and there
---
beestation.dme | 6 +-
code/__DEFINES/atmospherics.dm | 588 ------------------
code/__DEFINES/atmospherics/atmos_core.dm | 189 ++++++
code/__DEFINES/atmospherics/atmos_helpers.dm | 72 +++
.../atmospherics/atmos_mapping_helpers.dm | 189 ++++++
.../atmospherics/atmos_mob_interaction.dm | 135 ++++
code/__DEFINES/atmospherics/atmos_piping.dm | 83 +++
7 files changed, 673 insertions(+), 589 deletions(-)
delete mode 100644 code/__DEFINES/atmospherics.dm
create mode 100644 code/__DEFINES/atmospherics/atmos_core.dm
create mode 100644 code/__DEFINES/atmospherics/atmos_helpers.dm
create mode 100644 code/__DEFINES/atmospherics/atmos_mapping_helpers.dm
create mode 100644 code/__DEFINES/atmospherics/atmos_mob_interaction.dm
create mode 100644 code/__DEFINES/atmospherics/atmos_piping.dm
diff --git a/beestation.dme b/beestation.dme
index 4191d2618d811..a606975406d62 100644
--- a/beestation.dme
+++ b/beestation.dme
@@ -40,8 +40,12 @@
#include "code\__DEFINES\art.dm"
#include "code\__DEFINES\assets.dm"
#include "code\__DEFINES\async.dm"
-#include "code\__DEFINES\atmospherics.dm"
#include "code\__DEFINES\atom_hud.dm"
+#include "code\__DEFINES\atmospherics\atmos_core.dm"
+#include "code\__DEFINES\atmospherics\atmos_helpers.dm"
+#include "code\__DEFINES\atmospherics\atmos_mapping_helpers.dm"
+#include "code\__DEFINES\atmospherics\atmos_mob_interaction.dm"
+#include "code\__DEFINES\atmospherics\atmos_piping.dm"
#include "code\__DEFINES\balloon_alert.dm"
#include "code\__DEFINES\bans.dm"
#include "code\__DEFINES\basic_mobs.dm"
diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm
deleted file mode 100644
index eed196e0f653e..0000000000000
--- a/code/__DEFINES/atmospherics.dm
+++ /dev/null
@@ -1,588 +0,0 @@
-//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)
-#define R_IDEAL_GAS_EQUATION 8.31
-/// kPa
-#define ONE_ATMOSPHERE 101.325
-/// -270.3degC
-#define TCMB 2.7
-/// -48.15degC
-#define TCRYO 225
-/// 0degC
-#define T0C 273.15
-/// 20degC
-#define T20C 293.15
-/// -14C - Temperature used for kitchen cold room, medical freezer, etc.
-#define COLD_ROOM_TEMP 259.15
-
-///moles in a 2.5 m^3 cell at 101.325 Pa and 20 degC (103 or so)
-#define MOLES_CELLSTANDARD (ONE_ATMOSPHERE*CELL_VOLUME/(T20C*R_IDEAL_GAS_EQUATION))
-///compared against for superconductivity
-#define M_CELL_WITH_RATIO (MOLES_CELLSTANDARD * 0.005)
-/// percentage of oxygen in a normal mixture of air
-#define O2STANDARD 0.21
-/// same but for nitrogen
-#define N2STANDARD 0.79
-/// O2 standard value (21%)
-#define MOLES_O2STANDARD (MOLES_CELLSTANDARD*O2STANDARD)
-/// N2 standard value (79%)
-#define MOLES_N2STANDARD (MOLES_CELLSTANDARD*N2STANDARD)
-/// liters in a cell
-#define CELL_VOLUME 2500
-/** liters in a normal breath. note that breaths are taken once every 4 life ticks, which is 8 seconds
- * Addendum for people tweaking this value in the future.
- * Because o2 tank release values/human o2 requirements are very strictly set to the same pressure, small errors can cause breakage
- * This comes from QUANTIZE being used in /datum/gas_mixture.remove(), forming a slight sawtooth pattern of the added/removed gas, centered on the actual pressure
- * Changing BREATH_VOLUME can set us on the lower half of this sawtooth, making humans unable to breath at standard pressure.
- * There's no good way I can come up with to hardcode a fix for this. So if you're going to change this variable
- * graph the functions that describe how it is used/how it interacts with breath code, and pick something on the upper half of the sawtooth
- *
-**/
-#define BREATH_VOLUME 1.99
-/// Amount of air to take a from a tile
-#define BREATH_PERCENTAGE (BREATH_VOLUME/CELL_VOLUME)
-
-/**
- * Some further context on breakdown. Unlike dismantle, the breakdown ticker doesn't reset itself when a tile is added
- * This is because we cannot expect maps to have small spaces, so we need to even ourselves out often
- * We do this to avoid equalizing a large space in one tick, with some significant amount of say heat diff
- * This way large areas don't suddenly all become cold at once, it acts more like a wave
- *
- * Because of this and the behavior of share(), the breakdown cycles value can be tweaked directly to effect how fast we want gas to move
- */
-//EXCITED GROUPS
-/// number of FULL air controller ticks before an excited group breaks down (averages gas contents across turfs)
-#define EXCITED_GROUP_BREAKDOWN_CYCLES 5
-/// number of FULL air controller ticks before an excited group dismantles and removes its turfs from active
-#define EXCITED_GROUP_DISMANTLE_CYCLES (EXCITED_GROUP_BREAKDOWN_CYCLES * 2) + 1 //Reset after 2 breakdowns
-/// Ratio of air that must move to/from a tile to reset group processing
-#define MINIMUM_AIR_RATIO_TO_SUSPEND 0.1
-/// Minimum ratio of air that must move to/from a tile
-#define MINIMUM_AIR_RATIO_TO_MOVE 0.001
-/// Minimum amount of air that has to move before a group processing can be suspended (Round about 10)
-#define MINIMUM_AIR_TO_SUSPEND (MOLES_CELLSTANDARD*MINIMUM_AIR_RATIO_TO_SUSPEND)
-/// Either this must be active (round about 0.1) //Might need to raise this a tad to better support space leaks. we'll see
-#define MINIMUM_MOLES_DELTA_TO_MOVE (MOLES_CELLSTANDARD*MINIMUM_AIR_RATIO_TO_MOVE)
-/// or this (or both, obviously)
-#define MINIMUM_TEMPERATURE_TO_MOVE (T20C+100)
-/// Minimum temperature difference before group processing is suspended
-#define MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND 4
-/// Minimum temperature difference before the gas temperatures are just set to be equal
-#define MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER 0.5
-#define MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION (T20C+80)
-#define MINIMUM_TEMPERATURE_START_SUPERCONDUCTION (T20C+400)
-
-
-//HEAT TRANSFER COEFFICIENTS
-//Must be between 0 and 1. Values closer to 1 equalize temperature faster
-//Should not exceed 0.4 else strange heat flow occur
-#define WALL_HEAT_TRANSFER_COEFFICIENT 0.0
-#define OPEN_HEAT_TRANSFER_COEFFICIENT 0.4
-/// a hack for now
-#define WINDOW_HEAT_TRANSFER_COEFFICIENT 0.1
-/// a hack to help make vacuums "cold", sacrificing realism for gameplay
-#define HEAT_CAPACITY_VACUUM 7000
-
-//FIRE
-#define FIRE_MINIMUM_TEMPERATURE_TO_SPREAD (150+T0C)
-#define FIRE_MINIMUM_TEMPERATURE_TO_EXIST (100+T0C)
-#define FIRE_SPREAD_RADIOSITY_SCALE 0.85
-#define FIRE_GROWTH_RATE 40000 //For small fires
-#define PLASMA_MINIMUM_BURN_TEMPERATURE (100+T0C)
-#define PLASMA_UPPER_TEMPERATURE (1370+T0C)
-#define PLASMA_OXYGEN_FULLBURN 10
-#define HYDROGEN_MINIMUM_BURN_TEMPERATURE (100+T0C)
-#define HYDROGEN_UPPER_TEMPERATURE (1370+T0C)
-#define HYDROGEN_OXYGEN_FULLBURN 10
-
-//COLD FIRE (this is used only for the freon-o2 reaction, there is no fire still)
-#define COLD_FIRE_MAXIMUM_TEMPERATURE_TO_SPREAD 263 //fire will spread if the temperature is -10 °C
-#define COLD_FIRE_MAXIMUM_TEMPERATURE_TO_EXIST 273 //fire will start if the temperature is 0 °C
-#define COLD_FIRE_SPREAD_RADIOSITY_SCALE 0.95
-#define COLD_FIRE_GROWTH_RATE 40000
-#define FREON_MAXIMUM_BURN_TEMPERATURE 283
-#define FREON_LOWER_TEMPERATURE 60 //minimum temperature allowed for the burn to go, we would have negative pressure otherwise
-#define FREON_OXYGEN_FULLBURN 10
-
-//GASES
-#define MIN_TOXIC_GAS_DAMAGE 1
-#define MAX_TOXIC_GAS_DAMAGE 10
-/// Moles in a standard cell after which gases are visible
-#define MOLES_GAS_VISIBLE 0.25
-
-/// moles_visible * FACTOR_GAS_VISIBLE_MAX = Moles after which gas is at maximum visibility
-#define FACTOR_GAS_VISIBLE_MAX 20
-/// Mole step for alpha updates. This means alpha can update at 0.25, 0.5, 0.75 and so on
-#define MOLES_GAS_VISIBLE_STEP 0.25
-/// The total visible states
-#define TOTAL_VISIBLE_STATES (FACTOR_GAS_VISIBLE_MAX * (1 / MOLES_GAS_VISIBLE_STEP))
-
-//REACTIONS
-//return values for reactions (bitflags)
-#define NO_REACTION 0
-#define REACTING 1
-#define STOP_REACTIONS 2
-
-// Pressure limits.
-/// This determins at what pressure the ultra-high pressure red icon is displayed. (This one is set as a constant)
-#define HAZARD_HIGH_PRESSURE 550
-/// This determins when the orange pressure icon is displayed (it is 0.7 * HAZARD_HIGH_PRESSURE)
-#define WARNING_HIGH_PRESSURE 325
-/// This is when the gray low pressure icon is displayed. (it is 2.5 * HAZARD_LOW_PRESSURE)
-#define WARNING_LOW_PRESSURE 50
-/// This is when the black ultra-low pressure icon is displayed. (This one is set as a constant)
-#define HAZARD_LOW_PRESSURE 20
-
-/// This is used in handle_temperature_damage() for humans, and in reagents that affect body temperature. Temperature damage is multiplied by this amount.
-#define TEMPERATURE_DAMAGE_COEFFICIENT 1.5
-
-/// The natural temperature for a body
-#define BODYTEMP_NORMAL 310.15
-/// This is the divisor which handles how much of the temperature difference between the current body temperature and 310.15K (optimal temperature) humans auto-regenerate each tick. The higher the number, the slower the recovery. This is applied each tick, so long as the mob is alive.
-#define BODYTEMP_AUTORECOVERY_DIVISOR 14
-/// Minimum amount of kelvin moved toward 310K per tick. So long as abs(310.15 - bodytemp) is more than 50.
-#define BODYTEMP_AUTORECOVERY_MINIMUM 6
-///Similar to the BODYTEMP_AUTORECOVERY_DIVISOR, but this is the divisor which is applied at the stage that follows autorecovery. This is the divisor which comes into play when the human's loc temperature is lower than their body temperature. Make it lower to lose bodytemp faster.
-#define BODYTEMP_COLD_DIVISOR 15
-/// Similar to the BODYTEMP_AUTORECOVERY_DIVISOR, but this is the divisor which is applied at the stage that follows autorecovery. This is the divisor which comes into play when the human's loc temperature is higher than their body temperature. Make it lower to gain bodytemp faster.
-#define BODYTEMP_HEAT_DIVISOR 15
-/// The maximum number of degrees that your body can cool in 1 tick, due to the environment, when in a cold area.
-#define BODYTEMP_COOLING_MAX -30
-/// The maximum number of degrees that your body can heat up in 1 tick, due to the environment, when in a hot area.
-#define BODYTEMP_HEATING_MAX 30
-/// The body temperature limit the human body can take before it starts taking damage from heat.
-/// This also affects how fast the body normalises it's temperature when hot.
-/// 340k is about 66c, and rather high for a human.
-#define BODYTEMP_HEAT_DAMAGE_LIMIT (BODYTEMP_NORMAL + 30)
-/// The body temperature limit the human body can take before it starts taking damage from cold.
-/// This also affects how fast the body normalises it's temperature when cold.
-/// 270k is about -3c, that is below freezing and would hurt over time.
-#define BODYTEMP_COLD_DAMAGE_LIMIT (BODYTEMP_NORMAL - 40)
-/// The body temperature limit the human body can take before it will take wound damage.
-#define BODYTEMP_HEAT_WOUND_LIMIT (BODYTEMP_NORMAL + 90) // 400.5 k
-
-// Body temperature warning icons
-/// The temperature the red icon is displayed.
-#define BODYTEMP_HEAT_WARNING_3 (BODYTEMP_HEAT_DAMAGE_LIMIT + 360) //+700k
-/// The temperature the orange icon is displayed.
-#define BODYTEMP_HEAT_WARNING_2 (BODYTEMP_HEAT_DAMAGE_LIMIT + 120) //460K
-/// The temperature the yellow icon is displayed.
-#define BODYTEMP_HEAT_WARNING_1 (BODYTEMP_HEAT_DAMAGE_LIMIT) //340K
-/// The temperature the light green icon is displayed.
-#define BODYTEMP_COLD_WARNING_1 (BODYTEMP_COLD_DAMAGE_LIMIT) //270k
-/// The temperature the cyan icon is displayed.
-#define BODYTEMP_COLD_WARNING_2 (BODYTEMP_COLD_DAMAGE_LIMIT - 70) //200k
-/// The temperature the blue icon is displayed.
-#define BODYTEMP_COLD_WARNING_3 (BODYTEMP_COLD_DAMAGE_LIMIT - 150) //120k
-
-
-//Emergency skinsuits
-#define EMERGENCY_HELM_MIN_TEMP_PROTECT 2.0 //The helmet is pressurized with air from the oxygen tank. If they don't take damage from that they won't take damage here
-#define EMERGENCY_SUIT_MIN_TEMP_PROTECT 237 //This is the approximate average temperature of Mt. Everest in the winter
-
-/// what min_cold_protection_temperature is set to for space-helmet quality headwear. MUST NOT BE 0.
-#define SPACE_HELM_MIN_TEMP_PROTECT 2.0
-/// Thermal insulation works both ways /Malkevin
-#define SPACE_HELM_MAX_TEMP_PROTECT 1500
-/// what min_cold_protection_temperature is set to for space-suit quality jumpsuits or suits. MUST NOT BE 0.
-#define SPACE_SUIT_MIN_TEMP_PROTECT 2.0
-/// The min cold protection of a space suit without the heater active
-#define SPACE_SUIT_MIN_TEMP_PROTECT_OFF 72
-#define SPACE_SUIT_MAX_TEMP_PROTECT 1500
-
-/// Cold protection for firesuits
-#define FIRE_SUIT_MIN_TEMP_PROTECT 60
-/// what max_heat_protection_temperature is set to for firesuit quality suits. MUST NOT BE 0.
-#define FIRE_SUIT_MAX_TEMP_PROTECT 30000
-/// Cold protection for fire helmets
-#define FIRE_HELM_MIN_TEMP_PROTECT 60
-/// for fire helmet quality items (red and white hardhats)
-#define FIRE_HELM_MAX_TEMP_PROTECT 30000
-
-/// what max_heat_protection_temperature is set to for firesuit quality suits and helmets. MUST NOT BE 0.
-#define FIRE_IMMUNITY_MAX_TEMP_PROTECT 35000
-
-/// For normal helmets
-#define HELMET_MIN_TEMP_PROTECT 160
-/// For normal helmets
-#define HELMET_MAX_TEMP_PROTECT 600
-/// For armor
-#define ARMOR_MIN_TEMP_PROTECT 160
-/// For armor
-#define ARMOR_MAX_TEMP_PROTECT 600
-
-/// For some gloves (black and)
-#define GLOVES_MIN_TEMP_PROTECT 2.0
-/// For some gloves
-#define GLOVES_MAX_TEMP_PROTECT 1500
-/// For gloves
-#define SHOES_MIN_TEMP_PROTECT 2.0
-/// For gloves
-#define SHOES_MAX_TEMP_PROTECT 1500
-
-/// The amount of pressure damage someone takes is equal to (pressure / HAZARD_HIGH_PRESSURE)*PRESSURE_DAMAGE_COEFFICIENT, with the maximum of MAX_PRESSURE_DAMAGE
-#define PRESSURE_DAMAGE_COEFFICIENT 4
-#define MAX_HIGH_PRESSURE_DAMAGE 4
-/// The amount of damage someone takes when in a low pressure area (The pressure threshold is so low that it doesn't make sense to do any calculations, so it just applies this flat value).
-#define LOW_PRESSURE_DAMAGE 4
-
-/// Humans are slowed by the difference between bodytemp and BODYTEMP_COLD_DAMAGE_LIMIT divided by this
-#define COLD_SLOWDOWN_FACTOR 20
-
-//PIPES
-//Atmos pipe limits
-/// (kPa) What pressure pumps and powered equipment max out at.
-#define MAX_OUTPUT_PRESSURE 4500
-/// (L/s) Maximum speed powered equipment can work at.
-#define MAX_TRANSFER_RATE 200
-/// How many percent of the contents that an overclocked volume pumps leak into the air
-#define VOLUME_PUMP_LEAK_AMOUNT 0.1
-//used for device_type vars
-#define UNARY 1
-#define BINARY 2
-#define TRINARY 3
-#define QUATERNARY 4
-
-//TANKS
-/// temperature in kelvins at which a tank will start to melt
-#define TANK_MELT_TEMPERATURE 1000000
-/// Tank starts leaking
-#define TANK_LEAK_PRESSURE (30.*ONE_ATMOSPHERE)
-/// Tank spills all contents into atmosphere
-#define TANK_RUPTURE_PRESSURE (35.*ONE_ATMOSPHERE)
-/// Boom 3x3 base explosion
-#define TANK_FRAGMENT_PRESSURE (40.*ONE_ATMOSPHERE)
-/// +1 for each SCALE kPa aboe threshold
-#define TANK_FRAGMENT_SCALE (6.*ONE_ATMOSPHERE)
-#define TANK_MAX_RELEASE_PRESSURE (ONE_ATMOSPHERE*3)
-#define TANK_MIN_RELEASE_PRESSURE 0
-#define TANK_DEFAULT_RELEASE_PRESSURE 16
-
-//CANATMOSPASS
-#define ATMOS_PASS_YES 1
-#define ATMOS_PASS_NO 0
-/// ask CanAtmosPass()
-#define ATMOS_PASS_PROC -1
-/// just check density
-#define ATMOS_PASS_DENSITY -2
-
-//DO NOT USE THESE FOR ACCESSING ATMOS DATA, THEY MUTATE THINGS WHEN CALLED. I WILL BEAT YOU WITH A STICK. See the actual proc for more details
-#define CANATMOSPASS(A, O) ( A.CanAtmosPass == ATMOS_PASS_PROC ? A.CanAtmosPass(O) : ( A.CanAtmosPass == ATMOS_PASS_DENSITY ? !A.density : A.CanAtmosPass ) )
-#define CANVERTICALATMOSPASS(A, O) ( A.CanAtmosPassVertical == ATMOS_PASS_PROC ? A.CanAtmosPass(O, TRUE) : ( A.CanAtmosPassVertical == ATMOS_PASS_DENSITY ? !A.density : A.CanAtmosPassVertical ) )
-
-//OPEN TURF ATMOS
-/// the default air mix that open turfs spawn
-#define OPENTURF_DEFAULT_ATMOS "o2=22;n2=82;TEMP=293.15"
-#define OPENTURF_LOW_PRESSURE "o2=14;n2=30;TEMP=293.15"
-/// -193,15°C telecommunications. also used for xenobiology slime killrooms
-#define TCOMMS_ATMOS "n2=100;TEMP=80"
-/// space
-#define AIRLESS_ATMOS "TEMP=2.7"
-/// -93.15°C snow and ice turfs
-#define FROZEN_ATMOS "o2=22;n2=82;TEMP=180"
-/// -14°C kitchen coldroom, just might loss your tail; higher amount of mol to reach about 101.3 kpA
-#define KITCHEN_COLDROOM_ATMOS "o2=26;n2=97;TEMP=[COLD_ROOM_TEMP]"
-/// used in the holodeck burn test program
-#define BURNMIX_ATMOS "o2=2500;plasma=5000;TEMP=370"
-
-//ATMOSPHERICS DEPARTMENT GAS TANK TURFS
-#define ATMOS_TANK_N2O "n2o=6000;TEMP=293.15"
-#define ATMOS_TANK_CO2 "co2=50000;TEMP=293.15"
-#define ATMOS_TANK_PLASMA "plasma=70000;TEMP=293.15"
-#define ATMOS_TANK_O2 "o2=100000;TEMP=293.15"
-#define ATMOS_TANK_N2 "n2=100000;TEMP=293.15"
-#define ATMOS_TANK_BZ "bz=100000;TEMP=293.15"
-#define ATMOS_TANK_FREON "freon=100000;TEMP=293.15"
-#define ATMOS_TANK_HALON "halon=100000;TEMP=293.15"
-#define ATMOS_TANK_HEALIUM "healium=100000;TEMP=293.15"
-#define ATMOS_TANK_H2 "hydrogen=100000;TEMP=293.15"
-#define ATMOS_TANK_HYPERNOBLIUM "nob=100000;TEMP=293.15"
-#define ATMOS_TANK_MIASMA "miasma=100000;TEMP=293.15"
-#define ATMOS_TANK_NO2 "no2=100000;TEMP=293.15"
-#define ATMOS_TANK_PLUOXIUM "pluox=100000;TEMP=293.15"
-#define ATMOS_TANK_PROTO_NITRATE "proto_nitrate=100000;TEMP=293.15"
-#define ATMOS_TANK_STIMULUM "stim=100000;TEMP=293.15"
-#define ATMOS_TANK_TRITIUM "tritium=100000;TEMP=293.15"
-#define ATMOS_TANK_H2O "water_vapor=100000;TEMP=293.15"
-#define ATMOS_TANK_ZAUKER "zauker=100000;TEMP=293.15"
-#define ATMOS_TANK_HELIUM "helium=100000;TEMP=293.15"
-#define ATMOS_TANK_ANTINOBLIUM "antinoblium=100000;TEMP=293.15"
-#define ATMOS_TANK_AIRMIX "o2=2644;n2=10580;TEMP=293.15"
-
-//LAVALAND
-/// what pressure you have to be under to increase the effect of equipment meant for lavaland
-#define MAXIMUM_LAVALAND_EQUIPMENT_EFFECT_PRESSURE 90
-
-//ATMOS MIX IDS
-#define LAVALAND_DEFAULT_ATMOS "LAVALAND_ATMOS"
-#define ICEMOON_DEFAULT_ATMOS "ICEMOON_ATMOS"
-
-//ATMOSIA GAS MONITOR TAGS
-#define ATMOS_GAS_MONITOR_INPUT_O2 "o2_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_O2 "o2_out"
-#define ATMOS_GAS_MONITOR_SENSOR_O2 "o2_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_PLASMA "plasma_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_PLASMA "plasma_out"
-#define ATMOS_GAS_MONITOR_SENSOR_PLASMA "plasma_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_AIR "air_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_AIR "air_out"
-#define ATMOS_GAS_MONITOR_SENSOR_AIR "air_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_MIX "mix_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_MIX "mix_out"
-#define ATMOS_GAS_MONITOR_SENSOR_MIX "mix_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_N2O "n2o_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_N2O "n2o_out"
-#define ATMOS_GAS_MONITOR_SENSOR_N2O "n2o_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_N2 "n2_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_N2 "n2_out"
-#define ATMOS_GAS_MONITOR_SENSOR_N2 "n2_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_CO2 "co2_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_CO2 "co2_out"
-#define ATMOS_GAS_MONITOR_SENSOR_CO2 "co2_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_BZ "bz_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_BZ "bz_out"
-#define ATMOS_GAS_MONITOR_SENSOR_BZ "bz_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_FREON "freon_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_FREON "freon_out"
-#define ATMOS_GAS_MONITOR_SENSOR_FREON "freon_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_HALON "halon_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_HALON "halon_out"
-#define ATMOS_GAS_MONITOR_SENSOR_HALON "halon_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_HEALIUM "healium_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_HEALIUM "healium_out"
-#define ATMOS_GAS_MONITOR_SENSOR_HEALIUM "healium_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_H2 "h2_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_H2 "h2_out"
-#define ATMOS_GAS_MONITOR_SENSOR_H2 "h2_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_HYPERNOBLIUM "hypernoblium_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_HYPERNOBLIUM "hypernoblium_out"
-#define ATMOS_GAS_MONITOR_SENSOR_HYPERNOBLIUM "hypernoblium_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_MIASMA "miasma_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_MIASMA "miasma_out"
-#define ATMOS_GAS_MONITOR_SENSOR_MIASMA "miasma_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_NO2 "no2_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_NO2 "no2_out"
-#define ATMOS_GAS_MONITOR_SENSOR_NO2 "no2_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_PLUOXIUM "pluoxium_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_PLUOXIUM "pluoxium_out"
-#define ATMOS_GAS_MONITOR_SENSOR_PLUOXIUM "pluoxium_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_PROTO_NITRATE "proto-nitrate_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_PROTO_NITRATE "proto-nitrate_out"
-#define ATMOS_GAS_MONITOR_SENSOR_PROTO_NITRATE "proto-nitrate_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_STIMULUM "stimulum_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_STIMULUM "stimulum_out"
-#define ATMOS_GAS_MONITOR_SENSOR_STIMULUM "stimulum_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_TRITIUM "tritium_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_TRITIUM "tritium_out"
-#define ATMOS_GAS_MONITOR_SENSOR_TRITIUM "tritium_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_H2O "h2o_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_H2O "h2o_out"
-#define ATMOS_GAS_MONITOR_SENSOR_H2O "h2o_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_ZAUKER "zauker_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_ZAUKER "zauker_out"
-#define ATMOS_GAS_MONITOR_SENSOR_ZAUKER "zauker_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_HELIUM "helium_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_HELIUM "helium_out"
-#define ATMOS_GAS_MONITOR_SENSOR_HELIUM "helium_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_ANTINOBLIUM "antinoblium_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_ANTINOBLIUM "antinoblium_out"
-#define ATMOS_GAS_MONITOR_SENSOR_ANTINOBLIUM "antinoblium_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_INCINERATOR "incinerator_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_INCINERATOR "incinerator_out"
-#define ATMOS_GAS_MONITOR_SENSOR_INCINERATOR "incinerator_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_TOXINS_LAB "toxinslab_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_TOXINS_LAB "toxinslab_out"
-#define ATMOS_GAS_MONITOR_SENSOR_TOXINS_LAB "toxinslab_sensor"
-
-#define ATMOS_GAS_MONITOR_LOOP_DISTRIBUTION "distro-loop_meter"
-#define ATMOS_GAS_MONITOR_LOOP_ATMOS_WASTE "atmos-waste_loop_meter"
-
-#define ATMOS_GAS_MONITOR_WASTE_ENGINE "engine-waste_out"
-#define ATMOS_GAS_MONITOR_WASTE_ATMOS "atmos-waste_out"
-
-#define ATMOS_GAS_MONITOR_INPUT_SM "sm_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_SM "sm_out"
-#define ATMOS_GAS_MONITOR_SENSOR_SM "sm_sense"
-
-#define ATMOS_GAS_MONITOR_INPUT_SM_WASTE "sm_waste_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_SM_WASTE "sm_waste_out"
-#define ATMOS_GAS_MONITOR_SENSOR_SM_WASTE "sm_waste_sense"
-
-#define ATMOS_GAS_MONITOR_INPUT_TOXINS_WASTE "toxins_waste_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_TOXINS_WASTE "toxins_waste_out"
-#define ATMOS_GAS_MONITOR_SENSOR_TOXINS_WASTE "toxins_waste_sense"
-
-//AIRLOCK CONTROLLER TAGS
-
-//RnD toxins burn chamber
-#define INCINERATOR_TOXMIX_IGNITER "toxmix_igniter"
-#define INCINERATOR_TOXMIX_VENT "toxmix_vent"
-#define INCINERATOR_TOXMIX_DP_VENTPUMP "toxmix_airlock_pump"
-#define INCINERATOR_TOXMIX_AIRLOCK_SENSOR "toxmix_airlock_sensor"
-#define INCINERATOR_TOXMIX_AIRLOCK_CONTROLLER "toxmix_airlock_controller"
-#define INCINERATOR_TOXMIX_AIRLOCK_INTERIOR "toxmix_airlock_interior"
-#define INCINERATOR_TOXMIX_AIRLOCK_EXTERIOR "toxmix_airlock_exterior"
-
-//Atmospherics/maintenance incinerator
-#define INCINERATOR_ATMOS_IGNITER "atmos_incinerator_igniter"
-#define INCINERATOR_ATMOS_MAINVENT "atmos_incinerator_mainvent"
-#define INCINERATOR_ATMOS_AUXVENT "atmos_incinerator_auxvent"
-#define INCINERATOR_ATMOS_DP_VENTPUMP "atmos_incinerator_airlock_pump"
-#define INCINERATOR_ATMOS_AIRLOCK_SENSOR "atmos_incinerator_airlock_sensor"
-#define INCINERATOR_ATMOS_AIRLOCK_CONTROLLER "atmos_incinerator_airlock_controller"
-#define INCINERATOR_ATMOS_AIRLOCK_INTERIOR "atmos_incinerator_airlock_interior"
-#define INCINERATOR_ATMOS_AIRLOCK_EXTERIOR "atmos_incinerator_airlock_exterior"
-#define TEST_ROOM_ATMOS_MAINVENT_1 "atmos_test_room_mainvent_1"
-#define TEST_ROOM_ATMOS_MAINVENT_2 "atmos_test_room_mainvent_2"
-
-//Syndicate lavaland base incinerator (lavaland_surface_syndicate_base1.dmm)
-#define INCINERATOR_SYNDICATELAVA_IGNITER "syndicatelava_igniter"
-#define INCINERATOR_SYNDICATELAVA_MAINVENT "syndicatelava_mainvent"
-#define INCINERATOR_SYNDICATELAVA_AUXVENT "syndicatelava_auxvent"
-#define INCINERATOR_SYNDICATELAVA_DP_VENTPUMP "syndicatelava_airlock_pump"
-#define INCINERATOR_SYNDICATELAVA_AIRLOCK_SENSOR "syndicatelava_airlock_sensor"
-#define INCINERATOR_SYNDICATELAVA_AIRLOCK_CONTROLLER "syndicatelava_airlock_controller"
-#define INCINERATOR_SYNDICATELAVA_AIRLOCK_INTERIOR "syndicatelava_airlock_interior"
-#define INCINERATOR_SYNDICATELAVA_AIRLOCK_EXTERIOR "syndicatelava_airlock_exterior"
-
-//MULTIPIPES
-//IF YOU EVER CHANGE THESE CHANGE SPRITES TO MATCH.
-//layer = initial(layer) + piping_layer / 1000 in atmospherics/update_icon() to determine order of pipe overlap
-#define PIPING_LAYER_MIN 1
-#define PIPING_LAYER_MAX 5
-#define PIPING_LAYER_DEFAULT 3
-#define PIPING_LAYER_P_X 5
-#define PIPING_LAYER_P_Y 5
-#define PIPING_LAYER_LCHANGE 0.05
-
-/// intended to connect with all layers, check for all instead of just one.
-#define PIPING_ALL_LAYER (1<<0)
-/// can only be built if nothing else with this flag is on the tile already.
-#define PIPING_ONE_PER_TURF (1<<1)
-/// can only exist at PIPING_LAYER_DEFAULT
-#define PIPING_DEFAULT_LAYER_ONLY (1<<2)
-/// north/south east/west doesn't matter, auto normalize on build.
-#define PIPING_CARDINAL_AUTONORMALIZE (1<<3)
-
-// Ventcrawling bitflags, handled in var/vent_movement
-///Allows for ventcrawling to occur. All atmospheric machines have this flag on by default. Cryo is the exception
-#define VENTCRAWL_ALLOWED (1<<0)
-///Allows mobs to enter or leave from atmospheric machines. On for passive, unary, and scrubber vents.
-#define VENTCRAWL_ENTRANCE_ALLOWED (1<<1)
-///Used to check if a machinery is visible. Called by update_pipe_vision(). On by default for all except cryo.
-#define VENTCRAWL_CAN_SEE (1<<2)
-
-GLOBAL_LIST_INIT(pipe_paint_colors, sort_list(list(
- "amethyst" = rgb(130,43,255), //supplymain
- "blue" = rgb(0,0,255),
- "brown" = rgb(178,100,56),
- "cyan" = rgb(0,255,249),
- "dark" = rgb(69,69,69),
- "green" = rgb(30,255,0),
- "grey" = rgb(255,255,255),
- "orange" = rgb(255,129,25),
- "purple" = rgb(128,0,182),
- "red" = rgb(255,0,0),
- "violet" = rgb(64,0,128),
- "yellow" = rgb(255,198,0)
-)))
-
-//Helpers
-#define PIPING_LAYER_SHIFT(T, PipingLayer) \
- if(T.dir & (NORTH|SOUTH)) { \
- T.pixel_x = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_X;\
- } \
- if(T.dir & (EAST|WEST)) { \
- T.pixel_y = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_Y;\
- }
-
-#define PIPING_FORWARD_SHIFT(T, PipingLayer, more_shift) \
- if(T.dir & (NORTH|SOUTH)) { \
- T.pixel_y += more_shift * (PipingLayer - PIPING_LAYER_DEFAULT);\
- } \
- if(T.dir & (EAST|WEST)) { \
- T.pixel_x += more_shift * (PipingLayer - PIPING_LAYER_DEFAULT);\
- }
-
-#define PIPING_LAYER_DOUBLE_SHIFT(T, PipingLayer) \
- T.pixel_x = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_X;\
- T.pixel_y = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_Y;
-
-#define THERMAL_ENERGY(gas) (gas.temperature * gas.heat_capacity())
-
-#define ADD_GAS(gas_id, out_list)\
- var/list/tmp_gaslist = GLOB.gaslist_cache[gas_id]; out_list[gas_id] = tmp_gaslist.Copy();
-
-#define ASSERT_GAS(gas_id, gas_mixture) if (!gas_mixture.gases[gas_id]) { ADD_GAS(gas_id, gas_mixture.gases) };
-
-///Adds a gas to a gas LIST but checks if is already present, accepts a list instead of a datum, so faster if the list is locally cached
-#define ASSERT_GAS_IN_LIST(gas_id, gases) if (!gases[gas_id]) { ADD_GAS(gas_id, gases) };
-
-
-//prefer this to gas_mixture/total_moles in performance critical areas
-#define TOTAL_MOLES(cached_gases, out_var)\
- out_var = 0;\
- for(var/total_moles_id in cached_gases){\
- out_var += cached_gases[total_moles_id][MOLES];\
- }
-
-#define TOTAL_MOLES_SPECIFIC(cached_gases, gas_id, out_var)\
- out_var = 0;\
- if(cached_gases[gas_id]){\
- out_var = cached_gases[gas_id][MOLES];\
- }
-
-#ifdef TESTING
-GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
-#define CALCULATE_ADJACENT_TURFS(T, state) if (SSadjacent_air.queue[T]) { GLOB.atmos_adjacent_savings[1] += 1 } else { GLOB.atmos_adjacent_savings[2] += 1; SSadjacent_air.queue[T] = state}
-#else
-#define CALCULATE_ADJACENT_TURFS(T, state) SSadjacent_air.queue[T] = state
-#endif
-
-//Adjacent turf related defines, they dictate what to do with a turf once it's been recalculated
-//Used as "state" in CALCULATE_ADJACENT_TURFS
-#define NORMAL_TURF 1
-#define MAKE_ACTIVE 2
-#define KILL_EXCITED 3
-
-//If you're doing spreading things related to atmos, DO NOT USE CANATMOSPASS, IT IS NOT CHEAP. use this instead, the info is cached after all. it's tweaked just a bit to allow for circular checks
-#define TURFS_CAN_SHARE(T1, T2) (LAZYACCESS(T2.atmos_adjacent_turfs, T1) || LAZYLEN(T1.atmos_adjacent_turfs & T2.atmos_adjacent_turfs))
-//Use this to see if a turf is fully blocked or not, think windows or firelocks. Fails with 1x1 non full tile windows, but it's not worth the cost.
-#define TURF_SHARES(T) (LAZYLEN(T.atmos_adjacent_turfs))
-
diff --git a/code/__DEFINES/atmospherics/atmos_core.dm b/code/__DEFINES/atmospherics/atmos_core.dm
new file mode 100644
index 0000000000000..1ef465435d239
--- /dev/null
+++ b/code/__DEFINES/atmospherics/atmos_core.dm
@@ -0,0 +1,189 @@
+//LISTMOS
+//indices of values in gas lists.
+///Amount of total moles in said gas mixture
+#define MOLES 1
+///Archived version of MOLES
+#define ARCHIVE 2
+///All gas related variables
+#define GAS_META 3
+///Gas specific heat per mole
+#define META_GAS_SPECIFIC_HEAT 1
+///Name of the gas
+#define META_GAS_NAME 2
+///Amount of moles required of the gas to be visible
+#define META_GAS_MOLES_VISIBLE 3
+///Overlay path of the gas, also setup the alpha based on the amount
+#define META_GAS_OVERLAY 4
+///Let the air alarm know if the gas is dangerous
+#define META_GAS_DANGER 5
+///Id of the gas for quick access
+#define META_GAS_ID 6
+///Power of the gas when used in the current iteration of fusion
+#define META_GAS_FUSION_POWER 7
+//ATMOS
+//stuff you should probably leave well alone!
+/// kPa*L/(K*mol)
+#define R_IDEAL_GAS_EQUATION 8.31
+/// kPa
+#define ONE_ATMOSPHERE 101.325
+/// -270.3degC
+#define TCMB 2.7
+/// -48.15degC
+#define TCRYO 225
+/// 0degC
+#define T0C 273.15
+/// 20degC
+#define T20C 293.15
+/// -14C - Temperature used for kitchen cold room, medical freezer, etc.
+#define COLD_ROOM_TEMP 259.15
+
+/**
+ *I feel the need to document what happens here. Basically this is used
+ *catch rounding errors, and make gas go away in small portions.
+ *People have raised it to higher levels in the past, do not do this. Consider this number a soft limit
+ *If you're making gasmixtures that have unexpected behavior related to this value, you're doing something wrong.
+ *
+ *On an unrelated note this may cause a bug that creates negative gas, related to round(). When it has a second arg it will round up.
+ *So for instance round(0.5, 1) == 1. I've hardcoded a fix for this into share, by forcing the garbage collect.
+ *Any other attempts to fix it just killed atmos. I leave this to a greater man then I
+ */
+/// The minimum heat capacity of a gas
+#define MINIMUM_HEAT_CAPACITY 0.0003
+/// Minimum mole count of a gas
+#define MINIMUM_MOLE_COUNT 0.01
+/// Molar accuracy to round to
+#define MOLAR_ACCURACY 1E-4
+/// Types of gases (based on gaslist_cache)
+#define GAS_TYPE_COUNT GLOB.gaslist_cache.len
+/// Maximum error caused by QUANTIZE when removing gas (roughly, in reality around 2 * MOLAR_ACCURACY less)
+#define MAXIMUM_ERROR_GAS_REMOVAL (MOLAR_ACCURACY * GAS_TYPE_COUNT)
+
+/// Moles in a standard cell after which gases are visible
+#define MOLES_GAS_VISIBLE 0.25
+
+/// moles_visible * FACTOR_GAS_VISIBLE_MAX = Moles after which gas is at maximum visibility
+#define FACTOR_GAS_VISIBLE_MAX 20
+/// Mole step for alpha updates. This means alpha can update at 0.25, 0.5, 0.75 and so on
+#define MOLES_GAS_VISIBLE_STEP 0.25
+/// The total visible states
+#define TOTAL_VISIBLE_STATES (FACTOR_GAS_VISIBLE_MAX * (1 / MOLES_GAS_VISIBLE_STEP))
+
+//REACTIONS
+//return values for reactions (bitflags)
+///The gas mixture is not reacting
+#define NO_REACTION 0
+///The gas mixture is reacting
+#define REACTING 1
+///The gas mixture is able to stop all reactions
+#define STOP_REACTIONS 2
+
+
+//EXCITED GROUPS
+/**
+ * Some further context on breakdown. Unlike dismantle, the breakdown ticker doesn't reset itself when a tile is added
+ * This is because we cannot expect maps to have small spaces, so we need to even ourselves out often
+ * We do this to avoid equalizing a large space in one tick, with some significant amount of say heat diff
+ * This way large areas don't suddenly all become cold at once, it acts more like a wave
+ *
+ * Because of this and the behavior of share(), the breakdown cycles value can be tweaked directly to effect how fast we want gas to move
+ */
+/// number of FULL air controller ticks before an excited group breaks down (averages gas contents across turfs)
+#define EXCITED_GROUP_BREAKDOWN_CYCLES 5
+/// number of FULL air controller ticks before an excited group dismantles and removes its turfs from active
+#define EXCITED_GROUP_DISMANTLE_CYCLES (EXCITED_GROUP_BREAKDOWN_CYCLES * 2) + 1 //Reset after 2 breakdowns
+/// Ratio of air that must move to/from a tile to reset group processing
+#define MINIMUM_AIR_RATIO_TO_SUSPEND 0.1
+/// Minimum ratio of air that must move to/from a tile
+#define MINIMUM_AIR_RATIO_TO_MOVE 0.001
+/// Minimum amount of air that has to move before a group processing can be suspended (Round about 10)
+#define MINIMUM_AIR_TO_SUSPEND (MOLES_CELLSTANDARD*MINIMUM_AIR_RATIO_TO_SUSPEND)
+/// Either this must be active (round about 0.1) //Might need to raise this a tad to better support space leaks. we'll see
+#define MINIMUM_MOLES_DELTA_TO_MOVE (MOLES_CELLSTANDARD*MINIMUM_AIR_RATIO_TO_MOVE)
+/// or this (or both, obviously)
+#define MINIMUM_TEMPERATURE_TO_MOVE (T20C+100)
+/// Minimum temperature difference before group processing is suspended
+#define MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND 4
+/// Minimum temperature difference before the gas temperatures are just set to be equal
+#define MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER 0.5
+///Minimum temperature to continue superconduction once started
+#define MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION (T20C+80)
+///Minimum temperature to start doing superconduction calculations
+#define MINIMUM_TEMPERATURE_START_SUPERCONDUCTION (T20C+400)
+
+//HEAT TRANSFER COEFFICIENTS
+//Must be between 0 and 1. Values closer to 1 equalize temperature faster
+//Should not exceed 0.4 else strange heat flow occur
+#define WALL_HEAT_TRANSFER_COEFFICIENT 0.0
+#define OPEN_HEAT_TRANSFER_COEFFICIENT 0.4
+/// a hack for now
+#define WINDOW_HEAT_TRANSFER_COEFFICIENT 0.1
+/// a hack to help make vacuums "cold", sacrificing realism for gameplay
+#define HEAT_CAPACITY_VACUUM 7000
+
+//FIRE
+///Minimum temperature for fire to move to the next turf (150 °C or 433 K)
+#define FIRE_MINIMUM_TEMPERATURE_TO_SPREAD (150+T0C)
+///Minimum temperature for fire to exist on a turf (100 °C or 373 K)
+#define FIRE_MINIMUM_TEMPERATURE_TO_EXIST (100+T0C)
+///Multiplier for the temperature shared to other turfs
+#define FIRE_SPREAD_RADIOSITY_SCALE 0.85
+///Helper for small fires to grow
+#define FIRE_GROWTH_RATE 40000
+///Minimum temperature to burn plasma
+#define PLASMA_MINIMUM_BURN_TEMPERATURE (100+T0C)
+///Upper temperature ceiling for plasmafire reaction calculations for fuel consumption
+#define PLASMA_UPPER_TEMPERATURE (1370+T0C)
+///Multiplier for plasmafire with O2 moles * PLASMA_OXYGEN_FULLBURN for the maximum fuel consumption
+#define PLASMA_OXYGEN_FULLBURN 10
+///Minimum temperature to burn hydrogen
+#define HYDROGEN_MINIMUM_BURN_TEMPERATURE (100+T0C)
+///Upper temperature ceiling for h2fire reaction calculations for fuel consumption
+#define HYDROGEN_UPPER_TEMPERATURE (1370+T0C)
+///Multiplier for h2fire with O2 moles * HYDROGEN_OXYGEN_FULLBURN for the maximum fuel consumption
+#define HYDROGEN_OXYGEN_FULLBURN 10
+
+//COLD FIRE (this is used only for the freon-o2 reaction, there is no fire still)
+///fire will spread if the temperature is -10 °C
+#define COLD_FIRE_MAXIMUM_TEMPERATURE_TO_SPREAD 263
+///fire will start if the temperature is 0 °C
+#define COLD_FIRE_MAXIMUM_TEMPERATURE_TO_EXIST 273
+#define COLD_FIRE_SPREAD_RADIOSITY_SCALE 0.95 //Not yet implemented
+#define COLD_FIRE_GROWTH_RATE 40000 //Not yet implemented
+///Maximum temperature to burn freon
+#define FREON_MAXIMUM_BURN_TEMPERATURE 283
+///Minimum temperature allowed for the burn to go, we would have negative pressure otherwise
+#define FREON_LOWER_TEMPERATURE 60
+///Multiplier for freonfire with O2 moles * FREON_OXYGEN_FULLBURN for the maximum fuel consumption
+#define FREON_OXYGEN_FULLBURN 10
+
+///moles in a 2.5 m^3 cell at 101.325 Pa and 20 degC (103 or so)
+#define MOLES_CELLSTANDARD (ONE_ATMOSPHERE*CELL_VOLUME/(T20C*R_IDEAL_GAS_EQUATION))
+///compared against for superconductivity
+#define M_CELL_WITH_RATIO (MOLES_CELLSTANDARD * 0.005)
+/// percentage of oxygen in a normal mixture of air
+#define O2STANDARD 0.21
+/// same but for nitrogen
+#define N2STANDARD 0.79
+/// O2 standard value (21%)
+#define MOLES_O2STANDARD (MOLES_CELLSTANDARD*O2STANDARD)
+/// N2 standard value (79%)
+#define MOLES_N2STANDARD (MOLES_CELLSTANDARD*N2STANDARD)
+/// liters in a cell
+#define CELL_VOLUME 2500
+
+//CANATMOSPASS
+#define ATMOS_PASS_YES 1
+#define ATMOS_PASS_NO 0
+/// ask CanAtmosPass()
+#define ATMOS_PASS_PROC -1
+/// just check density
+#define ATMOS_PASS_DENSITY -2
+
+//Adjacent turf related defines, they dictate what to do with a turf once it's been recalculated
+//Used as "state" in CALCULATE_ADJACENT_TURFS
+///Normal non-active turf
+#define NORMAL_TURF 1
+///Set the turf to be activated on the next calculation
+#define MAKE_ACTIVE 2
+///Disable excited group
+#define KILL_EXCITED 3
diff --git a/code/__DEFINES/atmospherics/atmos_helpers.dm b/code/__DEFINES/atmospherics/atmos_helpers.dm
new file mode 100644
index 0000000000000..ca0a2c0bb5a0a
--- /dev/null
+++ b/code/__DEFINES/atmospherics/atmos_helpers.dm
@@ -0,0 +1,72 @@
+//DO NOT USE THESE FOR ACCESSING ATMOS DATA, THEY MUTATE THINGS WHEN CALLED. I WILL BEAT YOU WITH A STICK. See the actual proc for more details
+///Check if the turfs allows gas passage based on density, do not use.
+#define CANATMOSPASS(A, O) ( A.CanAtmosPass == ATMOS_PASS_PROC ? A.CanAtmosPass(O) : ( A.CanAtmosPass == ATMOS_PASS_DENSITY ? !A.density : A.CanAtmosPass ) )
+///Check if the turfs allows gas passage on a z level, do not use.
+#define CANVERTICALATMOSPASS(A, O) ( A.CanAtmosPassVertical == ATMOS_PASS_PROC ? A.CanAtmosPass(O, TRUE) : ( A.CanAtmosPassVertical == ATMOS_PASS_DENSITY ? !A.density : A.CanAtmosPassVertical ) )
+
+//Helpers
+///Moves the icon of the device based on the piping layer and on the direction
+#define PIPING_LAYER_SHIFT(T, PipingLayer) \
+ if(T.dir & (NORTH|SOUTH)) { \
+ T.pixel_x = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_X;\
+ } \
+ if(T.dir & (EAST|WEST)) { \
+ T.pixel_y = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_Y;\
+ }
+
+///Moves the icon of the device based on the piping layer and on the direction, the shift amount is dictated by more_shift
+#define PIPING_FORWARD_SHIFT(T, PipingLayer, more_shift) \
+ if(T.dir & (NORTH|SOUTH)) { \
+ T.pixel_y += more_shift * (PipingLayer - PIPING_LAYER_DEFAULT);\
+ } \
+ if(T.dir & (EAST|WEST)) { \
+ T.pixel_x += more_shift * (PipingLayer - PIPING_LAYER_DEFAULT);\
+ }
+
+///Moves the icon of the device based on the piping layer on both x and y
+#define PIPING_LAYER_DOUBLE_SHIFT(T, PipingLayer) \
+ T.pixel_x = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_X;\
+ T.pixel_y = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_Y;
+
+///Calculate the thermal energy of the selected gas (J)
+#define THERMAL_ENERGY(gas) (gas.temperature * gas.heat_capacity())
+
+///Directly adds a gas to a gas mixture without checking for its presence beforehand, use only if is certain the absence of said gas
+#define ADD_GAS(gas_id, out_list)\
+ var/list/tmp_gaslist = GLOB.gaslist_cache[gas_id]; out_list[gas_id] = tmp_gaslist.Copy();
+
+///Adds a gas to a gas mixture but checks if is already present, faster than the same proc
+#define ASSERT_GAS(gas_id, gas_mixture) if (!gas_mixture.gases[gas_id]) { ADD_GAS(gas_id, gas_mixture.gases) };
+
+//prefer this to gas_mixture/total_moles in performance critical areas
+///Calculate the total moles of the gas mixture, faster than the proc, good for performance critical areas
+#define TOTAL_MOLES(cached_gases, out_var)\
+ out_var = 0;\
+ for(var/total_moles_id in cached_gases){\
+ out_var += cached_gases[total_moles_id][MOLES];\
+ }
+
+GLOBAL_LIST_INIT(nonoverlaying_gases, typecache_of_gases_with_no_overlays())
+///Returns a list of overlays of every gas in the mixture
+#define GAS_OVERLAYS(gases, out_var)\
+ out_var = list();\
+ for(var/_ID in gases){\
+ if(GLOB.nonoverlaying_gases[_ID]) continue;\
+ var/_GAS = gases[_ID];\
+ var/_GAS_META = _GAS[GAS_META];\
+ if(_GAS[MOLES] <= _GAS_META[META_GAS_MOLES_VISIBLE]) continue;\
+ var/_GAS_OVERLAY = _GAS_META[META_GAS_OVERLAY];\
+ out_var += _GAS_OVERLAY[min(TOTAL_VISIBLE_STATES, CEILING(_GAS[MOLES] / MOLES_GAS_VISIBLE_STEP, 1))];\
+ }
+
+#ifdef TESTING
+GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
+#define CALCULATE_ADJACENT_TURFS(T, state) if (SSadjacent_air.queue[T]) { GLOB.atmos_adjacent_savings[1] += 1 } else { GLOB.atmos_adjacent_savings[2] += 1; SSadjacent_air.queue[T] = state}
+#else
+#define CALCULATE_ADJACENT_TURFS(T, state) SSadjacent_air.queue[T] = state
+#endif
+
+//If you're doing spreading things related to atmos, DO NOT USE CANATMOSPASS, IT IS NOT CHEAP. use this instead, the info is cached after all. it's tweaked just a bit to allow for circular checks
+#define TURFS_CAN_SHARE(T1, T2) (LAZYACCESS(T2.atmos_adjacent_turfs, T1) || LAZYLEN(T1.atmos_adjacent_turfs & T2.atmos_adjacent_turfs))
+//Use this to see if a turf is fully blocked or not, think windows or firelocks. Fails with 1x1 non full tile windows, but it's not worth the cost.
+#define TURF_SHARES(T) (LAZYLEN(T.atmos_adjacent_turfs))
diff --git a/code/__DEFINES/atmospherics/atmos_mapping_helpers.dm b/code/__DEFINES/atmospherics/atmos_mapping_helpers.dm
new file mode 100644
index 0000000000000..0ba8f29f4e210
--- /dev/null
+++ b/code/__DEFINES/atmospherics/atmos_mapping_helpers.dm
@@ -0,0 +1,189 @@
+//OPEN TURF ATMOS
+/// the default air mix that open turfs spawn
+#define OPENTURF_DEFAULT_ATMOS "o2=22;n2=82;TEMP=293.15"
+#define OPENTURF_LOW_PRESSURE "o2=14;n2=30;TEMP=293.15"
+/// -193,15°C telecommunications. also used for xenobiology slime killrooms
+#define TCOMMS_ATMOS "n2=100;TEMP=80"
+/// space
+#define AIRLESS_ATMOS "TEMP=2.7"
+/// -93.15°C snow and ice turfs
+#define FROZEN_ATMOS "o2=22;n2=82;TEMP=180"
+/// -14°C kitchen coldroom, just might loss your tail; higher amount of mol to reach about 101.3 kpA
+#define KITCHEN_COLDROOM_ATMOS "o2=26;n2=97;TEMP=[COLD_ROOM_TEMP]"
+/// used in the holodeck burn test program
+#define BURNMIX_ATMOS "o2=2500;plasma=5000;TEMP=370"
+
+//ATMOSPHERICS DEPARTMENT GAS TANK TURFS
+#define ATMOS_TANK_N2O "n2o=6000;TEMP=293.15"
+#define ATMOS_TANK_CO2 "co2=50000;TEMP=293.15"
+#define ATMOS_TANK_PLASMA "plasma=70000;TEMP=293.15"
+#define ATMOS_TANK_O2 "o2=100000;TEMP=293.15"
+#define ATMOS_TANK_N2 "n2=100000;TEMP=293.15"
+#define ATMOS_TANK_BZ "bz=100000;TEMP=293.15"
+#define ATMOS_TANK_HYPERNOBLIUM "nob=100000;TEMP=293.15"
+#define ATMOS_TANK_NO2 "no2=100000;TEMP=293.15"
+#define ATMOS_TANK_PLUOXIUM "pluox=100000;TEMP=293.15"
+#define ATMOS_TANK_STIMULUM "stim=100000;TEMP=293.15"
+#define ATMOS_TANK_TRITIUM "tritium=100000;TEMP=293.15"
+#define ATMOS_TANK_H2O "water_vapor=100000;TEMP=293.15"
+#define ATMOS_TANK_AIRMIX "o2=2644;n2=10580;TEMP=293.15"
+
+//LAVALAND
+/// what pressure you have to be under to increase the effect of equipment meant for lavaland
+#define MAXIMUM_LAVALAND_EQUIPMENT_EFFECT_PRESSURE 90
+
+//ATMOS MIX IDS
+#define LAVALAND_DEFAULT_ATMOS "LAVALAND_ATMOS"
+
+
+//ATMOSIA GAS MONITOR TAGS
+#define ATMOS_GAS_MONITOR_INPUT_O2 "o2_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_O2 "o2_out"
+#define ATMOS_GAS_MONITOR_SENSOR_O2 "o2_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_PLASMA "plasma_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_PLASMA "plasma_out"
+#define ATMOS_GAS_MONITOR_SENSOR_PLASMA "plasma_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_AIR "air_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_AIR "air_out"
+#define ATMOS_GAS_MONITOR_SENSOR_AIR "air_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_MIX "mix_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_MIX "mix_out"
+#define ATMOS_GAS_MONITOR_SENSOR_MIX "mix_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_N2O "n2o_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_N2O "n2o_out"
+#define ATMOS_GAS_MONITOR_SENSOR_N2O "n2o_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_N2 "n2_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_N2 "n2_out"
+#define ATMOS_GAS_MONITOR_SENSOR_N2 "n2_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_CO2 "co2_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_CO2 "co2_out"
+#define ATMOS_GAS_MONITOR_SENSOR_CO2 "co2_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_BZ "bz_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_BZ "bz_out"
+#define ATMOS_GAS_MONITOR_SENSOR_BZ "bz_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_FREON "freon_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_FREON "freon_out"
+#define ATMOS_GAS_MONITOR_SENSOR_FREON "freon_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_HALON "halon_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_HALON "halon_out"
+#define ATMOS_GAS_MONITOR_SENSOR_HALON "halon_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_HEALIUM "healium_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_HEALIUM "healium_out"
+#define ATMOS_GAS_MONITOR_SENSOR_HEALIUM "healium_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_H2 "h2_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_H2 "h2_out"
+#define ATMOS_GAS_MONITOR_SENSOR_H2 "h2_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_HYPERNOBLIUM "hypernoblium_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_HYPERNOBLIUM "hypernoblium_out"
+#define ATMOS_GAS_MONITOR_SENSOR_HYPERNOBLIUM "hypernoblium_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_MIASMA "miasma_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_MIASMA "miasma_out"
+#define ATMOS_GAS_MONITOR_SENSOR_MIASMA "miasma_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_NO2 "no2_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_NO2 "no2_out"
+#define ATMOS_GAS_MONITOR_SENSOR_NO2 "no2_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_PLUOXIUM "pluoxium_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_PLUOXIUM "pluoxium_out"
+#define ATMOS_GAS_MONITOR_SENSOR_PLUOXIUM "pluoxium_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_PROTO_NITRATE "proto-nitrate_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_PROTO_NITRATE "proto-nitrate_out"
+#define ATMOS_GAS_MONITOR_SENSOR_PROTO_NITRATE "proto-nitrate_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_STIMULUM "stimulum_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_STIMULUM "stimulum_out"
+#define ATMOS_GAS_MONITOR_SENSOR_STIMULUM "stimulum_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_TRITIUM "tritium_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_TRITIUM "tritium_out"
+#define ATMOS_GAS_MONITOR_SENSOR_TRITIUM "tritium_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_H2O "h2o_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_H2O "h2o_out"
+#define ATMOS_GAS_MONITOR_SENSOR_H2O "h2o_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_ZAUKER "zauker_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_ZAUKER "zauker_out"
+#define ATMOS_GAS_MONITOR_SENSOR_ZAUKER "zauker_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_HELIUM "helium_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_HELIUM "helium_out"
+#define ATMOS_GAS_MONITOR_SENSOR_HELIUM "helium_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_ANTINOBLIUM "antinoblium_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_ANTINOBLIUM "antinoblium_out"
+#define ATMOS_GAS_MONITOR_SENSOR_ANTINOBLIUM "antinoblium_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_INCINERATOR "incinerator_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_INCINERATOR "incinerator_out"
+#define ATMOS_GAS_MONITOR_SENSOR_INCINERATOR "incinerator_sensor"
+
+#define ATMOS_GAS_MONITOR_INPUT_TOXINS_LAB "toxinslab_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_TOXINS_LAB "toxinslab_out"
+#define ATMOS_GAS_MONITOR_SENSOR_TOXINS_LAB "toxinslab_sensor"
+
+#define ATMOS_GAS_MONITOR_LOOP_DISTRIBUTION "distro-loop_meter"
+#define ATMOS_GAS_MONITOR_LOOP_ATMOS_WASTE "atmos-waste_loop_meter"
+
+#define ATMOS_GAS_MONITOR_WASTE_ENGINE "engine-waste_out"
+#define ATMOS_GAS_MONITOR_WASTE_ATMOS "atmos-waste_out"
+
+#define ATMOS_GAS_MONITOR_INPUT_SM "sm_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_SM "sm_out"
+#define ATMOS_GAS_MONITOR_SENSOR_SM "sm_sense"
+
+#define ATMOS_GAS_MONITOR_INPUT_SM_WASTE "sm_waste_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_SM_WASTE "sm_waste_out"
+#define ATMOS_GAS_MONITOR_SENSOR_SM_WASTE "sm_waste_sense"
+
+#define ATMOS_GAS_MONITOR_INPUT_TOXINS_WASTE "toxins_waste_in"
+#define ATMOS_GAS_MONITOR_OUTPUT_TOXINS_WASTE "toxins_waste_out"
+#define ATMOS_GAS_MONITOR_SENSOR_TOXINS_WASTE "toxins_waste_sense"
+
+//AIRLOCK CONTROLLER TAGS
+
+//RnD toxins burn chamber
+#define INCINERATOR_TOXMIX_IGNITER "toxmix_igniter"
+#define INCINERATOR_TOXMIX_VENT "toxmix_vent"
+#define INCINERATOR_TOXMIX_DP_VENTPUMP "toxmix_airlock_pump"
+#define INCINERATOR_TOXMIX_AIRLOCK_SENSOR "toxmix_airlock_sensor"
+#define INCINERATOR_TOXMIX_AIRLOCK_CONTROLLER "toxmix_airlock_controller"
+#define INCINERATOR_TOXMIX_AIRLOCK_INTERIOR "toxmix_airlock_interior"
+#define INCINERATOR_TOXMIX_AIRLOCK_EXTERIOR "toxmix_airlock_exterior"
+
+//Atmospherics/maintenance incinerator
+#define INCINERATOR_ATMOS_IGNITER "atmos_incinerator_igniter"
+#define INCINERATOR_ATMOS_MAINVENT "atmos_incinerator_mainvent"
+#define INCINERATOR_ATMOS_AUXVENT "atmos_incinerator_auxvent"
+#define INCINERATOR_ATMOS_DP_VENTPUMP "atmos_incinerator_airlock_pump"
+#define INCINERATOR_ATMOS_AIRLOCK_SENSOR "atmos_incinerator_airlock_sensor"
+#define INCINERATOR_ATMOS_AIRLOCK_CONTROLLER "atmos_incinerator_airlock_controller"
+#define INCINERATOR_ATMOS_AIRLOCK_INTERIOR "atmos_incinerator_airlock_interior"
+#define INCINERATOR_ATMOS_AIRLOCK_EXTERIOR "atmos_incinerator_airlock_exterior"
+#define TEST_ROOM_ATMOS_MAINVENT_1 "atmos_test_room_mainvent_1"
+#define TEST_ROOM_ATMOS_MAINVENT_2 "atmos_test_room_mainvent_2"
+
+//Syndicate lavaland base incinerator (lavaland_surface_syndicate_base1.dmm)
+#define INCINERATOR_SYNDICATELAVA_IGNITER "syndicatelava_igniter"
+#define INCINERATOR_SYNDICATELAVA_MAINVENT "syndicatelava_mainvent"
+#define INCINERATOR_SYNDICATELAVA_AUXVENT "syndicatelava_auxvent"
+#define INCINERATOR_SYNDICATELAVA_DP_VENTPUMP "syndicatelava_airlock_pump"
+#define INCINERATOR_SYNDICATELAVA_AIRLOCK_SENSOR "syndicatelava_airlock_sensor"
+#define INCINERATOR_SYNDICATELAVA_AIRLOCK_CONTROLLER "syndicatelava_airlock_controller"
+#define INCINERATOR_SYNDICATELAVA_AIRLOCK_INTERIOR "syndicatelava_airlock_interior"
+#define INCINERATOR_SYNDICATELAVA_AIRLOCK_EXTERIOR "syndicatelava_airlock_exterior"
diff --git a/code/__DEFINES/atmospherics/atmos_mob_interaction.dm b/code/__DEFINES/atmospherics/atmos_mob_interaction.dm
new file mode 100644
index 0000000000000..2069d6695b3d5
--- /dev/null
+++ b/code/__DEFINES/atmospherics/atmos_mob_interaction.dm
@@ -0,0 +1,135 @@
+/** liters in a normal breath. note that breaths are taken once every 4 life ticks, which is 8 seconds
+ * Addendum for people tweaking this value in the future.
+ * Because o2 tank release values/human o2 requirements are very strictly set to the same pressure, small errors can cause breakage
+ * This comes from QUANTIZE being used in /datum/gas_mixture.remove(), forming a slight sawtooth pattern of the added/removed gas, centered on the actual pressure
+ * Changing BREATH_VOLUME can set us on the lower half of this sawtooth, making humans unable to breath at standard pressure.
+ * There's no good way I can come up with to hardcode a fix for this. So if you're going to change this variable
+ * graph the functions that describe how it is used/how it interacts with breath code, and pick something on the upper half of the sawtooth
+ *
+**/
+#define BREATH_VOLUME 1.99
+/// Amount of air to take a from a tile
+#define BREATH_PERCENTAGE (BREATH_VOLUME/CELL_VOLUME)
+
+//Defines for N2O and Healium euphoria moodlets
+#define EUPHORIA_INACTIVE 0
+#define EUPHORIA_ACTIVE 1
+#define EUPHORIA_LAST_FLAG 2
+
+#define MIASMA_CORPSE_MOLES 0.02
+#define MIASMA_GIBS_MOLES 0.005
+
+#define MIN_TOXIC_GAS_DAMAGE 1
+#define MAX_TOXIC_GAS_DAMAGE 10
+
+// Pressure limits.
+/// This determins at what pressure the ultra-high pressure red icon is displayed. (This one is set as a constant)
+#define HAZARD_HIGH_PRESSURE 550
+/// This determins when the orange pressure icon is displayed (it is 0.7 * HAZARD_HIGH_PRESSURE)
+#define WARNING_HIGH_PRESSURE 325
+/// This is when the gray low pressure icon is displayed. (it is 2.5 * HAZARD_LOW_PRESSURE)
+#define WARNING_LOW_PRESSURE 50
+/// This is when the black ultra-low pressure icon is displayed. (This one is set as a constant)
+#define HAZARD_LOW_PRESSURE 20
+
+/// This is used in handle_temperature_damage() for humans, and in reagents that affect body temperature. Temperature damage is multiplied by this amount.
+#define TEMPERATURE_DAMAGE_COEFFICIENT 1.5
+
+/// The natural temperature for a body
+#define BODYTEMP_NORMAL 310.15
+/// This is the divisor which handles how much of the temperature difference between the current body temperature and 310.15K (optimal temperature) humans auto-regenerate each tick. The higher the number, the slower the recovery. This is applied each tick, so long as the mob is alive.
+#define BODYTEMP_AUTORECOVERY_DIVISOR 28
+/// Minimum amount of kelvin moved toward 310K per tick. So long as abs(310.15 - bodytemp) is more than 50.
+#define BODYTEMP_AUTORECOVERY_MINIMUM 3
+///Similar to the BODYTEMP_AUTORECOVERY_DIVISOR, but this is the divisor which is applied at the stage that follows autorecovery. This is the divisor which comes into play when the human's loc temperature is lower than their body temperature. Make it lower to lose bodytemp faster.
+#define BODYTEMP_COLD_DIVISOR 15
+/// Similar to the BODYTEMP_AUTORECOVERY_DIVISOR, but this is the divisor which is applied at the stage that follows autorecovery. This is the divisor which comes into play when the human's loc temperature is higher than their body temperature. Make it lower to gain bodytemp faster.
+#define BODYTEMP_HEAT_DIVISOR 15
+/// The maximum number of degrees that your body can cool in 1 tick, due to the environment, when in a cold area.
+#define BODYTEMP_COOLING_MAX -30
+/// The maximum number of degrees that your body can heat up in 1 tick, due to the environment, when in a hot area.
+#define BODYTEMP_HEATING_MAX 30
+/// The body temperature limit the human body can take before it starts taking damage from heat.
+/// This also affects how fast the body normalises it's temperature when hot.
+/// 340k is about 66c, and rather high for a human.
+#define BODYTEMP_HEAT_DAMAGE_LIMIT (BODYTEMP_NORMAL + 30)
+/// The body temperature limit the human body can take before it starts taking damage from cold.
+/// This also affects how fast the body normalises it's temperature when cold.
+/// 270k is about -3c, that is below freezing and would hurt over time.
+#define BODYTEMP_COLD_DAMAGE_LIMIT (BODYTEMP_NORMAL - 40)
+/// The body temperature limit the human body can take before it will take wound damage.
+#define BODYTEMP_HEAT_WOUND_LIMIT (BODYTEMP_NORMAL + 90) // 400.5 k
+/// The modifier on cold damage limit hulks get ontop of their regular limit
+#define BODYTEMP_HULK_COLD_DAMAGE_LIMIT_MODIFIER 25
+/// The modifier on cold damage hulks get.
+#define HULK_COLD_DAMAGE_MOD 2
+
+// Body temperature warning icons
+/// The temperature the red icon is displayed.
+#define BODYTEMP_HEAT_WARNING_3 (BODYTEMP_HEAT_DAMAGE_LIMIT + 360) //+700k
+/// The temperature the orange icon is displayed.
+#define BODYTEMP_HEAT_WARNING_2 (BODYTEMP_HEAT_DAMAGE_LIMIT + 120) //460K
+/// The temperature the yellow icon is displayed.
+#define BODYTEMP_HEAT_WARNING_1 (BODYTEMP_HEAT_DAMAGE_LIMIT) //340K
+/// The temperature the light green icon is displayed.
+#define BODYTEMP_COLD_WARNING_1 (BODYTEMP_COLD_DAMAGE_LIMIT) //270k
+/// The temperature the cyan icon is displayed.
+#define BODYTEMP_COLD_WARNING_2 (BODYTEMP_COLD_DAMAGE_LIMIT - 70) //200k
+/// The temperature the blue icon is displayed.
+#define BODYTEMP_COLD_WARNING_3 (BODYTEMP_COLD_DAMAGE_LIMIT - 150) //120k
+
+/// The amount of pressure damage someone takes is equal to (pressure / HAZARD_HIGH_PRESSURE)*PRESSURE_DAMAGE_COEFFICIENT, with the maximum of MAX_PRESSURE_DAMAGE
+#define PRESSURE_DAMAGE_COEFFICIENT 2
+#define MAX_HIGH_PRESSURE_DAMAGE 2
+/// The amount of damage someone takes when in a low pressure area (The pressure threshold is so low that it doesn't make sense to do any calculations, so it just applies this flat value).
+#define LOW_PRESSURE_DAMAGE 2
+
+/// Humans are slowed by the difference between bodytemp and BODYTEMP_COLD_DAMAGE_LIMIT divided by this
+#define COLD_SLOWDOWN_FACTOR 20
+
+
+//CLOTHES
+
+//Emergency skinsuits
+#define EMERGENCY_HELM_MIN_TEMP_PROTECT 2.0 //The helmet is pressurized with air from the oxygen tank. If they don't take damage from that they won't take damage here
+#define EMERGENCY_SUIT_MIN_TEMP_PROTECT 237 //This is the approximate average temperature of Mt. Everest in the winter
+
+/// what min_cold_protection_temperature is set to for space-helmet quality headwear. MUST NOT BE 0.
+#define SPACE_HELM_MIN_TEMP_PROTECT 2.0
+/// Thermal insulation works both ways /Malkevin
+#define SPACE_HELM_MAX_TEMP_PROTECT 1500
+/// what min_cold_protection_temperature is set to for space-suit quality jumpsuits or suits. MUST NOT BE 0.
+#define SPACE_SUIT_MIN_TEMP_PROTECT 2.0
+/// The min cold protection of a space suit without the heater active
+#define SPACE_SUIT_MIN_TEMP_PROTECT_OFF 72
+#define SPACE_SUIT_MAX_TEMP_PROTECT 1500
+
+/// Cold protection for firesuits
+#define FIRE_SUIT_MIN_TEMP_PROTECT 60
+/// what max_heat_protection_temperature is set to for firesuit quality suits. MUST NOT BE 0.
+#define FIRE_SUIT_MAX_TEMP_PROTECT 30000
+/// Cold protection for fire helmets
+#define FIRE_HELM_MIN_TEMP_PROTECT 60
+/// for fire helmet quality items (red and white hardhats)
+#define FIRE_HELM_MAX_TEMP_PROTECT 30000
+
+/// what max_heat_protection_temperature is set to for firesuit quality suits and helmets. MUST NOT BE 0.
+#define FIRE_IMMUNITY_MAX_TEMP_PROTECT 35000
+
+/// For normal helmets
+#define HELMET_MIN_TEMP_PROTECT 160
+/// For normal helmets
+#define HELMET_MAX_TEMP_PROTECT 600
+/// For armor
+#define ARMOR_MIN_TEMP_PROTECT 160
+/// For armor
+#define ARMOR_MAX_TEMP_PROTECT 600
+
+/// For some gloves (black and)
+#define GLOVES_MIN_TEMP_PROTECT 2.0
+/// For some gloves
+#define GLOVES_MAX_TEMP_PROTECT 1500
+/// For gloves
+#define SHOES_MIN_TEMP_PROTECT 2.0
+/// For gloves
+#define SHOES_MAX_TEMP_PROTECT 1500
diff --git a/code/__DEFINES/atmospherics/atmos_piping.dm b/code/__DEFINES/atmospherics/atmos_piping.dm
new file mode 100644
index 0000000000000..3b01d29209a7c
--- /dev/null
+++ b/code/__DEFINES/atmospherics/atmos_piping.dm
@@ -0,0 +1,83 @@
+//PIPES
+//Defines for pipe bitmasking
+#define NORTH_FULLPIPE (1<<0) //also just NORTH
+#define SOUTH_FULLPIPE (1<<1) //also just SOUTH
+#define EAST_FULLPIPE (1<<2) //also just EAST
+#define WEST_FULLPIPE (1<<3) //also just WEST
+#define NORTH_SHORTPIPE (1<<4)
+#define SOUTH_SHORTPIPE (1<<5)
+#define EAST_SHORTPIPE (1<<6)
+#define WEST_SHORTPIPE (1<<7)
+//Atmos pipe limits
+/// (kPa) What pressure pumps and powered equipment max out at.
+#define MAX_OUTPUT_PRESSURE 4500
+/// (L/s) Maximum speed powered equipment can work at.
+#define MAX_TRANSFER_RATE 200
+/// How many percent of the contents that an overclocked volume pumps leak into the air
+#define VOLUME_PUMP_LEAK_AMOUNT 0.1
+//used for device_type vars
+#define UNARY 1
+#define BINARY 2
+#define TRINARY 3
+#define QUATERNARY 4
+
+//TANKS
+/// temperature in kelvins at which a tank will start to melt
+#define TANK_MELT_TEMPERATURE 1000000
+/// Tank starts leaking
+#define TANK_LEAK_PRESSURE (30.*ONE_ATMOSPHERE)
+/// Tank spills all contents into atmosphere
+#define TANK_RUPTURE_PRESSURE (35.*ONE_ATMOSPHERE)
+/// Boom 3x3 base explosion
+#define TANK_FRAGMENT_PRESSURE (40.*ONE_ATMOSPHERE)
+/// +1 for each SCALE kPa aboe threshold
+#define TANK_FRAGMENT_SCALE (6.*ONE_ATMOSPHERE)
+#define TANK_MAX_RELEASE_PRESSURE (ONE_ATMOSPHERE*3)
+#define TANK_MIN_RELEASE_PRESSURE 0
+#define TANK_DEFAULT_RELEASE_PRESSURE 16
+
+//MULTIPIPES
+//IF YOU EVER CHANGE THESE CHANGE SPRITES TO MATCH.
+//layer = initial(layer) + piping_layer / 1000 in atmospherics/update_icon() to determine order of pipe overlap
+#define PIPING_LAYER_MIN 1
+#define PIPING_LAYER_MAX 5
+#define PIPING_LAYER_DEFAULT 3
+#define PIPING_LAYER_P_X 5
+#define PIPING_LAYER_P_Y 5
+#define PIPING_LAYER_LCHANGE 0.05
+
+/// intended to connect with all layers, check for all instead of just one.
+#define PIPING_ALL_LAYER (1<<0)
+/// can only be built if nothing else with this flag is on the tile already.
+#define PIPING_ONE_PER_TURF (1<<1)
+/// can only exist at PIPING_LAYER_DEFAULT
+#define PIPING_DEFAULT_LAYER_ONLY (1<<2)
+/// north/south east/west doesn't matter, auto normalize on build.
+#define PIPING_CARDINAL_AUTONORMALIZE (1<<3)
+/// intended to connect with everything, both layers and colors
+#define PIPING_ALL_COLORS (1<<4)
+/// can bridge over pipenets
+#define PIPING_BRIDGE (1<<5)
+
+// Ventcrawling bitflags, handled in var/vent_movement
+///Allows for ventcrawling to occur. All atmospheric machines have this flag on by default. Cryo is the exception
+#define VENTCRAWL_ALLOWED (1<<0)
+///Allows mobs to enter or leave from atmospheric machines. On for passive, unary, and scrubber vents.
+#define VENTCRAWL_ENTRANCE_ALLOWED (1<<1)
+///Used to check if a machinery is visible. Called by update_pipe_vision(). On by default for all except cryo.
+#define VENTCRAWL_CAN_SEE (1<<2)
+
+GLOBAL_LIST_INIT(pipe_paint_colors, sort_list(list(
+ "amethyst" = rgb(130,43,255), //supplymain
+ "blue" = rgb(0,0,255),
+ "brown" = rgb(178,100,56),
+ "cyan" = rgb(0,255,249),
+ "dark" = rgb(69,69,69),
+ "green" = rgb(30,255,0),
+ "grey" = rgb(255,255,255),
+ "orange" = rgb(255,129,25),
+ "purple" = rgb(128,0,182),
+ "red" = rgb(255,0,0),
+ "violet" = rgb(64,0,128),
+ "yellow" = rgb(255,198,0)
+)))
From 3c7651aabfbe8cec0eb47c6fbd97848e2901f572 Mon Sep 17 00:00:00 2001
From: Pickle-Coding <58013024+Pickle-Coding@users.noreply.github.com>
Date: Sat, 2 Oct 2021 22:59:29 +0100
Subject: [PATCH 039/114] The mole counts in the min checks in reactions.dm
will now be multiplied by the inverse of the consumption multiplier. (#61557)
The moles in the min checks in reactions.dm will be multiplied by the inverse of the consumption multiplier. This will allow reactions to fully react when it has available gasses. It also makes some of the code easier to read.
Fixes (#61380)
From the issue report above:
Alright. So there's this pattern in reaction code
Looks like this
tgstation/code/modules/atmospherics/gasmixtures/reactions.dm
Lines 597 to 604 in 00154ae
var/nob_formed = min((cached_gases[/datum/gas/nitrogen][MOLES] + cached_gases[/datum/gas/tritium][MOLES]) * 0.01, cached_gases[/datum/gas/tritium][MOLES] * 0.1, cached_gases[/datum/gas/nitrogen][MOLES] * 0.2)
var/energy_produced = nob_formed * (NOBLIUM_FORMATION_ENERGY / (max(cached_gases[/datum/gas/bz][MOLES], 1)))
if ((cached_gases[/datum/gas/tritium][MOLES] - 5 * nob_formed < 0) || (cached_gases[/datum/gas/nitrogen][MOLES] - 10 * nob_formed < 0))
return NO_REACTION
cached_gases[/datum/gas/tritium][MOLES] -= 5 * nob_formed
cached_gases[/datum/gas/nitrogen][MOLES] -= 10 * nob_formed
cached_gases[/datum/gas/hypernoblium][MOLES] += nob_formed
We take the minimum of a few values, theoretically because we want the reaction to run with the lowest amount feasible.
So if there's 20 plasma, 10 o2, and 2 n2, and the reaction takes 4 parts plasma, 2 part o2, and 1 part n2, we'll only end up using 8 plasma, 4 o2, and 2 n2. Since we can't react without the n2 and all.
The if check is there to serve as a backup and prevent negative outputs, theoretically because they wreck havoc, though honestly they don't really, so long as the right bitflag is returned the whole mix is garbage collected anyway. Alright sanity check though. that's fine.
You notice how here, because he removes 5x nob formed from tritium, he includes that in the if check? If you scroll out to the right you'll notice that he multiplies the inputs in the min by the inverse of their scalar. At least that's what we want trying to do, mixed the two up.
You get the picture. The min serves to get the lowest possible amount to remove so the reaction can go through, and the if check serves as a sanity check wrapping around it.
The issue is people have been misusing it, for a good while. (Including in this instance)
They most commonly forget to include the inverse scaling in the min(), which leads to these weird fucked phantom gas minimums that aren't listed anywhere, but still stop the reaction.
See:
tgstation/code/modules/atmospherics/gasmixtures/reactions.dm
Lines 690 to 697 in 00154ae
var/heat_efficency = min(temperature * 0.3, cached_gases[/datum/gas/freon][MOLES], cached_gases[/datum/gas/bz][MOLES])
var/energy_used = heat_efficency * 9000
ASSERT_GAS(/datum/gas/healium, air)
if ((cached_gases[/datum/gas/freon][MOLES] - heat_efficency * 2.75 < 0 ) || (cached_gases[/datum/gas/bz][MOLES] - heat_efficency * 0.25 < 0)) //Shouldn't produce gas from nothing.
return NO_REACTION
cached_gases[/datum/gas/freon][MOLES] -= heat_efficency * 2.75
cached_gases[/datum/gas/bz][MOLES] -= heat_efficency * 0.25
cached_gases[/datum/gas/healium][MOLES] += heat_efficency * 3
They need to be updated to not do this, and use min() properly. It leads to dumb graphs like this https://www.desmos.com/calculator/xufgz8piqw (Healium formation graphed out. p is freon, b is bz. if either are reduced below 0, the reaction stops. If you notice this leads to really strange scaling deadspots, and a lot of frustrating behavior)
Thanks to @GuillaumePrata for bringing this to my attention, love you man.
---
.../atmospherics/gasmixtures/reactions.dm | 28 +++++++++++--------
1 file changed, 16 insertions(+), 12 deletions(-)
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index 13a37aade2503..23e1d0c4a8d14 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -40,8 +40,12 @@
return priority_reactions
/datum/gas_reaction
- //regarding the requirements list: the minimum or maximum requirements must be non-zero.
- //when in doubt, use MINIMUM_MOLE_COUNT.
+ /**
+ * Regarding the requirements list: the minimum or maximum requirements must be non-zero.
+ * When in doubt, use MINIMUM_MOLE_COUNT.
+ * Another thing to note is that reactions will not fire if we have any requirements outside of gas id path or MIN_TEMP or MAX_TEMP.
+ * More complex implementations will require modifications to gas_mixture.react()
+ */
var/list/requirements
var/major_gas //the highest rarity gas used in the reaction.
var/exclude = FALSE //do it this way to allow for addition/removal of reactions midmatch in the future
@@ -240,7 +244,7 @@
plasma_burn_rate = (temperature_scale * (cached_gases[/datum/gas/oxygen][MOLES] / PLASMA_OXYGEN_FULLBURN)) / PLASMA_BURN_RATE_DELTA
if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY)
- plasma_burn_rate = min(plasma_burn_rate, cached_gases[/datum/gas/plasma][MOLES], cached_gases[/datum/gas/oxygen][MOLES]/oxygen_burn_rate) //Ensures matter is conserved properly
+ plasma_burn_rate = min(plasma_burn_rate, cached_gases[/datum/gas/plasma][MOLES], cached_gases[/datum/gas/oxygen][MOLES] * INVERSE(oxygen_burn_rate)) //Ensures matter is conserved properly
cached_gases[/datum/gas/plasma][MOLES] = QUANTIZE(cached_gases[/datum/gas/plasma][MOLES] - plasma_burn_rate)
cached_gases[/datum/gas/oxygen][MOLES] = QUANTIZE(cached_gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate))
if (super_saturation)
@@ -259,7 +263,7 @@
if(energy_released > 0)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
- air.temperature = (temperature*old_heat_capacity + energy_released)/new_heat_capacity
+ air.temperature = (temperature * old_heat_capacity + energy_released) / new_heat_capacity
//let the floor know a fire is happening
if(istype(location))
@@ -390,7 +394,7 @@
var/temperature = air.temperature
var/old_heat_capacity = air.heat_capacity()
- var/heat_efficency = min(temperature / (FIRE_MINIMUM_TEMPERATURE_TO_EXIST * 8), cached_gases[/datum/gas/oxygen][MOLES], cached_gases[/datum/gas/nitrogen][MOLES])
+ var/heat_efficency = min(temperature / (FIRE_MINIMUM_TEMPERATURE_TO_EXIST * 8), cached_gases[/datum/gas/oxygen][MOLES], cached_gases[/datum/gas/nitrogen][MOLES], cached_gases[/datum/gas/bz][MOLES] * INVERSE(0.05))
var/energy_used = heat_efficency * NITRYL_FORMATION_ENERGY
ASSERT_GAS(/datum/gas/nitryl, air)
if ((cached_gases[/datum/gas/oxygen][MOLES] - heat_efficency < 0 ) || (cached_gases[/datum/gas/nitrogen][MOLES] - heat_efficency < 0) || (cached_gases[/datum/gas/bz][MOLES] - heat_efficency * 0.05 < 0)) //Shouldn't produce gas from nothing.
@@ -424,7 +428,7 @@
var/temperature = air.temperature
var/pressure = air.return_pressure()
var/old_heat_capacity = air.heat_capacity()
- var/reaction_efficency = min(1 / ((pressure / (0.1 * ONE_ATMOSPHERE)) * (max(cached_gases[/datum/gas/plasma][MOLES] / cached_gases[/datum/gas/nitrous_oxide][MOLES], 1))), cached_gases[/datum/gas/nitrous_oxide][MOLES], cached_gases[/datum/gas/plasma][MOLES] * 0.5)
+ var/reaction_efficency = min(1 / ((pressure / (0.1 * ONE_ATMOSPHERE)) * (max(cached_gases[/datum/gas/plasma][MOLES] / cached_gases[/datum/gas/nitrous_oxide][MOLES], 1))), cached_gases[/datum/gas/nitrous_oxide][MOLES], cached_gases[/datum/gas/plasma][MOLES] * INVERSE(2))
var/energy_released = 2 * reaction_efficency * FIRE_CARBON_ENERGY_RELEASED
if ((cached_gases[/datum/gas/nitrous_oxide][MOLES] - reaction_efficency < 0 )|| (cached_gases[/datum/gas/plasma][MOLES] - (2 * reaction_efficency) < 0) || energy_released <= 0) //Shouldn't produce gas from nothing.
return NO_REACTION
@@ -433,8 +437,8 @@
cached_gases[/datum/gas/bz][MOLES] += reaction_efficency * 2.5
if(reaction_efficency == cached_gases[/datum/gas/nitrous_oxide][MOLES])
ASSERT_GAS(/datum/gas/oxygen, air)
- cached_gases[/datum/gas/bz][MOLES] -= min(pressure,0.5)
- cached_gases[/datum/gas/oxygen][MOLES] += min(pressure,0.5)
+ cached_gases[/datum/gas/bz][MOLES] -= min(pressure, 0.5)
+ cached_gases[/datum/gas/oxygen][MOLES] += min(pressure, 0.5)
cached_gases[/datum/gas/nitrous_oxide][MOLES] -= reaction_efficency
cached_gases[/datum/gas/plasma][MOLES] -= 2 * reaction_efficency
@@ -460,14 +464,14 @@
var/list/cached_gases = air.gases
var/old_heat_capacity = air.heat_capacity()
- var/heat_scale = min(air.temperature/STIMULUM_HEAT_SCALE,cached_gases[/datum/gas/tritium][MOLES],cached_gases[/datum/gas/plasma][MOLES],cached_gases[/datum/gas/nitryl][MOLES])
- var/stim_energy_change = heat_scale + STIMULUM_FIRST_RISE*(heat_scale**2) - STIMULUM_FIRST_DROP*(heat_scale**3) + STIMULUM_SECOND_RISE*(heat_scale**4) - STIMULUM_ABSOLUTE_DROP*(heat_scale**5)
+ var/heat_scale = min(air.temperature/STIMULUM_HEAT_SCALE, cached_gases[/datum/gas/tritium][MOLES], cached_gases[/datum/gas/plasma][MOLES], cached_gases[/datum/gas/nitryl][MOLES])
+ var/stim_energy_change = heat_scale + STIMULUM_FIRST_RISE * (heat_scale ** 2) - STIMULUM_FIRST_DROP * (heat_scale ** 3) + STIMULUM_SECOND_RISE * (heat_scale ** 4) - STIMULUM_ABSOLUTE_DROP * (heat_scale ** 5)
ASSERT_GAS(/datum/gas/stimulum, air)
if ((cached_gases[/datum/gas/tritium][MOLES] - heat_scale < 0 ) || (cached_gases[/datum/gas/nitryl][MOLES] - heat_scale < 0)) //Shouldn't produce gas from nothing.
return NO_REACTION
- cached_gases[/datum/gas/stimulum][MOLES] += heat_scale * 0.75
cached_gases[/datum/gas/tritium][MOLES] -= heat_scale
cached_gases[/datum/gas/nitryl][MOLES] -= heat_scale
+ cached_gases[/datum/gas/stimulum][MOLES] += heat_scale * 0.75
if(stim_energy_change)
var/new_heat_capacity = air.heat_capacity()
@@ -492,7 +496,7 @@
var/list/cached_gases = air.gases
air.assert_gases(/datum/gas/hypernoblium, /datum/gas/bz)
var/old_heat_capacity = air.heat_capacity()
- var/nob_formed = min((cached_gases[/datum/gas/nitrogen][MOLES] + cached_gases[/datum/gas/tritium][MOLES]) * 0.01, cached_gases[/datum/gas/tritium][MOLES] * 0.1, cached_gases[/datum/gas/nitrogen][MOLES] * 0.2)
+ var/nob_formed = min((cached_gases[/datum/gas/nitrogen][MOLES] + cached_gases[/datum/gas/tritium][MOLES]) * 0.01, cached_gases[/datum/gas/tritium][MOLES] * INVERSE(5), cached_gases[/datum/gas/nitrogen][MOLES] * INVERSE(10))
var/energy_produced = nob_formed * (NOBLIUM_FORMATION_ENERGY / (max(cached_gases[/datum/gas/bz][MOLES], 1)))
if ((cached_gases[/datum/gas/tritium][MOLES] - 5 * nob_formed < 0) || (cached_gases[/datum/gas/nitrogen][MOLES] - 10 * nob_formed < 0))
return NO_REACTION
From 3dd0e54c77e2451df3971a61202b526592d3cf34 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 19 Aug 2024 18:33:04 +0200
Subject: [PATCH 040/114] First part of the PR of cleanup
---
_maps/arenas/aiupload.dmm | 2 +-
_maps/map_files/generic/CentCom.dmm | 2 +-
code/__DEFINES/atmospherics/atmos_core.dm | 2 +-
code/__DEFINES/atmospherics/atmos_helpers.dm | 4 +-
code/controllers/subsystem/adjacent_air.dm | 2 +-
code/controllers/subsystem/air.dm | 10 ++--
code/datums/components/orbiter.dm | 4 +-
code/game/atoms_movable.dm | 4 +-
.../dynamic/dynamic_rulesets_midround.dm | 4 +-
code/game/machinery/airlock_cycle_control.dm | 2 +-
code/game/machinery/doors/airlock_types.dm | 2 +-
code/game/machinery/doors/door.dm | 8 +--
code/game/machinery/doors/firedoor.dm | 6 +--
code/game/machinery/doors/windowdoor.dm | 4 +-
code/game/machinery/pipe/construction.dm | 8 +--
code/game/machinery/pipe/pipe_dispenser.dm | 2 +-
code/game/machinery/shieldgen.dm | 2 +-
code/game/machinery/shuttle/shuttle_heater.dm | 12 ++---
.../effects/effect_system/effects_foam.dm | 2 +-
code/game/objects/effects/forcefields.dm | 4 +-
code/game/objects/effects/glowshroom.dm | 2 +-
code/game/objects/effects/spiders.dm | 2 +-
code/game/objects/items/RCD.dm | 2 +-
code/game/objects/items/RPD.dm | 2 +-
.../items/devices/forcefieldprojector.dm | 2 +-
code/game/objects/structures/aliens.dm | 4 +-
code/game/objects/structures/false_walls.dm | 2 +-
code/game/objects/structures/holosign.dm | 2 +-
code/game/objects/structures/mineral_doors.dm | 2 +-
code/game/objects/structures/mirror.dm | 8 +--
code/game/objects/structures/plasticflaps.dm | 2 +-
code/game/objects/structures/statues.dm | 4 +-
.../objects/structures/windoor_assembly.dm | 4 +-
code/game/objects/structures/window.dm | 6 +--
code/game/turfs/change_turf.dm | 2 +-
code/game/turfs/open/_open.dm | 4 +-
code/game/turfs/open/floor/reinf_floor.dm | 4 +-
code/game/turfs/open/openspace.dm | 2 +-
.../antagonists/blob/structures/_blob.dm | 6 +--
.../antagonists/clock_cult/clockwork_turfs.dm | 2 +-
code/modules/antagonists/cult/runes.dm | 4 +-
code/modules/atmospherics/Atmospherics.md | 2 +-
.../environmental/LINDA_system.dm | 42 +++++++--------
.../atmospherics/machinery/atmosmachinery.dm | 54 +++++++++----------
.../binary_devices/binary_devices.dm | 4 +-
.../components/binary_devices/circulator.dm | 18 +++----
.../components/binary_devices/dp_vent_pump.dm | 4 +-
.../components/binary_devices/passive_gate.dm | 4 +-
.../binary_devices/pressure_valve.dm | 2 +-
.../components/binary_devices/pump.dm | 2 +-
.../components/binary_devices/volume_pump.dm | 2 +-
.../machinery/components/components_base.dm | 24 ++++-----
.../components/trinary_devices/filter.dm | 8 +--
.../components/trinary_devices/mixer.dm | 6 +--
.../trinary_devices/trinary_devices.dm | 4 +-
.../components/unary_devices/cryo.dm | 8 +--
.../unary_devices/heat_exchanger.dm | 2 +-
.../unary_devices/outlet_injector.dm | 4 +-
.../components/unary_devices/passive_vent.dm | 2 +-
.../unary_devices/portables_connector.dm | 2 +-
.../components/unary_devices/tank.dm | 2 +-
.../components/unary_devices/thermomachine.dm | 12 ++---
.../components/unary_devices/unary_devices.dm | 2 +-
.../components/unary_devices/vent_pump.dm | 4 +-
.../components/unary_devices/vent_scrubber.dm | 4 +-
.../atmospherics/machinery/datum_pipeline.dm | 52 +++++++++---------
.../machinery/pipes/heat_exchange/he_pipes.dm | 2 +-
.../machinery/pipes/heat_exchange/junction.dm | 6 +--
.../machinery/pipes/heat_exchange/manifold.dm | 4 +-
.../pipes/heat_exchange/manifold4w.dm | 4 +-
.../machinery/pipes/heat_exchange/simple.dm | 2 +-
.../machinery/pipes/layermanifold.dm | 16 +++---
.../atmospherics/machinery/pipes/manifold.dm | 4 +-
.../machinery/pipes/manifold4w.dm | 4 +-
.../atmospherics/machinery/pipes/multiz.dm | 2 +-
.../atmospherics/machinery/pipes/pipes.dm | 8 +--
.../atmospherics/machinery/pipes/simple.dm | 2 +-
code/modules/events/alien_infestation.dm | 2 +-
code/modules/events/spider_infestation.dm | 2 +-
code/modules/flufftext/Hallucination.dm | 2 +-
code/modules/mining/equipment/survival_pod.dm | 2 +-
.../mob/living/carbon/human/human_defense.dm | 8 +--
.../mob/living/simple_animal/bot/atmosbot.dm | 6 +--
.../mob/living/simple_animal/constructs.dm | 8 +--
.../simple_animal/hostile/megafauna/drake.dm | 2 +-
code/modules/mob/living/ventcrawling.dm | 6 +--
.../power/singularity/field_generator.dm | 4 +-
code/modules/power/turbine.dm | 4 +-
.../modules/projectiles/ammunition/_firing.dm | 6 +--
.../projectiles/guns/misc/beam_rifle.dm | 12 ++---
code/modules/projectiles/projectile.dm | 10 ++--
.../xenobiology/crossbreeding/_misc.dm | 2 +-
code/modules/shuttle/on_move.dm | 12 ++---
code/modules/shuttle/shuttle_rotate.dm | 6 +--
.../loot/alien_artifact.dm | 2 +-
.../shuttle_components/plasma_refiner.dm | 8 +--
96 files changed, 291 insertions(+), 291 deletions(-)
diff --git a/_maps/arenas/aiupload.dmm b/_maps/arenas/aiupload.dmm
index aa6928a3b6ab6..8f9f299dab980 100644
--- a/_maps/arenas/aiupload.dmm
+++ b/_maps/arenas/aiupload.dmm
@@ -28,7 +28,7 @@
dir = 1
},
/obj/structure/window/reinforced{
- CanAtmosPass = 3;
+ can_atmos_pass = 3;
dir = 4
},
/turf/open/floor/iron/techmaint,
diff --git a/_maps/map_files/generic/CentCom.dmm b/_maps/map_files/generic/CentCom.dmm
index 601a428bc6b73..40d239c158499 100644
--- a/_maps/map_files/generic/CentCom.dmm
+++ b/_maps/map_files/generic/CentCom.dmm
@@ -9601,7 +9601,7 @@
/area/centcom/control)
"NT" = (
/obj/structure/window/paperframe{
- CanAtmosPass = 0
+ can_atmos_pass = 0
},
/turf/open/floor/wood,
/area/centcom/holding)
diff --git a/code/__DEFINES/atmospherics/atmos_core.dm b/code/__DEFINES/atmospherics/atmos_core.dm
index 1ef465435d239..8f5388b5d2c45 100644
--- a/code/__DEFINES/atmospherics/atmos_core.dm
+++ b/code/__DEFINES/atmospherics/atmos_core.dm
@@ -174,7 +174,7 @@
//CANATMOSPASS
#define ATMOS_PASS_YES 1
#define ATMOS_PASS_NO 0
-/// ask CanAtmosPass()
+/// ask can_atmos_pass()
#define ATMOS_PASS_PROC -1
/// just check density
#define ATMOS_PASS_DENSITY -2
diff --git a/code/__DEFINES/atmospherics/atmos_helpers.dm b/code/__DEFINES/atmospherics/atmos_helpers.dm
index ca0a2c0bb5a0a..c546c9d745111 100644
--- a/code/__DEFINES/atmospherics/atmos_helpers.dm
+++ b/code/__DEFINES/atmospherics/atmos_helpers.dm
@@ -1,8 +1,8 @@
//DO NOT USE THESE FOR ACCESSING ATMOS DATA, THEY MUTATE THINGS WHEN CALLED. I WILL BEAT YOU WITH A STICK. See the actual proc for more details
///Check if the turfs allows gas passage based on density, do not use.
-#define CANATMOSPASS(A, O) ( A.CanAtmosPass == ATMOS_PASS_PROC ? A.CanAtmosPass(O) : ( A.CanAtmosPass == ATMOS_PASS_DENSITY ? !A.density : A.CanAtmosPass ) )
+#define CANATMOSPASS(A, O) ( A.can_atmos_pass == ATMOS_PASS_PROC ? A.can_atmos_pass(O) : ( A.can_atmos_pass == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_pass ) )
///Check if the turfs allows gas passage on a z level, do not use.
-#define CANVERTICALATMOSPASS(A, O) ( A.CanAtmosPassVertical == ATMOS_PASS_PROC ? A.CanAtmosPass(O, TRUE) : ( A.CanAtmosPassVertical == ATMOS_PASS_DENSITY ? !A.density : A.CanAtmosPassVertical ) )
+#define CANVERTICALATMOSPASS(A, O) ( A.can_atmos_passVertical == ATMOS_PASS_PROC ? A.can_atmos_pass(O, TRUE) : ( A.can_atmos_passVertical == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_passVertical ) )
//Helpers
///Moves the icon of the device based on the piping layer and on the direction
diff --git a/code/controllers/subsystem/adjacent_air.dm b/code/controllers/subsystem/adjacent_air.dm
index df0a5cab4e6b8..cde823399db27 100644
--- a/code/controllers/subsystem/adjacent_air.dm
+++ b/code/controllers/subsystem/adjacent_air.dm
@@ -28,7 +28,7 @@ SUBSYSTEM_DEF(adjacent_air)
var/goal = queue[currT]
queue.Cut(1,2)
- currT.ImmediateCalculateAdjacentTurfs()
+ currT.immediate_calculate_adjacent_turfs()
if(goal == MAKE_ACTIVE)
SSair.add_to_active(currT)
else if(goal == KILL_EXCITED)
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index 39325b25918a9..aa5ae4e5e562b 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -411,8 +411,8 @@ SUBSYSTEM_DEF(air)
continue
for(var/obj/machinery/atmospherics/considered_device in result)
if(!istype(considered_device, /obj/machinery/atmospherics/pipe))
- considered_device.setPipenet(net, borderline)
- net.addMachineryMember(considered_device)
+ 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))
@@ -580,7 +580,7 @@ SUBSYSTEM_DEF(air)
/datum/controller/subsystem/air/proc/setup_atmos_machinery()
for (var/obj/machinery/atmospherics/AM in atmos_machinery)
- AM.atmosinit()
+ AM.atmos_init()
CHECK_TICK
//this can't be done with setup_atmos_machinery() because
@@ -608,7 +608,7 @@ GLOBAL_LIST_EMPTY(colored_images)
var/obj/machinery/atmospherics/AM
for(var/A in 1 to atmos_machines.len)
AM = atmos_machines[A]
- AM.atmosinit()
+ AM.atmos_init()
CHECK_TICK
for(var/A in 1 to atmos_machines.len)
@@ -625,7 +625,7 @@ GLOBAL_LIST_EMPTY(colored_images)
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/datums/components/orbiter.dm b/code/datums/components/orbiter.dm
index 8186365f5cd89..c64402be49546 100644
--- a/code/datums/components/orbiter.dm
+++ b/code/datums/components/orbiter.dm
@@ -139,12 +139,12 @@
if(!newturf)
qdel(src)
- var/atom/curloc = master.loc
+ var/atom/current_location = master.loc
for(var/atom/movable/movable_orbiter as anything in current_orbiters)
if(QDELETED(movable_orbiter) || movable_orbiter.loc == newturf)
continue
movable_orbiter.abstract_move(newturf)
- if(CHECK_TICK && master.loc != curloc)
+ if(CHECK_TICK && master.loc != current_location)
// We moved again during the checktick, cancel current operation
break
diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm
index e9c3ec87a0867..9152921ff8d7e 100644
--- a/code/game/atoms_movable.dm
+++ b/code/game/atoms_movable.dm
@@ -480,8 +480,8 @@
if(loc)
//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
+ if(((can_atmos_pass == ATMOS_PASS_DENSITY && density) || can_atmos_pass == ATMOS_PASS_NO) && isturf(loc))
+ can_atmos_pass = ATMOS_PASS_YES
air_update_turf(TRUE, FALSE)
loc.handle_atom_del(src)
diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm
index d6bf23d7f26bd..81a39f04f62f8 100644
--- a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm
+++ b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm
@@ -412,7 +412,7 @@
continue // No parent vent
// Stops Aliens getting stuck in small networks.
// See: Security, Virology
- if(length(temp_vent_parent.other_atmosmch) > 20)
+ if(length(temp_vent_parent.other_atmos_machines) > 20)
vents += temp_vent
if(!length(vents))
log_game("DYNAMIC: [ruletype] ruleset [name] ready() failed due to no valid spawn locations.")
@@ -712,7 +712,7 @@
var/datum/pipeline/temp_vent_parent = temp_vent.parents[1]
if(!temp_vent_parent)
continue // No parent vent
- if(length(temp_vent_parent.other_atmosmch) > 20)
+ if(length(temp_vent_parent.other_atmos_machines) > 20)
vents += temp_vent // Makes sure the pipeline is large enough
if(!length(vents))
log_game("DYNAMIC: [ruletype] ruleset [name] ready() failed due to no valid spawn locations.")
diff --git a/code/game/machinery/airlock_cycle_control.dm b/code/game/machinery/airlock_cycle_control.dm
index 133e90b2e88ef..beec75d02bbce 100644
--- a/code/game/machinery/airlock_cycle_control.dm
+++ b/code/game/machinery/airlock_cycle_control.dm
@@ -549,7 +549,7 @@
for(var/I = 1; I <= turfs.len; I++)
var/turf/open/T = turfs[I]
if(assume_roles)
- T.ImmediateCalculateAdjacentTurfs()
+ T.immediate_calculate_adjacent_turfs()
for(var/turf/open/T2 in T.atmos_adjacent_turfs)
if(get_dist(initial_turf, T2) > 5)
config_error_str = "Airlock too big"
diff --git a/code/game/machinery/doors/airlock_types.dm b/code/game/machinery/doors/airlock_types.dm
index 12bfa5067ab41..5562b1cb66948 100644
--- a/code/game/machinery/doors/airlock_types.dm
+++ b/code/game/machinery/doors/airlock_types.dm
@@ -244,7 +244,7 @@
DA.update_icon()
DA.update_name()
-/obj/machinery/door/airlock/plasma/BlockSuperconductivity() //we don't stop the heat~
+/obj/machinery/door/airlock/plasma/block_superconductivity() //we don't stop the heat~
return 0
/obj/machinery/door/airlock/plasma/attackby(obj/item/C, mob/user, params)
diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm
index 5ae0693a5e97a..02240088b6e84 100644
--- a/code/game/machinery/doors/door.dm
+++ b/code/game/machinery/doors/door.dm
@@ -13,7 +13,7 @@
z_flags = Z_BLOCK_IN_DOWN | Z_BLOCK_IN_UP
max_integrity = 350
armor = list(MELEE = 30, BULLET = 30, LASER = 20, ENERGY = 20, BOMB = 10, BIO = 100, RAD = 100, FIRE = 80, ACID = 70, STAMINA = 0)
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
flags_1 = PREVENT_CLICK_UNDER_1
ricochet_chance_mod = 0.8
damage_deflection = 10
@@ -209,7 +209,7 @@
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()
+ T.immediate_calculate_adjacent_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)
if((flags_1 & ON_BORDER_1) && get_dir(src, T2) != dir)
@@ -220,7 +220,7 @@
if(moles > max_moles)
max_moles = moles
density = TRUE
- T.ImmediateCalculateAdjacentTurfs() // alright lets put it back
+ T.immediate_calculate_adjacent_turfs() // alright lets put it back
return max_moles - min_moles > 20
/obj/machinery/door/attackby(obj/item/I, mob/user, params)
@@ -397,7 +397,7 @@
if(!glass && GLOB.cameranet)
GLOB.cameranet.updateVisibility(src, 0)
-/obj/machinery/door/BlockSuperconductivity() // All non-glass airlocks block heat, this is intended.
+/obj/machinery/door/block_superconductivity() // All non-glass airlocks block heat, this is intended.
if(opacity || heat_proof)
return 1
return 0
diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm
index edf14ba9f4a3c..768d918044af5 100644
--- a/code/game/machinery/doors/firedoor.dm
+++ b/code/game/machinery/doors/firedoor.dm
@@ -344,7 +344,7 @@
if(reconsider_immediately)
var/turf/open/T = FD.loc
if(istype(T))
- T.ImmediateCalculateAdjacentTurfs()
+ T.immediate_calculate_adjacent_turfs()
/obj/machinery/door/firedoor/proc/emergency_pressure_stop(consider_timer = TRUE)
set waitfor = 0
@@ -380,7 +380,7 @@
/obj/machinery/door/firedoor/border_only
icon = 'icons/obj/doors/firelocks/edge_Doorfire.dmi'
flags_1 = ON_BORDER_1
- CanAtmosPass = ATMOS_PASS_PROC
+ can_atmos_pass = ATMOS_PASS_PROC
assemblytype = /obj/structure/firelock_frame/border
/obj/machinery/door/firedoor/border_only/Initialize(mapload)
@@ -471,7 +471,7 @@
leaving.Bump(src)
return COMPONENT_ATOM_BLOCK_EXIT
-/obj/machinery/door/firedoor/border_only/CanAtmosPass(turf/T)
+/obj/machinery/door/firedoor/border_only/can_atmos_pass(turf/T)
if(get_dir(loc, T) == dir)
return !density
else
diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm
index 3552ca51c38af..6e21da400b20b 100644
--- a/code/game/machinery/doors/windowdoor.dm
+++ b/code/game/machinery/doors/windowdoor.dm
@@ -14,7 +14,7 @@
flags_1 = ON_BORDER_1
opacity = FALSE
pass_flags_self = PASSTRANSPARENT
- CanAtmosPass = ATMOS_PASS_PROC
+ can_atmos_pass = ATMOS_PASS_PROC
interaction_flags_machine = INTERACT_MACHINE_WIRES_IF_OPEN | INTERACT_MACHINE_ALLOW_SILICON | INTERACT_MACHINE_OPEN_SILICON | INTERACT_MACHINE_REQUIRES_SILICON | INTERACT_MACHINE_OPEN
network_id = NETWORK_DOOR_AIRLOCKS
z_flags = NONE // reset zblock
@@ -133,7 +133,7 @@
return TRUE
-/obj/machinery/door/window/CanAtmosPass(turf/T)
+/obj/machinery/door/window/can_atmos_pass(turf/T)
if(get_dir(loc, T) == dir)
return !density
else
diff --git a/code/game/machinery/pipe/construction.dm b/code/game/machinery/pipe/construction.dm
index 66e32708181a7..cc0a7cbcb5994 100644
--- a/code/game/machinery/pipe/construction.dm
+++ b/code/game/machinery/pipe/construction.dm
@@ -68,9 +68,9 @@ Buildable meters
/obj/item/pipe/dropped()
..()
if(loc)
- setPipingLayer(piping_layer)
+ set_piping_layer(piping_layer)
-/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)
@@ -142,7 +142,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, "There is already a pipe at that location!")
return TRUE
// no conflicts found
@@ -162,7 +162,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 6555d153e70ed..a833357a37f6e 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 4bb1ab579dfbc..79fb57dc9b672 100644
--- a/code/game/machinery/shieldgen.dm
+++ b/code/game/machinery/shieldgen.dm
@@ -10,7 +10,7 @@
anchored = TRUE
resistance_flags = LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF
max_integrity = 200 //The shield can only take so much beating (prevents perma-prisons)
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
/obj/structure/emergency_shield/Initialize(mapload)
. = ..()
diff --git a/code/game/machinery/shuttle/shuttle_heater.dm b/code/game/machinery/shuttle/shuttle_heater.dm
index c8ab5d4ab88bb..12f46c9c94118 100644
--- a/code/game/machinery/shuttle/shuttle_heater.dm
+++ b/code/game/machinery/shuttle/shuttle_heater.dm
@@ -36,7 +36,7 @@
/obj/machinery/atmospherics/components/unary/shuttle/heater/New()
. = ..()
GLOB.custom_shuttle_machines += src
- SetInitDirections()
+ set_init_directions()
update_adjacent_engines()
updateGasStats()
@@ -47,13 +47,13 @@
/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)
@@ -62,11 +62,11 @@
return
nullifyPipenet(parents[1])
- atmosinit()
+ atmos_init()
node = nodes[1]
if(node)
- node.atmosinit()
- node.addMember(src)
+ node.atmos_init()
+ node.add_member(src)
build_network()
return TRUE
diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm
index 7ef9f06d598d8..23994b07202ea 100644
--- a/code/game/objects/effects/effect_system/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/effects_foam.dm
@@ -285,7 +285,7 @@
desc = "A lightweight foamed metal wall."
gender = PLURAL
max_integrity = 20
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
/obj/structure/foamedmetal/Initialize(mapload)
. = ..()
diff --git a/code/game/objects/effects/forcefields.dm b/code/game/objects/effects/forcefields.dm
index bf7ae1fb93d37..f67419fc92107 100644
--- a/code/game/objects/effects/forcefields.dm
+++ b/code/game/objects/effects/forcefields.dm
@@ -5,7 +5,7 @@
anchored = TRUE
opacity = FALSE
density = TRUE
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
z_flags = Z_BLOCK_IN_DOWN | Z_BLOCK_IN_UP
var/timeleft = 300 //Set to 0 for permanent forcefields (ugh)
@@ -24,7 +24,7 @@
name = "glowing wall"
icon = 'icons/effects/cult_effects.dmi'
icon_state = "cultshield"
- CanAtmosPass = ATMOS_PASS_NO
+ can_atmos_pass = ATMOS_PASS_NO
timeleft = 200
///////////Mimewalls///////////
diff --git a/code/game/objects/effects/glowshroom.dm b/code/game/objects/effects/glowshroom.dm
index ed50f595ec48c..825319a593222 100644
--- a/code/game/objects/effects/glowshroom.dm
+++ b/code/game/objects/effects/glowshroom.dm
@@ -96,7 +96,7 @@
for(var/turf/open/floor/earth in view(3,src))
if(is_type_in_typecache(earth, blacklisted_glowshroom_turfs))
continue
- if(!ownturf.CanAtmosPass(earth))
+ if(!ownturf.can_atmos_pass(earth))
continue
if(spreadsIntoAdjacent || !locate(/obj/structure/glowshroom) in view(1,earth))
possibleLocs += earth
diff --git a/code/game/objects/effects/spiders.dm b/code/game/objects/effects/spiders.dm
index 4b0c17f14494f..ad71ee98fbed5 100644
--- a/code/game/objects/effects/spiders.dm
+++ b/code/game/objects/effects/spiders.dm
@@ -264,7 +264,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/items/RCD.dm b/code/game/objects/items/RCD.dm
index 06be746ccd785..9289a2b84bb30 100644
--- a/code/game/objects/items/RCD.dm
+++ b/code/game/objects/items/RCD.dm
@@ -827,7 +827,7 @@ RLD
for(var/direction in GLOB.cardinals)
var/turf/C = get_step(W, direction)
var/list/dupes = checkdupes(C)
- if(start.CanAtmosPass(C) && !dupes.len)
+ if(start.can_atmos_pass(C) && !dupes.len)
candidates += C
if(!candidates.len)
to_chat(user, "Valid target not found...")
diff --git a/code/game/objects/items/RPD.dm b/code/game/objects/items/RPD.dm
index b701a0509ba5d..dbbf928d14f27 100644
--- a/code/game/objects/items/RPD.dm
+++ b/code/game/objects/items/RPD.dm
@@ -532,7 +532,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/devices/forcefieldprojector.dm b/code/game/objects/items/devices/forcefieldprojector.dm
index 68a47eb19db09..a7c6df4766ec4 100644
--- a/code/game/objects/items/devices/forcefieldprojector.dm
+++ b/code/game/objects/items/devices/forcefieldprojector.dm
@@ -86,7 +86,7 @@
z_flags = Z_BLOCK_IN_DOWN | Z_BLOCK_IN_UP
mouse_opacity = MOUSE_OPACITY_OPAQUE
resistance_flags = INDESTRUCTIBLE
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
armor = list(MELEE = 0, BULLET = 25, LASER = 50, ENERGY = 50, BOMB = 25, BIO = 100, RAD = 100, FIRE = 100, ACID = 100, STAMINA = 0)
var/obj/item/forcefield_projector/generator
diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm
index e9ba9ff3aed15..40cfb310587b1 100644
--- a/code/game/objects/structures/aliens.dm
+++ b/code/game/objects/structures/aliens.dm
@@ -63,7 +63,7 @@
anchored = TRUE
max_integrity = 200
var/resintype = null
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
/obj/structure/alien/resin/Initialize(mapload)
@@ -88,7 +88,7 @@
smoothing_groups = list(SMOOTH_GROUP_ALIEN_RESIN, SMOOTH_GROUP_ALIEN_WALLS)
canSmoothWith = list(SMOOTH_GROUP_ALIEN_WALLS)
-/obj/structure/alien/resin/wall/BlockSuperconductivity()
+/obj/structure/alien/resin/wall/block_superconductivity()
return 1
/obj/structure/alien/resin/membrane
diff --git a/code/game/objects/structures/false_walls.dm b/code/game/objects/structures/false_walls.dm
index 34a9521373f60..460a2a0e2e916 100644
--- a/code/game/objects/structures/false_walls.dm
+++ b/code/game/objects/structures/false_walls.dm
@@ -16,7 +16,7 @@
opacity = TRUE
max_integrity = 100
can_be_unanchored = FALSE
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
rad_flags = RAD_PROTECT_CONTENTS | RAD_NO_CONTAMINATE
rad_insulation = RAD_MEDIUM_INSULATION
var/mineral = /obj/item/stack/sheet/iron
diff --git a/code/game/objects/structures/holosign.dm b/code/game/objects/structures/holosign.dm
index e077af261e06b..4db9d35f37002 100644
--- a/code/game/objects/structures/holosign.dm
+++ b/code/game/objects/structures/holosign.dm
@@ -91,7 +91,7 @@
icon_state = "holo_firelock"
density = FALSE
anchored = TRUE
- CanAtmosPass = ATMOS_PASS_NO
+ can_atmos_pass = ATMOS_PASS_NO
alpha = 150
rad_flags = RAD_PROTECT_CONTENTS | RAD_NO_CONTAMINATE
rad_insulation = RAD_LIGHT_INSULATION
diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm
index ae08039b9fe81..e0233e999c118 100644
--- a/code/game/objects/structures/mineral_doors.dm
+++ b/code/game/objects/structures/mineral_doors.dm
@@ -12,7 +12,7 @@
icon_state = "metal"
max_integrity = 200
armor = list(MELEE = 10, BULLET = 0, LASER = 0, ENERGY = 100, BOMB = 10, BIO = 100, RAD = 100, FIRE = 50, ACID = 50, STAMINA = 0)
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
rad_flags = RAD_PROTECT_CONTENTS | RAD_NO_CONTAMINATE
rad_insulation = RAD_MEDIUM_INSULATION
diff --git a/code/game/objects/structures/mirror.dm b/code/game/objects/structures/mirror.dm
index 02f2d717e58be..d8123ebd25294 100644
--- a/code/game/objects/structures/mirror.dm
+++ b/code/game/objects/structures/mirror.dm
@@ -254,14 +254,14 @@
if(P.starting)
var/new_x = P.starting.x + pick(0, 0, 0, 0, 0, -1, 1, -2, 2)
var/new_y = P.starting.y + pick(0, 0, 0, 0, 0, -1, 1, -2, 2)
- var/turf/curloc = get_turf(src)
+ var/turf/current_location = get_turf(src)
// redirect the projectile
P.original = locate(new_x, new_y, P.z)
- P.starting = curloc
+ P.starting = current_location
P.firer = src
- P.yo = new_y - curloc.y
- P.xo = new_x - curloc.x
+ P.yo = new_y - current_location.y
+ P.xo = new_x - current_location.x
var/new_angle_s = P.Angle + 180
while(new_angle_s > 180) // Translate to regular projectile degrees
new_angle_s -= 360
diff --git a/code/game/objects/structures/plasticflaps.dm b/code/game/objects/structures/plasticflaps.dm
index e896fa361854e..04072573e23d5 100644
--- a/code/game/objects/structures/plasticflaps.dm
+++ b/code/game/objects/structures/plasticflaps.dm
@@ -7,7 +7,7 @@
density = FALSE
anchored = TRUE
layer = BELOW_OBJ_LAYER
- CanAtmosPass = ATMOS_PASS_NO
+ can_atmos_pass = ATMOS_PASS_NO
/obj/structure/plasticflaps/opaque
opacity = TRUE
diff --git a/code/game/objects/structures/statues.dm b/code/game/objects/structures/statues.dm
index fd18f6beb92a2..b3e005893de5c 100644
--- a/code/game/objects/structures/statues.dm
+++ b/code/game/objects/structures/statues.dm
@@ -7,10 +7,10 @@
density = TRUE
anchored = FALSE
max_integrity = 100
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
var/oreAmount = 5
var/material_drop_type = /obj/item/stack/sheet/iron
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
material_modifier = 0.5
material_flags = MATERIAL_EFFECTS | MATERIAL_AFFECT_STATISTICS
/// Beauty component mood modifier
diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm
index 4c18c13485085..0286d36e70594 100644
--- a/code/game/objects/structures/windoor_assembly.dm
+++ b/code/game/objects/structures/windoor_assembly.dm
@@ -18,7 +18,7 @@
density = FALSE
layer = ABOVE_OBJ_LAYER //Just above doors
anchored = FALSE
- CanAtmosPass = ATMOS_PASS_PROC
+ can_atmos_pass = ATMOS_PASS_PROC
dir = NORTH
set_dir_on_move = FALSE
@@ -71,7 +71,7 @@
return TRUE
-/obj/structure/windoor_assembly/CanAtmosPass(turf/T)
+/obj/structure/windoor_assembly/can_atmos_pass(turf/T)
if(get_dir(loc, T) == dir)
return !density
else
diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm
index d408f8b1cd362..deead8ca24343 100644
--- a/code/game/objects/structures/window.dm
+++ b/code/game/objects/structures/window.dm
@@ -11,7 +11,7 @@
can_be_unanchored = TRUE
resistance_flags = ACID_PROOF
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 80, ACID = 100, STAMINA = 0)
- CanAtmosPass = ATMOS_PASS_PROC
+ can_atmos_pass = ATMOS_PASS_PROC
rad_insulation = RAD_VERY_LIGHT_INSULATION
rad_flags = RAD_PROTECT_CONTENTS
pass_flags_self = PASSTRANSPARENT
@@ -334,7 +334,7 @@
. = ..()
move_update_air(T)
-/obj/structure/window/CanAtmosPass(turf/T)
+/obj/structure/window/can_atmos_pass(turf/T)
if(!anchored || !density)
return TRUE
return !(fulltile || dir == get_dir(loc, T))
@@ -680,7 +680,7 @@
glass_type = /obj/item/stack/sheet/paperframes
heat_resistance = 233
decon_speed = 10
- CanAtmosPass = ATMOS_PASS_YES
+ can_atmos_pass = ATMOS_PASS_YES
resistance_flags = FLAMMABLE
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 0, ACID = 0, STAMINA = 0)
breaksound = 'sound/items/poster_ripped.ogg'
diff --git a/code/game/turfs/change_turf.dm b/code/game/turfs/change_turf.dm
index e2d8ff20cce2f..733728733e368 100644
--- a/code/game/turfs/change_turf.dm
+++ b/code/game/turfs/change_turf.dm
@@ -310,7 +310,7 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
/turf/proc/AfterChange(flags, oldType) //called after a turf has been replaced in ChangeTurf()
levelupdate()
if(flags & CHANGETURF_RECALC_ADJACENT)
- ImmediateCalculateAdjacentTurfs()
+ immediate_calculate_adjacent_turfs()
if(ispath(oldType, /turf/closed) && istype(src, /turf/open))
SSair.add_to_active(src)
else //In effect, I want closed turfs to make their tile active when sheered, but we need to queue it since they have no adjacent turfs
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index 367a5e5e92676..fcd0c65476c37 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -160,7 +160,7 @@
/turf/open/indestructible/binary
name = "tear in the fabric of reality"
- CanAtmosPass = ATMOS_PASS_NO
+ can_atmos_pass = ATMOS_PASS_NO
baseturfs = /turf/open/indestructible/binary
icon_state = "binary"
footstep = FOOTSTEP_PLATING
@@ -184,7 +184,7 @@
update_visuals()
current_cycle = times_fired
- ImmediateCalculateAdjacentTurfs()
+ immediate_calculate_adjacent_turfs()
for(var/i in atmos_adjacent_turfs)
var/turf/open/enemy_tile = i
var/datum/gas_mixture/enemy_air = enemy_tile.return_air()
diff --git a/code/game/turfs/open/floor/reinf_floor.dm b/code/game/turfs/open/floor/reinf_floor.dm
index e59930ab35da0..0b154861f03f8 100644
--- a/code/game/turfs/open/floor/reinf_floor.dm
+++ b/code/game/turfs/open/floor/reinf_floor.dm
@@ -130,8 +130,8 @@
icon_state = "plating"
floor_tile = null
var/obj/effect/clockwork/overlay/floor/bloodcult/realappearance
- CanAtmosPass = ATMOS_PASS_NO
- CanAtmosPassVertical = ATMOS_PASS_NO
+ can_atmos_pass = ATMOS_PASS_NO
+ can_atmos_passVertical = ATMOS_PASS_NO
/turf/open/floor/engine/cult/Initialize(mapload)
diff --git a/code/game/turfs/open/openspace.dm b/code/game/turfs/open/openspace.dm
index caa997873b427..e3ffe3e53743c 100644
--- a/code/game/turfs/open/openspace.dm
+++ b/code/game/turfs/open/openspace.dm
@@ -3,7 +3,7 @@
desc = "Watch your step!"
icon_state = "invisible"
baseturfs = /turf/open/openspace
- CanAtmosPassVertical = ATMOS_PASS_YES
+ can_atmos_passVertical = ATMOS_PASS_YES
overfloor_placed = FALSE
underfloor_accessibility = UNDERFLOOR_INTERACTABLE
allow_z_travel = TRUE
diff --git a/code/modules/antagonists/blob/structures/_blob.dm b/code/modules/antagonists/blob/structures/_blob.dm
index 9019d0543b3bd..3d7daa5b98fe0 100644
--- a/code/modules/antagonists/blob/structures/_blob.dm
+++ b/code/modules/antagonists/blob/structures/_blob.dm
@@ -9,7 +9,7 @@
anchored = TRUE
layer = BELOW_MOB_LAYER
pass_flags_self = PASSBLOB
- CanAtmosPass = ATMOS_PASS_PROC
+ can_atmos_pass = ATMOS_PASS_PROC
var/point_return = 0 //How many points the blob gets back when it removes a blob of that type. If less than 0, blob cannot be removed.
max_integrity = 30
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 80, ACID = 70, STAMINA = 0)
@@ -65,10 +65,10 @@
result++
. -= result - 1
-/obj/structure/blob/BlockSuperconductivity()
+/obj/structure/blob/block_superconductivity()
return atmosblock
-/obj/structure/blob/CanAtmosPass(turf/T)
+/obj/structure/blob/can_atmos_pass(turf/T)
return !atmosblock
/obj/structure/blob/update_icon() //Updates color based on overmind color if we have an overmind.
diff --git a/code/modules/antagonists/clock_cult/clockwork_turfs.dm b/code/modules/antagonists/clock_cult/clockwork_turfs.dm
index 5c84fd4915323..ddfa809c86737 100644
--- a/code/modules/antagonists/clock_cult/clockwork_turfs.dm
+++ b/code/modules/antagonists/clock_cult/clockwork_turfs.dm
@@ -343,7 +343,7 @@
damage_deflection = 30
normal_integrity = 240
air_tight = FALSE
- CanAtmosPass = ATMOS_PASS_YES
+ can_atmos_pass = ATMOS_PASS_YES
var/construction_state = GEAR_SECURE //Pinion airlocks have custom deconstruction
allow_repaint = FALSE
diff --git a/code/modules/antagonists/cult/runes.dm b/code/modules/antagonists/cult/runes.dm
index 1f7a20cebcc09..87eefb242e208 100644
--- a/code/modules/antagonists/cult/runes.dm
+++ b/code/modules/antagonists/cult/runes.dm
@@ -666,7 +666,7 @@ structure_check() searches for nearby cultist structures required for the invoca
invocation = "Khari'd! Eske'te tannin!"
icon_state = "4"
color = RUNE_COLOR_DARKRED
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
var/datum/timedevent/density_timer
var/recharging = FALSE
@@ -684,7 +684,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/block_superconductivity()
return density
/obj/effect/rune/wall/invoke(var/list/invokers)
diff --git a/code/modules/atmospherics/Atmospherics.md b/code/modules/atmospherics/Atmospherics.md
index f342bcda23e8e..dd4454d51d725 100644
--- a/code/modules/atmospherics/Atmospherics.md
+++ b/code/modules/atmospherics/Atmospherics.md
@@ -239,7 +239,7 @@ So then, what does superconduction do, and what do all these damn vars mean.
As I mentioned above, superconduction shares heat where heat can't normally travel. It does this by heating up the turf the heat is in, not the gasmix, the turf itself. This temperature is then shared with adjacent turfs, based on `thermal_conductivity`, a value between 0 and 1 that slows the heat share. Turfs also have a `heat_capacity`, which is how hard it is to heat, along with providing a threshold for the lowest temperature that can melt the turf.
-There's one more, and it's a doozy. `atmos_superconductivity` is a set of directions that we cannot share with. I know. It's set in CanAtmosPass(), a rather heady set of procs that build `atmos_adjacent_turfs`, and also modify `atmos_superconductivity`.
+There's one more, and it's a doozy. `atmos_superconductivity` is a set of directions that we cannot share with. I know. It's set in can_atmos_pass(), a rather heady set of procs that build `atmos_adjacent_turfs`, and also modify `atmos_superconductivity`.
So then, a review.
diff --git a/code/modules/atmospherics/environmental/LINDA_system.dm b/code/modules/atmospherics/environmental/LINDA_system.dm
index 378dd21b9e362..c3943a5406587 100644
--- a/code/modules/atmospherics/environmental/LINDA_system.dm
+++ b/code/modules/atmospherics/environmental/LINDA_system.dm
@@ -1,23 +1,23 @@
-/atom/var/CanAtmosPass = ATMOS_PASS_YES
-/atom/var/CanAtmosPassVertical = ATMOS_PASS_YES
+/atom/var/can_atmos_pass = ATMOS_PASS_YES
+/atom/var/can_atmos_passVertical = ATMOS_PASS_YES
-/atom/proc/CanAtmosPass(turf/T)
- switch (CanAtmosPass)
+/atom/proc/can_atmos_pass(turf/T)
+ switch (can_atmos_pass)
if (ATMOS_PASS_PROC)
return ATMOS_PASS_YES
if (ATMOS_PASS_DENSITY)
return !density
else
- return CanAtmosPass
+ return can_atmos_pass
-/turf/CanAtmosPass = ATMOS_PASS_NO
-/turf/CanAtmosPassVertical = ATMOS_PASS_NO
+/turf/can_atmos_pass = ATMOS_PASS_NO
+/turf/can_atmos_passVertical = ATMOS_PASS_NO
-/turf/open/CanAtmosPass = ATMOS_PASS_PROC
-/turf/open/CanAtmosPassVertical = ATMOS_PASS_PROC
+/turf/open/can_atmos_pass = ATMOS_PASS_PROC
+/turf/open/can_atmos_passVertical = ATMOS_PASS_PROC
//Do NOT use this to see if 2 turfs are connected, it mutates state, and we cache that info anyhow. Use TURFS_CAN_SHARE or TURF_SHARES depending on your usecase
-/turf/open/CanAtmosPass(turf/T, vertical = FALSE)
+/turf/open/can_atmos_pass(turf/T, vertical = FALSE)
var/dir = vertical? get_dir_multiz(src, T) : get_dir(src, T)
var/opp = REVERSE_DIR(dir)
var/R = FALSE
@@ -31,7 +31,7 @@
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
+ if(O.block_superconductivity()) //the direction and open/closed are already checked on can_atmos_pass() so there are no arguments
atmos_supeconductivity |= dir
T.atmos_supeconductivity |= opp
return FALSE //no need to keep going, we got all we asked
@@ -41,10 +41,10 @@
return !R
-/atom/movable/proc/BlockSuperconductivity() // objects that block air and don't let superconductivity act. Only firelocks atm.
+/atom/movable/proc/block_superconductivity() // objects that block air and don't let superconductivity act. Only firelocks atm.
return FALSE
-/turf/proc/ImmediateCalculateAdjacentTurfs()
+/turf/proc/immediate_calculate_adjacent_turfs()
var/canpass = CANATMOSPASS(src, src)
var/canvpass = CANVERTICALATMOSPASS(src, src)
for(var/direction in GLOB.cardinals_multiz)
@@ -78,23 +78,23 @@
if (!alldir)
return adjacent_turfs
- var/turf/curloc = src
+ var/turf/current_location = src
for (var/direction in GLOB.diagonals_multiz)
- var/matchingDirections = 0
- var/turf/S = get_step_multiz(curloc, direction)
+ var/matching_directions = 0
+ var/turf/S = get_step_multiz(current_location, direction)
if(!S)
continue
- for (var/checkDirection in GLOB.cardinals_multiz)
- var/turf/checkTurf = get_step(S, checkDirection)
+ for (var/check_direction in GLOB.cardinals_multiz)
+ var/turf/checkTurf = get_step(S, check_direction)
if(!S.atmos_adjacent_turfs || !S.atmos_adjacent_turfs[checkTurf])
continue
if (adjacent_turfs[checkTurf])
- matchingDirections++
+ matching_directions++
- if (matchingDirections >= 2)
+ if (matching_directions >= 2)
adjacent_turfs += S
break
@@ -115,7 +115,7 @@
*/
/turf/air_update_turf(update = FALSE, remove = FALSE)
if(update)
- ImmediateCalculateAdjacentTurfs()
+ immediate_calculate_adjacent_turfs()
if(remove)
SSair.remove_from_active(src)
else
diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm
index ffe4de6aa9338..21dd8785959a7 100644
--- a/code/modules/atmospherics/machinery/atmosmachinery.dm
+++ b/code/modules/atmospherics/machinery/atmosmachinery.dm
@@ -64,11 +64,11 @@
..()
if(process)
SSair.start_processing_machine(src)
- SetInitDirections()
+ set_init_directions()
/obj/machinery/atmospherics/Destroy()
for(var/i in 1 to device_type)
- nullifyNode(i)
+ nullify_node(i)
SSair.stop_processing_machine(src)
SSair.rebuild_queue -= src
@@ -96,19 +96,19 @@
/obj/machinery/atmospherics/proc/get_rebuild_targets()
return
-/obj/machinery/atmospherics/proc/nullifyNode(i)
+/obj/machinery/atmospherics/proc/nullify_node(i)
if(nodes[i])
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
for(var/i in 1 to device_type)
for(var/D in GLOB.cardinals)
- if(D & GetInitDirections())
+ if(D & get_init_directions())
if(D in node_connects)
continue
node_connects[i] = D
@@ -123,9 +123,9 @@
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]))
@@ -134,7 +134,7 @@
break
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_icon()
@@ -142,18 +142,18 @@
return connection_check(target, piping_layer)
//Find a connecting /obj/machinery/atmospherics in specified direction
-/obj/machinery/atmospherics/proc/findConnecting(direction, prompted_layer)
+/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) && !istype(target, /obj/machinery/atmospherics/pipe/multiz))
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) || istype(target, /obj/machinery/atmospherics/pipe/multiz)))
+ if(is_connectable(target, given_layer) && target.is_connectable(src, given_layer) && (target.initialize_directions & get_dir(target,src) || istype(target, /obj/machinery/atmospherics/pipe/multiz)))
return TRUE
return FALSE
-/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.piping_layer == given_layer) || (target.pipe_flags & PIPING_ALL_LAYER))
@@ -163,22 +163,22 @@
/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_pipenetAir()
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)
@@ -193,7 +193,7 @@
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 ..()
@@ -260,14 +260,14 @@
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)
. = 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(iconsetids[iconset] == null)
@@ -288,12 +288,12 @@
if(can_unwrench)
add_atom_colour(obj_color, FIXED_COLOUR_PRIORITY)
pipe_color = obj_color
- setPipingLayer(set_layer)
- atmosinit()
+ set_piping_layer(set_layer)
+ atmos_init()
var/list/nodes = pipeline_expansion()
for(var/obj/machinery/atmospherics/A in nodes)
- A.atmosinit()
- A.addMember(src)
+ A.atmos_init()
+ A.add_member(src)
SSair.add_to_rebuild_queue(src)
/obj/machinery/atmospherics/Entered(atom/movable/arrived, atom/old_loc, list/atom/old_locs)
@@ -314,14 +314,14 @@
return
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))
user.forceMove(target_move.loc) //handle entering and so on.
user.visible_message("You hear something squeezing through the ducts...", "You climb out the ventilation system.")
else
- var/list/pipenetdiff = returnPipenets() ^ target_move.returnPipenets()
+ var/list/pipenetdiff = return_pipenets() ^ target_move.return_pipenets()
if(pipenetdiff.len)
user.update_pipe_vision(target_move)
user.forceMove(target_move)
@@ -347,7 +347,7 @@
/obj/machinery/atmospherics/proc/can_crawl_through()
return TRUE
-/obj/machinery/atmospherics/proc/returnPipenets()
+/obj/machinery/atmospherics/proc/return_pipenets()
return list()
/obj/machinery/atmospherics/update_remote_sight(mob/user)
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 accec64dbd8c0..04cc3789b476a 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/binary_devices.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/binary_devices.dm
@@ -6,14 +6,14 @@
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
if(EAST, WEST)
initialize_directions = EAST|WEST
-/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 a145a6e802ce2..7adc98419a59f 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
@@ -103,28 +103,28 @@
nullifyPipenet(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)
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))
@@ -165,7 +165,7 @@
generator.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 296eb5bd7449c..3868afd9099ec 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
@@ -47,7 +47,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(welded)
@@ -131,7 +131,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 5497bc81d6534..9b7f616ad9336 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm
@@ -53,7 +53,7 @@ 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()
..()
@@ -125,7 +125,7 @@ Passive gate is similar to the regular pump except:
if(.)
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 c136cb3b746b5..b659fd39c72df 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_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 31bd3e8cdcfc7..3a0782e947471 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
@@ -131,7 +131,7 @@
if(.)
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/volume_pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
index d457af1c7076e..84c0a789aa97c 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
@@ -131,7 +131,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 de50ae8584207..b3ee7f4893b7e 100644
--- a/code/modules/atmospherics/machinery/components/components_base.dm
+++ b/code/modules/atmospherics/machinery/components/components_base.dm
@@ -85,13 +85,13 @@
*/
/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)
+/obj/machinery/atmospherics/components/nullify_node(i)
if(parents[i])
nullifyPipenet(parents[i])
QDEL_NULL(airs[i])
@@ -116,7 +116,7 @@
return to_return
/**
- * Called by nullifyNode(), used to remove the pipeline the component is attached to
+ * Called by nullify_node(), used to remove the pipeline the component is attached to
* Arguments:
* * -reference: the pipeline the component is attached to
*/
@@ -129,7 +129,7 @@
reference.other_airs -= airs[i] // Disconnects from the pipeline side
parents[i] = null // Disconnects from the machinery side.
- reference.other_atmosmch -= src
+ reference.other_atmos_machines -= src
/**
* We explicitly qdel pipeline when this particular pipeline
@@ -139,12 +139,12 @@
* again every time they are qdeleted.
*/
- if(!length(reference.other_atmosmch) && !length(reference.members))
+ if(!length(reference.other_atmos_machines) && !length(reference.members))
if(QDESTROYING(reference))
CRASH("nullifyPipenet() called on qdeleting [reference]")
qdel(reference)
-/obj/machinery/atmospherics/components/returnPipenetAirs(datum/pipeline/reference)
+/obj/machinery/atmospherics/components/return_pipenetAirs(datum/pipeline/reference)
var/list/returned_air = list()
for (var/i in 1 to parents.len)
@@ -157,13 +157,13 @@
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)
@@ -212,10 +212,10 @@
else
parent.update = TRUE
-/obj/machinery/atmospherics/components/returnPipenets()
+/obj/machinery/atmospherics/components/return_pipenets()
. = list()
for(var/i in 1 to device_type)
- . += returnPipenet(nodes[i])
+ . += return_pipenet(nodes[i])
// UI Stuff
diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
index eec363237a04a..f703a90024ddd 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
@@ -45,13 +45,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)
add_overlay(cap)
@@ -116,7 +116,7 @@
update_parents()
-/obj/machinery/atmospherics/components/trinary/filter/atmosinit()
+/obj/machinery/atmospherics/components/trinary/filter/atmos_init()
set_frequency(frequency)
return ..()
diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
index fd75fff07f301..ae1e1c63d25f8 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
@@ -39,13 +39,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)
add_overlay(cap)
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 01b89560d683e..d96b7244eb47d 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 8b842cff5ca30..da1af112e4539 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
@@ -468,17 +468,17 @@
/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()
+ 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 CRYOMOBS
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 3f1920d41f646..5068730358e5d 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm
@@ -32,7 +32,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 7a6abac873c8e..b17de0ebc83b1 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm
@@ -50,7 +50,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"
@@ -110,7 +110,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 dbb3bedc882a2..a07c6b078d8a9 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm
@@ -15,7 +15,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"
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 819b7d4918421..3a49035d50cc9 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm
@@ -31,7 +31,7 @@
/obj/machinery/atmospherics/components/unary/portables_connector/update_icon_nopipes()
icon_state = "connector"
if(showpipe)
- 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 529491c396c06..871ba1e1993ac 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
@@ -23,7 +23,7 @@
air_contents.gases[gas_type][MOLES] = AIR_CONTENTS
name = "[name] ([GLOB.meta_gas_info[gas_type][META_GAS_NAME]])"
- setPipingLayer(piping_layer)
+ set_piping_layer(piping_layer)
/obj/machinery/atmospherics/components/unary/tank/air
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm
index 38bd7572b9a4f..aa4d46e965113 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/thermomachine.dm
@@ -82,12 +82,12 @@
else
icon_state = icon_state_off
- add_overlay(getpipeimage(icon, "pipe", dir, , piping_layer))
+ add_overlay(get_pipe_image(icon, "pipe", dir, , piping_layer))
/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)
. = ..()
@@ -142,7 +142,7 @@
/obj/machinery/atmospherics/components/unary/thermomachine/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)
@@ -151,11 +151,11 @@
if(parents[1])
nullifyPipenet(parents[1])
- atmosinit()
+ 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)
return TRUE
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 8f31f8b58ef73..b2956b70067ba 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm
@@ -12,7 +12,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()
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 2425a207dcaaf..c32fd4d7cafa3 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
@@ -57,7 +57,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)
@@ -172,7 +172,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
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 0b622fcf12a89..d9ac9e9dd75a9 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
@@ -66,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)
@@ -122,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)
diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm
index 45a5555ac88d3..0eee42ffbc314 100644
--- a/code/modules/atmospherics/machinery/datum_pipeline.dm
+++ b/code/modules/atmospherics/machinery/datum_pipeline.dm
@@ -3,7 +3,7 @@
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
///Should we equalize air amoung all our members?
var/update = TRUE
@@ -13,7 +13,7 @@
/datum/pipeline/New()
other_airs = list()
members = list()
- other_atmosmch = list()
+ other_atmos_machines = list()
SSair.networks += src
/datum/pipeline/Destroy()
@@ -27,7 +27,7 @@
if(QDELETED(considered_pipe))
continue
SSair.add_to_rebuild_queue(considered_pipe)
- for(var/obj/machinery/atmospherics/components/considered_component in other_atmosmch)
+ for(var/obj/machinery/atmospherics/components/considered_component in other_atmos_machines)
considered_component.nullifyPipenet(src)
return ..()
@@ -50,7 +50,7 @@
air = considered_pipe.air_temporary
considered_pipe.air_temporary = null
else
- addMachineryMember(base)
+ add_machinery_member(base)
if(!air)
air = new
@@ -69,7 +69,7 @@
air = considered_pipe.air_temporary
considered_pipe.air_temporary = null
else
- addMachineryMember(base)
+ add_machinery_member(base)
if(!air)
air = new
@@ -82,8 +82,8 @@
continue
for(var/obj/machinery/atmospherics/considered_device in result)
if(!istype(considered_device, /obj/machinery/atmospherics/pipe))
- considered_device.setPipenet(src, borderline)
- addMachineryMember(considered_device)
+ considered_device.set_pipenet(src, borderline)
+ add_machinery_member(considered_device)
continue
var/obj/machinery/atmospherics/pipe/item = considered_device
if(members.Find(item))
@@ -119,18 +119,18 @@
* This parents list is populated when a machinery calls update_parents and is then added into the queue by the controller.
*/
-/datum/pipeline/proc/addMachineryMember(obj/machinery/atmospherics/components/considered_component)
- other_atmosmch |= considered_component
- var/list/returned_airs = considered_component.returnPipenetAirs(src)
+/datum/pipeline/proc/add_machinery_member(obj/machinery/atmospherics/components/considered_component)
+ other_atmos_machines |= considered_component
+ var/list/returned_airs = considered_component.return_pipenetAirs(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] \
+ stack_trace("add_machinery_member: 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/addMember(obj/machinery/atmospherics/reference_device, obj/machinery/atmospherics/device_to_add)
+/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.setPipenet(src, device_to_add)
- addMachineryMember(reference_device)
+ reference_device.set_pipenet(src, device_to_add)
+ add_machinery_member(reference_device)
else
var/obj/machinery/atmospherics/pipe/reference_pipe = reference_device
if(reference_pipe.parent)
@@ -154,26 +154,26 @@
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_atmosmch)
- reference_component.replacePipenet(parent_pipeline, src)
- other_atmosmch |= parent_pipeline.other_atmosmch
+ 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_atmosmch.Cut()
+ parent_pipeline.other_atmos_machines.Cut()
update = TRUE
qdel(parent_pipeline)
-/obj/machinery/atmospherics/proc/addMember(obj/machinery/atmospherics/considered_device)
+/obj/machinery/atmospherics/proc/add_member(obj/machinery/atmospherics/considered_device)
return
-/obj/machinery/atmospherics/pipe/addMember(obj/machinery/atmospherics/considered_device)
- parent.addMember(considered_device, src)
+/obj/machinery/atmospherics/pipe/add_member(obj/machinery/atmospherics/considered_device)
+ parent.add_member(considered_device, src)
-/obj/machinery/atmospherics/components/addMember(obj/machinery/atmospherics/considered_device)
- var/datum/pipeline/device_pipeline = returnPipenet(considered_device)
+/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.addMember() called by [type] on [COORD(src)]")
- device_pipeline.addMember(considered_device, src)
+ CRASH("null.add_member() called by [type] on [COORD(src)]")
+ device_pipeline.add_member(considered_device, src)
/datum/pipeline/proc/temporarily_store_air()
@@ -256,7 +256,7 @@
continue
gas_mixture_list += pipeline.other_airs
gas_mixture_list += pipeline.air
- for(var/atmosmch in pipeline.other_atmosmch)
+ for(var/atmosmch in pipeline.other_atmos_machines)
if (istype(atmosmch, /obj/machinery/atmospherics/components/binary/valve))
var/obj/machinery/atmospherics/components/binary/valve/considered_valve = atmosmch
if(considered_valve.on)
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 153967bc5207c..df9e5cf3d2f87 100644
--- a/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm
+++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm
@@ -14,7 +14,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 a5b736806f0fb..502a27a038f42 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 f02e1a4b75a61..c59c3c743312f 100644
--- a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm
+++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm
@@ -22,7 +22,7 @@
center = mutable_appearance(icon, "manifold_center")
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
@@ -35,7 +35,7 @@
//Add non-broken pieces
for(var/i in 1 to device_type)
if(nodes[i])
- add_overlay( getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) )
+ add_overlay( get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) )
update_layer()
diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm
index 18b4b1923f302..a321f7967e464 100644
--- a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm
+++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm
@@ -21,7 +21,7 @@
center = mutable_appearance(icon, "manifold4w_center")
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_icon()
@@ -33,7 +33,7 @@
//Add non-broken pieces
for(var/i in 1 to device_type)
if(nodes[i])
- add_overlay( getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) )
+ add_overlay( get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) )
update_layer()
diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm
index 7a5d9e5e6d1ef..7c43cd771af20 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 d01b60d5b508a..23221c20045db 100644
--- a/code/modules/atmospherics/machinery/pipes/layermanifold.dm
+++ b/code/modules/atmospherics/machinery/pipes/layermanifold.dm
@@ -68,21 +68,21 @@
var/image/I
if(p_color)
- I = getpipeimage(icon, "pipe", p_dir, p_color, piping_layer = p_layer)
+ I = get_pipe_image(icon, "pipe", p_dir, p_color, piping_layer = p_layer)
else
- I = getpipeimage(icon, "pipe", p_dir, piping_layer = p_layer)
+ I = get_pipe_image(icon, "pipe", p_dir, piping_layer = p_layer)
I.layer = layer - 0.01
add_overlay(I)
-/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,11 +103,11 @@
update_appearance()
return new_nodes
-/obj/machinery/atmospherics/pipe/layer_manifold/atmosinit()
+/obj/machinery/atmospherics/pipe/layer_manifold/atmos_init()
normalize_cardinal_directions()
findAllConnections()
-/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 93353618e61ef..67e9670839caf 100644
--- a/code/modules/atmospherics/machinery/pipes/manifold.dm
+++ b/code/modules/atmospherics/machinery/pipes/manifold.dm
@@ -31,7 +31,7 @@
center = mutable_appearance(icon, "manifold_center")
return ..()
-/obj/machinery/atmospherics/pipe/manifold/SetInitDirections()
+/obj/machinery/atmospherics/pipe/manifold/set_init_directions()
initialize_directions = NORTH|SOUTH|EAST|WEST
initialize_directions &= ~dir
@@ -45,6 +45,6 @@
//Add non-broken pieces
for(var/i in 1 to device_type)
if(nodes[i])
- add_overlay( getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) )
+ add_overlay( get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) )
update_layer()
diff --git a/code/modules/atmospherics/machinery/pipes/manifold4w.dm b/code/modules/atmospherics/machinery/pipes/manifold4w.dm
index 48e47d5405805..f764e70ee3ca3 100644
--- a/code/modules/atmospherics/machinery/pipes/manifold4w.dm
+++ b/code/modules/atmospherics/machinery/pipes/manifold4w.dm
@@ -26,7 +26,7 @@
center = mutable_appearance(icon, "manifold4w_center")
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_icon()
@@ -39,6 +39,6 @@
//Add non-broken pieces
for(var/i in 1 to device_type)
if(nodes[i])
- add_overlay( getpipeimage(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) )
+ add_overlay( get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) )
update_layer()
diff --git a/code/modules/atmospherics/machinery/pipes/multiz.dm b/code/modules/atmospherics/machinery/pipes/multiz.dm
index 699e4ab965f8a..3c0aeb6e915a0 100644
--- a/code/modules/atmospherics/machinery/pipes/multiz.dm
+++ b/code/modules/atmospherics/machinery/pipes/multiz.dm
@@ -32,7 +32,7 @@
pipe = mutable_appearance(icon, "pipe-[piping_layer]")
return ..()
-/obj/machinery/atmospherics/pipe/multiz/SetInitDirections()
+/obj/machinery/atmospherics/pipe/multiz/set_init_directions()
initialize_directions = dir
/obj/machinery/atmospherics/pipe/multiz/update_icon()
diff --git a/code/modules/atmospherics/machinery/pipes/pipes.dm b/code/modules/atmospherics/machinery/pipes/pipes.dm
index cf2a83542be00..bc62bfb3faa1d 100644
--- a/code/modules/atmospherics/machinery/pipes/pipes.dm
+++ b/code/modules/atmospherics/machinery/pipes/pipes.dm
@@ -26,7 +26,7 @@
if(hide)
AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE) //if changing this, change the subtypes RemoveElements too, because thats how bespoke works
-/obj/machinery/atmospherics/pipe/nullifyNode(i)
+/obj/machinery/atmospherics/pipe/nullify_node(i)
var/obj/machinery/atmospherics/oldN = nodes[i]
..()
if(oldN)
@@ -70,10 +70,10 @@
else
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()
@@ -100,7 +100,7 @@
var/obj/machinery/atmospherics/N = nodes[i]
N.update_icon()
-/obj/machinery/atmospherics/pipe/returnPipenets()
+/obj/machinery/atmospherics/pipe/return_pipenets()
. = list(parent)
/obj/machinery/atmospherics/pipe/paint(paint_color)
diff --git a/code/modules/atmospherics/machinery/pipes/simple.dm b/code/modules/atmospherics/machinery/pipes/simple.dm
index da6fab8c66d0d..fc954093311a6 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/events/alien_infestation.dm b/code/modules/events/alien_infestation.dm
index 16ddd69d6fa23..799e31cc8d820 100644
--- a/code/modules/events/alien_infestation.dm
+++ b/code/modules/events/alien_infestation.dm
@@ -55,7 +55,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/spider_infestation.dm b/code/modules/events/spider_infestation.dm
index a2715faac6365..1f43ff59f8410 100644
--- a/code/modules/events/spider_infestation.dm
+++ b/code/modules/events/spider_infestation.dm
@@ -30,7 +30,7 @@
if(!temp_vent_parent)
continue// no parent vent
- if(length(temp_vent_parent.other_atmosmch) > 20)
+ if(length(temp_vent_parent.other_atmos_machines) > 20)
vents += temp_vent // Makes sure the vent network's big enough
if(!length(vents))
diff --git a/code/modules/flufftext/Hallucination.dm b/code/modules/flufftext/Hallucination.dm
index 2247513e0ea2b..437dec134ac4f 100644
--- a/code/modules/flufftext/Hallucination.dm
+++ b/code/modules/flufftext/Hallucination.dm
@@ -201,7 +201,7 @@ GLOBAL_LIST_INIT(hallucination_list, list(
for(var/turf/FT in flood_turfs)
for(var/dir in GLOB.cardinals)
var/turf/T = get_step(FT, dir)
- if((T in flood_turfs) || !FT.CanAtmosPass(T))
+ if((T in flood_turfs) || !FT.can_atmos_pass(T))
continue
var/image/new_plasma = image(image_icon,T,image_state,FLY_LAYER)
new_plasma.alpha = 50
diff --git a/code/modules/mining/equipment/survival_pod.dm b/code/modules/mining/equipment/survival_pod.dm
index bf4b7d32dd1cf..2c3dae3f1d1df 100644
--- a/code/modules/mining/equipment/survival_pod.dm
+++ b/code/modules/mining/equipment/survival_pod.dm
@@ -296,7 +296,7 @@
density = TRUE
var/buildstacktype = /obj/item/stack/sheet/iron
var/buildstackamount = 5
- CanAtmosPass = ATMOS_PASS_NO
+ can_atmos_pass = ATMOS_PASS_NO
/obj/structure/fans/deconstruct()
if(!(flags_1 & NODECONSTRUCT_1))
diff --git a/code/modules/mob/living/carbon/human/human_defense.dm b/code/modules/mob/living/carbon/human/human_defense.dm
index 0ee0cc06683ef..d789f92b0be3a 100644
--- a/code/modules/mob/living/carbon/human/human_defense.dm
+++ b/code/modules/mob/living/carbon/human/human_defense.dm
@@ -91,14 +91,14 @@
if(P.starting)
var/new_x = P.starting.x + pick(0, 0, 0, 0, 0, -1, 1, -2, 2)
var/new_y = P.starting.y + pick(0, 0, 0, 0, 0, -1, 1, -2, 2)
- var/turf/curloc = get_turf(src)
+ var/turf/current_location = get_turf(src)
// redirect the projectile
P.original = locate(new_x, new_y, P.z)
- P.starting = curloc
+ P.starting = current_location
P.firer = src
- P.yo = new_y - curloc.y
- P.xo = new_x - curloc.x
+ P.yo = new_y - current_location.y
+ P.xo = new_x - current_location.x
var/new_angle_s = P.Angle + rand(120,240)
while(new_angle_s > 180) // Translate to regular projectile degrees
new_angle_s -= 360
diff --git a/code/modules/mob/living/simple_animal/bot/atmosbot.dm b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
index afe01b67a9289..db4dfbad014f3 100644
--- a/code/modules/mob/living/simple_animal/bot/atmosbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
@@ -265,7 +265,7 @@
for(var/obj/structure/holosign/barrier/atmos/A in target_turf)
blocked = TRUE
break
- if(!target_turf.CanAtmosPass(target_turf) || blocked)
+ if(!target_turf.can_atmos_pass(target_turf) || blocked)
//Pressumable from being inside a holobarrier, move somewhere nearby
var/turf/open/floor/floor_turf = pick(view(3, src))
if(floor_turf && istype(floor_turf))
@@ -292,7 +292,7 @@
for(var/obj/structure/holosign/barrier/atmos/A in checking_turf)
blocked = TRUE
break
- if(blocked || !checking_turf.CanAtmosPass(checking_turf))
+ if(blocked || !checking_turf.can_atmos_pass(checking_turf))
continue
var/datum/gas_mixture/current_air = checking_turf.return_air()
if (!current_air)
@@ -301,7 +301,7 @@
//Add adjacent turfs
for(var/direction in list(NORTH, SOUTH, EAST, WEST))
var/turf/adjacent_turf = get_step(checking_turf, direction)
- if(adjacent_turf in checked_turfs || !adjacent_turf.CanAtmosPass(adjacent_turf))
+ if(adjacent_turf in checked_turfs || !adjacent_turf.can_atmos_pass(adjacent_turf))
continue
var/datum/gas_mixture/checking_air = checking_turf.return_air()
if (!checking_air)
diff --git a/code/modules/mob/living/simple_animal/constructs.dm b/code/modules/mob/living/simple_animal/constructs.dm
index 067c92f2898cf..7e3e7debc40e7 100644
--- a/code/modules/mob/living/simple_animal/constructs.dm
+++ b/code/modules/mob/living/simple_animal/constructs.dm
@@ -175,14 +175,14 @@
if(P.starting)
var/new_x = P.starting.x + pick(0, 0, -1, 1, -2, 2, -2, 2, -2, 2, -3, 3, -3, 3)
var/new_y = P.starting.y + pick(0, 0, -1, 1, -2, 2, -2, 2, -2, 2, -3, 3, -3, 3)
- var/turf/curloc = get_turf(src)
+ var/turf/current_location = get_turf(src)
// redirect the projectile
P.original = locate(new_x, new_y, P.z)
- P.starting = curloc
+ P.starting = current_location
P.firer = src
- P.yo = new_y - curloc.y
- P.xo = new_x - curloc.x
+ P.yo = new_y - current_location.y
+ P.xo = new_x - current_location.x
var/new_angle_s = P.Angle + rand(120,240)
while(new_angle_s > 180) // Translate to regular projectile degrees
new_angle_s -= 360
diff --git a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm
index ebceb4d1aafc0..7d4880e982681 100644
--- a/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm
+++ b/code/modules/mob/living/simple_animal/hostile/megafauna/drake.dm
@@ -449,7 +449,7 @@ Difficulty: Medium
anchored = TRUE
opacity = FALSE
density = TRUE
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
duration = 82
color = COLOR_DARK_ORANGE
diff --git a/code/modules/mob/living/ventcrawling.dm b/code/modules/mob/living/ventcrawling.dm
index 0fd5f65ae1d0e..7527273f1d181 100644
--- a/code/modules/mob/living/ventcrawling.dm
+++ b/code/modules/mob/living/ventcrawling.dm
@@ -48,7 +48,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("[src] begins climbing into the ventilation system." ,"You begin climbing into the ventilation system.")
if(!do_after(src, 25, target = vent_found))
@@ -86,9 +86,9 @@ GLOBAL_LIST_INIT(ventcrawl_machinery, typecacheof(list(
return
var/list/totalMembers = list()
- for(var/datum/pipeline/P in starting_machine.returnPipenets())
+ 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/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm
index ab6ad558d629a..0af3d05f9b767 100644
--- a/code/modules/power/singularity/field_generator.dm
+++ b/code/modules/power/singularity/field_generator.dm
@@ -183,7 +183,7 @@ field_generator power level display
/obj/machinery/field/generator/proc/turn_off()
active = FG_OFFLINE
air_update_turf(TRUE, FALSE)
- CanAtmosPass = ATMOS_PASS_YES
+ can_atmos_pass = ATMOS_PASS_YES
spawn(1)
cleanup()
while (warming_up>0 && !active)
@@ -253,7 +253,7 @@ field_generator power level display
turn_off()
return
move_resist = INFINITY
- CanAtmosPass = ATMOS_PASS_NO
+ can_atmos_pass = ATMOS_PASS_NO
air_update_turf(TRUE, TRUE)
addtimer(CALLBACK(src, PROC_REF(setup_field), 1), 1)
addtimer(CALLBACK(src, PROC_REF(setup_field), 2), 2)
diff --git a/code/modules/power/turbine.dm b/code/modules/power/turbine.dm
index fa119b30239b5..f4997ff2ac8c6 100644
--- a/code/modules/power/turbine.dm
+++ b/code/modules/power/turbine.dm
@@ -29,7 +29,7 @@
icon_state = "compressor"
density = TRUE
resistance_flags = FIRE_PROOF
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
circuit = /obj/item/circuitboard/machine/power_compressor
var/obj/machinery/power/turbine/turbine
var/datum/gas_mixture/gas_contained
@@ -54,7 +54,7 @@
icon_state = "turbine"
density = TRUE
resistance_flags = FIRE_PROOF
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
circuit = /obj/item/circuitboard/machine/power_turbine
diff --git a/code/modules/projectiles/ammunition/_firing.dm b/code/modules/projectiles/ammunition/_firing.dm
index b3f6c491ccfcf..4819a42f9cc32 100644
--- a/code/modules/projectiles/ammunition/_firing.dm
+++ b/code/modules/projectiles/ammunition/_firing.dm
@@ -41,8 +41,8 @@
qdel(reagents)
/obj/item/ammo_casing/proc/throw_proj(atom/target, turf/targloc, mob/living/user, params, spread)
- var/turf/curloc = get_turf(user)
- if (!istype(targloc) || !istype(curloc) || !BB)
+ var/turf/current_location = get_turf(user)
+ if (!istype(targloc) || !istype(current_location) || !BB)
return FALSE
var/firing_dir
@@ -52,7 +52,7 @@
new firing_effect_type(get_turf(src), firing_dir)
var/direct_target
- if(targloc == curloc)
+ if(targloc == current_location)
if(target) //if the target is right on our location we'll skip the travelling code in the proj's fire()
direct_target = target
if(!direct_target)
diff --git a/code/modules/projectiles/guns/misc/beam_rifle.dm b/code/modules/projectiles/guns/misc/beam_rifle.dm
index 790dec3188be6..08564fa4bba29 100644
--- a/code/modules/projectiles/guns/misc/beam_rifle.dm
+++ b/code/modules/projectiles/guns/misc/beam_rifle.dm
@@ -192,12 +192,12 @@
P.color = rgb(255 * percent,255 * ((100 - percent) / 100),0)
else
P.color = rgb(0, 255, 0)
- var/turf/curloc = get_turf(src)
+ var/turf/current_location = get_turf(src)
var/turf/targloc = get_turf(aiming_target)
if(!istype(targloc))
- if(!istype(curloc))
+ if(!istype(current_location))
return
- targloc = get_turf_in_angle(lastangle, curloc, 10)
+ targloc = get_turf_in_angle(lastangle, current_location, 10)
P.preparePixelProjectile(targloc, current_user, aiming_params, 0)
P.fire(lastangle)
@@ -382,12 +382,12 @@
HS_BB.gun = host
/obj/item/ammo_casing/energy/beam_rifle/throw_proj(atom/target, turf/targloc, mob/living/user, params, spread)
- var/turf/curloc = get_turf(user)
- if(!istype(curloc) || !BB)
+ var/turf/current_location = get_turf(user)
+ if(!istype(current_location) || !BB)
return FALSE
var/obj/item/gun/energy/beam_rifle/gun = loc
if(!targloc && gun)
- targloc = get_turf_in_angle(gun.lastangle, curloc, 10)
+ targloc = get_turf_in_angle(gun.lastangle, current_location, 10)
else if(!targloc)
return FALSE
var/firing_dir
diff --git a/code/modules/projectiles/projectile.dm b/code/modules/projectiles/projectile.dm
index 72fe814ef336c..bb2462c62fd53 100644
--- a/code/modules/projectiles/projectile.dm
+++ b/code/modules/projectiles/projectile.dm
@@ -817,7 +817,7 @@
//Spread is FORCED!
/obj/projectile/proc/preparePixelProjectile(atom/target, atom/source, params, spread = 0)
- var/turf/curloc = get_turf(source)
+ var/turf/current_location = get_turf(source)
var/turf/targloc = get_turf(target)
trajectory_ignore_forcemove = TRUE
forceMove(get_turf(source))
@@ -825,8 +825,8 @@
starting = get_turf(source)
original = target
if(targloc || !params)
- yo = targloc.y - curloc.y
- xo = targloc.x - curloc.x
+ yo = targloc.y - current_location.y
+ xo = targloc.x - current_location.x
setAngle(get_angle(src, targloc) + spread)
if(isliving(source) && params)
@@ -836,8 +836,8 @@
setAngle(calculated[1] + spread)
else if(targloc)
- yo = targloc.y - curloc.y
- xo = targloc.x - curloc.x
+ yo = targloc.y - current_location.y
+ xo = targloc.x - current_location.x
setAngle(get_angle(src, targloc) + spread)
else
stack_trace("WARNING: Projectile [type] fired without either mouse parameters, or a target atom to aim at!")
diff --git a/code/modules/research/xenobiology/crossbreeding/_misc.dm b/code/modules/research/xenobiology/crossbreeding/_misc.dm
index 758439b839a68..5ecaf126d9c11 100644
--- a/code/modules/research/xenobiology/crossbreeding/_misc.dm
+++ b/code/modules/research/xenobiology/crossbreeding/_misc.dm
@@ -129,7 +129,7 @@ Slimecrossing Items
desc = "A mass of solidified slime gel - completely impenetrable, but it's melting away!"
icon = 'icons/obj/slimecrossing.dmi'
icon_state = "slimebarrier_thick"
- CanAtmosPass = ATMOS_PASS_NO
+ can_atmos_pass = ATMOS_PASS_NO
opacity = TRUE
timeleft = 100
diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm
index 4e9defeb8a6c7..b87db205e14be 100644
--- a/code/modules/shuttle/on_move.dm
+++ b/code/modules/shuttle/on_move.dm
@@ -266,20 +266,20 @@ 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_icon(), so we don't need to call it
+ // atmos_init() calls update_icon(), so we don't need to call it
update_icon()
/obj/machinery/navbeacon/beforeShuttleMove(turf/newT, rotation, move_mode, obj/docking_port/mobile/moving_dock)
diff --git a/code/modules/shuttle/shuttle_rotate.dm b/code/modules/shuttle/shuttle_rotate.dm
index dcfbdaf5794fe..9250197db416d 100644
--- a/code/modules/shuttle/shuttle_rotate.dm
+++ b/code/modules/shuttle/shuttle_rotate.dm
@@ -81,13 +81,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/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm b/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm
index a66a7e262a704..78f5491e79e37 100644
--- a/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm
+++ b/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm
@@ -198,7 +198,7 @@
/datum/artifact_effect/airfreeze/Initialize(atom/source)
. = ..()
- source.CanAtmosPass = ATMOS_PASS_NO
+ source.can_atmos_pass = ATMOS_PASS_NO
/datum/artifact_effect/airfreeze/register_signals(source)
RegisterSignal(source, COMSIG_MOVABLE_MOVED, PROC_REF(updateAir))
diff --git a/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm b/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm
index 8f9a18b0c62f0..b9114ac85d4b6 100644
--- a/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm
+++ b/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm
@@ -56,16 +56,16 @@
/obj/machinery/atmospherics/components/unary/plasma_refiner/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()
+ 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)
From 9a4e8565bf6471c29923e31452a6f7a4f8b4c034 Mon Sep 17 00:00:00 2001
From: Ghilker <42839747+Ghilker@users.noreply.github.com>
Date: Thu, 14 Oct 2021 10:13:57 +0200
Subject: [PATCH 041/114] modules/atmospherics major cleanup (#61904), what a
fucking mess
major cleanup of modules/atmospherics folder and all related files, still many missing
-cleanup of procs name
-cleanup of vars name
-documentation of some of the procs
-minor changes to some for() logic (no in game changes just early continue or as anything checks)
No in game changes, only code and docs
---
code/__DEFINES/atmospherics/atmos_helpers.dm | 2 +-
code/controllers/subsystem/air.dm | 9 +-
.../effects/effect_system/effects_foam.dm | 2 +-
.../effects/effect_system/effects_smoke.dm | 2 +-
code/game/objects/effects/portals.dm | 2 +
.../objects/effects/spawners/bombspawner.dm | 8 +-
code/game/objects/items/flamethrower.dm | 4 +-
code/game/objects/structures/aliens.dm | 4 +-
code/game/objects/structures/holosign.dm | 3 +
.../objects/structures/windoor_assembly.dm | 8 +-
code/game/objects/structures/window.dm | 5 +-
code/game/shuttle_engines.dm | 3 +-
code/game/turfs/open/floor/reinf_floor.dm | 2 +-
code/game/turfs/open/openspace.dm | 2 +-
code/modules/art/statues.dm | 579 ++++++++++++++++++
.../environmental/LINDA_system.dm | 135 ++--
.../environmental/LINDA_turf_tile.dm | 249 ++++----
.../atmospherics/machinery/atmosmachinery.dm | 155 ++++-
.../components/binary_devices/circulator.dm | 7 +-
.../components/binary_devices/dp_vent_pump.dm | 10 +-
.../components/binary_devices/passive_gate.dm | 8 +
.../binary_devices/pressure_valve.dm | 10 +
.../components/binary_devices/pump.dm | 9 +-
.../binary_devices/thermomachine.dm | 515 ++++++++++++++++
.../components/binary_devices/valve.dm | 10 +
.../components/binary_devices/volume_pump.dm | 8 +-
.../machinery/components/components_base.dm | 42 +-
.../machinery/components/fusion/hfr_parts.dm | 503 +++++++++++++++
.../gas_recipe_machines/crystallizer.dm | 339 ++++++++++
.../atmospherics/machinery/components/tank.dm | 553 +++++++++++++++++
.../components/trinary_devices/filter.dm | 21 +-
.../components/trinary_devices/mixer.dm | 22 +-
.../trinary_devices/trinary_devices.dm | 1 +
.../unary_devices/bluespace_sender.dm | 178 ++++++
.../components/unary_devices/cryo.dm | 4 +-
.../unary_devices/heat_exchanger.dm | 15 +-
.../unary_devices/outlet_injector.dm | 13 +-
.../components/unary_devices/passive_vent.dm | 2 +-
.../unary_devices/portables_connector.dm | 12 +-
.../components/unary_devices/unary_devices.dm | 2 +
.../components/unary_devices/vent_pump.dm | 25 +-
.../components/unary_devices/vent_scrubber.dm | 45 +-
.../atmospherics/machinery/datum_pipeline.dm | 19 +-
.../atmospherics/machinery/other/meter.dm | 21 +-
.../machinery/pipes/bridge_pipe.dm | 29 +
.../machinery/pipes/color_adapter.dm | 63 ++
.../machinery/pipes/heat_exchange/he_pipes.dm | 48 +-
.../machinery/pipes/heat_exchange/manifold.dm | 4 +-
.../pipes/heat_exchange/manifold4w.dm | 3 +-
.../machinery/pipes/heat_exchange/simple.dm | 2 +-
.../machinery/pipes/layermanifold.dm | 43 +-
.../atmospherics/machinery/pipes/multiz.dm | 21 +-
.../atmospherics/machinery/pipes/pipes.dm | 42 +-
.../atmospherics/machinery/pipes/smart.dm | 89 +++
.../portable/portable_atmospherics.dm | 87 +--
.../atmospherics/machinery/portable/pump.dm | 20 +-
.../machinery/portable/scrubber.dm | 2 +-
.../mob/living/simple_animal/bot/bot.dm | 6 +-
.../simple_animal/hostile/retaliate/clown.dm | 2 +-
.../power/singularity/containment_field.dm | 1 +
.../power/singularity/field_generator.dm | 2 +
code/modules/reagents/chem_splash.dm | 2 +-
code/modules/shuttle/on_move.dm | 4 +-
63 files changed, 3559 insertions(+), 479 deletions(-)
create mode 100644 code/modules/art/statues.dm
create mode 100644 code/modules/atmospherics/machinery/components/binary_devices/thermomachine.dm
create mode 100644 code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm
create mode 100644 code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm
create mode 100644 code/modules/atmospherics/machinery/components/tank.dm
create mode 100644 code/modules/atmospherics/machinery/components/unary_devices/bluespace_sender.dm
create mode 100644 code/modules/atmospherics/machinery/pipes/bridge_pipe.dm
create mode 100644 code/modules/atmospherics/machinery/pipes/color_adapter.dm
create mode 100644 code/modules/atmospherics/machinery/pipes/smart.dm
diff --git a/code/__DEFINES/atmospherics/atmos_helpers.dm b/code/__DEFINES/atmospherics/atmos_helpers.dm
index c546c9d745111..887021476467c 100644
--- a/code/__DEFINES/atmospherics/atmos_helpers.dm
+++ b/code/__DEFINES/atmospherics/atmos_helpers.dm
@@ -2,7 +2,7 @@
///Check if the turfs allows gas passage based on density, do not use.
#define CANATMOSPASS(A, O) ( A.can_atmos_pass == ATMOS_PASS_PROC ? A.can_atmos_pass(O) : ( A.can_atmos_pass == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_pass ) )
///Check if the turfs allows gas passage on a z level, do not use.
-#define CANVERTICALATMOSPASS(A, O) ( A.can_atmos_passVertical == ATMOS_PASS_PROC ? A.can_atmos_pass(O, TRUE) : ( A.can_atmos_passVertical == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_passVertical ) )
+#define CANVERTICALATMOSPASS(A, O) ( A.can_atmos_pass_vertical == ATMOS_PASS_PROC ? A.can_atmos_pass(O, TRUE) : ( A.can_atmos_pass_vertical == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_pass_vertical ) )
//Helpers
///Moves the icon of the device based on the piping layer and on the direction
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index aa5ae4e5e562b..34d9e8fc7576e 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -623,9 +623,12 @@ GLOBAL_LIST_EMPTY(colored_images)
if(!pipe_init_dirs_cache[type])
pipe_init_dirs_cache[type] = list()
- if(!pipe_init_dirs_cache[type]["[dir]"])
- var/obj/machinery/atmospherics/temp = new type(null, FALSE, dir)
- pipe_init_dirs_cache[type]["[dir]"] = temp.get_init_directions()
+ if(!pipe_init_dirs_cache[type]["[init_dir]"])
+ pipe_init_dirs_cache[type]["[init_dir]"] = list()
+
+ if(!pipe_init_dirs_cache[type]["[init_dir]"]["[dir]"])
+ var/obj/machinery/atmospherics/temp = new type(null, FALSE, dir, init_dir)
+ pipe_init_dirs_cache[type]["[init_dir]"]["[dir]"] = temp.get_init_directions()
qdel(temp)
return pipe_init_dirs_cache[type]["[dir]"]
diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm
index 23994b07202ea..8f55cf1023ce3 100644
--- a/code/game/objects/effects/effect_system/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/effects_foam.dm
@@ -193,7 +193,7 @@
/obj/effect/particle_effect/foam/proc/spread_foam()
var/turf/t_loc = get_turf(src)
- for(var/turf/T in t_loc.GetAtmosAdjacentTurfs())
+ for(var/turf/T in t_loc.get_atmos_adjacent_turfs())
var/obj/effect/particle_effect/foam/foundfoam = locate() in T //Don't spread foam where there's already foam!
if(foundfoam)
continue
diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm
index a969544c09669..4eea8f4d46c19 100644
--- a/code/game/objects/effects/effect_system/effects_smoke.dm
+++ b/code/game/objects/effects/effect_system/effects_smoke.dm
@@ -91,7 +91,7 @@
if(!t_loc)
return
var/list/newsmokes = list()
- for(var/turf/T in t_loc.GetAtmosAdjacentTurfs(!circle))
+ for(var/turf/T in t_loc.get_atmos_adjacent_turfs())
var/obj/effect/particle_effect/smoke/foundsmoke = locate() in T //Don't spread smoke where there's already smoke!
if(foundsmoke)
continue
diff --git a/code/game/objects/effects/portals.dm b/code/game/objects/effects/portals.dm
index 6e276151487f0..f509df340dccb 100644
--- a/code/game/objects/effects/portals.dm
+++ b/code/game/objects/effects/portals.dm
@@ -143,10 +143,12 @@
if(istype(atmos_source))
if(istype(atmos_destination) && !atmos_source.Adjacent(atmos_destination) && !CANATMOSPASS(atmos_destination, atmos_source))
LAZYREMOVE(atmos_source.atmos_adjacent_turfs, atmos_destination)
+ atmos_source.immediate_calculate_adjacent_turfs() //Just in case they were next to each other
atmos_source = null
if(istype(atmos_destination))
if(istype(atmos_source) && !atmos_destination.Adjacent(atmos_source) && !CANATMOSPASS(atmos_source, atmos_destination))
LAZYREMOVE(atmos_destination.atmos_adjacent_turfs, atmos_source)
+ atmos_destination.immediate_calculate_adjacent_turfs()
atmos_destination = null
/obj/effect/portal/Destroy(force) //Calls on_portal_destroy(destroyed portal, location of destroyed portal) on creator if creator has such call.
diff --git a/code/game/objects/effects/spawners/bombspawner.dm b/code/game/objects/effects/spawners/bombspawner.dm
index 6dd0fd43fadb3..63dbe14b0e027 100644
--- a/code/game/objects/effects/spawners/bombspawner.dm
+++ b/code/game/objects/effects/spawners/bombspawner.dm
@@ -30,10 +30,10 @@
oxygen_mix.gases[/datum/gas/oxygen][MOLES] = pressure_o*oxygen_mix.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o))
oxygen_mix.temperature = CELSIUS_TO_KELVIN(temp_o)
- V.tank_one = PT
- V.tank_two = OT
- PT.master = V
- OT.master = V
+ V.tank_one = plasma_tank
+ V.tank_two = oxygen_tank
+ plasma_tank.master = V
+ oxygen_tank.master = V
if(assembly_type)
var/obj/item/assembly/A = new assembly_type(V)
diff --git a/code/game/objects/items/flamethrower.dm b/code/game/objects/items/flamethrower.dm
index a82b7a9dd0292..9e0a51f5b1f68 100644
--- a/code/game/objects/items/flamethrower.dm
+++ b/code/game/objects/items/flamethrower.dm
@@ -198,8 +198,8 @@
var/turf/previousturf = get_turf(src)
for(var/turf/T in turflist)
if(T == previousturf)
- continue //so we don't burn the tile we be standin on
- var/list/turfs_sharing_with_prev = previousturf.GetAtmosAdjacentTurfs(alldir=1)
+ continue //so we don't burn the tile we be standin on
+ var/list/turfs_sharing_with_prev = previousturf.get_atmos_adjacent_turfs(alldir=1)
if(!(T in turfs_sharing_with_prev))
break
if(igniter)
diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm
index 40cfb310587b1..40ae9681508e9 100644
--- a/code/game/objects/structures/aliens.dm
+++ b/code/game/objects/structures/aliens.dm
@@ -185,8 +185,8 @@
qdel(src)
return FALSE
- for(var/turf/T in U.GetAtmosAdjacentTurfs())
- if((locate(/obj/structure/alien/weeds) in T))
+ for(var/turf/T in U.get_atmos_adjacent_turfs())
+ if(locate(/obj/structure/alien/weeds) in T)
continue
if(is_type_in_typecache(T, blacklisted_turfs))
diff --git a/code/game/objects/structures/holosign.dm b/code/game/objects/structures/holosign.dm
index 4db9d35f37002..ef22a437e98ff 100644
--- a/code/game/objects/structures/holosign.dm
+++ b/code/game/objects/structures/holosign.dm
@@ -109,6 +109,9 @@
ADD_TRAIT(local, TRAIT_FIREDOOR_STOP, TRAIT_GENERIC)
air_update_turf(TRUE, TRUE)
+/obj/structure/holosign/barrier/atmos/block_superconductivity() //Didn't used to do this, but it's "normal", and will help ease heat flow transitions with the players.
+ return TRUE
+
/obj/structure/holosign/barrier/atmos/Destroy()
var/turf/local = get_turf(loc)
REMOVE_TRAIT(local, TRAIT_FIREDOOR_STOP, TRAIT_GENERIC)
diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm
index 0286d36e70594..010a72bc49312 100644
--- a/code/game/objects/structures/windoor_assembly.dm
+++ b/code/game/objects/structures/windoor_assembly.dm
@@ -26,10 +26,10 @@
var/created_name = null
//Vars to help with the icon's name
- var/facing = "l" //Does the windoor open to the left or right?
- var/secure = FALSE //Whether or not this creates a secure windoor
- var/state = "01" //How far the door assembly has progressed
-
+ var/facing = "l" //Does the windoor open to the left or right?
+ var/secure = FALSE //Whether or not this creates a secure windoor
+ var/state = "01" //How far the door assembly has progressed
+ can_atmos_pass = ATMOS_PASS_PROC
/obj/structure/windoor_assembly/Initialize(mapload, loc, set_dir)
. = ..()
diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm
index deead8ca24343..7b7e0084ec0e6 100644
--- a/code/game/objects/structures/window.dm
+++ b/code/game/objects/structures/window.dm
@@ -467,7 +467,10 @@
explosion_block = 2
glass_type = /obj/item/stack/sheet/plasmarglass
-/obj/structure/window/plasma/reinforced/spawner/east
+/obj/structure/window/reinforced/plasma/block_superconductivity()
+ return TRUE
+
+/obj/structure/window/reinforced/plasma/spawner/east
dir = EAST
/obj/structure/window/plasma/reinforced/spawner/west
diff --git a/code/game/shuttle_engines.dm b/code/game/shuttle_engines.dm
index 7fc2d2d0b5eba..caa813fd7f35c 100644
--- a/code/game/shuttle_engines.dm
+++ b/code/game/shuttle_engines.dm
@@ -8,7 +8,8 @@
icon = 'icons/turf/shuttle.dmi'
resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF
max_integrity = 500
- armor = list(MELEE = 100, BULLET = 10, LASER = 10, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 70, STAMINA = 0) //default + ignores melee
+ armor = list(MELEE = 100, BULLET = 10, LASER = 10, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 70) //default + ignores melee
+ can_atmos_pass = ATMOS_PASS_DENSITY
/obj/structure/shuttle/engine
name = "engine"
diff --git a/code/game/turfs/open/floor/reinf_floor.dm b/code/game/turfs/open/floor/reinf_floor.dm
index 0b154861f03f8..65000cf9f13e5 100644
--- a/code/game/turfs/open/floor/reinf_floor.dm
+++ b/code/game/turfs/open/floor/reinf_floor.dm
@@ -131,7 +131,7 @@
floor_tile = null
var/obj/effect/clockwork/overlay/floor/bloodcult/realappearance
can_atmos_pass = ATMOS_PASS_NO
- can_atmos_passVertical = ATMOS_PASS_NO
+ can_atmos_pass_vertical = ATMOS_PASS_NO
/turf/open/floor/engine/cult/Initialize(mapload)
diff --git a/code/game/turfs/open/openspace.dm b/code/game/turfs/open/openspace.dm
index e3ffe3e53743c..b603ddff1c12f 100644
--- a/code/game/turfs/open/openspace.dm
+++ b/code/game/turfs/open/openspace.dm
@@ -3,7 +3,7 @@
desc = "Watch your step!"
icon_state = "invisible"
baseturfs = /turf/open/openspace
- can_atmos_passVertical = ATMOS_PASS_YES
+ can_atmos_pass_vertical = ATMOS_PASS_YES
overfloor_placed = FALSE
underfloor_accessibility = UNDERFLOOR_INTERACTABLE
allow_z_travel = TRUE
diff --git a/code/modules/art/statues.dm b/code/modules/art/statues.dm
new file mode 100644
index 0000000000000..de9ecb770d67b
--- /dev/null
+++ b/code/modules/art/statues.dm
@@ -0,0 +1,579 @@
+/obj/structure/statue
+ name = "statue"
+ desc = "Placeholder. Yell at Firecage if you SOMEHOW see this."
+ icon = 'icons/obj/statue.dmi'
+ icon_state = ""
+ density = TRUE
+ anchored = FALSE
+ max_integrity = 100
+ can_atmos_pass = ATMOS_PASS_DENSITY
+ material_modifier = 0.5
+ material_flags = MATERIAL_EFFECTS | MATERIAL_AFFECT_STATISTICS
+ blocks_emissive = EMISSIVE_BLOCK_UNIQUE
+ /// Beauty component mood modifier
+ var/impressiveness = 15
+ /// Art component subtype added to this statue
+ var/art_type = /datum/element/art
+ /// Abstract root type
+ var/abstract_type = /obj/structure/statue
+
+/obj/structure/statue/Initialize(mapload)
+ . = ..()
+ AddElement(art_type, impressiveness)
+ AddElement(/datum/element/beauty, impressiveness * 75)
+ AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE, CALLBACK(src, .proc/can_user_rotate), CALLBACK(src, .proc/can_be_rotated), null)
+
+/obj/structure/statue/proc/can_be_rotated(mob/user)
+ if(!anchored)
+ return TRUE
+ to_chat(user, span_warning("It's bolted to the floor, you'll need to unwrench it first."))
+
+/obj/structure/statue/proc/can_user_rotate(mob/user)
+ return user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))
+
+/obj/structure/statue/attackby(obj/item/W, mob/living/user, params)
+ add_fingerprint(user)
+ if(!(flags_1 & NODECONSTRUCT_1))
+ if(default_unfasten_wrench(user, W))
+ return
+ if(W.tool_behaviour == TOOL_WELDER)
+ if(!W.tool_start_check(user, amount=0))
+ return FALSE
+
+ user.visible_message(span_notice("[user] is slicing apart the [name]."), \
+ span_notice("You are slicing apart the [name]..."))
+ if(W.use_tool(src, user, 40, volume=50))
+ user.visible_message(span_notice("[user] slices apart the [name]."), \
+ span_notice("You slice apart the [name]!"))
+ deconstruct(TRUE)
+ return
+ return ..()
+
+/obj/structure/statue/deconstruct(disassembled = TRUE)
+ if(!(flags_1 & NODECONSTRUCT_1))
+ var/amount_mod = disassembled ? 0 : -2
+ for(var/mat in custom_materials)
+ var/datum/material/custom_material = GET_MATERIAL_REF(mat)
+ var/amount = max(0,round(custom_materials[mat]/MINERAL_MATERIAL_AMOUNT) + amount_mod)
+ if(amount > 0)
+ new custom_material.sheet_type(drop_location(),amount)
+ qdel(src)
+
+//////////////////////////////////////STATUES/////////////////////////////////////////////////////////////
+////////////////////////uranium///////////////////////////////////
+
+/obj/structure/statue/uranium
+ max_integrity = 300
+ light_range = 2
+ custom_materials = list(/datum/material/uranium=MINERAL_MATERIAL_AMOUNT*5)
+ impressiveness = 25 // radiation makes an impression
+ abstract_type = /obj/structure/statue/uranium
+
+/obj/structure/statue/uranium/nuke
+ name = "statue of a nuclear fission explosive"
+ desc = "This is a grand statue of a Nuclear Explosive. It has a sickening green colour."
+ icon_state = "nuke"
+
+/obj/structure/statue/uranium/eng
+ name = "Statue of an engineer"
+ desc = "This statue has a sickening green colour."
+ icon_state = "eng"
+
+////////////////////////////plasma///////////////////////////////////////////////////////////////////////
+
+/obj/structure/statue/plasma
+ max_integrity = 200
+ impressiveness = 20
+ desc = "This statue is suitably made from plasma."
+ custom_materials = list(/datum/material/plasma=MINERAL_MATERIAL_AMOUNT*5)
+ abstract_type = /obj/structure/statue/plasma
+
+/obj/structure/statue/plasma/scientist
+ name = "statue of a scientist"
+ icon_state = "sci"
+
+/obj/structure/statue/plasma/xeno
+ name = "statue of a xenomorph"
+ icon_state = "xeno"
+
+/obj/structure/statue/plasma/Initialize(mapload)
+ . = ..()
+ AddElement(/datum/element/atmos_sensitive, mapload)
+
+/obj/structure/statue/plasma/bullet_act(obj/projectile/Proj)
+ var/burn = FALSE
+ if(!(Proj.nodamage) && Proj.damage_type == BURN && !QDELETED(src))
+ burn = TRUE
+ if(burn)
+ var/turf/T = get_turf(src)
+ if(Proj.firer)
+ message_admins("Plasma statue ignited by [ADMIN_LOOKUPFLW(Proj.firer)] in [ADMIN_VERBOSEJMP(T)]")
+ log_game("Plasma statue ignited by [key_name(Proj.firer)] in [AREACOORD(T)]")
+ else
+ message_admins("Plasma statue ignited by [Proj]. No known firer, in [ADMIN_VERBOSEJMP(T)]")
+ log_game("Plasma statue ignited by [Proj] in [AREACOORD(T)]. No known firer.")
+ PlasmaBurn(2500)
+ . = ..()
+
+/obj/structure/statue/plasma/attackby(obj/item/W, mob/user, params)
+ if(W.get_temperature() > 300 && !QDELETED(src))//If the temperature of the object is over 300, then ignite
+ var/turf/T = get_turf(src)
+ message_admins("Plasma statue ignited by [ADMIN_LOOKUPFLW(user)] in [ADMIN_VERBOSEJMP(T)]")
+ log_game("Plasma statue ignited by [key_name(user)] in [AREACOORD(T)]")
+ ignite(W.get_temperature())
+ else
+ return ..()
+
+/obj/structure/statue/plasma/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
+ return exposed_temperature > 300
+
+/obj/structure/statue/plasma/atmos_expose(datum/gas_mixture/air, exposed_temperature)
+ PlasmaBurn(exposed_temperature)
+
+/obj/structure/statue/plasma/proc/PlasmaBurn(temperature)
+ if(QDELETED(src))
+ return
+ if(custom_materials[/datum/material/plasma])
+ var/plasma_amount = round(custom_materials[/datum/material/plasma]/MINERAL_MATERIAL_AMOUNT)
+ atmos_spawn_air("plasma=[plasma_amount*10];TEMP=[temperature]")
+ deconstruct(FALSE)
+
+/obj/structure/statue/plasma/proc/ignite(exposed_temperature)
+ if(exposed_temperature > 300)
+ PlasmaBurn(exposed_temperature)
+
+//////////////////////gold///////////////////////////////////////
+
+/obj/structure/statue/gold
+ max_integrity = 300
+ impressiveness = 25
+ desc = "This is a highly valuable statue made from gold."
+ custom_materials = list(/datum/material/gold=MINERAL_MATERIAL_AMOUNT*5)
+ abstract_type = /obj/structure/statue/gold
+
+/obj/structure/statue/gold/hos
+ name = "statue of the head of security"
+ icon_state = "hos"
+
+/obj/structure/statue/gold/hop
+ name = "statue of the head of personnel"
+ icon_state = "hop"
+
+/obj/structure/statue/gold/cmo
+ name = "statue of the chief medical officer"
+ icon_state = "cmo"
+
+/obj/structure/statue/gold/ce
+ name = "statue of the chief engineer"
+ icon_state = "ce"
+
+/obj/structure/statue/gold/rd
+ name = "statue of the research director"
+ icon_state = "rd"
+
+//////////////////////////silver///////////////////////////////////////
+
+/obj/structure/statue/silver
+ max_integrity = 300
+ impressiveness = 25
+ desc = "This is a valuable statue made from silver."
+ custom_materials = list(/datum/material/silver=MINERAL_MATERIAL_AMOUNT*5)
+ abstract_type = /obj/structure/statue/silver
+
+/obj/structure/statue/silver/md
+ name = "statue of a medical officer"
+ icon_state = "md"
+
+/obj/structure/statue/silver/janitor
+ name = "statue of a janitor"
+ icon_state = "jani"
+
+/obj/structure/statue/silver/sec
+ name = "statue of a security officer"
+ icon_state = "sec"
+
+/obj/structure/statue/silver/secborg
+ name = "statue of a security cyborg"
+ icon_state = "secborg"
+
+/obj/structure/statue/silver/medborg
+ name = "statue of a medical cyborg"
+ icon_state = "medborg"
+
+/////////////////////////diamond/////////////////////////////////////////
+
+/obj/structure/statue/diamond
+ max_integrity = 1000
+ impressiveness = 50
+ desc = "This is a very expensive diamond statue."
+ custom_materials = list(/datum/material/diamond=MINERAL_MATERIAL_AMOUNT*5)
+ abstract_type = /obj/structure/statue/diamond
+
+/obj/structure/statue/diamond/captain
+ name = "statue of THE captain."
+ icon_state = "cap"
+
+/obj/structure/statue/diamond/ai1
+ name = "statue of the AI hologram."
+ icon_state = "ai1"
+
+/obj/structure/statue/diamond/ai2
+ name = "statue of the AI core."
+ icon_state = "ai2"
+
+////////////////////////bananium///////////////////////////////////////
+
+/obj/structure/statue/bananium
+ max_integrity = 300
+ impressiveness = 50
+ desc = "A bananium statue with a small engraving:'HOOOOOOONK'."
+ custom_materials = list(/datum/material/bananium=MINERAL_MATERIAL_AMOUNT*5)
+ abstract_type = /obj/structure/statue/bananium
+
+/obj/structure/statue/bananium/clown
+ name = "statue of a clown"
+ icon_state = "clown"
+
+/////////////////////sandstone/////////////////////////////////////////
+
+/obj/structure/statue/sandstone
+ max_integrity = 50
+ impressiveness = 15
+ custom_materials = list(/datum/material/sandstone=MINERAL_MATERIAL_AMOUNT*5)
+ abstract_type = /obj/structure/statue/sandstone
+
+/obj/structure/statue/sandstone/assistant
+ name = "statue of an assistant"
+ desc = "A cheap statue of sandstone for a greyshirt."
+ icon_state = "assist"
+
+
+/obj/structure/statue/sandstone/venus //call me when we add marble i guess
+ name = "statue of a pure maiden"
+ desc = "An ancient marble statue. The subject is depicted with a floor-length braid and is wielding a toolbox. By Jove, it's easily the most gorgeous depiction of a woman you've ever seen. The artist must truly be a master of his craft. Shame about the broken arm, though."
+ icon = 'icons/obj/statuelarge.dmi'
+ icon_state = "venus"
+
+/////////////////////snow/////////////////////////////////////////
+
+/obj/structure/statue/snow
+ max_integrity = 50
+ custom_materials = list(/datum/material/snow=MINERAL_MATERIAL_AMOUNT*5)
+ abstract_type = /obj/structure/statue/snow
+
+/obj/structure/statue/snow/snowman
+ name = "snowman"
+ desc = "Several lumps of snow put together to form a snowman."
+ icon_state = "snowman"
+
+/obj/structure/statue/snow/snowlegion
+ name = "snowlegion"
+ desc = "Looks like that weird kid with the tiger plushie has been round here again."
+ icon_state = "snowlegion"
+
+///////////////////////////////bronze///////////////////////////////////
+
+/obj/structure/statue/bronze
+ custom_materials = list(/datum/material/bronze=MINERAL_MATERIAL_AMOUNT*5)
+ abstract_type = /obj/structure/statue/bronze
+
+/obj/structure/statue/bronze/marx
+ name = "\improper Karl Marx bust"
+ desc = "A bust depicting a certain 19th century economist. You get the feeling a specter is haunting the station."
+ icon_state = "marx"
+ art_type = /datum/element/art/rev
+
+///////////Elder Atmosian///////////////////////////////////////////
+
+/obj/structure/statue/elder_atmosian
+ name = "Elder Atmosian"
+ desc = "A statue of an Elder Atmosian, capable of bending the laws of thermodynamics to their will."
+ icon_state = "eng"
+ custom_materials = list(/datum/material/metalhydrogen = MINERAL_MATERIAL_AMOUNT*10)
+ max_integrity = 1000
+ impressiveness = 100
+ abstract_type = /obj/structure/statue/elder_atmosian //This one is uncarvable
+
+/obj/item/chisel
+ name = "chisel"
+ desc = "Breaking and making art since 4000 BC. This one uses advanced technology to allow the creation of lifelike moving statues."
+ icon = 'icons/obj/statue.dmi'
+ icon_state = "chisel"
+ inhand_icon_state = "screwdriver_nuke"
+ lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
+ righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
+ flags_1 = CONDUCT_1
+ slot_flags = ITEM_SLOT_BELT
+ force = 5
+ w_class = WEIGHT_CLASS_TINY
+ throwforce = 5
+ throw_speed = 3
+ throw_range = 5
+ custom_materials = list(/datum/material/iron=75)
+ attack_verb_continuous = list("stabs")
+ attack_verb_simple = list("stab")
+ hitsound = 'sound/weapons/bladeslice.ogg'
+ usesound = list('sound/items/screwdriver.ogg', 'sound/items/screwdriver2.ogg')
+ drop_sound = 'sound/items/handling/screwdriver_drop.ogg'
+ pickup_sound = 'sound/items/handling/screwdriver_pickup.ogg'
+ sharpness = SHARP_POINTY
+ tool_behaviour = TOOL_RUSTSCRAPER
+ toolspeed = 3 // You're gonna have a bad time
+
+ /// Block we're currently carving in
+ var/obj/structure/carving_block/prepared_block
+ /// If tracked user moves we stop sculpting
+ var/mob/living/tracked_user
+ /// Currently sculpting
+ var/sculpting = FALSE
+
+/obj/item/chisel/Initialize(mapload)
+ . = ..()
+ AddElement(/datum/element/eyestab)
+ AddElement(/datum/element/wall_engraver)
+
+/obj/item/chisel/Destroy()
+ prepared_block = null
+ tracked_user = null
+ return ..()
+
+/*
+Hit the block to start
+Point with the chisel at the target to choose what to sculpt or hit block to choose from preset statue types.
+Hit block again to start sculpting.
+Moving interrupts
+*/
+/obj/item/chisel/pre_attack(atom/A, mob/living/user, params)
+ . = ..()
+ if(sculpting)
+ return
+ if(istype(A,/obj/structure/carving_block))
+ if(A == prepared_block && (prepared_block.current_target || prepared_block.current_preset_type))
+ start_sculpting(user)
+ else if(!prepared_block)
+ set_block(A,user)
+ else if(A == prepared_block)
+ show_generic_statues_prompt(user)
+ return TRUE
+ else if(prepared_block) //We're aiming at something next to us with block prepared
+ prepared_block.set_target(A,user)
+ return TRUE
+
+// We aim at something distant.
+/obj/item/chisel/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
+ . = ..()
+ if(!proximity_flag && !sculpting && prepared_block && ismovable(target) && prepared_block.completion == 0)
+ prepared_block.set_target(target,user)
+
+/obj/item/chisel/proc/start_sculpting(mob/living/user)
+ to_chat(user,span_notice("You start sculpting [prepared_block]."),type=MESSAGE_TYPE_INFO)
+ sculpting = TRUE
+ //How long whole process takes
+ var/sculpting_time = 30 SECONDS
+ //Single interruptible progress period
+ var/sculpting_period = round(sculpting_time / world.icon_size) //this is just so it reveals pixels line by line for each.
+ var/interrupted = FALSE
+ var/remaining_time = sculpting_time - (prepared_block.completion * sculpting_time)
+
+ var/datum/progressbar/total_progress_bar = new(user, sculpting_time, prepared_block )
+ while(remaining_time > 0 && !interrupted)
+ if(do_after(user,sculpting_period, target = prepared_block, progress = FALSE))
+ remaining_time -= sculpting_period
+ prepared_block.set_completion((sculpting_time - remaining_time)/sculpting_time)
+ total_progress_bar.update(sculpting_time - remaining_time)
+ else
+ interrupted = TRUE
+ total_progress_bar.end_progress()
+ if(!interrupted && !QDELETED(prepared_block))
+ prepared_block.create_statue()
+ to_chat(user,span_notice("The statue is finished!"),type=MESSAGE_TYPE_INFO)
+ break_sculpting()
+
+/obj/item/chisel/proc/set_block(obj/structure/carving_block/B,mob/living/user)
+ prepared_block = B
+ tracked_user = user
+ RegisterSignal(tracked_user,COMSIG_MOVABLE_MOVED,.proc/break_sculpting)
+ to_chat(user,span_notice("You prepare to work on [B]."),type=MESSAGE_TYPE_INFO)
+
+/obj/item/chisel/dropped(mob/user, silent)
+ . = ..()
+ break_sculpting()
+
+/obj/item/chisel/proc/break_sculpting()
+ SIGNAL_HANDLER
+ sculpting = FALSE
+ if(prepared_block && prepared_block.completion == 0)
+ prepared_block.reset_target()
+ prepared_block = null
+ if(tracked_user)
+ UnregisterSignal(tracked_user,COMSIG_MOVABLE_MOVED)
+ tracked_user = null
+
+/obj/item/chisel/proc/show_generic_statues_prompt(mob/living/user)
+ var/list/choices = list()
+ for(var/statue_path in prepared_block.get_possible_statues())
+ var/obj/structure/statue/S = statue_path
+ choices[statue_path] = image(icon=initial(S.icon),icon_state=initial(S.icon_state))
+ var/choice = show_radial_menu(user, prepared_block , choices, require_near = TRUE)
+ if(choice)
+ prepared_block.current_preset_type = choice
+ var/image/chosen_looks = choices[choice]
+ prepared_block.current_target = chosen_looks.appearance
+ var/obj/structure/statue/S = choice
+ to_chat(user,span_notice("You decide to sculpt [prepared_block] into [initial(S.name)]."),type=MESSAGE_TYPE_INFO)
+
+
+/obj/structure/carving_block
+ name = "block"
+ desc = "ready for sculpting."
+ icon = 'icons/obj/statue.dmi'
+ icon_state = "block"
+ material_flags = MATERIAL_EFFECTS | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS | MATERIAL_ADD_PREFIX
+ density = TRUE
+ material_modifier = 0.5 //50% effectiveness of materials
+
+ /// The thing it will look like - Unmodified resulting statue appearance
+ var/current_target
+ /// Currently chosen preset statue type
+ var/current_preset_type
+ //Table of required materials for each non-abstract statue type
+ var/static/list/statue_costs
+ /// statue completion from 0 to 1.0
+ var/completion = 0
+ /// Greyscaled target with cutout filter
+ var/mutable_appearance/target_appearance_with_filters
+ /// HSV color filters parameters
+ var/static/list/greyscale_with_value_bump = list(0,0,0, 0,0,0, 0,0,1, 0,0,-0.05)
+
+/obj/structure/carving_block/Destroy()
+ current_target = null
+ target_appearance_with_filters = null
+ return ..()
+
+/obj/structure/carving_block/proc/set_target(atom/movable/target,mob/living/user)
+ if(!is_viable_target(target))
+ to_chat(user,"You won't be able to carve that.")
+ return
+ if(istype(target,/obj/structure/statue/custom))
+ var/obj/structure/statue/custom/original = target
+ current_target = original.content_ma
+ else
+ current_target = target.appearance
+ var/mutable_appearance/ma = current_target
+ to_chat(user,span_notice("You decide to sculpt [src] into [ma.name]."),type=MESSAGE_TYPE_INFO)
+
+/obj/structure/carving_block/proc/reset_target()
+ current_target = null
+ current_preset_type = null
+ target_appearance_with_filters = null
+
+/obj/structure/carving_block/update_overlays()
+ . = ..()
+ if(!target_appearance_with_filters)
+ return
+ //We're only keeping one instance here that changes in the middle so we have to clone it to avoid managed overlay issues
+ var/mutable_appearance/clone = new(target_appearance_with_filters)
+ . += clone
+
+/obj/structure/carving_block/proc/is_viable_target(atom/movable/target)
+ //Only things on turfs
+ if(!isturf(target.loc))
+ return FALSE
+ //No big icon things
+ var/icon/thing_icon = icon(target.icon, target.icon_state)
+ if(thing_icon.Height() != world.icon_size || thing_icon.Width() != world.icon_size)
+ return FALSE
+ return TRUE
+
+/obj/structure/carving_block/proc/create_statue()
+ if(current_preset_type)
+ var/obj/structure/statue/preset_statue = new current_preset_type(get_turf(src))
+ preset_statue.set_custom_materials(custom_materials)
+ qdel(src)
+ else if(current_target)
+ var/obj/structure/statue/custom/new_statue = new(get_turf(src))
+ new_statue.set_visuals(current_target)
+ new_statue.set_custom_materials(custom_materials)
+ var/mutable_appearance/ma = current_target
+ new_statue.name = "statue of [ma.name]"
+ new_statue.desc = "statue depicting [ma.name]"
+ qdel(src)
+
+/obj/structure/carving_block/proc/set_completion(value)
+ if(!current_target)
+ return
+ if(!target_appearance_with_filters)
+ target_appearance_with_filters = new(current_target)
+ // KEEP_APART in case carving block gets KEEP_TOGETHER from somewhere like material texture filters.
+ target_appearance_with_filters.appearance_flags |= KEEP_TOGETHER | KEEP_APART
+ //Doesn't use filter helpers because MAs aren't atoms
+ target_appearance_with_filters.filters = filter(type="color",color=greyscale_with_value_bump,space=FILTER_COLOR_HSV)
+ completion = value
+ var/static/icon/white = icon('icons/effects/alphacolors.dmi', "white")
+ switch(value)
+ if(0)
+ //delete uncovered and reset filters
+ remove_filter("partial_uncover")
+ target_appearance_with_filters = null
+ else
+ var/mask_offset = min(world.icon_size,round(completion * world.icon_size))
+ remove_filter("partial_uncover")
+ add_filter("partial_uncover", 1, alpha_mask_filter(icon = white, y = -mask_offset))
+ target_appearance_with_filters.filters = filter(type="alpha",icon=white,y=-mask_offset,flags=MASK_INVERSE)
+ update_appearance()
+
+
+/// Returns a list of preset statues carvable from this block depending on the custom materials
+/obj/structure/carving_block/proc/get_possible_statues()
+ . = list()
+ if(!statue_costs)
+ statue_costs = build_statue_cost_table()
+ for(var/statue_path in statue_costs)
+ var/list/carving_cost = statue_costs[statue_path]
+ var/enough_materials = TRUE
+ for(var/required_material in carving_cost)
+ if(!has_material_type(required_material, TRUE, carving_cost[required_material]))
+ enough_materials = FALSE
+ break
+ if(enough_materials)
+ . += statue_path
+
+/obj/structure/carving_block/proc/build_statue_cost_table()
+ . = list()
+ for(var/statue_type in subtypesof(/obj/structure/statue) - /obj/structure/statue/custom)
+ var/obj/structure/statue/S = new statue_type()
+ if(!S.icon_state || S.abstract_type == S.type || !S.custom_materials)
+ continue
+ .[S.type] = S.custom_materials
+ qdel(S)
+
+/obj/structure/statue/custom
+ name = "custom statue"
+ icon_state = "base"
+ obj_flags = CAN_BE_HIT | UNIQUE_RENAME
+ appearance_flags = TILE_BOUND | PIXEL_SCALE | KEEP_TOGETHER //Added keep together in case targets has weird layering
+ material_flags = MATERIAL_EFFECTS | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS
+ /// primary statue overlay
+ var/mutable_appearance/content_ma
+ var/static/list/greyscale_with_value_bump = list(0,0,0, 0,0,0, 0,0,1, 0,0,-0.05)
+
+/obj/structure/statue/custom/Destroy()
+ content_ma = null
+ return ..()
+
+/obj/structure/statue/custom/proc/set_visuals(model_appearance)
+ if(content_ma)
+ QDEL_NULL(content_ma)
+ content_ma = new
+ content_ma.appearance = model_appearance
+ content_ma.pixel_x = 0
+ content_ma.pixel_y = 0
+ content_ma.alpha = 255
+ content_ma.appearance_flags &= ~KEEP_APART //Don't want this
+ content_ma.filters = filter(type="color",color=greyscale_with_value_bump,space=FILTER_COLOR_HSV)
+ update_appearance()
+
+/obj/structure/statue/custom/update_overlays()
+ . = ..()
+ if(content_ma)
+ . += content_ma
diff --git a/code/modules/atmospherics/environmental/LINDA_system.dm b/code/modules/atmospherics/environmental/LINDA_system.dm
index c3943a5406587..88eeb654e4165 100644
--- a/code/modules/atmospherics/environmental/LINDA_system.dm
+++ b/code/modules/atmospherics/environmental/LINDA_system.dm
@@ -1,7 +1,10 @@
-/atom/var/can_atmos_pass = ATMOS_PASS_YES
-/atom/var/can_atmos_passVertical = ATMOS_PASS_YES
+/atom
+ ///Check if atmos can pass in this atom (ATMOS_PASS_YES, ATMOS_PASS_NO, ATMOS_PASS_DENSITY, ATMOS_PASS_PROC)
+ var/can_atmos_pass = ATMOS_PASS_YES
+ ///Zlevel check for can_atmos_pass
+ var/can_atmos_pass_vertical = ATMOS_PASS_YES
-/atom/proc/can_atmos_pass(turf/T)
+/atom/proc/can_atmos_pass(turf/target_turf)
switch (can_atmos_pass)
if (ATMOS_PASS_PROC)
return ATMOS_PASS_YES
@@ -10,65 +13,69 @@
else
return can_atmos_pass
-/turf/can_atmos_pass = ATMOS_PASS_NO
-/turf/can_atmos_passVertical = ATMOS_PASS_NO
+/turf
+ can_atmos_pass = ATMOS_PASS_NO
+ can_atmos_pass_vertical = ATMOS_PASS_NO
-/turf/open/can_atmos_pass = ATMOS_PASS_PROC
-/turf/open/can_atmos_passVertical = ATMOS_PASS_PROC
+/turf/open
+ can_atmos_pass = ATMOS_PASS_PROC
+ can_atmos_pass_vertical = ATMOS_PASS_PROC
//Do NOT use this to see if 2 turfs are connected, it mutates state, and we cache that info anyhow. Use TURFS_CAN_SHARE or TURF_SHARES depending on your usecase
-/turf/open/can_atmos_pass(turf/T, vertical = FALSE)
- var/dir = vertical? get_dir_multiz(src, T) : get_dir(src, T)
- var/opp = REVERSE_DIR(dir)
- var/R = FALSE
- if(vertical && !(zAirOut(dir, T) && T.zAirIn(dir, src)))
- R = TRUE
- if(blocks_air || T.blocks_air)
- R = TRUE
- if (T == src)
- return !R
- 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.block_superconductivity()) //the direction and open/closed are already checked on can_atmos_pass() so there are no arguments
- atmos_supeconductivity |= dir
- T.atmos_supeconductivity |= opp
- return FALSE //no need to keep going, we got all we asked
-
- atmos_supeconductivity &= ~dir
- T.atmos_supeconductivity &= ~opp
-
- return !R
-
-/atom/movable/proc/block_superconductivity() // objects that block air and don't let superconductivity act. Only firelocks atm.
+/turf/open/can_atmos_pass(turf/target_turf, vertical = FALSE)
+ var/direction = vertical ? get_dir_multiz(src, target_turf) : get_dir(src, target_turf)
+ var/opposite_direction = REVERSE_DIR(direction)
+ var/can_pass = FALSE
+ if(vertical && !(zAirOut(direction, target_turf) && target_turf.zAirIn(direction, src)))
+ can_pass = TRUE
+ if(blocks_air || target_turf.blocks_air)
+ can_pass = TRUE
+ if (target_turf == src)
+ return !can_pass
+ for(var/obj/checked_object in contents + target_turf.contents)
+ var/turf/other = (checked_object.loc == src ? target_turf : src)
+ if(!(vertical? (CANVERTICALATMOSPASS(checked_object, other)) : (CANATMOSPASS(checked_object, other))))
+ can_pass = TRUE
+ if(checked_object.block_superconductivity()) //the direction and open/closed are already checked on can_atmos_pass() so there are no arguments
+ atmos_supeconductivity |= direction
+ target_turf.atmos_supeconductivity |= opposite_direction
+ return FALSE //no need to keep going, we got all we asked
+
+ atmos_supeconductivity &= ~direction
+ target_turf.atmos_supeconductivity &= ~opposite_direction
+
+ return !can_pass
+
+/atom/movable/proc/block_superconductivity() // objects that block air and don't let superconductivity act
return FALSE
/turf/proc/immediate_calculate_adjacent_turfs()
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))
+ var/turf/current_turf = get_step_multiz(src, direction)
+ if(!isopenturf(current_turf))
continue
- if(!(blocks_air || T.blocks_air) && ((direction & (UP|DOWN))? (canvpass && CANVERTICALATMOSPASS(T, src)) : (canpass && CANATMOSPASS(T, src))) )
+ if(!(blocks_air || current_turf.blocks_air) && ((direction & (UP|DOWN)) ? (canvpass && CANVERTICALATMOSPASS(current_turf, src)) : (canpass && CANATMOSPASS(current_turf, src))) )
LAZYINITLIST(atmos_adjacent_turfs)
- LAZYINITLIST(T.atmos_adjacent_turfs)
- atmos_adjacent_turfs[T] = TRUE
- T.atmos_adjacent_turfs[src] = TRUE
+ LAZYINITLIST(current_turf.atmos_adjacent_turfs)
+ atmos_adjacent_turfs[current_turf] = TRUE
+ current_turf.atmos_adjacent_turfs[src] = TRUE
else
if (atmos_adjacent_turfs)
- atmos_adjacent_turfs -= T
- if (T.atmos_adjacent_turfs)
- T.atmos_adjacent_turfs -= src
- UNSETEMPTY(T.atmos_adjacent_turfs)
+ atmos_adjacent_turfs -= current_turf
+ if (current_turf.atmos_adjacent_turfs)
+ current_turf.atmos_adjacent_turfs -= src
+ UNSETEMPTY(current_turf.atmos_adjacent_turfs)
UNSETEMPTY(atmos_adjacent_turfs)
src.atmos_adjacent_turfs = atmos_adjacent_turfs
-//returns a list of adjacent turfs that can share air with this one.
-//alldir includes adjacent diagonal tiles that can share
-// air with both of the related adjacent cardinal tiles
-/turf/proc/GetAtmosAdjacentTurfs(alldir = 0)
+/**
+ * returns a list of adjacent turfs that can share air with this one.
+ * alldir includes adjacent diagonal tiles that can share
+ * air with both of the related adjacent cardinal tiles
+**/
+/turf/proc/get_atmos_adjacent_turfs(alldir = 0)
var/adjacent_turfs
if (atmos_adjacent_turfs)
adjacent_turfs = atmos_adjacent_turfs.Copy()
@@ -82,27 +89,29 @@
for (var/direction in GLOB.diagonals_multiz)
var/matching_directions = 0
- var/turf/S = get_step_multiz(current_location, direction)
- if(!S)
+ var/turf/checked_turf = get_step_multiz(current_location, direction)
+ if(!checked_turf)
continue
for (var/check_direction in GLOB.cardinals_multiz)
- var/turf/checkTurf = get_step(S, check_direction)
- if(!S.atmos_adjacent_turfs || !S.atmos_adjacent_turfs[checkTurf])
+ var/turf/secondary_turf = get_step(checked_turf, check_direction)
+ if(!checked_turf.atmos_adjacent_turfs || !checked_turf.atmos_adjacent_turfs[secondary_turf])
continue
- if (adjacent_turfs[checkTurf])
+ if (adjacent_turfs[secondary_turf])
matching_directions++
if (matching_directions >= 2)
- adjacent_turfs += S
+ adjacent_turfs += checked_turf
break
return adjacent_turfs
/atom/proc/air_update_turf(update = FALSE, remove = FALSE)
- var/turf/T = get_turf(loc)
- T.air_update_turf(update, remove)
+ var/turf/local_turf = get_turf(loc)
+ if(!local_turf)
+ return
+ local_turf.air_update_turf(update, remove)
/**
* A helper proc for dealing with atmos changes
@@ -121,24 +130,24 @@
else
SSair.add_to_active(src)
-/atom/movable/proc/move_update_air(turf/T)
- if(isturf(T))
- T.air_update_turf(TRUE, FALSE) //You're empty now
+/atom/movable/proc/move_update_air(turf/target_turf)
+ if(isturf(target_turf))
+ target_turf.air_update_turf(TRUE, FALSE) //You're empty now
air_update_turf(TRUE, TRUE) //You aren't
/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)
- if(!istype(T))
+ var/turf/open/local_turf = get_turf(src)
+ if(!istype(local_turf))
return
- T.atmos_spawn_air(text)
+ local_turf.atmos_spawn_air(text)
/turf/open/atmos_spawn_air(text)
if(!text || !air)
return
- var/datum/gas_mixture/G = new
- G.parse_gas_string(text)
+ var/datum/gas_mixture/turf_mixture = new
+ turf_mixture.parse_gas_string(text)
- air.merge(G)
+ air.merge(turf_mixture)
archive()
SSair.add_to_active(src)
diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
index e501ef607a4d4..5bce3594540e8 100644
--- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
+++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
@@ -1,7 +1,9 @@
/turf
- //used for temperature calculations
+ ///used for temperature calculations in superconduction
var/thermal_conductivity = 0.05
+ ///Amount of heat necessary to activate some atmos processes (there is a weird usage of this var because is compared directly to the temperature instead of heat energy)
var/heat_capacity = INFINITY //This should be opt in rather then opt out
+ ///Archived version of the temperature on a turf
var/temperature_archived
///list of turfs adjacent to us that air can flow onto
@@ -9,29 +11,39 @@
///bitfield of dirs in which we are superconducitng
var/atmos_supeconductivity = NONE
- //used to determine whether we should archive
+ ///used to determine whether we should archive
var/archived_cycle = 0
var/current_cycle = 0
- //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
+ /**
+ * 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
+ * approximation of MOLES_O2STANDARD and MOLES_N2STANDARD pending byond allowing constant expressions to be embedded in constant strings
+ * If someone will place 0 of some gas there, SHIT WILL BREAK. Do not do that.
+ **/
var/initial_gas_mix = OPENTURF_DEFAULT_ATMOS
- //approximation of MOLES_O2STANDARD and MOLES_N2STANDARD pending byond allowing constant expressions to be embedded in constant strings
- // If someone will place 0 of some gas there, SHIT WILL BREAK. Do not do that.
/turf/open
//used for spacewind
+ ///Pressure difference between two turfs
var/pressure_difference = 0
+ ///Where the difference come from (from higher pressure to lower pressure)
var/pressure_direction = 0
+ ///Excited group we are part of
var/datum/excited_group/excited_group
+ ///Are we active?
var/excited = FALSE
+ ///Our gas mix
var/datum/gas_mixture/turf/air
+ ///If there is an active hotspot on us store a reference to it here
var/obj/effect/hotspot/active_hotspot
+ ///Whether or not we are a planetary turf
var/planetary_atmos = FALSE //air will revert to initial_gas_mix
- var/list/atmos_overlay_types //gas IDs of current active gas overlays
+ ///gas IDs of current active gas overlays
+ var/list/atmos_overlay_types
var/significant_share_ticker = 0
#ifdef TRACK_MAX_SHARE
var/max_share = 0
@@ -52,8 +64,8 @@
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)
+ for(var/near_turf in atmos_adjacent_turfs)
+ SSair.add_to_active(near_turf)
return ..()
/////////////////GAS MIXTURE PROCS///////////////////
@@ -71,9 +83,9 @@
update_visuals()
return removed
-/turf/open/proc/copy_air_with_tile(turf/open/T)
- if(istype(T))
- air.copy_from(T.air)
+/turf/open/proc/copy_air_with_tile(turf/open/target_turf)
+ if(istype(target_turf))
+ air.copy_from(target_turf.air)
/turf/open/proc/copy_air(datum/gas_mixture/copy)
if(copy)
@@ -81,9 +93,9 @@
/turf/return_air()
RETURN_TYPE(/datum/gas_mixture)
- var/datum/gas_mixture/GM = new
- GM.copy_from_turf(src)
- return GM
+ var/datum/gas_mixture/copied_mixture = new
+ copied_mixture.copy_from_turf(src)
+ return copied_mixture
/turf/open/return_air()
RETURN_TYPE(/datum/gas_mixture)
@@ -281,11 +293,11 @@
should_share_air = TRUE
else if(our_air.compare(enemy_air)) //Lets see if you're up for it
SSair.add_to_active(enemy_tile) //Add yourself young man
- var/datum/excited_group/EG = our_excited_group || enemy_excited_group || new
+ var/datum/excited_group/existing_group = our_excited_group || enemy_excited_group || new
if(!our_excited_group)
- EG.add_turf(src)
+ existing_group.add_turf(src)
if(!enemy_excited_group)
- EG.add_turf(enemy_tile)
+ existing_group.add_turf(enemy_tile)
our_excited_group = excited_group
should_share_air = TRUE
@@ -304,19 +316,19 @@
/******************* GROUP HANDLING FINISH *********************************************************************/
if (planetary_atmos) //share our air with the "atmosphere" "above" the turf
- var/datum/gas_mixture/G = SSair.planetary[initial_gas_mix]
+ var/datum/gas_mixture/planetary_mix = SSair.planetary[initial_gas_mix]
// archive ourself again so we don't accidentally share more gas than we currently have
archive()
- if(our_air.compare(G))
+ if(our_air.compare(planetary_mix))
if(!our_excited_group)
- var/datum/excited_group/EG = new
- EG.add_turf(src)
+ var/datum/excited_group/new_group = new
+ new_group.add_turf(src)
our_excited_group = excited_group
// shares 4/5 of our difference in moles with the atmosphere
- our_air.share(G, 0.25)
+ our_air.share(planetary_mix, 0.25)
// temperature share with the atmosphere with an inflated heat capacity to simulate faster sharing with a large atmosphere
- our_air.temperature_share(G, OPEN_HEAT_TRANSFER_COEFFICIENT, G.temperature_archived, G.heat_capacity() * 5)
- G.garbage_collect()
+ our_air.temperature_share(planetary_mix, OPEN_HEAT_TRANSFER_COEFFICIENT, planetary_mix.temperature_archived, planetary_mix.heat_capacity() * 5)
+ planetary_mix.garbage_collect()
PLANET_SHARE_CHECK
our_air.react(src)
@@ -333,30 +345,32 @@
//////////////////////////SPACEWIND/////////////////////////////
-/turf/open/proc/consider_pressure_difference(turf/T, difference)
+/turf/open/proc/consider_pressure_difference(turf/target_turf, difference)
SSair.high_pressure_delta |= src
if(difference > pressure_difference)
- pressure_direction = get_dir(src, T)
+ pressure_direction = get_dir(src, target_turf)
pressure_difference = difference
/turf/open/proc/high_pressure_movements()
- var/atom/movable/M
+ var/atom/movable/moving_atom
for(var/thing in src)
- M = thing
- if (!M.anchored && !M.pulledby && M.last_high_pressure_movement_air_cycle < SSair.times_fired)
- M.experience_pressure_difference(pressure_difference, pressure_direction)
+ moving_atom = thing
+ if (!moving_atom.anchored && !moving_atom.pulledby && moving_atom.last_high_pressure_movement_air_cycle < SSair.times_fired)
+ moving_atom.experience_pressure_difference(pressure_difference, pressure_direction)
-/atom/movable/var/pressure_resistance = 10
-/atom/movable/var/last_high_pressure_movement_air_cycle = 0
+/atom/movable
+ ///How much delta pressure is needed for us to move
+ var/pressure_resistance = 10
+ var/last_high_pressure_movement_air_cycle = 0
/atom/movable/proc/experience_pressure_difference(pressure_difference, direction, pressure_resistance_prob_delta = 0)
var/const/PROBABILITY_OFFSET = 25
var/const/PROBABILITY_BASE_PRECENT = 75
- var/max_force = sqrt(pressure_difference)*(MOVE_FORCE_DEFAULT / 5)
+ var/max_force = sqrt(pressure_difference) * (MOVE_FORCE_DEFAULT / 5)
set waitfor = FALSE
var/move_prob = 100
if (pressure_resistance > 0)
- move_prob = (pressure_difference/pressure_resistance*PROBABILITY_BASE_PRECENT)-PROBABILITY_OFFSET
+ move_prob = (pressure_difference / pressure_resistance * PROBABILITY_BASE_PRECENT) - PROBABILITY_OFFSET
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))))
step(src, direction)
@@ -374,72 +388,75 @@
We solve this with excited group cleanup. See the documentation for more details.
*/
/datum/excited_group
+ ///Stores a reference to the turfs we are controlling
var/list/turf_list = list()
+ ///If this is over EXCITED_GROUP_BREAKDOWN_CYCLES we call self_breakdown()
var/breakdown_cooldown = 0
+ ///If this is over EXCITED_GROUP_DISMANTLE_CYCLES we call dismantle()
var/dismantle_cooldown = 0
+ ///Used for debug to show the excited groups active and their turfs
var/should_display = FALSE
+ ///Id of the index color of the displayed group
var/display_id = 0
+ ///Wrapping loop of the index colors
var/static/wrapping_id = 0
/datum/excited_group/New()
SSair.excited_groups += src
-/datum/excited_group/proc/add_turf(turf/open/T)
- turf_list += T
- T.excited_group = src
+/datum/excited_group/proc/add_turf(turf/open/target_turf)
+ turf_list += target_turf
+ target_turf.excited_group = src
dismantle_cooldown = 0
if(should_display || SSair.display_all_groups)
- display_turf(T)
-
-/datum/excited_group/proc/merge_groups(datum/excited_group/E)
- if(turf_list.len > E.turf_list.len)
- SSair.excited_groups -= E
- for(var/t in E.turf_list)
- var/turf/open/T = t
- T.excited_group = src
- turf_list += T
- should_display = E.should_display | should_display
+ display_turf(target_turf)
+
+/datum/excited_group/proc/merge_groups(datum/excited_group/target_group)
+ if(turf_list.len > target_group.turf_list.len)
+ SSair.excited_groups -= target_group
+ for(var/turf/open/group_member as anything in target_group.turf_list)
+ group_member.excited_group = src
+ turf_list += group_member
+ should_display = target_group.should_display | should_display
if(should_display || SSair.display_all_groups)
- E.hide_turfs()
+ target_group.hide_turfs()
display_turfs()
- breakdown_cooldown = min(breakdown_cooldown, E.breakdown_cooldown) //Take the smaller of the two options
+ breakdown_cooldown = min(breakdown_cooldown, target_group.breakdown_cooldown) //Take the smaller of the two options
dismantle_cooldown = 0
else
SSair.excited_groups -= src
- for(var/t in turf_list)
- var/turf/open/T = t
- T.excited_group = E
- E.turf_list += T
- E.should_display = E.should_display | should_display
- if(E.should_display || SSair.display_all_groups)
+ for(var/turf/open/group_member as anything in turf_list)
+ group_member.excited_group = target_group
+ target_group.turf_list += group_member
+ target_group.should_display = target_group.should_display | should_display
+ if(target_group.should_display || SSair.display_all_groups)
hide_turfs()
- E.display_turfs()
- E.breakdown_cooldown = min(breakdown_cooldown, E.breakdown_cooldown)
- E.dismantle_cooldown = 0
+ target_group.display_turfs()
+ target_group.breakdown_cooldown = min(breakdown_cooldown, target_group.breakdown_cooldown)
+ target_group.dismantle_cooldown = 0
/datum/excited_group/proc/reset_cooldowns()
breakdown_cooldown = 0
dismantle_cooldown = 0
/datum/excited_group/proc/self_breakdown(roundstart = FALSE, poke_turfs = FALSE)
- var/datum/gas_mixture/A = new
+ var/datum/gas_mixture/shared_mix = new
//make local for sanic speed
- var/list/A_gases = A.gases
+ var/list/shared_gases = shared_mix.gases
var/list/turf_list = src.turf_list
var/turflen = turf_list.len
var/imumutable_in_group = FALSE
var/energy = 0
var/heat_cap = 0
- for(var/t in turf_list)
- var/turf/open/T = t
+ for(var/turf/open/group_member as anything in turf_list)
//Cache?
- var/datum/gas_mixture/turf/mix = T.air
- if (roundstart && istype(T.air, /datum/gas_mixture/immutable))
+ var/datum/gas_mixture/turf/mix = group_member.air
+ if (roundstart && istype(group_member.air, /datum/gas_mixture/immutable))
imumutable_in_group = TRUE
- A.copy_from(T.air) //This had better be immutable young man
- A_gases = A.gases //update the cache
+ shared_mix.copy_from(group_member.air) //This had better be immutable young man
+ shared_gases = shared_mix.gases //update the cache
break
//"borrowing" this code from merge(), I need to play with the temp portion. Lets expand it out
//temperature = (giver.temperature * giver_heat_capacity + temperature * self_heat_capacity) / combined_heat_capacity
@@ -449,37 +466,35 @@
var/list/giver_gases = mix.gases
for(var/giver_id in giver_gases)
- ASSERT_GAS(giver_id, A)
- A_gases[giver_id][MOLES] += giver_gases[giver_id][MOLES]
+ ASSERT_GAS(giver_id, shared_mix)
+ shared_gases[giver_id][MOLES] += giver_gases[giver_id][MOLES]
if(!imumutable_in_group)
- A.temperature = energy / heat_cap
- for(var/id in A_gases)
- A_gases[id][MOLES] /= turflen
- A.garbage_collect()
-
- for(var/t in turf_list)
- var/turf/open/T = t
- if(T.planetary_atmos) //We do this as a hack to try and minimize unneeded excited group spread over planetary turfs
- T.air.copy_from(SSair.planetary[T.initial_gas_mix]) //Comes with a cost of "slower" drains, but it's worth it
+ shared_mix.temperature = energy / heat_cap
+ for(var/id in shared_gases)
+ shared_gases[id][MOLES] /= turflen
+ shared_mix.garbage_collect()
+
+ for(var/turf/open/group_member as anything in turf_list)
+ if(group_member.planetary_atmos) //We do this as a hack to try and minimize unneeded excited group spread over planetary turfs
+ group_member.air.copy_from(SSair.planetary[group_member.initial_gas_mix]) //Comes with a cost of "slower" drains, but it's worth it
else
- T.air.copy_from(A) //Otherwise just set the mix to a copy of our equalized mix
- T.update_visuals()
+ group_member.air.copy_from(shared_mix) //Otherwise just set the mix to a copy of our equalized mix
+ group_member.update_visuals()
if(poke_turfs) //Because we only activate all these once every breakdown, in event of lag due to this code and slow space + vent things, increase the wait time for breakdowns
- SSair.add_to_active(T)
- T.significant_share_ticker = EXCITED_GROUP_DISMANTLE_CYCLES //Max out the ticker, if they don't share next tick, nuke em
+ SSair.add_to_active(group_member)
+ group_member.significant_share_ticker = EXCITED_GROUP_DISMANTLE_CYCLES //Max out the ticker, if they don't share next tick, nuke em
breakdown_cooldown = 0
///Dismantles the excited group, puts allll the turfs to sleep
/datum/excited_group/proc/dismantle()
- for(var/t in turf_list)
- var/turf/open/T = t
- T.excited = FALSE
- T.significant_share_ticker = 0
- SSair.active_turfs -= T
+ for(var/turf/open/current_turf as anything in turf_list)
+ current_turf.excited = FALSE
+ current_turf.significant_share_ticker = 0
+ SSair.active_turfs -= current_turf
#ifdef VISUALIZE_ACTIVE_TURFS //Use this when you want details about how the turfs are moving, display_all_groups should work for normal operation
- T.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, COLOR_VIBRANT_LIME)
+ current_turf.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, COLOR_VIBRANT_LIME)
#endif
garbage_collect()
@@ -487,9 +502,8 @@
/datum/excited_group/proc/garbage_collect()
if(display_id) //If we ever did make those changes
hide_turfs()
- for(var/t in turf_list)
- var/turf/open/T = t
- T.excited_group = null
+ for(var/turf/open/current_turf as anything in turf_list)
+ current_turf.excited_group = null
turf_list.Cut()
SSair.excited_groups -= src
if(SSair.currentpart == SSAIR_EXCITEDGROUPS)
@@ -542,8 +556,8 @@ Then we space some of our heat, and think about if we should stop conducting.
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))
+ var/turf/checked_turf = get_step(src, direction)
+ if(!(checked_turf in atmos_adjacent_turfs) && !(atmos_supeconductivity & direction))
. |= direction
///These two procs are a bit of a web, I belive in you
@@ -556,12 +570,11 @@ Then we space some of our heat, and think about if we should stop conducting.
/turf/open/neighbor_conduct_with_src(turf/other)
if(blocks_air)
- ..()
- return
+ return ..()
if(!other.blocks_air) //Both tiles are open
- var/turf/open/T = other
- T.air.temperature_share(air, WINDOW_HEAT_TRANSFER_COEFFICIENT)
+ var/turf/open/open_other = other
+ open_other.air.temperature_share(air, WINDOW_HEAT_TRANSFER_COEFFICIENT)
else //Open but neighbor is solid
temperature_share_open_to_solid(other)
SSair.add_to_active(src)
@@ -572,18 +585,19 @@ Then we space some of our heat, and think about if we should stop conducting.
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(!(conductivity_directions & direction))
+ continue
+ var/turf/neighbor = get_step(src, direction)
- if(!neighbor.thermal_conductivity)
- continue
+ if(!neighbor.thermal_conductivity)
+ continue
- if(neighbor.archived_cycle < SSair.times_fired)
- neighbor.archive()
+ if(neighbor.archived_cycle < SSair.times_fired)
+ neighbor.archive()
- neighbor.neighbor_conduct_with_src(src)
+ neighbor.neighbor_conduct_with_src(src)
- neighbor.consider_superconductivity()
+ neighbor.consider_superconductivity()
radiate_to_spess()
@@ -622,13 +636,14 @@ Then we space some of our heat, and think about if we should stop conducting.
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
+ if(temperature <= T0C) //Considering 0 degC as te break even point for radiation in and out
+ return
+ var/delta_temperature = (temperature_archived - TCMB) //hardcoded space temperature
+ if(heat_capacity <= 0 || abs(delta_temperature) <= MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
+ return
+ 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)
@@ -636,9 +651,7 @@ Then we space some of our heat, and think about if we should stop conducting.
/turf/proc/share_temperature_mutual_solid(turf/sharer, conduction_coefficient) //This is all just heat sharing, don't get freaked out
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)) //The larger the combined capacity the less is shared
-
- temperature -= heat/heat_capacity //The higher your own heat cap the less heat you get from this arrangement
- sharer.temperature += heat/sharer.heat_capacity
+ var/heat = conduction_coefficient * delta_temperature * \
+ (heat_capacity * sharer.heat_capacity / (heat_capacity + sharer.heat_capacity)) //The larger the combined capacity the less is shared
+ temperature -= heat / heat_capacity //The higher your own heat cap the less heat you get from this arrangement
+ sharer.temperature += heat / sharer.heat_capacity
diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm
index 21dd8785959a7..19ee92b44d433 100644
--- a/code/modules/atmospherics/machinery/atmosmachinery.dm
+++ b/code/modules/atmospherics/machinery/atmosmachinery.dm
@@ -64,7 +64,7 @@
..()
if(process)
SSair.start_processing_machine(src)
- set_init_directions()
+ set_init_directions(init_dir)
/obj/machinery/atmospherics/Destroy()
for(var/i in 1 to device_type)
@@ -96,19 +96,31 @@
/obj/machinery/atmospherics/proc/get_rebuild_targets()
return
+/**
+ * Called on destroy(mostly deconstruction) and when moving nodes around, disconnect the nodes from the network
+ * Arguments:
+ * * i - is the current iteration of the node, based on the device_type (from 1 to 4)
+ */
/obj/machinery/atmospherics/proc/nullify_node(i)
- if(nodes[i])
- var/obj/machinery/atmospherics/N = nodes[i]
- N.disconnect(src)
- nodes[i] = null
+ if(!nodes[i])
+ return
+ var/obj/machinery/atmospherics/node_machine = nodes[i]
+ node_machine.disconnect(src)
+ nodes[i] = null
+/**
+ * Getter for node_connects
+ *
+ * Return a list of the nodes that can connect to other machines, get called by atmos_init()
+ */
/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 & get_init_directions())
+ if(D & init_directions)
if(D in node_connects)
continue
node_connects[i] = D
@@ -122,7 +134,13 @@
if(WEST)
setDir(EAST)
-//this is called just after the air controller sets up turfs
+/**
+ * Initialize for atmos devices
+ *
+ * initialize the nodes for each pipe/device, this is called just after the air controller sets up turfs
+ * Arguments:
+ * * list/node_connects - a list of the nodes on the device that can make a connection to other machines
+ */
/obj/machinery/atmospherics/proc/atmos_init(list/node_connects)
if(!node_connects) //for pipes where order of nodes doesn't matter
node_connects = get_node_connects()
@@ -134,25 +152,76 @@
break
update_icon()
+/**
+ * setter for pipe layers
+ *
+ * Set the layer of the pipe that the device has to a new_layer
+ * Arguments:
+ * * new_layer - the layer at which we want the piping_layer to be (1 to 5)
+ */
/obj/machinery/atmospherics/proc/set_piping_layer(new_layer)
piping_layer = (pipe_flags & PIPING_DEFAULT_LAYER_ONLY) ? PIPING_LAYER_DEFAULT : new_layer
update_icon()
+/obj/machinery/atmospherics/update_icon()
+ layer = initial(layer) + piping_layer / 1000
+ return ..()
+
+/**
+ * Check if a node can actually exists by connecting to another machine
+ * called on atmos_init()
+ * Arguments:
+ * * obj/machinery/atmospherics/target - the machine we are connecting to
+ * * iteration - the current node we are checking (from 1 to 4)
+ */
/obj/machinery/atmospherics/proc/can_be_node(obj/machinery/atmospherics/target, iteration)
return connection_check(target, piping_layer)
-//Find a connecting /obj/machinery/atmospherics in specified direction
+/**
+ * Find a connecting /obj/machinery/atmospherics in specified direction, called by relaymove()
+ * used by ventcrawling mobs to check if they can move inside a pipe in a specific direction
+ * Arguments:
+ * * direction - the direction we are checking against
+ * * prompted_layer - the piping_layer we are inside
+ */
/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) && !istype(target, /obj/machinery/atmospherics/pipe/multiz))
if(connection_check(target, prompted_layer))
return target
+/**
+ * Check the connection between two nodes
+ *
+ * Check if our machine and the target machine are connectable by both calling isConnectable and by checking that the directions and piping_layer are compatible
+ * called by can_be_node() (for building a network) and find_connecting() (for ventcrawling)
+ * Arguments:
+ * * obj/machinery/atmospherics/target - the machinery we want to connect to
+ * * given_layer - the piping_layer we are checking
+ */
/obj/machinery/atmospherics/proc/connection_check(obj/machinery/atmospherics/target, given_layer)
- if(is_connectable(target, given_layer) && target.is_connectable(src, given_layer) && (target.initialize_directions & get_dir(target,src) || istype(target, /obj/machinery/atmospherics/pipe/multiz)))
+ if(is_connectable(target, given_layer) && target.is_connectable(src, given_layer) && check_init_directions(target))
return TRUE
return FALSE
+/**
+ * check if the initialized direction are the same on both sides (or if is a multiz adapter)
+ * returns TRUE or FALSE if the connection is possible or not
+ * Arguments:
+ * * obj/machinery/atmospherics/target - the machinery we want to connect to
+ */
+/obj/machinery/atmospherics/proc/check_init_directions(obj/machinery/atmospherics/target)
+ if((initialize_directions & get_dir(src, target) && target.initialize_directions & get_dir(target,src)) || istype(target, /obj/machinery/atmospherics/pipe/multiz))
+ return TRUE
+ return FALSE
+
+/**
+ * check if the piping layer and color are the same on both sides (grey can connect to all colors)
+ * returns TRUE or FALSE if the connection is possible or not
+ * Arguments:
+ * * obj/machinery/atmospherics/target - the machinery we want to connect to
+ * * given_layer - the piping_layer we are connecting to
+ */
/obj/machinery/atmospherics/proc/is_connectable(obj/machinery/atmospherics/target, given_layer)
if(isnull(given_layer))
given_layer = piping_layer
@@ -160,27 +229,55 @@
return TRUE
return FALSE
+/**
+ * Called on construction and when expanding the datum_pipeline, returns the nodes of the device
+ */
/obj/machinery/atmospherics/proc/pipeline_expansion()
return nodes
-/obj/machinery/atmospherics/proc/set_init_directions()
+/**
+ * Set the initial directions of the device (NORTH || SOUTH || EAST || WEST), called on New()
+ */
+/obj/machinery/atmospherics/proc/set_init_directions(init_dir)
return
+/**
+ * Getter of initial directions
+ */
/obj/machinery/atmospherics/proc/get_init_directions()
return initialize_directions
+/**
+ * Called by add_member() in datum_pipeline.dm, returns the parent network the device is connected to
+ */
/obj/machinery/atmospherics/proc/return_pipenet()
return
-/obj/machinery/atmospherics/proc/return_pipenetAir()
+/**
+ * Called by add_machinery_member() in datum_pipeline.dm, returns a list of gas_mixtures and assigns them into other_airs (by addMachineryMember) to allow pressure redistribution for the machineries.
+ */
+/obj/machinery/atmospherics/proc/return_pipenet_airs()
return
+/**
+ * Called by build_pipeline() and add_member() in datum_pipeline.dm, set the network the device is connected to, to the datum pipeline it has reference
+ */
/obj/machinery/atmospherics/proc/set_pipenet()
return
+/**
+ * Similar to set_pipenet() but instead of setting a network to a pipeline, it replaces the old pipeline with a new one, called by Merge() in datum_pipeline.dm
+ */
/obj/machinery/atmospherics/proc/replace_pipenet()
return
+/**
+ * Disconnects the nodes
+ *
+ * Called by nullify_node(), it disconnects two nodes by removing the reference id from the node itself that called this proc
+ * Arguments:
+ * * obj/machinery/atmospherics/reference - the machinery we are removing from the node connection
+ */
/obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference)
if(istype(reference, /obj/machinery/atmospherics/pipe))
var/obj/machinery/atmospherics/pipe/P = reference
@@ -267,27 +364,31 @@
. = stored
..()
-/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(iconsetids[iconset] == null)
- iconsetids[iconset] = num2text(iconsetids.len + 1)
-
- //Generate a unique identifier for this image combination
- var/identifier = iconsetids[iconset] + "_[iconstate]_[direction]_[col]_[piping_layer]"
-
- if((!(. = pipeimages[identifier])))
- var/image/pipe_overlay
- pipe_overlay = . = pipeimages[identifier] = image(iconset, iconstate, dir = direction)
- pipe_overlay.color = col
- PIPING_LAYER_SHIFT(pipe_overlay, piping_layer)
- if(trinary && (piping_layer == 1 || piping_layer == 5))
- PIPING_FORWARD_SHIFT(pipe_overlay, piping_layer, 2)
+/**
+ * Getter for piping layer shifted, pipe colored overlays
+ *
+ * Creates the image for the pipe underlay that all components use, called by get_pipe_underlay() in components_base.dm
+ * Arguments:
+ * * iconfile - path of the iconstate we are using (ex: 'icons/obj/atmospherics/components/thermomachine.dmi')
+ * * iconstate - the image we are using inside the file
+ * * direction - the direction of our device
+ * * color - the color (in hex value, like #559900) that the pipe should have
+ * * piping_layer - the piping_layer the device is in, used inside PIPING_LAYER_SHIFT
+ * * trinary - if TRUE we also use PIPING_FORWARD_SHIFT on layer 1 and 5 for trinary devices (filters and mixers)
+ */
+/obj/machinery/atmospherics/proc/get_pipe_image(iconfile, iconstate, direction, color = COLOR_VERY_LIGHT_GRAY, piping_layer = 3, trinary = FALSE)
+ var/image/pipe_overlay = image(iconfile, iconstate, dir = direction)
+ pipe_overlay.color = color
+ PIPING_LAYER_SHIFT(pipe_overlay, piping_layer)
+ if(trinary == TRUE && (piping_layer == 1 || piping_layer == 5))
+ PIPING_FORWARD_SHIFT(pipe_overlay, piping_layer, 2)
+ return pipe_overlay
/obj/machinery/atmospherics/on_construction(obj_color, set_layer)
if(can_unwrench)
add_atom_colour(obj_color, FIXED_COLOUR_PRIORITY)
pipe_color = obj_color
+ update_name()
set_piping_layer(set_layer)
atmos_init()
var/list/nodes = pipeline_expansion()
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
index 7adc98419a59f..5388683552d7d 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
@@ -96,11 +96,14 @@
if(node1)
node1.disconnect(src)
nodes[1] = null
- nullifyPipenet(parents[1])
+ if(parents[1])
+ nullify_pipenet(parents[1])
+
if(node2)
node2.disconnect(src)
nodes[2] = null
- nullifyPipenet(parents[2])
+ if(parents[2])
+ nullify_pipenet(parents[2])
if(anchored)
set_init_directions()
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 3868afd9099ec..f6cb9bdc9910f 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
@@ -47,7 +47,7 @@
/obj/machinery/atmospherics/components/binary/dp_vent_pump/update_icon_nopipes()
cut_overlays()
if(showpipe)
- var/image/cap = get_pipe_image(icon, "dpvent_cap", dir, piping_layer = piping_layer)
+ var/image/cap = get_pipe_image(icon, "dpvent_cap", dir, pipe_color, piping_layer = piping_layer)
add_overlay(cap)
if(welded)
@@ -108,12 +108,20 @@
//Radio remote control
+/**
+ * Called in atmos_init(), used to change or remove the radio frequency from the component
+ * Arguments:
+ * * -new_frequency: the frequency that should be used for the radio to attach to the component, use 0 to remove the radio
+ */
/obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA)
+/**
+ * Called in atmos_init(), send the component status to the radio device connected
+ */
/obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/broadcast_status()
if(!radio_connection)
return
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 9b7f616ad9336..d9ce0b2510217 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm
@@ -67,12 +67,20 @@ Passive gate is similar to the regular pump except:
//Radio remote control
+/**
+ * Called in atmos_init(), used to change or remove the radio frequency from the component
+ * Arguments:
+ * * -new_frequency: the frequency that should be used for the radio to attach to the component, use 0 to remove the radio
+ */
/obj/machinery/atmospherics/components/binary/passive_gate/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA)
+/**
+ * Called in atmos_init(), send the component status to the radio device connected
+ */
/obj/machinery/atmospherics/components/binary/passive_gate/proc/broadcast_status()
if(!radio_connection)
return
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 b659fd39c72df..72d3571ef8c59 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm
@@ -66,12 +66,22 @@
is_gas_flowing = FALSE
update_icon_nopipes()
+//Radio remote control
+
+/**
+ * Called in atmos_init(), used to change or remove the radio frequency from the component
+ * Arguments:
+ * * -new_frequency: the frequency that should be used for the radio to attach to the component, use 0 to remove the radio
+ */
/obj/machinery/atmospherics/components/binary/pressure_valve/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA)
+/**
+ * Called in atmos_init(), send the component status to the radio device connected
+ */
/obj/machinery/atmospherics/components/binary/pressure_valve/proc/broadcast_status()
if(!radio_connection)
return
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
index 3a0782e947471..5312987fcc767 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
@@ -72,13 +72,20 @@
on = active
SEND_SIGNAL(src, COMSIG_PUMP_SET_ON, on)
-//Radio remote control
+/**
+ * Called in atmos_init(), used to change or remove the radio frequency from the component
+ * Arguments:
+ * * -new_frequency: the frequency that should be used for the radio to attach to the component, use 0 to remove the radio
+ */
/obj/machinery/atmospherics/components/binary/pump/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA)
+/**
+ * Called in atmos_init(), send the component status to the radio device connected
+ */
/obj/machinery/atmospherics/components/binary/pump/proc/broadcast_status()
if(!radio_connection)
return
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/binary_devices/thermomachine.dm
new file mode 100644
index 0000000000000..ad4aaf777cba0
--- /dev/null
+++ b/code/modules/atmospherics/machinery/components/binary_devices/thermomachine.dm
@@ -0,0 +1,515 @@
+#define THERMOMACHINE_SAFE_TEMPERATURE 500000
+#define THERMOMACHINE_POWER_CONVERSION 0.01
+
+/obj/machinery/atmospherics/components/binary/thermomachine
+ icon = 'icons/obj/atmospherics/components/thermomachine.dmi'
+ icon_state = "thermo_base"
+
+ name = "Temperature control unit"
+ desc = "Heats or cools gas in connected pipes."
+
+ density = TRUE
+ max_integrity = 300
+ armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 100, BOMB = 0, BIO = 100, RAD = 100, FIRE = 80, ACID = 30)
+ layer = OBJ_LAYER
+ circuit = /obj/item/circuitboard/machine/thermomachine
+
+ hide = TRUE
+
+ move_resist = MOVE_RESIST_DEFAULT
+ vent_movement = NONE
+ pipe_flags = PIPING_ONE_PER_TURF
+
+ greyscale_config = /datum/greyscale_config/thermomachine
+ greyscale_colors = COLOR_VIBRANT_LIME
+
+ set_dir_on_move = FALSE
+
+ var/min_temperature = T20C //actual temperature will be defined by RefreshParts() and by the cooling var
+ var/max_temperature = T20C //actual temperature will be defined by RefreshParts() and by the cooling var
+ var/target_temperature = T20C
+ var/heat_capacity = 0
+ var/interactive = TRUE // So mapmakers can disable interaction.
+ var/cooling = TRUE
+ var/base_heating = 140
+ var/base_cooling = 170
+ var/use_enviroment_heat = FALSE
+ var/skipping_work = FALSE
+ var/safeties = TRUE
+ var/lastwarning
+ var/color_index = 1
+
+ // Efficiency dictates how much we throttle the heat exchange process.
+ var/efficiency = 1
+ ///Efficiency minimum amount, min 0.25, max 1 (works best on higher laser tiers)
+ var/parts_efficiency = 1
+
+/obj/machinery/atmospherics/components/binary/thermomachine/Initialize(mapload)
+ . = ..()
+ RefreshParts()
+ update_appearance()
+
+/obj/machinery/atmospherics/components/binary/thermomachine/is_connectable()
+ if(!anchored || panel_open)
+ return FALSE
+ . = ..()
+
+/obj/machinery/atmospherics/components/binary/thermomachine/get_node_connects()
+ return list(dir, turn(dir, 180))
+
+/obj/machinery/atmospherics/components/binary/thermomachine/on_construction(obj_color, set_layer)
+ var/obj/item/circuitboard/machine/thermomachine/board = circuit
+ if(board)
+ piping_layer = board.pipe_layer
+ set_layer = piping_layer
+
+ if(check_pipe_on_turf())
+ deconstruct(TRUE)
+ return
+ return..()
+
+/obj/machinery/atmospherics/components/binary/thermomachine/RefreshParts()
+ var/calculated_bin_rating
+ for(var/obj/item/stock_parts/matter_bin/bin in component_parts)
+ calculated_bin_rating += bin.rating
+ heat_capacity = 7500 * ((calculated_bin_rating - 1) ** 2)
+ min_temperature = T20C
+ max_temperature = T20C
+ var/calculated_laser_rating
+ for(var/obj/item/stock_parts/micro_laser/laser in component_parts)
+ calculated_laser_rating += laser.rating
+ min_temperature = max(T0C - (base_cooling + calculated_laser_rating * 15), TCMB) //73.15K with T1 stock parts
+ max_temperature = T20C + (base_heating * calculated_laser_rating) //573.15K with T1 stock parts
+ parts_efficiency = min(calculated_laser_rating * 0.125, 1)
+
+/obj/machinery/atmospherics/components/binary/thermomachine/update_icon_state()
+ switch(target_temperature)
+ if(BODYTEMP_HEAT_WARNING_3 to INFINITY)
+ greyscale_colors = COLOR_RED
+ if(BODYTEMP_HEAT_WARNING_2 to BODYTEMP_HEAT_WARNING_3)
+ greyscale_colors = COLOR_ORANGE
+ if(BODYTEMP_HEAT_WARNING_1 to BODYTEMP_HEAT_WARNING_2)
+ greyscale_colors = COLOR_YELLOW
+ if(BODYTEMP_COLD_WARNING_1 to BODYTEMP_HEAT_WARNING_1)
+ greyscale_colors = COLOR_VIBRANT_LIME
+ if(BODYTEMP_COLD_WARNING_2 to BODYTEMP_COLD_WARNING_1)
+ greyscale_colors = COLOR_CYAN
+ if(BODYTEMP_COLD_WARNING_3 to BODYTEMP_COLD_WARNING_2)
+ greyscale_colors = COLOR_BLUE
+ else
+ greyscale_colors = COLOR_VIOLET
+
+ set_greyscale(colors=greyscale_colors)
+
+ if(panel_open)
+ icon_state = "thermo-open"
+ return ..()
+ if(on && is_operational)
+ if(skipping_work)
+ icon_state = "thermo_1_blinking"
+ else
+ icon_state = "thermo_1"
+ return ..()
+ icon_state = "thermo_base"
+ return ..()
+
+/obj/machinery/atmospherics/components/binary/thermomachine/update_overlays()
+ . = ..()
+ if(!initial(icon))
+ return
+ var/mutable_appearance/thermo_overlay = new(initial(icon))
+ . += get_pipe_image(thermo_overlay, "pipe", dir, COLOR_LIME, piping_layer)
+ . += get_pipe_image(thermo_overlay, "pipe", turn(dir, 180), COLOR_MOSTLY_PURE_RED, piping_layer)
+
+/obj/machinery/atmospherics/components/binary/thermomachine/examine(mob/user)
+ . = ..()
+ if(obj_flags & EMAGGED)
+ . += span_notice("Something seems wrong with [src]'s thermal safeties.")
+ . += span_notice("With the panel open:")
+ . += span_notice("-use a wrench with left-click to rotate [src] and right-click to unanchor it.")
+ . += span_notice("-use a multitool with left-click to change the piping layer and right-click to change the piping color.")
+ . += span_notice("The thermostat is set to [target_temperature]K ([(T0C-target_temperature)*-1]C).")
+ if(in_range(user, src) || isobserver(user))
+ . += span_notice("Heat capacity at [heat_capacity] Joules per Kelvin.")
+ . += span_notice("Temperature range [min_temperature]K - [max_temperature]K ([(T0C-min_temperature)*-1]C - [(T0C-max_temperature)*-1]C).")
+
+/obj/machinery/atmospherics/components/binary/thermomachine/AltClick(mob/living/user)
+ if(!can_interact(user))
+ return
+ target_temperature = T20C
+ investigate_log("was set to [target_temperature] K by [key_name(user)]", INVESTIGATE_ATMOS)
+ balloon_alert(user, "temperature reset to [target_temperature] K")
+
+/** Performs heat calculation for the freezer. The full equation for this whole process is:
+ * T3 = (C1*T1 + (C1*C2)/(C1+C2)*(T2-T1)*E) / C1.
+ * T4 = (C1*T1 - (C1*C2)/(C1+C2)*(T2-T1)*E + M) / C1.
+ * C1 is main port heat capacity, T1 is the temp.
+ * C2 and T2 is for the heat capacity of the freezer and temperature that we desire respectively.
+ * T3 is the temperature we get, T4 is the exchange target (heat reservoir).
+ * M is the motor heat.
+ * E is the efficiency variable. At E=1 and M=0 it works out to be ((C1*T1)+(C2*T2))/(C1+C2).
+ */
+/obj/machinery/atmospherics/components/binary/thermomachine/process_atmos()
+ if(!is_operational || !on) //if it has no power or its switched off, dont process atmos
+ on = FALSE
+ update_appearance()
+ return
+
+ var/turf/local_turf = get_turf(src)
+ if(!local_turf)
+ on = FALSE
+ update_appearance()
+ return
+
+ // The gas we want to cool/heat
+ var/datum/gas_mixture/main_port = airs[1]
+ var/datum/gas_mixture/exchange_target = airs[2]
+
+ // The difference between target and what we need to heat/cool. Positive if heating, negative if cooling.
+ var/temperature_target_delta = target_temperature - main_port.temperature
+
+ // This variable holds the (C1*C2)/(C1+C2)*(T2-T1) part of the equation.
+ var/heat_amount = temperature_target_delta * (main_port.heat_capacity() * heat_capacity / (main_port.heat_capacity() + heat_capacity))
+
+ // Motor heat is the heat added to both ports of the thermomachine at every tick.
+ var/motor_heat = 5000
+ if(abs(temperature_target_delta) < 5) //Allow the machine to work more finely on lower temperature differences.
+ motor_heat = 0
+
+ // Automatic Switching. Longer if check to prevent unecessary update_appearances.
+ if ((cooling && temperature_target_delta > 0) || (!cooling && temperature_target_delta < 0))
+ cooling = temperature_target_delta <= 0 // Thermomachines that reached the target will default to cooling.
+ update_appearance()
+
+ skipping_work = FALSE
+
+ if (main_port.total_moles() < 0.01)
+ skipping_work = TRUE
+ return
+
+ // Efficiency should be a proc level variable, but we need it for the ui.
+ // This is to reset the value when we are heating.
+ efficiency = 1
+
+ var/mole_efficiency = 1
+ var/mole_eff_main_port = 1
+ var/mole_eff_thermal_port = 1
+ if(cooling)
+ // Exchange target is the thing we are paired with, be it enviroment or the red port.
+ if(use_enviroment_heat)
+ exchange_target = local_turf.return_air()
+ else
+ exchange_target = airs[2]
+
+ if(exchange_target.total_moles() < 5)
+ mole_eff_thermal_port = 0.1
+ else
+ mole_eff_thermal_port = max(1 - (1 / (exchange_target.total_moles() + 1)) * 5, 0.1)
+
+ if(main_port.total_moles() < 5)
+ mole_eff_main_port = 0.1
+ else
+ mole_eff_main_port = max(1 - (1 / (main_port.total_moles() + 1)) * 5, 0.1)
+
+ mole_efficiency = min(mole_eff_main_port, mole_eff_thermal_port)
+
+ if(cooling)
+ if (exchange_target.total_moles() < 0.01)
+ skipping_work = TRUE
+ return
+
+ // The hotter the heat reservoir is, the larger the malus.
+ var/temperature_exchange_delta = exchange_target.temperature - main_port.temperature
+ // Log 1 is already 0, going any lower will result in a negative number.
+ efficiency = clamp(1 - log(10, max(1, temperature_exchange_delta)) * 0.08, 0.65, 1)
+ // We take an extra efficiency malus for enviroments where the mol is too low.
+ // Cases of log(0) will be caught by the early return above.
+ if (use_enviroment_heat)
+ efficiency *= clamp(log(1.55, exchange_target.total_moles()) * 0.15, 0.65, 1)
+
+ efficiency *= mole_efficiency
+ efficiency = max(efficiency, parts_efficiency)
+
+ if (exchange_target.temperature > THERMOMACHINE_SAFE_TEMPERATURE && safeties)
+ on = FALSE
+ visible_message(span_warning("The heat reservoir has reached critical levels, shutting down..."))
+ update_appearance()
+ return
+
+ else if(exchange_target.temperature > THERMOMACHINE_SAFE_TEMPERATURE && !safeties)
+ if((REALTIMEOFDAY - lastwarning) / 5 >= WARNING_DELAY)
+ lastwarning = REALTIMEOFDAY
+ visible_message(span_warning("The heat reservoir has reached critical levels!"))
+ if(check_explosion(exchange_target.temperature))
+ explode()
+ return PROCESS_KILL //We're dying anyway, so let's stop processing
+
+ exchange_target.temperature = max((THERMAL_ENERGY(exchange_target) - (heat_amount * efficiency) + motor_heat) / exchange_target.heat_capacity(), TCMB)
+
+ if(!cooling)
+ efficiency *= mole_efficiency
+ efficiency = max(efficiency, parts_efficiency)
+
+ main_port.temperature = max((THERMAL_ENERGY(main_port) + (heat_amount * efficiency)) / main_port.heat_capacity(), TCMB)
+
+ heat_amount = min(abs(heat_amount), 1e8) * THERMOMACHINE_POWER_CONVERSION
+ var/power_usage = 0
+ var/power_efficiency = max(efficiency, 0.4)
+ if(abs(temperature_target_delta) > 1)
+ power_usage = (heat_amount * 0.05 + idle_power_usage) ** (1.05 - (5e7 * power_efficiency) / (max(5e7, heat_amount)))
+ else
+ power_usage = idle_power_usage
+
+ use_power(power_usage)
+ update_appearance()
+ update_parents()
+
+/obj/machinery/atmospherics/components/binary/thermomachine/attackby(obj/item/item, mob/user, params)
+ if(!on && item.tool_behaviour == TOOL_SCREWDRIVER)
+ if(!anchored)
+ to_chat(user, span_notice("Anchor [src] first!"))
+ return
+ if(default_deconstruction_screwdriver(user, "thermo-open", "thermo-0", item))
+ change_pipe_connection(panel_open)
+ return
+ if(default_change_direction_wrench(user, item))
+ return
+ if(default_deconstruction_crowbar(item))
+ return
+
+ if(panel_open && item.tool_behaviour == TOOL_MULTITOOL)
+ piping_layer = (piping_layer >= PIPING_LAYER_MAX) ? PIPING_LAYER_MIN : (piping_layer + 1)
+ to_chat(user, span_notice("You change the circuitboard to layer [piping_layer]."))
+ update_appearance()
+ return
+ return ..()
+
+/obj/machinery/atmospherics/components/binary/thermomachine/default_change_direction_wrench(mob/user, obj/item/I)
+ if(!..())
+ return FALSE
+ set_init_directions()
+ update_appearance()
+ return TRUE
+
+/obj/machinery/atmospherics/components/binary/thermomachine/proc/change_pipe_connection(disconnect)
+ if(disconnect)
+ disconnect_pipes()
+ return
+ connect_pipes()
+
+/obj/machinery/atmospherics/components/binary/thermomachine/proc/connect_pipes()
+ var/obj/machinery/atmospherics/node1 = nodes[1]
+ var/obj/machinery/atmospherics/node2 = nodes[2]
+ atmos_init()
+ node1 = nodes[1]
+ if(node1)
+ node1.atmos_init()
+ node1.add_member(src)
+ node2 = nodes[2]
+ if(node2)
+ node2.atmos_init()
+ node2.add_member(src)
+ SSair.add_to_rebuild_queue(src)
+
+/obj/machinery/atmospherics/components/binary/thermomachine/proc/disconnect_pipes()
+ var/obj/machinery/atmospherics/node1 = nodes[1]
+ var/obj/machinery/atmospherics/node2 = nodes[2]
+ 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(node2)
+ if(src in node2.nodes) //Only if it's actually connected. On-pipe version would is one-sided.
+ node2.disconnect(src)
+ nodes[2] = null
+ if(parents[1])
+ nullify_pipenet(parents[1])
+ if(parents[2])
+ nullify_pipenet(parents[2])
+
+/obj/machinery/atmospherics/components/binary/thermomachine/attackby_secondary(obj/item/item, mob/user, params)
+ . = ..()
+ if(panel_open && item.tool_behaviour == TOOL_WRENCH && !check_pipe_on_turf())
+ if(default_unfasten_wrench(user, item))
+ return SECONDARY_ATTACK_CONTINUE_CHAIN
+ if(panel_open && item.tool_behaviour == TOOL_MULTITOOL)
+ color_index = (color_index >= GLOB.pipe_paint_colors.len) ? (color_index = 1) : (color_index = 1 + color_index)
+ pipe_color = GLOB.pipe_paint_colors[GLOB.pipe_paint_colors[color_index]]
+ visible_message("You set [src] pipe color to [GLOB.pipe_color_name[pipe_color]].")
+ update_appearance()
+ return SECONDARY_ATTACK_CONTINUE_CHAIN
+ return SECONDARY_ATTACK_CONTINUE_CHAIN
+
+/obj/machinery/atmospherics/components/binary/thermomachine/proc/check_pipe_on_turf()
+ for(var/obj/machinery/atmospherics/device in get_turf(src))
+ if(device == src)
+ continue
+ if(device.piping_layer == piping_layer)
+ visible_message(span_warning("A pipe is hogging the ports, remove the obstruction or change the machine piping layer."))
+ return TRUE
+ return FALSE
+
+/obj/machinery/atmospherics/components/binary/thermomachine/multitool_act(mob/living/user, obj/item/multitool/multitool)
+ if(!istype(multitool))
+ return
+ if(panel_open && !anchored)
+ piping_layer = (piping_layer >= PIPING_LAYER_MAX) ? PIPING_LAYER_MIN : (piping_layer + 1)
+ to_chat(user, span_notice("You change the circuitboard to layer [piping_layer]."))
+ update_appearance()
+
+/obj/machinery/atmospherics/components/binary/thermomachine/emag_act(mob/user)
+ . = ..()
+ if(!(obj_flags & EMAGGED))
+ if(!do_after(user, 1 SECONDS, src))
+ return
+ var/datum/effect_system/spark_spread/sparks = new
+ sparks.set_up(5, 0, src)
+ sparks.attach(src)
+ sparks.start()
+ obj_flags |= EMAGGED
+ user.visible_message(span_warning("You emag [src], overwriting thermal safety restrictions."))
+ log_game("[key_name(user)] emagged [src] at [AREACOORD(src)], overwriting thermal safety restrictions.")
+
+/obj/machinery/atmospherics/components/binary/thermomachine/emp_act()
+ . = ..()
+ if(!(obj_flags & EMAGGED))
+ var/datum/effect_system/spark_spread/sparks = new
+ sparks.set_up(5, 0, src)
+ sparks.attach(src)
+ sparks.start()
+ obj_flags |= EMAGGED
+ safeties = FALSE
+
+/obj/machinery/atmospherics/components/binary/thermomachine/proc/check_explosion(temperature)
+ if(temperature < THERMOMACHINE_SAFE_TEMPERATURE + 2000)
+ return FALSE
+ if(prob(log(6, temperature) * 10)) //75% at 500000, 100% at 1e8
+ return TRUE
+
+/obj/machinery/atmospherics/components/binary/thermomachine/proc/explode()
+ explosion(loc, 0, 0, 3, 3, TRUE, explosion_cause = src)
+ var/datum/gas_mixture/main_port = airs[1]
+ var/datum/gas_mixture/exchange_target = airs[2]
+ if(main_port)
+ loc.assume_air(main_port.remove_ratio(1))
+ if(exchange_target)
+ loc.assume_air(exchange_target.remove_ratio(1))
+ qdel(src)
+
+/obj/machinery/atmospherics/components/binary/thermomachine/ui_status(mob/user)
+ if(interactive)
+ return ..()
+ return UI_CLOSE
+
+/obj/machinery/atmospherics/components/binary/thermomachine/ui_interact(mob/user, datum/tgui/ui)
+ if(panel_open)
+ return
+ ui = SStgui.try_update_ui(user, src, ui)
+ if(!ui)
+ ui = new(user, src, "ThermoMachine", name)
+ ui.open()
+
+/obj/machinery/atmospherics/components/binary/thermomachine/ui_data(mob/user)
+ var/list/data = list()
+ data["on"] = on
+ data["cooling"] = cooling
+
+ data["min"] = min_temperature
+ data["max"] = max_temperature
+ data["target"] = target_temperature
+ data["initial"] = initial(target_temperature)
+
+ var/datum/gas_mixture/air1 = airs[1]
+ data["temperature"] = air1.temperature
+ data["pressure"] = air1.return_pressure()
+ data["efficiency"] = efficiency
+
+ data["use_env_heat"] = use_enviroment_heat
+ data["skipping_work"] = skipping_work
+ data["safeties"] = safeties
+ var/hacked = (obj_flags & EMAGGED) ? TRUE : FALSE
+ data["hacked"] = hacked
+ return data
+
+/obj/machinery/atmospherics/components/binary/thermomachine/ui_act(action, params)
+ . = ..()
+ if(.)
+ return
+
+ switch(action)
+ if("power")
+ on = !on
+ update_use_power(on ? ACTIVE_POWER_USE : IDLE_POWER_USE)
+ investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS)
+ . = TRUE
+ if("cooling")
+ cooling = !cooling
+ investigate_log("was changed to [cooling ? "cooling" : "heating"] by [key_name(usr)]", INVESTIGATE_ATMOS)
+ . = TRUE
+ if("target")
+ var/target = params["target"]
+ var/adjust = text2num(params["adjust"])
+ if(target == "input")
+ target = input("Set new target ([min_temperature]-[max_temperature] K):", name, target_temperature) as num|null
+ if(!isnull(target))
+ . = TRUE
+ else if(adjust)
+ target = target_temperature + adjust
+ . = TRUE
+ else if(text2num(target) != null)
+ target = text2num(target)
+ . = TRUE
+ if(.)
+ target_temperature = clamp(target, min_temperature, max_temperature)
+ investigate_log("was set to [target_temperature] K by [key_name(usr)]", INVESTIGATE_ATMOS)
+ if("use_env_heat")
+ use_enviroment_heat = !use_enviroment_heat
+ . = TRUE
+ if("safeties")
+ safeties = !safeties
+ investigate_log("[key_name(usr)] turned off the [src] safeties", INVESTIGATE_ATMOS)
+ . = TRUE
+
+ update_appearance()
+
+/obj/machinery/atmospherics/components/binary/thermomachine/CtrlClick(mob/living/user)
+ if(!panel_open)
+ if(!can_interact(user))
+ return
+ on = !on
+ investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS)
+ update_appearance()
+ return
+ . = ..()
+
+/obj/machinery/atmospherics/components/binary/thermomachine/freezer
+ cooling = TRUE
+
+/obj/machinery/atmospherics/components/binary/thermomachine/freezer/on
+ on = TRUE
+ icon_state = "thermo_base_1"
+
+/obj/machinery/atmospherics/components/binary/thermomachine/freezer/on/Initialize(mapload)
+ . = ..()
+ if(target_temperature == initial(target_temperature))
+ target_temperature = min_temperature
+
+/obj/machinery/atmospherics/components/binary/thermomachine/freezer/on/coldroom
+ name = "Cold room temperature control unit"
+ icon_state = "thermo_base_1"
+ greyscale_colors = COLOR_CYAN
+ cooling = TRUE
+
+/obj/machinery/atmospherics/components/binary/thermomachine/freezer/on/coldroom/Initialize(mapload)
+ . = ..()
+ target_temperature = COLD_ROOM_TEMP
+
+/obj/machinery/atmospherics/components/binary/thermomachine/heater
+ cooling = FALSE
+
+/obj/machinery/atmospherics/components/binary/thermomachine/heater/on
+ on = TRUE
+ icon_state = "thermo_base_1"
+
+#undef THERMOMACHINE_SAFE_TEMPERATURE
+#undef THERMOMACHINE_POWER_CONVERSION
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm
index ba1d7403ea844..7465d3b5cb5e9 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm
@@ -52,6 +52,16 @@ It's like a regular ol' straight pipe, but you can turn it on and off.
update_icon_nopipes()
investigate_log("was closed by [usr ? key_name(usr) : "a remote signal"]", INVESTIGATE_ATMOS)
+
+// 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/interact(mob/user)
add_fingerprint(usr)
if(switching)
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 84c0a789aa97c..61d7198b395c5 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
@@ -95,6 +95,11 @@
if(overclocked)
. += "Its warning light is on[on ? " and it's spewing gas!" : "."]"
+/**
+ * Called in atmos_init(), used to change or remove the radio frequency from the component
+ * Arguments:
+ * * -new_frequency: the frequency that should be used for the radio to attach to the component, use 0 to remove the radio
+ */
/obj/machinery/atmospherics/components/binary/volume_pump/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
frequency = new_frequency
@@ -103,7 +108,6 @@
/obj/machinery/atmospherics/components/binary/volume_pump/proc/broadcast_status()
if(!radio_connection)
- return
var/datum/signal/signal = new(list(
"tag" = id,
@@ -132,7 +136,7 @@
return data
/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 b3ee7f4893b7e..7f683b8b210c8 100644
--- a/code/modules/atmospherics/machinery/components/components_base.dm
+++ b/code/modules/atmospherics/machinery/components/components_base.dm
@@ -23,9 +23,11 @@
..()
for(var/i in 1 to device_type)
- var/datum/gas_mixture/A = new
- A.volume = 200
- airs[i] = A
+ if(airs[i])
+ continue
+ var/datum/gas_mixture/component_mixture = new
+ component_mixture.volume = 200
+ airs[i] = component_mixture
/obj/machinery/atmospherics/components/Initialize()
. = ..()
@@ -93,8 +95,8 @@
/obj/machinery/atmospherics/components/nullify_node(i)
if(parents[i])
- nullifyPipenet(parents[i])
- QDEL_NULL(airs[i])
+ nullify_pipenet(parents[i])
+ airs[i] = null
return ..()
/obj/machinery/atmospherics/components/on_construction()
@@ -120,9 +122,9 @@
* Arguments:
* * -reference: the pipeline the component is attached to
*/
-/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)]")
+ CRASH("nullify_pipenet(null) called by [type] on [COORD(src)]")
for (var/i in 1 to parents.len)
if (parents[i] == reference)
@@ -141,10 +143,10 @@
if(!length(reference.other_atmos_machines) && !length(reference.members))
if(QDESTROYING(reference))
- CRASH("nullifyPipenet() called on qdeleting [reference]")
+ CRASH("nullify_pipenet() called on qdeleting [reference]")
qdel(reference)
-/obj/machinery/atmospherics/components/return_pipenetAirs(datum/pipeline/reference)
+/obj/machinery/atmospherics/components/return_pipenet_airs(datum/pipeline/reference)
var/list/returned_air = list()
for (var/i in 1 to parents.len)
@@ -157,11 +159,11 @@
return list(nodes[parents.Find(reference)])
return ..()
-/obj/machinery/atmospherics/components/set_pipenet(datum/pipeline/reference, obj/machinery/atmospherics/A)
- parents[nodes.Find(A)] = reference
+/obj/machinery/atmospherics/components/set_pipenet(datum/pipeline/reference, obj/machinery/atmospherics/target_component)
+ parents[nodes.Find(target_component)] = reference
-/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/return_pipenet(obj/machinery/atmospherics/target_component = nodes[1]) //returns parents[1] if called without argument
+ return parents[nodes.Find(target_component)]
/obj/machinery/atmospherics/components/replace_pipenet(datum/pipeline/Old, datum/pipeline/New)
parents[parents.Find(Old)] = New
@@ -169,11 +171,11 @@
/obj/machinery/atmospherics/components/unsafe_pressure_release(mob/user, pressures)
. = ..()
- var/turf/T = get_turf(src)
- if(!T)
+ var/turf/current_turf = get_turf(src)
+ if(!current_turf)
return
//Remove the gas from airs and assume it
- var/datum/gas_mixture/environment = T.return_air()
+ var/datum/gas_mixture/environment = current_turf.return_air()
var/lost = null
var/times_lost = 0
for(var/i in 1 to device_type)
@@ -189,8 +191,7 @@
to_release = air.remove(shared_loss)
continue
to_release.merge(air.remove(shared_loss))
- T.assume_air(to_release)
- air_update_turf(FALSE, FALSE)
+ current_turf.assume_air(to_release)
// Helpers
@@ -217,6 +218,11 @@
for(var/i in 1 to device_type)
. += return_pipenet(nodes[i])
+/// When this machine is in a pipenet that is reconciling airs, this proc can add airs to the calculation.
+/// Can be either a list of airs or a single air mix.
+/obj/machinery/atmospherics/components/proc/return_airs_for_reconcilation(datum/pipeline/requester)
+ return list()
+
// UI Stuff
/obj/machinery/atmospherics/components/ui_status(mob/user)
diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm
new file mode 100644
index 0000000000000..5ea71e5933a38
--- /dev/null
+++ b/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm
@@ -0,0 +1,503 @@
+/**
+ * This file contain the eight parts surrounding the main core, those are: fuel input, moderator input, waste output, interface and the corners
+ * The file also contain the guicode of the machine
+ */
+/obj/machinery/atmospherics/components/unary/hypertorus
+ icon = 'icons/obj/atmospherics/components/hypertorus.dmi'
+ icon_state = "core"
+
+ name = "thermomachine"
+ desc = "Heats or cools gas in connected pipes."
+ anchored = TRUE
+ density = TRUE
+ resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF
+ layer = OBJ_LAYER
+ pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY
+ circuit = /obj/item/circuitboard/machine/thermomachine
+ ///Vars for the state of the icon of the object (open, off, active)
+ var/icon_state_open
+ var/icon_state_off
+ var/icon_state_active
+ ///Check if the machine has been activated
+ var/active = FALSE
+ ///Check if fusion has started
+ var/fusion_started = FALSE
+ ///Check if the machine is cracked open
+ var/cracked = FALSE
+
+/obj/machinery/atmospherics/components/unary/hypertorus/Initialize(mapload)
+ . = ..()
+ initialize_directions = dir
+
+/obj/machinery/atmospherics/components/unary/hypertorus/examine(mob/user)
+ . = ..()
+ . += span_notice("[src] can be rotated by first opening the panel with a screwdriver and then using a wrench on it.")
+
+/obj/machinery/atmospherics/components/unary/hypertorus/attackby(obj/item/I, mob/user, params)
+ if(!fusion_started)
+ if(default_deconstruction_screwdriver(user, icon_state_open, icon_state_off, I))
+ return
+ if(default_change_direction_wrench(user, I))
+ return
+ if(default_deconstruction_crowbar(I))
+ return
+ return ..()
+
+/obj/machinery/atmospherics/components/unary/hypertorus/welder_act(mob/living/user, obj/item/tool)
+ if(!cracked)
+ return FALSE
+ if(user.combat_mode)
+ return FALSE
+ balloon_alert(user, "You start repairing the crack...")
+ if(tool.use_tool(src, user, 10 SECONDS, volume=30, amount=5))
+ balloon_alert(user, "You repaired the crack.")
+ cracked = FALSE
+ update_appearance()
+
+/obj/machinery/atmospherics/components/unary/hypertorus/default_change_direction_wrench(mob/user, obj/item/I)
+ . = ..()
+ if(.)
+ set_init_directions()
+ var/obj/machinery/atmospherics/node = nodes[1]
+ if(node)
+ node.disconnect(src)
+ nodes[1] = null
+ if(parents[1])
+ nullify_pipenet(parents[1])
+ atmos_init()
+ node = nodes[1]
+ if(node)
+ node.atmos_init()
+ node.add_member(src)
+ SSair.add_to_rebuild_queue(src)
+
+/obj/machinery/atmospherics/components/unary/hypertorus/update_icon_state()
+ if(panel_open)
+ icon_state = icon_state_open
+ return ..()
+ if(active)
+ icon_state = icon_state_active
+ return ..()
+ icon_state = icon_state_off
+ return ..()
+
+/obj/machinery/atmospherics/components/unary/hypertorus/update_overlays()
+ . = ..()
+ if(!cracked)
+ return
+ var/image/crack = image(icon, icon_state = "crack")
+ crack.dir = dir
+ . += crack
+
+/obj/machinery/atmospherics/components/unary/hypertorus/fuel_input
+ name = "HFR fuel input port"
+ desc = "Input port for the Hypertorus Fusion Reactor, designed to take in only Hydrogen and Tritium in gas forms."
+ icon_state = "fuel_input_off"
+ icon_state_open = "fuel_input_open"
+ icon_state_off = "fuel_input_off"
+ icon_state_active = "fuel_input_active"
+ circuit = /obj/item/circuitboard/machine/HFR_fuel_input
+
+/obj/machinery/atmospherics/components/unary/hypertorus/waste_output
+ name = "HFR waste output port"
+ desc = "Waste port for the Hypertorus Fusion Reactor, designed to output the hot waste gases coming from the core of the machine."
+ icon_state = "waste_output_off"
+ icon_state_open = "waste_output_open"
+ icon_state_off = "waste_output_off"
+ icon_state_active = "waste_output_active"
+ circuit = /obj/item/circuitboard/machine/HFR_waste_output
+
+/obj/machinery/atmospherics/components/unary/hypertorus/moderator_input
+ name = "HFR moderator input port"
+ desc = "Moderator port for the Hypertorus Fusion Reactor, designed to move gases inside the machine to cool and control the flow of the reaction."
+ icon_state = "moderator_input_off"
+ icon_state_open = "moderator_input_open"
+ icon_state_off = "moderator_input_off"
+ icon_state_active = "moderator_input_active"
+ circuit = /obj/item/circuitboard/machine/HFR_moderator_input
+
+/*
+* Interface and corners
+*/
+/obj/machinery/hypertorus
+ name = "hypertorus_core"
+ desc = "hypertorus_core"
+ icon = 'icons/obj/atmospherics/components/hypertorus.dmi'
+ icon_state = "core"
+ move_resist = INFINITY
+ anchored = TRUE
+ density = TRUE
+ resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF
+ power_channel = AREA_USAGE_ENVIRON
+ var/active = FALSE
+ var/icon_state_open
+ var/icon_state_off
+ var/icon_state_active
+ var/fusion_started = FALSE
+
+/obj/machinery/hypertorus/examine(mob/user)
+ . = ..()
+ . += span_notice("[src] can be rotated by first opening the panel with a screwdriver and then using a wrench on it.")
+
+/obj/machinery/hypertorus/attackby(obj/item/I, mob/user, params)
+ if(!fusion_started)
+ if(default_deconstruction_screwdriver(user, icon_state_open, icon_state_off, I))
+ return
+ if(default_change_direction_wrench(user, I))
+ return
+ if(default_deconstruction_crowbar(I))
+ return
+ return ..()
+
+/obj/machinery/hypertorus/update_icon_state()
+ if(panel_open)
+ icon_state = icon_state_open
+ return ..()
+ if(active)
+ icon_state = icon_state_active
+ return ..()
+ icon_state = icon_state_off
+ return ..()
+
+/obj/machinery/hypertorus/interface
+ name = "HFR interface"
+ desc = "Interface for the HFR to control the flow of the reaction."
+ icon_state = "interface_off"
+ circuit = /obj/item/circuitboard/machine/HFR_interface
+ var/obj/machinery/atmospherics/components/unary/hypertorus/core/connected_core
+ icon_state_off = "interface_off"
+ icon_state_open = "interface_open"
+ icon_state_active = "interface_active"
+
+/obj/machinery/hypertorus/interface/Destroy()
+ if(connected_core)
+ connected_core = null
+ return..()
+
+/obj/machinery/hypertorus/interface/multitool_act(mob/living/user, obj/item/I)
+ . = ..()
+ var/turf/T = get_step(src,turn(dir,180))
+ var/obj/machinery/atmospherics/components/unary/hypertorus/core/centre = locate() in T
+
+ if(!centre || !centre.check_part_connectivity())
+ to_chat(user, span_notice("Check all parts and then try again."))
+ return TRUE
+ new/obj/item/paper/guides/jobs/atmos/hypertorus(loc)
+ connected_core = centre
+
+ connected_core.activate(user)
+ return TRUE
+
+/obj/machinery/hypertorus/interface/ui_interact(mob/user, datum/tgui/ui)
+ if(active)
+ ui = SStgui.try_update_ui(user, src, ui)
+ if(!ui)
+ ui = new(user, src, "Hypertorus", name)
+ ui.open()
+ else
+ to_chat(user, span_notice("Activate the machine first by using a multitool on the interface."))
+
+/obj/machinery/hypertorus/interface/ui_static_data()
+ var/data = list()
+ data["selected_fuel"] = list(list("name" = "Nothing", "id" = null))
+ for(var/path in GLOB.hfr_fuels_list)
+ var/datum/hfr_fuel/recipe = GLOB.hfr_fuels_list[path]
+ data["selected_fuel"] += list(list("name" = recipe.name, "id" = recipe.id))
+ return data
+
+/obj/machinery/hypertorus/interface/ui_data()
+ var/data = list()
+
+ if(connected_core.selected_fuel)
+ data["selected"] = connected_core.selected_fuel.id
+ else
+ data["selected"] = ""
+
+ var/list/product_gases
+ if(!connected_core.selected_fuel)
+ product_gases = list("Select a fuel mix to see the output")
+ else
+ product_gases = list("The [connected_core.selected_fuel.name] mix will produce the following gases:")
+ for(var/gas_type in connected_core.selected_fuel.secondary_products)
+ var/datum/gas/gas_produced = gas_type
+ product_gases += "-[initial(gas_produced.name)]"
+ var/minimum_temp = connected_core.selected_fuel.negative_temperature_multiplier < 1 ? "Decrease" : "Increase"
+ var/maximum_temp = connected_core.selected_fuel.positive_temperature_multiplier < 1 ? "Decrease" : "Increase"
+ var/energy = connected_core.selected_fuel.energy_concentration_multiplier > 1 ? "Decrease" : "Increase"
+ var/fuel_consumption = connected_core.selected_fuel.fuel_consumption_multiplier < 1 ? "Decrease" : "Increase"
+ var/fuel_production = connected_core.selected_fuel.gas_production_multiplier < 1 ? "Decrease" : "Increase"
+ product_gases += "The fuel mix will"
+ product_gases += "-[minimum_temp] the maximum cooling by a factor of [connected_core.selected_fuel.negative_temperature_multiplier]"
+ product_gases += "-[maximum_temp] the maximum heating by a factor of [connected_core.selected_fuel.positive_temperature_multiplier]"
+ product_gases += "-[energy] the energy output consumption by a factor of [1 / connected_core.selected_fuel.energy_concentration_multiplier]"
+ product_gases += "-[fuel_consumption] the fuel consumption by a factor of [connected_core.selected_fuel.fuel_consumption_multiplier]"
+ product_gases += "-[fuel_production] the gas production by a factor of [connected_core.selected_fuel.gas_production_multiplier]"
+ product_gases += "-Maximum fusion temperature with this mix: [FUSION_MAXIMUM_TEMPERATURE * connected_core.selected_fuel.temperature_change_multiplier] K."
+
+ data["product_gases"] = product_gases.Join("\n")
+
+ //Internal Fusion gases
+ var/list/fusion_gasdata = list()
+ if(connected_core.internal_fusion.total_moles())
+ for(var/gasid in connected_core.internal_fusion.gases)
+ fusion_gasdata.Add(list(list(
+ "name"= connected_core.internal_fusion.gases[gasid][GAS_META][META_GAS_NAME],
+ "amount" = round(connected_core.internal_fusion.gases[gasid][MOLES], 0.01),
+ )))
+ else
+ for(var/gasid in connected_core.internal_fusion.gases)
+ fusion_gasdata.Add(list(list(
+ "name"= connected_core.internal_fusion.gases[gasid][GAS_META][META_GAS_NAME],
+ "amount" = 0,
+ )))
+ //Moderator gases
+ var/list/moderator_gasdata = list()
+ if(connected_core.moderator_internal.total_moles())
+ for(var/gasid in connected_core.moderator_internal.gases)
+ moderator_gasdata.Add(list(list(
+ "name"= connected_core.moderator_internal.gases[gasid][GAS_META][META_GAS_NAME],
+ "amount" = round(connected_core.moderator_internal.gases[gasid][MOLES], 0.01),
+ )))
+ else
+ for(var/gasid in connected_core.moderator_internal.gases)
+ moderator_gasdata.Add(list(list(
+ "name"= connected_core.moderator_internal.gases[gasid][GAS_META][META_GAS_NAME],
+ "amount" = 0,
+ )))
+
+ data["fusion_gases"] = fusion_gasdata
+ data["moderator_gases"] = moderator_gasdata
+
+ data["energy_level"] = connected_core.energy
+ data["heat_limiter_modifier"] = connected_core.heat_limiter_modifier
+ data["heat_output"] = abs(connected_core.heat_output)
+ data["heat_output_bool"] = connected_core.heat_output >= 0 ? "" : "-"
+
+ data["heating_conductor"] = connected_core.heating_conductor
+ data["magnetic_constrictor"] = connected_core.magnetic_constrictor
+ data["fuel_injection_rate"] = connected_core.fuel_injection_rate
+ data["moderator_injection_rate"] = connected_core.moderator_injection_rate
+ data["current_damper"] = connected_core.current_damper
+
+ data["power_level"] = connected_core.power_level
+ data["iron_content"] = connected_core.iron_content
+ data["integrity"] = connected_core.get_integrity_percent()
+
+ data["start_power"] = connected_core.start_power
+ data["start_cooling"] = connected_core.start_cooling
+ data["start_fuel"] = connected_core.start_fuel
+ data["start_moderator"] = connected_core.start_moderator
+
+ data["internal_fusion_temperature"] = connected_core.fusion_temperature
+ data["moderator_internal_temperature"] = connected_core.moderator_temperature
+ data["internal_output_temperature"] = connected_core.output_temperature
+ data["internal_coolant_temperature"] = connected_core.coolant_temperature
+
+ data["waste_remove"] = connected_core.waste_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)))
+
+ data["cooling_volume"] = connected_core.airs[1].volume
+ data["mod_filtering_rate"] = connected_core.moderator_filtering_rate
+
+ return data
+
+/obj/machinery/hypertorus/interface/ui_act(action, params)
+ . = ..()
+ if(.)
+ return
+ switch(action)
+ if("start_power")
+ connected_core.start_power = !connected_core.start_power
+ connected_core.update_use_power(connected_core.start_power ? ACTIVE_POWER_USE : IDLE_POWER_USE)
+ . = TRUE
+ if("start_cooling")
+ connected_core.start_cooling = !connected_core.start_cooling
+ . = TRUE
+ if("start_fuel")
+ connected_core.start_fuel = !connected_core.start_fuel
+ . = TRUE
+ if("start_moderator")
+ connected_core.start_moderator = !connected_core.start_moderator
+ . = TRUE
+ if("heating_conductor")
+ var/heating_conductor = text2num(params["heating_conductor"])
+ if(heating_conductor != null)
+ connected_core.heating_conductor = clamp(heating_conductor, 50, 500)
+ . = TRUE
+ if("magnetic_constrictor")
+ var/magnetic_constrictor = text2num(params["magnetic_constrictor"])
+ if(magnetic_constrictor != null)
+ connected_core.magnetic_constrictor = clamp(magnetic_constrictor, 50, 1000)
+ . = TRUE
+ if("fuel_injection_rate")
+ var/fuel_injection_rate = text2num(params["fuel_injection_rate"])
+ if(fuel_injection_rate != null)
+ connected_core.fuel_injection_rate = clamp(fuel_injection_rate, 0.5, 150)
+ . = TRUE
+ if("moderator_injection_rate")
+ var/moderator_injection_rate = text2num(params["moderator_injection_rate"])
+ if(moderator_injection_rate != null)
+ connected_core.moderator_injection_rate = clamp(moderator_injection_rate, 0.5, 150)
+ . = TRUE
+ if("current_damper")
+ var/current_damper = text2num(params["current_damper"])
+ if(current_damper != null)
+ connected_core.current_damper = clamp(current_damper, 0, 1000)
+ . = TRUE
+ if("waste_remove")
+ connected_core.waste_remove = !connected_core.waste_remove
+ . = TRUE
+ if("filter")
+ connected_core.moderator_scrubbing ^= gas_id2path(params["mode"])
+ . = TRUE
+ if("mod_filtering_rate")
+ var/mod_filtering_rate = text2num(params["mod_filtering_rate"])
+ if(mod_filtering_rate != null)
+ connected_core.moderator_filtering_rate = clamp(mod_filtering_rate, 5, 200)
+ . = TRUE
+ if("fuel")
+ connected_core.selected_fuel = null
+ var/fuel_mix = "nothing"
+ var/datum/hfr_fuel/fuel = null
+ if(params["mode"] != "")
+ fuel = GLOB.hfr_fuels_list[params["mode"]]
+ if(fuel)
+ connected_core.selected_fuel = fuel
+ fuel_mix = fuel.name
+ if(connected_core.internal_fusion.total_moles())
+ connected_core.dump_gases()
+ connected_core.update_parents() //prevent the machine from stopping because of the recipe change and the pipenet not updating
+ connected_core.linked_input.update_parents()
+ connected_core.linked_output.update_parents()
+ connected_core.linked_moderator.update_parents()
+ investigate_log("was set to recipe [fuel_mix ? fuel_mix : "null"] by [key_name(usr)]", INVESTIGATE_ATMOS)
+ . = TRUE
+ if("cooling_volume")
+ var/cooling_volume = text2num(params["cooling_volume"])
+ if(cooling_volume != null)
+ connected_core.airs[1].volume = clamp(cooling_volume, 50, 2000)
+ . = TRUE
+
+/obj/machinery/hypertorus/corner
+ name = "HFR corner"
+ desc = "Structural piece of the machine."
+ icon_state = "corner_off"
+ circuit = /obj/item/circuitboard/machine/HFR_corner
+ icon_state_off = "corner_off"
+ icon_state_open = "corner_open"
+ icon_state_active = "corner_active"
+ dir = SOUTHEAST
+
+/obj/item/paper/guides/jobs/atmos/hypertorus
+ name = "paper- 'Quick guide to safe handling of the HFR'"
+ info = "How to safely(TM) operate the Hypertorus \
+ -Build the machine as it�s shown in the main guide. \
+ -Make a 50/50 gasmix of tritium and hydrogen totalling around 2000 moles. \
+ -Start the machine, fill up the cooling loop with plasma/hypernoblium and use space or freezers to cool it. \
+ -Connect the fuel mix into the fuel injector port, allow only 1000 moles into the machine to ease the kickstart of the reaction \
+ -Set the Heat conductor to 500 when starting the reaction, reset it to 100 when power level is higher than 1 \
+ -In the event of a meltdown, set the heat conductor to max and set the current damper to max. Set the fuel injection to min. \
+ If the heat output doesn�t go negative, try changing the magnetic costrictors untill heat output goes negative. \
+ Make the cooling stronger, put high heat capacity gases inside the moderator (hypernoblium will help dealing with the problem)
\
+ Warnings: \
+ -You cannot dismantle the machine if the power level is over 0 \
+ -You cannot power of the machine if the power level is over 0 \
+ -You cannot dispose of waste gases if power level is over 5 \
+ -You cannot remove gases from the fusion mix if they are not helium and antinoblium \
+ -Hypernoblium will decrease the power of the mix by a lot \
+ -Antinoblium will INCREASE the power of the mix by a lot more \
+ -High heat capacity gases are harder to heat/cool \
+ -Low heat capacity gases are easier to heat/cool \
+ -The machine consumes 50 KW per power level, reaching 350 KW at power level 6 so prepare the SM accordingly \
+ -In case of a power shortage, the fusion reaction will CONTINUE but the cooling will STOP
\
+ The writer of the quick guide will not be held responsible for misuses and meltdown caused by the use of the guide, \
+ use more advanced guides to understando how the various gases will act as moderators."
+
+/obj/item/hfr_box
+ name = "HFR box"
+ desc = "If you see this, call the police."
+ icon = 'icons/obj/atmospherics/components/hypertorus.dmi'
+ icon_state = "box"
+ ///What kind of box are we handling?
+ var/box_type = "impossible"
+ ///What's the path of the machine we making
+ var/part_path
+
+/obj/item/hfr_box/corner
+ name = "HFR box corner"
+ desc = "Place this as the corner of your 3x3 multiblock fusion reactor"
+ icon_state = "box_corner"
+ box_type = "corner"
+ part_path = /obj/machinery/hypertorus/corner
+
+/obj/item/hfr_box/body
+ name = "HFR box body"
+ desc = "Place this on the sides of the core box of your 3x3 multiblock fusion reactor"
+ box_type = "body"
+ icon_state = "box_body"
+
+/obj/item/hfr_box/body/fuel_input
+ name = "HFR box fuel input"
+ part_path = /obj/machinery/atmospherics/components/unary/hypertorus/fuel_input
+
+/obj/item/hfr_box/body/moderator_input
+ name = "HFR box moderator input"
+ part_path = /obj/machinery/atmospherics/components/unary/hypertorus/moderator_input
+
+/obj/item/hfr_box/body/waste_output
+ name = "HFR box waste output"
+ part_path = /obj/machinery/atmospherics/components/unary/hypertorus/waste_output
+
+/obj/item/hfr_box/body/interface
+ name = "HFR box interface"
+ part_path = /obj/machinery/hypertorus/interface
+
+/obj/item/hfr_box/core
+ name = "HFR box core"
+ desc = "Activate this with a multitool to deploy the full machine after setting up the other boxes"
+ icon_state = "box_core"
+ box_type = "core"
+ part_path = /obj/machinery/atmospherics/components/unary/hypertorus/core
+
+/obj/item/hfr_box/core/multitool_act(mob/living/user, obj/item/I)
+ . = ..()
+ var/list/parts = list()
+ for(var/obj/item/hfr_box/box in orange(1,src))
+ var/direction = get_dir(src, box)
+ if(box.box_type == "corner")
+ if(ISDIAGONALDIR(direction))
+ box.dir = direction
+ parts |= box
+ continue
+ if(box.box_type == "body")
+ if(direction in GLOB.cardinals)
+ box.dir = direction
+ parts |= box
+ continue
+ if(parts.len == 8)
+ build_reactor(parts)
+ return
+
+/obj/item/hfr_box/core/proc/build_reactor(list/parts)
+ for(var/obj/item/hfr_box/box in parts)
+ if(box.box_type == "corner")
+ var/obj/machinery/hypertorus/corner/corner = new box.part_path(box.loc)
+ corner.dir = box.dir
+ qdel(box)
+ continue
+ if(box.box_type == "body")
+ var/location = get_turf(box)
+ if(box.part_path != /obj/machinery/hypertorus/interface)
+ var/obj/machinery/atmospherics/components/unary/hypertorus/part = new box.part_path(location, TRUE, box.dir)
+ part.dir = box.dir
+ else
+ var/obj/machinery/hypertorus/interface/part = new box.part_path(location)
+ part.dir = box.dir
+ qdel(box)
+ continue
+
+ new/obj/machinery/atmospherics/components/unary/hypertorus/core(loc, TRUE)
+ qdel(src)
diff --git a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm b/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm
new file mode 100644
index 0000000000000..2fb7a673631da
--- /dev/null
+++ b/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm
@@ -0,0 +1,339 @@
+#define MIN_PROGRESS_AMOUNT 3
+#define MIN_DEVIATION_RATE 0.90
+#define MAX_DEVIATION_RATE 1.1
+#define HIGH_CONDUCTIVITY_RATIO 0.95
+
+/obj/machinery/atmospherics/components/binary/crystallizer
+ icon = 'icons/obj/atmospherics/components/machines.dmi'
+ icon_state = "crystallizer-off"
+ name = "crystallizer"
+ desc = "Used to crystallize or solidify gases."
+ layer = ABOVE_MOB_LAYER
+ density = TRUE
+ max_integrity = 300
+ armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 100, BOMB = 0, BIO = 100, RAD = 100, FIRE = 80, ACID = 30)
+ circuit = /obj/item/circuitboard/machine/crystallizer
+ pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY
+ vent_movement = NONE
+
+ ///Base icon state for the machine to be used in update_icon()
+ var/base_icon = "crystallizer"
+ ///Internal Gas mix used for processing the gases that have been put in
+ var/datum/gas_mixture/internal
+ ///Var that controls how much gas gets injected in moles per tick
+ var/gas_input = 0
+ ///Saves the progress during the processing of the items
+ var/progress_bar = 0
+ ///Stores the amount of lost quality
+ var/quality_loss = 0
+ ///Stores the recipe selected by the user in the GUI
+ var/datum/gas_recipe/selected_recipe = null
+ ///Stores the total amount of moles needed for the current recipe
+ var/total_recipe_moles = 0
+
+/obj/machinery/atmospherics/components/binary/crystallizer/Initialize(mapload)
+ . = ..()
+ internal = new
+
+/obj/machinery/atmospherics/components/binary/crystallizer/attackby(obj/item/I, mob/user, params)
+ if(!on)
+ if(default_deconstruction_screwdriver(user, "[base_icon]-open", "[base_icon]-off", I))
+ return
+ if(default_change_direction_wrench(user, I))
+ return
+ if(default_deconstruction_crowbar(I))
+ return
+ return ..()
+
+/obj/machinery/atmospherics/components/binary/crystallizer/default_change_direction_wrench(mob/user, obj/item/I)
+ . = ..()
+ if(!.)
+ return FALSE
+ set_init_directions()
+ var/obj/machinery/atmospherics/node1 = nodes[1]
+ var/obj/machinery/atmospherics/node2 = nodes[2]
+ 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(node2)
+ if(src in node2.nodes) //Only if it's actually connected. On-pipe version would is one-sided.
+ node2.disconnect(src)
+ nodes[2] = null
+
+ if(parents[1])
+ nullify_pipenet(parents[1])
+ if(parents[2])
+ nullify_pipenet(parents[2])
+
+ atmos_init()
+ node1 = nodes[1]
+ if(node1)
+ node1.atmos_init()
+ node1.add_member(src)
+ node2 = nodes[2]
+ if(node2)
+ 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()
+ var/mutable_appearance/pipe_appearance1 = mutable_appearance('icons/obj/atmospherics/pipes/pipe_underlays.dmi', "intact_[dir]_[piping_layer]", layer = GAS_SCRUBBER_LAYER)
+ pipe_appearance1.color = COLOR_LIME
+ var/mutable_appearance/pipe_appearance2 = mutable_appearance('icons/obj/atmospherics/pipes/pipe_underlays.dmi', "intact_[turn(dir, 180)]_[piping_layer]", layer = GAS_SCRUBBER_LAYER)
+ pipe_appearance2.color = COLOR_MOSTLY_PURE_RED
+ . += pipe_appearance1
+ . += pipe_appearance2
+
+/obj/machinery/atmospherics/components/binary/crystallizer/update_icon_state()
+ . = ..()
+ if(panel_open)
+ icon_state = "[base_icon]-open"
+ else if(on && is_operational)
+ icon_state = "[base_icon]-on"
+ else
+ icon_state = "[base_icon]-off"
+
+/obj/machinery/atmospherics/components/binary/crystallizer/attackby_secondary(mob/user)
+ if(!can_interact(user))
+ return
+ on = !on
+ investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS)
+ update_icon()
+
+///Checks if the reaction temperature is inside the range of temperature + a little deviation
+/obj/machinery/atmospherics/components/binary/crystallizer/proc/check_temp_requirements()
+ if(internal.temperature >= selected_recipe.min_temp * MIN_DEVIATION_RATE && internal.temperature <= selected_recipe.max_temp * MAX_DEVIATION_RATE)
+ return TRUE
+ return FALSE
+
+///Injects the gases from the input inside the internal gasmix, the amount is dependant on the gas_input var
+/obj/machinery/atmospherics/components/binary/crystallizer/proc/inject_gases()
+ var/datum/gas_mixture/contents = airs[2]
+ for(var/gas_type in selected_recipe.requirements)
+ if(!contents.gases[gas_type] || !contents.gases[gas_type][MOLES])
+ continue
+ if(internal.gases[gas_type] && internal.gases[gas_type][MOLES] >= selected_recipe.requirements[gas_type] * 2)
+ continue
+ internal.merge(contents.remove_specific(gas_type, contents.gases[gas_type][MOLES] * gas_input))
+
+///Checks if the gases required are all inside
+/obj/machinery/atmospherics/components/binary/crystallizer/proc/internal_check()
+ var/gas_check = 0
+ for(var/gas_type in selected_recipe.requirements)
+ if(!internal.gases[gas_type] || !internal.gases[gas_type][MOLES])
+ return FALSE
+ if(internal.gases[gas_type][MOLES] >= selected_recipe.requirements[gas_type])
+ gas_check++
+ if(gas_check == selected_recipe.requirements.len)
+ return TRUE
+ return FALSE
+
+///Calculation for the heat of the various gas mixes and controls the quality of the item
+/obj/machinery/atmospherics/components/binary/crystallizer/proc/heat_calculations()
+ if( (internal.temperature >= (selected_recipe.min_temp * MIN_DEVIATION_RATE) && internal.temperature <= selected_recipe.min_temp) || \
+ (internal.temperature >= selected_recipe.max_temp && internal.temperature <= (selected_recipe.max_temp * MAX_DEVIATION_RATE)))
+ quality_loss = min(quality_loss + 1.5, 100)
+
+ var/median_temperature = (selected_recipe.max_temp - selected_recipe.min_temp) * 0.5
+ if(internal.temperature >= (median_temperature * MIN_DEVIATION_RATE) && internal.temperature <= (median_temperature * MAX_DEVIATION_RATE))
+ quality_loss = max(quality_loss - 5.5, -100)
+
+ if(selected_recipe.reaction_type == "endothermic")
+ internal.temperature = max(internal.temperature - (selected_recipe.energy_release / internal.heat_capacity()), TCMB)
+ update_parents()
+ else if(selected_recipe.reaction_type == "exothermic")
+ internal.temperature = max(internal.temperature + (selected_recipe.energy_release / internal.heat_capacity()), TCMB)
+ update_parents()
+
+///Conduction between the internal gasmix and the moderating (cooling/heating) gasmix.
+/obj/machinery/atmospherics/components/binary/crystallizer/proc/heat_conduction()
+ var/datum/gas_mixture/cooling_port = airs[1]
+ if(cooling_port.total_moles() > MINIMUM_MOLE_COUNT)
+ if(internal.total_moles() > 0)
+ var/coolant_temperature_delta = cooling_port.temperature - internal.temperature
+ var/cooling_heat_capacity = cooling_port.heat_capacity()
+ var/internal_heat_capacity = internal.heat_capacity()
+ var/cooling_heat_amount = HIGH_CONDUCTIVITY_RATIO * coolant_temperature_delta * (cooling_heat_capacity * internal_heat_capacity / (cooling_heat_capacity + internal_heat_capacity))
+ cooling_port.temperature = max(cooling_port.temperature - cooling_heat_amount / cooling_heat_capacity, TCMB)
+ internal.temperature = max(internal.temperature + cooling_heat_amount / internal_heat_capacity, TCMB)
+ update_parents()
+
+///Calculate the total moles needed for the recipe
+/obj/machinery/atmospherics/components/binary/crystallizer/proc/moles_calculations()
+ var/amounts = 0
+ for(var/gas_type in selected_recipe.requirements)
+ amounts += selected_recipe.requirements[gas_type]
+ total_recipe_moles = amounts
+
+///Removes the gases from the internal gasmix when the recipe is changed
+/obj/machinery/atmospherics/components/binary/crystallizer/proc/dump_gases()
+ var/datum/gas_mixture/remove = internal.remove(internal.total_moles())
+ airs[2].merge(remove)
+ internal.garbage_collect()
+
+/obj/machinery/atmospherics/components/binary/crystallizer/process_atmos()
+ if(!on || !is_operational || selected_recipe == null)
+ return
+
+ inject_gases()
+
+ if(!internal.total_moles())
+ return
+
+ heat_conduction()
+
+ if(internal_check())
+ if(check_temp_requirements())
+ heat_calculations()
+ progress_bar = min(progress_bar + (MIN_PROGRESS_AMOUNT * 5 / (round(log(10, total_recipe_moles * 0.1), 0.01))), 100)
+ else
+ quality_loss = min(quality_loss + 0.5, 100)
+ progress_bar = max(progress_bar - 1, 0)
+ if(progress_bar != 100)
+ update_parents()
+ return
+ progress_bar = 0
+
+ for(var/gas_type in selected_recipe.requirements)
+ var/amount_consumed = selected_recipe.requirements[gas_type] + quality_loss * 5
+ if(internal.gases[gas_type][MOLES] < amount_consumed)
+ quality_loss = min(quality_loss + 10, 100)
+ internal.remove_specific(gas_type, amount_consumed)
+
+ var/total_quality = clamp(50 - quality_loss, 0, 100)
+ var/quality_control
+ switch(total_quality)
+ if(100)
+ quality_control = "Masterwork"
+ if(95 to 99)
+ quality_control = "Supreme"
+ if(75 to 94)
+ quality_control = "Good"
+ if(65 to 74)
+ quality_control = "Decent"
+ if(55 to 64)
+ quality_control = "Average"
+ if(35 to 54)
+ quality_control = "Ok"
+ if(15 to 34)
+ quality_control = "Poor"
+ if(5 to 14)
+ quality_control = "Ugly"
+ if(1 to 4)
+ quality_control = "Cracked"
+ if(0)
+ quality_control = "Oh God why"
+
+ for(var/path in selected_recipe.products)
+ var/amount_produced = selected_recipe.products[path]
+ for(var/i in 1 to amount_produced)
+ var/obj/creation = new path(get_step(src, SOUTH))
+ creation.name = "[quality_control] [creation.name]"
+ if(selected_recipe.dangerous)
+ investigate_log("has been created in the crystallizer.", INVESTIGATE_SUPERMATTER)
+ message_admins("[src] has been created in the crystallizer [ADMIN_JMP(src)].")
+
+
+ quality_loss = 0
+ update_parents()
+
+/obj/machinery/atmospherics/components/binary/crystallizer/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
+ if(!ui)
+ ui = new(user, src, "Crystallizer", name)
+ ui.open()
+
+/obj/machinery/atmospherics/components/binary/crystallizer/ui_static_data()
+ var/data = list()
+ data["selected_recipes"] = list(list("name" = "Nothing", "id" = ""))
+ for(var/path in GLOB.gas_recipe_meta)
+ var/datum/gas_recipe/recipe = GLOB.gas_recipe_meta[path]
+ if(recipe.machine_type != "Crystallizer")
+ continue
+ data["selected_recipes"] += list(list("name" = recipe.name, "id" = recipe.id))
+ return data
+
+/obj/machinery/atmospherics/components/binary/crystallizer/ui_data()
+ var/data = list()
+ data["on"] = on
+
+ if(selected_recipe)
+ data["selected"] = selected_recipe.id
+ else
+ data["selected"] = ""
+
+ var/list/internal_gas_data = list()
+ if(internal.total_moles())
+ for(var/gasid in internal.gases)
+ internal_gas_data.Add(list(list(
+ "name"= internal.gases[gasid][GAS_META][META_GAS_NAME],
+ "amount" = round(internal.gases[gasid][MOLES], 0.01),
+ )))
+ else
+ for(var/gasid in internal.gases)
+ internal_gas_data.Add(list(list(
+ "name"= internal.gases[gasid][GAS_META][META_GAS_NAME],
+ "amount" = 0,
+ )))
+ data["internal_gas_data"] = internal_gas_data
+
+ var/list/requirements
+ if(!selected_recipe)
+ requirements = list("Select a recipe to see the requirements")
+ 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 += "In a temperature range between [selected_recipe.min_temp] K and [selected_recipe.max_temp] K"
+ requirements += "The crystallization reaction will be [selected_recipe.reaction_type]"
+ data["requirements"] = requirements.Join("\n")
+
+ var/temperature
+ if(internal.total_moles())
+ temperature = internal.temperature
+ else
+ temperature = 0
+ data["internal_temperature"] = temperature
+ data["progress_bar"] = progress_bar
+ data["gas_input"] = gas_input
+ return data
+
+/obj/machinery/atmospherics/components/binary/crystallizer/ui_act(action, params)
+ . = ..()
+ if(.)
+ return
+ switch(action)
+ if("power")
+ on = !on
+ investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS)
+ . = TRUE
+ if("recipe")
+ selected_recipe = null
+ var/recipe_name = "nothing"
+ var/datum/gas_recipe/recipe = GLOB.gas_recipe_meta[params["mode"]]
+ if(internal.total_moles())
+ dump_gases()
+ quality_loss = 0
+ progress_bar = 0
+ if(recipe && recipe.id != "")
+ selected_recipe = recipe
+ recipe_name = recipe.name
+ update_parents() //prevent the machine from stopping because of the recipe change and the pipenet not updating
+ moles_calculations()
+ investigate_log("was set to recipe [recipe_name ? recipe_name : "null"] by [key_name(usr)]", INVESTIGATE_ATMOS)
+ . = TRUE
+ if("gas_input")
+ var/_gas_input = params["gas_input"]
+ gas_input = clamp(_gas_input, 0, 250)
+ update_icon()
+
+#undef MIN_PROGRESS_AMOUNT
+#undef MIN_DEVIATION_RATE
+#undef MAX_DEVIATION_RATE
+#undef HIGH_CONDUCTIVITY_RATIO
diff --git a/code/modules/atmospherics/machinery/components/tank.dm b/code/modules/atmospherics/machinery/components/tank.dm
new file mode 100644
index 0000000000000..51bb68b9489c4
--- /dev/null
+++ b/code/modules/atmospherics/machinery/components/tank.dm
@@ -0,0 +1,553 @@
+/obj/machinery/atmospherics/components/tank
+ icon = 'icons/obj/atmospherics/stationary_canisters.dmi'
+ icon_state = "smooth"
+
+ name = "pressure tank"
+ desc = "A large vessel containing pressurized gas."
+
+ max_integrity = 800
+ integrity_failure = 0.2
+ density = TRUE
+ layer = ABOVE_WINDOW_LAYER
+
+ custom_materials = list(/datum/material/iron = 20000) // plasteel is not a material to prevent two bugs: one where the default pressure is 1.5 times higher as plasteel's material modifier is added, and a second one where the tank names could be "plasteel plasteel" tanks
+ material_flags = MATERIAL_EFFECTS | MATERIAL_GREYSCALE | MATERIAL_ADD_PREFIX | MATERIAL_AFFECT_STATISTICS
+
+ pipe_flags = PIPING_ONE_PER_TURF
+ device_type = QUATERNARY
+ initialize_directions = NONE
+ custom_reconcilation = TRUE
+
+ smoothing_flags = SMOOTH_CORNERS | SMOOTH_OBJ
+ smoothing_groups = list(SMOOTH_GROUP_GAS_TANK)
+ canSmoothWith = list(SMOOTH_GROUP_GAS_TANK)
+ appearance_flags = KEEP_TOGETHER
+
+ greyscale_config = /datum/greyscale_config/stationary_canister
+ greyscale_colors = "#ffffff"
+
+ ///The image showing the gases inside of the tank
+ var/image/window
+
+ /// The volume of the gas mixture
+ var/volume = 2500 //in liters
+ /// The max pressure of the gas mixture before damaging the tank
+ var/max_pressure = 20000
+ /// The typepath of the gas this tank should be filled with.
+ var/gas_type = null
+
+ ///Reference to the gas mix inside the tank
+ var/datum/gas_mixture/air_contents
+
+ /// The sounds that play when the tank is breaking from overpressure
+ var/static/list/breaking_sounds = list(
+ 'sound/effects/structure_stress/pop1.ogg',
+ 'sound/effects/structure_stress/pop2.ogg',
+ 'sound/effects/structure_stress/pop3.ogg',
+ )
+
+ /// Shared images for the knob overlay representing a side of the tank that is open to connections
+ var/static/list/knob_overlays
+
+ /// Number of crack states to fill the list with. This exists because I'm lazy and didn't want to keeping adding more things manually to the below list.
+ var/crack_states_count = 10
+ /// The icon states for the cracks in the tank dmi
+ var/static/list/crack_states
+
+ /// The merger id used to create/get the merger group in charge of handling tanks that share an internal gas storage
+ var/merger_id = "stationary_tanks"
+ /// The typecache of types which are allowed to merge internal storage
+ var/static/list/merger_typecache
+
+/obj/machinery/atmospherics/components/tank/Initialize(mapload)
+ . = ..()
+
+ if(!knob_overlays)
+ knob_overlays = list()
+ for(var/dir in GLOB.cardinals)
+ knob_overlays["[dir]"] = image('icons/obj/atmospherics/stationary_canisters.dmi', icon_state = "knob", dir = dir, layer = FLOAT_LAYER)
+
+ if(!crack_states)
+ crack_states = list()
+ for(var/i in 1 to crack_states_count)
+ crack_states += "crack[i]"
+
+ if(!merger_typecache)
+ merger_typecache = typecacheof(/obj/machinery/atmospherics/components/tank)
+
+ AddComponent(/datum/component/gas_leaker, leak_rate = 0.05)
+ AddElement(/datum/element/volatile_gas_storage)
+ AddElement(/datum/element/crackable, 'icons/obj/atmospherics/stationary_canisters.dmi', crack_states)
+
+ RegisterSignal(src, COMSIG_MERGER_ADDING, .proc/merger_adding)
+ RegisterSignal(src, COMSIG_MERGER_REMOVING, .proc/merger_removing)
+ RegisterSignal(src, COMSIG_ATOM_SMOOTHED_ICON, .proc/smoothed)
+
+ air_contents = new
+ air_contents.temperature = T20C
+ air_contents.volume = volume
+ refresh_pressure_limit()
+
+ if(gas_type)
+ fill_to_pressure(gas_type)
+
+ QUEUE_SMOOTH(src)
+ QUEUE_SMOOTH_NEIGHBORS(src)
+
+ // Mapped in tanks should automatically connect to adjacent pipenets in the direction set in dir
+ if(mapload)
+ initialize_directions = dir
+
+ return INITIALIZE_HINT_LATELOAD
+
+// We late initialize here so all stationary tanks have time to set up their
+// initial gas mixes and signal registrations.
+/obj/machinery/atmospherics/components/tank/LateInitialize()
+ . = ..()
+ GetMergeGroup(merger_id, merger_typecache)
+
+/obj/machinery/atmospherics/components/tank/Destroy()
+ QUEUE_SMOOTH_NEIGHBORS(src)
+ return ..()
+
+/obj/machinery/atmospherics/components/tank/examine(mob/user, thats)
+ . = ..()
+ var/wrench_hint = EXAMINE_HINT("wrench")
+ if(!initialize_directions)
+ . += span_notice("A pipe port can be opened with a [wrench_hint].")
+ else
+ . += span_notice("The pipe port can be moved or closed with a [wrench_hint].")
+ . += span_notice("A holographic sticker on it says that its maximum safe pressure is: [siunit_pressure(max_pressure, 0)].")
+
+/obj/machinery/atmospherics/components/tank/set_custom_materials(list/materials, multiplier)
+ . = ..()
+ refresh_pressure_limit()
+
+/// Recalculates pressure based on the current max integrity compared to original
+/obj/machinery/atmospherics/components/tank/proc/refresh_pressure_limit()
+ var/max_pressure_multiplier = max_integrity / initial(max_integrity)
+ max_pressure = max_pressure_multiplier * initial(max_pressure)
+
+/// Fills the tank to the maximum safe pressure.
+/// Safety margin is a multiplier for the cap for the purpose of this proc so it doesn't have to be filled completely.
+/obj/machinery/atmospherics/components/tank/proc/fill_to_pressure(gastype, safety_margin = 0.5)
+ var/pressure_limit = max_pressure * safety_margin
+
+ var/moles_to_add = (pressure_limit * air_contents.volume) / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
+ air_contents.assert_gas(gastype)
+ air_contents.gases[gastype][MOLES] += moles_to_add
+ air_contents.archive()
+
+/obj/machinery/atmospherics/components/tank/process_atmos()
+ if(air_contents.react(src))
+ update_parents()
+
+ if(air_contents.return_pressure() > max_pressure)
+ take_damage(0.1, BRUTE, sound_effect = FALSE)
+ if(prob(40))
+ playsound(src, pick(breaking_sounds), 30, vary = TRUE)
+
+ refresh_window()
+
+///////////////////////////////////////////////////////////////////
+// Pipenet stuff
+
+/obj/machinery/atmospherics/components/tank/return_analyzable_air()
+ return air_contents
+
+/obj/machinery/atmospherics/components/tank/return_airs_for_reconcilation(datum/pipeline/requester)
+ . = ..()
+ if(!air_contents)
+ return
+ . += air_contents
+
+/obj/machinery/atmospherics/components/tank/return_pipenets_for_reconcilation(datum/pipeline/requester)
+ . = ..()
+ var/datum/merger/merge_group = GetMergeGroup(merger_id, merger_typecache)
+ for(var/obj/machinery/atmospherics/components/tank/tank as anything in merge_group.members)
+ . += tank.parents
+
+/obj/machinery/atmospherics/components/tank/proc/toggle_side_port(new_dir)
+ if(initialize_directions & new_dir)
+ initialize_directions &= ~new_dir
+ else
+ initialize_directions |= new_dir
+
+ for(var/i in 1 to length(nodes))
+ var/obj/machinery/atmospherics/components/node = nodes[i]
+ if(!node)
+ continue
+ if(src in node.nodes)
+ node.disconnect(src)
+ nodes[i] = null
+ if(parents[i])
+ nullify_pipenet(parents[i])
+
+ atmos_init()
+
+ for(var/obj/machinery/atmospherics/components/node as anything in nodes)
+ if(!node)
+ continue
+ node.atmos_init()
+ node.add_member(src)
+ SSair.add_to_rebuild_queue(src)
+
+ update_parents()
+
+///////////////////////////////////////////////////////////////////
+// Merger handling
+
+/obj/machinery/atmospherics/components/tank/proc/merger_adding(obj/machinery/atmospherics/components/tank/us, datum/merger/new_merger)
+ SIGNAL_HANDLER
+ if(new_merger.id != merger_id)
+ return
+ RegisterSignal(new_merger, COMSIG_MERGER_REFRESH_COMPLETE, .proc/merger_refresh_complete)
+
+/obj/machinery/atmospherics/components/tank/proc/merger_removing(obj/machinery/atmospherics/components/tank/us, datum/merger/old_merger)
+ SIGNAL_HANDLER
+ if(old_merger.id != merger_id)
+ return
+ UnregisterSignal(old_merger, COMSIG_MERGER_REFRESH_COMPLETE)
+
+/// Handles the combined gas tank for the entire merger group, only the origin tank actualy runs this.
+/obj/machinery/atmospherics/components/tank/proc/merger_refresh_complete(datum/merger/merger, list/leaving_members, list/joining_members)
+ SIGNAL_HANDLER
+ if(merger.origin != src)
+ return
+ var/shares = length(merger.members) + length(leaving_members) - length(joining_members)
+ for(var/obj/machinery/atmospherics/components/tank/leaver as anything in leaving_members)
+ var/datum/gas_mixture/gas_share = air_contents.remove_ratio(1 / shares--)
+ air_contents.volume -= leaver.volume
+ leaver.air_contents = gas_share
+ leaver.update_appearance()
+
+ for(var/obj/machinery/atmospherics/components/tank/joiner as anything in joining_members)
+ if(joiner == src)
+ continue
+ var/datum/gas_mixture/joiner_share = joiner.air_contents
+ if(joiner_share)
+ air_contents.merge(joiner_share)
+ joiner.air_contents = air_contents
+ air_contents.volume += joiner.volume
+ joiner.update_appearance()
+
+ for(var/dir in GLOB.cardinals)
+ if(dir & initialize_directions & merger.members[src])
+ toggle_side_port(dir)
+
+///////////////////////////////////////////////////////////////////
+// Appearance stuff
+
+/obj/machinery/atmospherics/components/tank/proc/smoothed()
+ SIGNAL_HANDLER
+ refresh_window()
+
+/obj/machinery/atmospherics/components/tank/update_appearance()
+ . = ..()
+ refresh_window()
+
+/obj/machinery/atmospherics/components/tank/update_overlays()
+ . = ..()
+ if(!initialize_directions)
+ return
+ for(var/dir in GLOB.cardinals)
+ if(initialize_directions & dir)
+ . += knob_overlays["[dir]"]
+
+/obj/machinery/atmospherics/components/tank/update_greyscale()
+ . = ..()
+ refresh_window()
+
+/obj/machinery/atmospherics/components/tank/proc/refresh_window()
+ cut_overlay(window)
+
+ if(!air_contents)
+ window = null
+ return
+
+ window = image(icon, icon_state = "window-bg", layer = FLOAT_LAYER)
+
+ var/list/new_underlays = list()
+ for(var/obj/effect/overlay/gas/gas as anything in air_contents.return_visuals())
+ var/image/new_underlay = image(gas.icon, icon_state = gas.icon_state, layer = FLOAT_LAYER)
+ new_underlay.filters = alpha_mask_filter(icon = icon(icon, icon_state = "window-bg"))
+ new_underlays += new_underlay
+
+ var/image/foreground = image(icon, icon_state = "window-fg", layer = FLOAT_LAYER)
+ foreground.underlays = new_underlays
+ window.overlays = list(foreground)
+
+ add_overlay(window)
+
+///////////////////////////////////////////////////////////////////
+// Tool interactions
+
+/obj/machinery/atmospherics/components/tank/wrench_act(mob/living/user, obj/item/item)
+ . = TRUE
+ var/new_dir = get_dir(src, user)
+
+ if(new_dir in GLOB.diagonals)
+ return
+
+ item.play_tool_sound(src, 10)
+ if(!item.use_tool(src, user, 3 SECONDS))
+ return
+
+ toggle_side_port(new_dir)
+
+ item.play_tool_sound(src, 50)
+
+/obj/machinery/atmospherics/components/tank/welder_act(mob/living/user, obj/item/tool)
+ . = ..()
+ . = TRUE
+ if(atom_integrity >= max_integrity)
+ return
+ if(!tool.tool_start_check(user, amount = 0))
+ return
+ to_chat(user, span_notice("You begin to repair the cracks in the gas tank..."))
+ var/repair_amount = max_integrity / 10
+ do
+ if(!tool.use_tool(src, user, 2.5 SECONDS, volume = 40))
+ return
+ while(repair_damage(repair_amount))
+ to_chat(user, span_notice("The gas tank has been fully repaired and all cracks sealed."))
+
+/obj/machinery/atmospherics/components/tank/welder_act_secondary(mob/living/user, obj/item/tool)
+ . = ..()
+ . = TRUE
+ to_chat(user, span_notice("You begin cutting open the gas tank..."))
+ var/turf/current_location = get_turf(src)
+ var/datum/gas_mixture/airmix = current_location.return_air()
+
+ var/time_taken = 4 SECONDS
+
+ if(air_contents.return_pressure() > airmix.return_pressure())
+ time_taken *= 2
+ to_chat(user, span_warning("The tank seems to be pressurized, are you sure this is a good idea?"))
+
+ if(!tool.use_tool(src, user, time_taken, volume = 60))
+ return
+
+ deconstruct(disassembled=TRUE)
+ to_chat(user, span_notice("You finish cutting open the sealed gas tank, revealing the innards."))
+
+/obj/machinery/atmospherics/components/tank/deconstruct(disassembled)
+ var/turf/location = drop_location()
+ . = ..()
+ if(!disassembled)
+ return
+ var/obj/structure/tank_frame/frame = new(location)
+ frame.construction_state = TANK_PLATING_UNSECURED
+ frame.material_end_product = custom_materials[2].type
+ frame.update_appearance()
+
+///////////////////////////////////////////////////////////////////
+// Gas tank variants
+
+/obj/machinery/atmospherics/components/tank/air
+ name = "pressure tank (Air)"
+
+/obj/machinery/atmospherics/components/tank/air/Initialize(mapload)
+ . = ..()
+ fill_to_pressure(/datum/gas/oxygen, safety_margin = (O2STANDARD * 0.5))
+ fill_to_pressure(/datum/gas/nitrogen, safety_margin = (N2STANDARD * 0.5))
+
+/obj/machinery/atmospherics/components/tank/carbon_dioxide
+ gas_type = /datum/gas/carbon_dioxide
+
+/obj/machinery/atmospherics/components/tank/plasma
+ gas_type = /datum/gas/plasma
+
+/obj/machinery/atmospherics/components/tank/nitrogen
+ gas_type = /datum/gas/nitrogen
+
+/obj/machinery/atmospherics/components/tank/oxygen
+ gas_type = /datum/gas/oxygen
+
+/obj/machinery/atmospherics/components/tank/nitrous
+ gas_type = /datum/gas/nitrous_oxide
+
+/obj/machinery/atmospherics/components/tank/bz
+ gas_type = /datum/gas/bz
+
+/obj/machinery/atmospherics/components/tank/freon
+ gas_type = /datum/gas/freon
+
+/obj/machinery/atmospherics/components/tank/halon
+ gas_type = /datum/gas/halon
+
+/obj/machinery/atmospherics/components/tank/healium
+ gas_type = /datum/gas/healium
+
+/obj/machinery/atmospherics/components/tank/hydrogen
+ gas_type = /datum/gas/hydrogen
+
+/obj/machinery/atmospherics/components/tank/hypernoblium
+ gas_type = /datum/gas/hypernoblium
+
+/obj/machinery/atmospherics/components/tank/miasma
+ gas_type = /datum/gas/miasma
+
+/obj/machinery/atmospherics/components/tank/nitryl
+ gas_type = /datum/gas/nitryl
+
+/obj/machinery/atmospherics/components/tank/pluoxium
+ gas_type = /datum/gas/pluoxium
+
+/obj/machinery/atmospherics/components/tank/proto_nitrate
+ gas_type = /datum/gas/proto_nitrate
+
+/obj/machinery/atmospherics/components/tank/stimulum
+ gas_type = /datum/gas/stimulum
+
+/obj/machinery/atmospherics/components/tank/tritium
+ gas_type = /datum/gas/tritium
+
+/obj/machinery/atmospherics/components/tank/water_vapor
+ gas_type = /datum/gas/water_vapor
+
+/obj/machinery/atmospherics/components/tank/zauker
+ gas_type = /datum/gas/zauker
+
+/obj/machinery/atmospherics/components/tank/helium
+ gas_type = /datum/gas/helium
+
+/obj/machinery/atmospherics/components/tank/antinoblium
+ gas_type = /datum/gas/antinoblium
+
+///////////////////////////////////////////////////////////////////
+// Tank Frame Structure
+
+/obj/structure/tank_frame
+ icon = 'icons/obj/atmospherics/stationary_canisters.dmi'
+ icon_state = "frame"
+ anchored = FALSE
+ density = TRUE
+ custom_materials = list(/datum/material/alloy/plasteel = 4000)
+ var/construction_state = TANK_FRAME
+ var/datum/material/material_end_product
+
+/obj/structure/tank_frame/examine(mob/user)
+ . = ..()
+ var/wrenched_hint = EXAMINE_HINT("wrenched")
+
+ if(!anchored)
+ . += span_notice("[src] has not been [wrenched_hint] to the floor yet.")
+ else
+ . += span_notice("[src] is [wrenched_hint] to the floor.")
+
+ switch(construction_state)
+ if(TANK_FRAME)
+ var/screwed_hint = EXAMINE_HINT("screwed")
+ var/plating_hint = EXAMINE_HINT("metal plating")
+ . += span_notice("[src] is [screwed_hint] together and now just needs some [plating_hint].")
+ if(TANK_PLATING_UNSECURED)
+ var/crowbar_hint = EXAMINE_HINT("crowbar")
+ var/welder_hint = EXAMINE_HINT("welder")
+ . += span_notice("The plating has been firmly attached and would need a [crowbar_hint] to detach, but still needs to be sealed by a [welder_hint].")
+
+/obj/structure/tank_frame/deconstruct(disassembled)
+ if(disassembled)
+ for(var/datum/material/mat as anything in custom_materials)
+ new mat.sheet_type(drop_location())
+ return ..()
+
+/obj/structure/tank_frame/update_icon(updates)
+ . = ..()
+ switch(construction_state)
+ if(TANK_FRAME)
+ icon_state = "frame"
+ if(TANK_PLATING_UNSECURED)
+ icon_state = "plated_frame"
+
+/obj/structure/tank_frame/attackby(obj/item/item, mob/living/user, params)
+ if(construction_state == TANK_FRAME && istype(item, /obj/item/stack) && add_plating(user, item))
+ return
+ return ..()
+
+/obj/structure/tank_frame/wrench_act(mob/living/user, obj/item/tool)
+ . = ..()
+ return default_unfasten_wrench(user, tool, 0.5 SECONDS)
+
+/obj/structure/tank_frame/screwdriver_act_secondary(mob/living/user, obj/item/tool)
+ . = ..()
+ if(construction_state != TANK_FRAME)
+ return
+ . = TRUE
+ to_chat(user, span_notice("You begin taking apart [src]."))
+ if(!tool.use_tool(src, user, 1 SECONDS))
+ return
+ deconstruct(TRUE)
+ to_chat(user, span_notice("[src] has been taken apart."))
+
+/obj/structure/tank_frame/proc/add_plating(mob/living/user, obj/item/stack/stack)
+ . = FALSE
+ var/datum/material/stack_mat = GET_MATERIAL_REF(stack.material_type)
+ if(!(MAT_CATEGORY_RIGID in stack_mat.categories))
+ to_chat(user, span_notice("This material doesn't seem rigid enough to hold the shape of a tank..."))
+ return
+
+ . = TRUE
+ to_chat(user, span_notice("You begin adding [stack] to [src]..."))
+ if(!stack.use_tool(src, user, 3 SECONDS))
+ return
+ if(!stack.use(20))
+ var/amount_more
+ switch(stack.amount)
+ if(0) // Wat?
+ amount_more = "any at all"
+ if(1 to 4)
+ amount_more = "a lot more"
+ if(5 to 9)
+ amount_more = "about four times as much"
+ if(10 to 15)
+ amount_more = "about twice as much"
+ if(16 to 20)
+ amount_more = "just a bit more"
+ else
+ amount_more = "an indeterminate amount more"
+ to_chat(user, span_notice("You don't have enough [stack] to add all the plating. Maybe [amount_more]."))
+ return
+
+ material_end_product = stack_mat
+ construction_state = TANK_PLATING_UNSECURED
+ update_appearance()
+ to_chat(user, span_notice("You finish attaching [stack] to [src]."))
+
+/obj/structure/tank_frame/crowbar_act_secondary(mob/living/user, obj/item/tool)
+ . = ..()
+ if(construction_state != TANK_PLATING_UNSECURED)
+ return
+ . = TRUE
+ to_chat(user, span_notice("You start prying off the outer plating..."))
+ if(!tool.use_tool(src, user, 2 SECONDS))
+ return
+ construction_state = TANK_FRAME
+ new material_end_product.sheet_type(drop_location(), 20)
+ material_end_product = null
+ update_appearance()
+
+/obj/structure/tank_frame/welder_act(mob/living/user, obj/item/tool)
+ . = ..()
+ if(construction_state != TANK_PLATING_UNSECURED)
+ return
+ . = TRUE
+ if(!anchored)
+ to_chat(user, span_notice("You need to wrench [src] to the floor before finishing."))
+ return
+ if(!tool.tool_start_check(user, amount = 0))
+ return
+ to_chat(user, span_notice("You begin sealing the outer plating with the welder..."))
+ if(!tool.use_tool(src, user, 2 SECONDS, volume = 60))
+ return
+
+ var/turf/build_location = drop_location()
+ if(!isturf(build_location))
+ return
+ var/obj/machinery/atmospherics/components/tank/new_tank = new(build_location)
+ var/list/new_custom_materials = list()
+ new_custom_materials[material_end_product] = 20000
+ new_tank.set_custom_materials(new_custom_materials)
+ new_tank.on_construction(new_tank.pipe_color, new_tank.piping_layer)
+ to_chat(user, span_notice("[new_tank] has been sealed and is ready to accept gases."))
+ qdel(src)
diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
index f703a90024ddd..ade69b0de301c 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
@@ -6,15 +6,18 @@
desc = "Very useful for filtering gasses."
can_unwrench = TRUE
+ construction_type = /obj/item/pipe/trinary/flippable
+ pipe_state = "filter"
+
+ ///Rate of transfer of the gases to the outputs
var/transfer_rate = MAX_TRANSFER_RATE
+ ///What gas are we filtering
var/filter_type = null
+ ///Frequency id for connecting to the NTNet
var/frequency = 0
+ ///Reference to the radio datum
var/datum/radio_frequency/radio_connection
- construction_type = /obj/item/pipe/trinary/flippable
- pipe_state = "filter"
-
-
/obj/machinery/atmospherics/components/trinary/filter/CtrlClick(mob/user)
if(can_interact(user))
on = !on
@@ -47,15 +50,7 @@
continue
var/obj/machinery/atmospherics/node = find_connecting(direction)
- var/image/cap
- if(node)
- cap = get_pipe_image(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer, trinary = TRUE)
- else
- cap = get_pipe_image(icon, "cap", direction, piping_layer = piping_layer, trinary = TRUE)
-
- add_overlay(cap)
-
- return ..()
+ . += get_pipe_image(icon, "cap", direction, pipe_color, piping_layer, TRUE)
/obj/machinery/atmospherics/components/trinary/filter/update_icon_nopipes()
var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational
diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
index ae1e1c63d25f8..e8c0f05e0e77b 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
@@ -6,17 +6,15 @@
desc = "Very useful for mixing gasses."
can_unwrench = TRUE
+ construction_type = /obj/item/pipe/trinary/flippable
+ pipe_state = "mixer"
+ ///Output pressure target
var/target_pressure = ONE_ATMOSPHERE
+ ///Ratio between the node 1 and 2, determines the amount of gas transfered, sums up to 1
var/node1_concentration = 0.5
+ ///Ratio between the node 1 and 2, determines the amount of gas transfered, sums up to 1
var/node2_concentration = 0.5
-
- construction_type = /obj/item/pipe/trinary/flippable
- pipe_state = "mixer"
-
-
-
-
//node 3 is the outlet, nodes 1 & 2 are intakes
/obj/machinery/atmospherics/components/trinary/mixer/CtrlClick(mob/user)
@@ -41,15 +39,7 @@
continue
var/obj/machinery/atmospherics/node = find_connecting(direction)
- var/image/cap
- if(node)
- cap = get_pipe_image(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer, trinary = TRUE)
- else
- cap = get_pipe_image(icon, "cap", direction, piping_layer = piping_layer, trinary = TRUE)
-
- add_overlay(cap)
-
- return ..()
+ . += get_pipe_image(icon, "cap", direction, pipe_color, piping_layer, TRUE)
/obj/machinery/atmospherics/components/trinary/mixer/update_icon_nopipes()
var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational
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 d96b7244eb47d..35afd91778fec 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm
@@ -7,6 +7,7 @@
layer = GAS_FILTER_LAYER
pipe_flags = PIPING_ONE_PER_TURF
+ ///Flips the node connections so that the first and third ports are swapped
var/flipped = FALSE
/obj/machinery/atmospherics/components/trinary/set_init_directions()
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/bluespace_sender.dm b/code/modules/atmospherics/machinery/components/unary_devices/bluespace_sender.dm
new file mode 100644
index 0000000000000..ba88a1edc4c8d
--- /dev/null
+++ b/code/modules/atmospherics/machinery/components/unary_devices/bluespace_sender.dm
@@ -0,0 +1,178 @@
+/obj/machinery/atmospherics/components/unary/bluespace_sender
+ icon = 'icons/obj/atmospherics/components/bluespace_gas_selling.dmi'
+ icon_state = "bluespace_sender_off"
+ name = "Bluespace Gas Sender"
+ desc = "Sends gases to the bluespace network to be shared with the connected vendors, who knows what's beyond!"
+
+ density = TRUE
+ max_integrity = 300
+ armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 100, BOMB = 0, BIO = 100, RAD = 100, FIRE = 80, ACID = 30)
+ layer = OBJ_LAYER
+ circuit = /obj/item/circuitboard/machine/bluespace_sender
+ pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY
+
+ ///Base icon name for updating the appearance
+ var/base_icon = "bluespace_sender"
+ ///Gas mixture containing the inserted gases and that is connected to the vendors
+ var/datum/gas_mixture/bluespace_network
+ ///Rate of gas transfer inside the network (from 0 to 1)
+ var/gas_transfer_rate = 0.5
+ ///A base price for each and every gases, in case you don't want to change them
+ var/list/base_prices = list()
+ ///List storing all the vendors connected to the machine
+ var/list/vendors
+ ///Amount of credits gained from each vendor
+ var/credits_gained = 0
+
+/obj/machinery/atmospherics/components/unary/bluespace_sender/Initialize(mapload)
+ . = ..()
+ initialize_directions = dir
+ bluespace_network = new
+ for(var/gas_id in GLOB.meta_gas_info)
+ bluespace_network.assert_gas(gas_id)
+ for(var/gas_id in GLOB.meta_gas_info)
+ var/datum/gas/gas = gas_id
+ base_prices[gas_id] = initial(gas.base_value)
+
+ update_appearance()
+
+/obj/machinery/atmospherics/components/unary/bluespace_sender/Destroy()
+ if(bluespace_network.total_moles())
+ var/turf/local_turf = get_turf(src)
+ local_turf.assume_air(bluespace_network)
+ return ..()
+
+/obj/machinery/atmospherics/components/unary/bluespace_sender/update_icon_state()
+ if(panel_open)
+ icon_state = "[base_icon]_open"
+ return ..()
+ if(on && is_operational)
+ icon_state = "[base_icon]_on"
+ return ..()
+ icon_state = "[base_icon]_off"
+ return ..()
+
+/obj/machinery/atmospherics/components/unary/bluespace_sender/update_overlays()
+ . = ..()
+ . += get_pipe_image(icon, "pipe", dir, , piping_layer)
+ if(showpipe)
+ . += get_pipe_image(icon, "pipe", initialize_directions)
+
+/obj/machinery/atmospherics/components/unary/bluespace_sender/process_atmos()
+ if(!is_operational || !on || !nodes[1]) //if it has no power or its switched off, dont process atmos
+ return
+
+ var/datum/gas_mixture/content = airs[1]
+ var/datum/gas_mixture/remove = content.remove_ratio(gas_transfer_rate)
+ bluespace_network.merge(remove)
+ bluespace_network.temperature = T20C
+ update_parents()
+
+/obj/machinery/atmospherics/components/unary/bluespace_sender/attackby(obj/item/item, mob/user, params)
+ if(!on)
+ if(default_deconstruction_screwdriver(user, "[base_icon]_open", "[base_icon]_off", item))
+ update_appearance()
+ return
+ if(default_change_direction_wrench(user, item))
+ return
+ if(item.tool_behaviour == TOOL_CROWBAR && panel_open && bluespace_network.total_moles() > 0)
+ say("WARNING - Bluespace network can contain hazardous gases, deconstruct with caution!")
+ if(!do_after(user, 3 SECONDS, src))
+ return
+ if(default_deconstruction_crowbar(item))
+ return
+ return ..()
+
+/obj/machinery/atmospherics/components/unary/bluespace_sender/default_change_direction_wrench(mob/user, obj/item/item)
+ if(!..())
+ return FALSE
+ set_init_directions()
+ 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])
+ nullify_pipenet(parents[1])
+
+ atmos_init()
+ node = nodes[1]
+ if(node)
+ node.atmos_init()
+ node.add_member(src)
+ SSair.add_to_rebuild_queue(src)
+ return TRUE
+
+/obj/machinery/atmospherics/components/unary/bluespace_sender/multitool_act(mob/living/user, obj/item/item)
+ var/obj/item/multitool/multitool = item
+ multitool.buffer = src
+ to_chat(user, span_notice("You store linkage information in [item]'s buffer."))
+ return TRUE
+
+/obj/machinery/atmospherics/components/unary/bluespace_sender/ui_interact(mob/user, datum/tgui/ui)
+ ui = SStgui.try_update_ui(user, src, ui)
+ if(!ui)
+ ui = new(user, src, "BluespaceSender", name)
+ ui.open()
+
+/obj/machinery/atmospherics/components/unary/bluespace_sender/ui_data(mob/user)
+ var/list/data = list()
+ data["on"] = on
+ data["gas_transfer_rate"] = gas_transfer_rate
+ var/list/bluespace_gasdata = list()
+ if(bluespace_network.total_moles())
+ for(var/gas_id in bluespace_network.gases)
+ bluespace_gasdata.Add(list(list(
+ "name" = bluespace_network.gases[gas_id][GAS_META][META_GAS_NAME],
+ "id" = bluespace_network.gases[gas_id][GAS_META][META_GAS_ID],
+ "amount" = round(bluespace_network.gases[gas_id][MOLES], 0.01),
+ "price" = base_prices[gas_id],
+ )))
+ else
+ for(var/gas_id in bluespace_network.gases)
+ bluespace_gasdata.Add(list(list(
+ "name" = bluespace_network.gases[gas_id][GAS_META][META_GAS_NAME],
+ "id" = "",
+ "amount" = 0,
+ "price" = 0,
+ )))
+ data["bluespace_network_gases"] = bluespace_gasdata
+ var/list/vendors_list = list()
+ if(vendors)
+ for(var/obj/machinery/bluespace_vendor/vendor in vendors)
+ vendors_list.Add(list(list(
+ "name" = vendor.name,
+ "area" = get_area(vendor),
+ )))
+ data["vendors_list"] = vendors_list
+ data["credits"] = credits_gained
+ return data
+
+/obj/machinery/atmospherics/components/unary/bluespace_sender/ui_act(action, params)
+ . = ..()
+ if(.)
+ return
+
+ switch(action)
+ if("power")
+ on = !on
+ investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS)
+ update_appearance()
+ . = TRUE
+
+ if("rate")
+ gas_transfer_rate = clamp(params["rate"], 0, 1)
+ . = TRUE
+
+ if("price")
+ var/gas_type = gas_id2path(params["gas_type"])
+ base_prices[gas_type] = clamp(params["gas_price"], 0, 100)
+ . = TRUE
+
+ if("retrieve")
+ if(bluespace_network.total_moles() > 0)
+ var/datum/gas_mixture/remove = bluespace_network.remove(bluespace_network.total_moles())
+ airs[1].merge(remove)
+ update_parents()
+ bluespace_network.garbage_collect()
+ . = TRUE
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
index da1af112e4539..131a77a7be70d 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
@@ -473,7 +473,9 @@
if(node)
node.disconnect(src)
nodes[1] = null
- nullifyPipenet(parents[1])
+ if(parents[1])
+ nullify_pipenet(parents[1])
+
atmos_init()
node = nodes[1]
if(node)
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 5068730358e5d..3e74715fb3399 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm
@@ -44,10 +44,9 @@
target.partner_ref = WEAKREF(src)
break
- ..()
+ . = ..()
/obj/machinery/atmospherics/components/unary/heat_exchanger/process_atmos()
- ..()
var/obj/machinery/atmospherics/components/unary/heat_exchanger/partner = partner_ref?.resolve()
if(!partner)
partner_ref = null
@@ -69,14 +68,14 @@
var/other_old_temperature = partner_air_contents.return_temperature()
if(combined_heat_capacity > 0)
- var/combined_energy = partner_air_contents.return_temperature()*other_air_heat_capacity + air_heat_capacity*air_contents.return_temperature()
+ var/combined_energy = partnerair_contents.temperature * other_air_heat_capacity + air_heat_capacity * air_contents.temperature
- var/new_temperature = combined_energy/combined_heat_capacity
- air_contents.temperature = (new_temperature)
- partner_air_contents.temperature = (new_temperature)
+ var/new_temperature = combined_energy / combined_heat_capacity
+ air_contents.temperature = new_temperature
+ partnerair_contents.temperature = new_temperature
- if(abs(old_temperature-air_contents.return_temperature()) > 1)
+ if(abs(old_temperature - air_contents.temperature) > 1)
update_parents()
- if(abs(other_old_temperature-partner_air_contents.return_temperature()) > 1)
+ if(abs(other_old_temperature - partnerair_contents.temperature) > 1)
partner.update_parents()
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 b17de0ebc83b1..712876b51c992 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm
@@ -8,15 +8,18 @@
can_unwrench = TRUE
shift_underlay_only = FALSE
hide = TRUE
-
+ layer = GAS_SCRUBBER_LAYER
+ pipe_state = "injector"
resistance_flags = FIRE_PROOF | UNACIDABLE | ACID_PROOF //really helpful in building gas chambers for xenomorphs
- var/injecting = 0
-
+ ///Variable used for radio frequency injection
+ var/injecting = FALSE
+ ///Rate of operation of the device
var/volume_rate = 50
+ ///Frequency id for connecting to the NTNet
var/frequency = 0
- var/id = null
+ ///Reference to the radio datum
var/datum/radio_frequency/radio_connection
interacts_with_air = TRUE
@@ -50,7 +53,7 @@
cut_overlays()
if(showpipe)
// everything is already shifted so don't shift the cap
- add_overlay(get_pipe_image(icon, "inje_cap", initialize_directions))
+ add_overlay(get_pipe_image(icon, "inje_cap", initialize_directions, pipe_color))
if(!nodes[1] || !on || !is_operational)
icon_state = "inje_off"
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 a07c6b078d8a9..3853d3f46e2c3 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm
@@ -15,7 +15,7 @@
/obj/machinery/atmospherics/components/unary/passive_vent/update_icon_nopipes()
cut_overlays()
if(showpipe)
- var/image/cap = get_pipe_image(icon, "vent_cap", initialize_directions)
+ var/image/cap = get_pipe_image(icon, "vent_cap", initialize_directions, pipe_color)
add_overlay(cap)
icon_state = "passive_vent"
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 3a49035d50cc9..5241577d7ab9d 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm
@@ -14,12 +14,13 @@
pipe_flags = PIPING_ONE_PER_TURF
pipe_state = "connector"
+ ///Reference to the connected device
var/obj/machinery/portable_atmospherics/connected_device
var/obj/machinery/atmospherics/components/unary/portables_connector/connect_to
/obj/machinery/atmospherics/components/unary/portables_connector/New()
- ..()
+ . = ..()
var/datum/gas_mixture/air_contents = airs[1]
air_contents.volume = 0
@@ -31,7 +32,8 @@
/obj/machinery/atmospherics/components/unary/portables_connector/update_icon_nopipes()
icon_state = "connector"
if(showpipe)
- var/image/cap = get_pipe_image(icon, "connector_cap", initialize_directions)
+ cut_overlays()
+ var/image/cap = get_pipe_image(icon, "connector_cap", initialize_directions, pipe_color)
add_overlay(cap)
/obj/machinery/atmospherics/components/unary/portables_connector/process_atmos()
@@ -39,6 +41,12 @@
return
update_parents()
+/obj/machinery/atmospherics/components/unary/portables_connector/return_airs_for_reconcilation(datum/pipeline/requester)
+ . = ..()
+ if(!connected_device)
+ return
+ . += connected_device.return_air()
+
/obj/machinery/atmospherics/components/unary/portables_connector/can_unwrench(mob/user)
. = ..()
if(. && connected_device)
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 b2956b70067ba..51c5ef23f1157 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm
@@ -5,7 +5,9 @@
device_type = UNARY
pipe_flags = PIPING_ONE_PER_TURF
construction_type = /obj/item/pipe/directional
+ ///Unique id of the device
var/uid
+ ///Increases to prevent duplicated Ids
var/static/gl_uid = 1
FASTDMM_PROP(\
pipe_type = PIPE_TYPE_NODE,\
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 c32fd4d7cafa3..8d3efbeebeac5 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
@@ -21,22 +21,27 @@
interacts_with_air = TRUE
+ ///Direction of pumping the gas (RELEASING or SIPHONING)
var/pump_direction = RELEASING
-
+ ///Should we check internal pressure, external pressure, both or none? (EXT_BOUND, INT_BOUND, NO_BOUND)
var/pressure_checks = EXT_BOUND
+ ///The external pressure threshold (default 101 kPa)
var/external_pressure_bound = ONE_ATMOSPHERE
+ ///The internal pressure threshold (default 0 kPa)
var/internal_pressure_bound = 0
// EXT_BOUND: Do not pass external_pressure_bound
// INT_BOUND: Do not pass internal_pressure_bound
// NO_BOUND: Do not pass either
+ ///Frequency id for connecting to the NTNet
var/frequency = FREQ_ATMOS_CONTROL
+ ///Reference to the radio datum
var/datum/radio_frequency/radio_connection
+ ///Radio connection to the air alarm
var/radio_filter_out
+ ///Radio connection from the air alarm
var/radio_filter_in
- var/obj/machinery/advanced_airlock_controller/aac = null
-
/obj/machinery/atmospherics/components/unary/vent_pump/New()
if(!id_tag)
id_tag = id_tag = SSnetworks.assign_random_name()
@@ -117,8 +122,9 @@
pressure_delta = min(pressure_delta, (air_contents.return_pressure() - internal_pressure_bound))
if(pressure_delta > 0)
- if(air_contents.return_temperature() > 0 && air_contents.return_volume() > 0)
- var/transfer_moles = (pressure_delta*environment.return_volume())/(air_contents.return_temperature() * R_IDEAL_GAS_EQUATION)
+ if(air_contents.temperature > 0)
+ var/transfer_moles = (pressure_delta * environment.volume) / (air_contents.temperature * R_IDEAL_GAS_EQUATION)
+ var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
loc.assume_air_moles(air_contents, transfer_moles)
air_update_turf(FALSE, FALSE)
@@ -252,11 +258,12 @@
broadcast_status()
update_icon()
-/obj/machinery/atmospherics/components/unary/vent_pump/welder_act(mob/living/user, obj/item/I)
- if(!I.tool_start_check(user, amount=0))
+/obj/machinery/atmospherics/components/unary/vent_pump/welder_act(mob/living/user, obj/item/welder)
+ ..()
+ if(!welder.tool_start_check(user, amount=0))
return TRUE
- to_chat(user, "You begin welding the vent...")
- if(I.use_tool(src, user, 20, volume=50))
+ to_chat(user, span_notice("You begin welding the vent..."))
+ if(welder.use_tool(src, user, 20, volume=50))
if(!welded)
user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.")
welded = TRUE
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 d9ac9e9dd75a9..958561010087c 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
@@ -31,6 +31,26 @@
pipe_state = "scrubber"
+ ///The mode of the scrubber (SCRUBBING or SIPHONING)
+ var/scrubbing = SCRUBBING //0 = siphoning, 1 = scrubbing
+ ///The list of gases we are filtering
+ var/filter_types = list(/datum/gas/carbon_dioxide)
+ ///Rate of the scrubber to remove gases from the air
+ var/volume_rate = 200
+ ///is this scrubber acting on the 3x3 area around it.
+ var/widenet = FALSE
+ ///List of the turfs near the scrubber, used for widenet
+ var/list/turf/adjacent_turfs = list()
+
+ ///Frequency id for connecting to the NTNet
+ var/frequency = FREQ_ATMOS_CONTROL
+ ///Reference to the radio datum
+ var/datum/radio_frequency/radio_connection
+ ///Radio connection to the air alarm
+ var/radio_filter_out
+ ///Radio connection from the air alarm
+ var/radio_filter_in
+
/obj/machinery/atmospherics/components/unary/vent_scrubber/New()
if(!id_tag)
id_tag = SSnetworks.assign_random_name()
@@ -122,14 +142,19 @@
return TRUE
+/obj/machinery/atmospherics/components/unary/vent_scrubber/update_name()
+ . = ..()
+ var/area/scrub_area = get_area(src)
+ name = "\proper [scrub_area.name] [name] [id_tag]"
+
/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
+ radio_filter_in = frequency == initial(frequency) ? RADIO_FROM_AIRALARM : null
+ radio_filter_out = frequency == initial(frequency) ? RADIO_TO_AIRALARM : null
if(frequency)
set_frequency(frequency)
broadcast_status()
check_turfs()
- ..()
+ . = ..()
/obj/machinery/atmospherics/components/unary/vent_scrubber/process_atmos()
..()
@@ -176,9 +201,8 @@
/obj/machinery/atmospherics/components/unary/vent_scrubber/proc/check_turfs()
adjacent_turfs.Cut()
- var/turf/T = get_turf(src)
- if(istype(T))
- adjacent_turfs = T.GetAtmosAdjacentTurfs(alldir = 1)
+ var/turf/local_turf = get_turf(src)
+ adjacent_turfs = local_turf.get_atmos_adjacent_turfs(alldir = TRUE)
/obj/machinery/atmospherics/components/unary/vent_scrubber/receive_signal(datum/signal/signal)
if(!is_operational || !signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
@@ -228,11 +252,12 @@
. = ..()
update_icon_nopipes()
-/obj/machinery/atmospherics/components/unary/vent_scrubber/welder_act(mob/living/user, obj/item/I)
- if(!I.tool_start_check(user, amount=0))
+/obj/machinery/atmospherics/components/unary/vent_scrubber/welder_act(mob/living/user, obj/item/welder)
+ ..()
+ if(!welder.tool_start_check(user, amount=0))
return TRUE
- to_chat(user, "Now welding the scrubber.")
- if(I.use_tool(src, user, 20, volume=50))
+ to_chat(user, ("Now welding the scrubber."))
+ if(welder.use_tool(src, user, 20, volume=50))
if(!welded)
user.visible_message("[user] welds the scrubber shut.","You weld the scrubber shut.", "You hear welding.")
welded = TRUE
diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm
index 0eee42ffbc314..47730e1a1460b 100644
--- a/code/modules/atmospherics/machinery/datum_pipeline.dm
+++ b/code/modules/atmospherics/machinery/datum_pipeline.dm
@@ -28,7 +28,7 @@
continue
SSair.add_to_rebuild_queue(considered_pipe)
for(var/obj/machinery/atmospherics/components/considered_component in other_atmos_machines)
- considered_component.nullifyPipenet(src)
+ considered_component.nullify_pipenet(src)
return ..()
/datum/pipeline/process()
@@ -121,7 +121,7 @@
/datum/pipeline/proc/add_machinery_member(obj/machinery/atmospherics/components/considered_component)
other_atmos_machines |= considered_component
- var/list/returned_airs = considered_component.return_pipenetAirs(src)
+ var/list/returned_airs = considered_component.return_pipenet_airs(src)
if (!length(returned_airs) || (null in returned_airs))
stack_trace("add_machinery_member: 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])")
@@ -256,16 +256,11 @@
continue
gas_mixture_list += pipeline.other_airs
gas_mixture_list += pipeline.air
- for(var/atmosmch in pipeline.other_atmos_machines)
- if (istype(atmosmch, /obj/machinery/atmospherics/components/binary/valve))
- var/obj/machinery/atmospherics/components/binary/valve/considered_valve = atmosmch
- if(considered_valve.on)
- pipeline_list |= considered_valve.parents[1]
- pipeline_list |= considered_valve.parents[2]
- else if (istype(atmosmch, /obj/machinery/atmospherics/components/unary/portables_connector))
- var/obj/machinery/atmospherics/components/unary/portables_connector/considered_connector = atmosmch
- if(considered_connector.connected_device)
- gas_mixture_list += considered_connector.connected_device.return_air()
+ for(var/obj/machinery/atmospherics/components/atmos_machine as anything in pipeline.other_atmos_machines)
+ if(!atmos_machine.custom_reconcilation)
+ continue
+ pipeline_list |= atmos_machine.return_pipenets_for_reconcilation(src)
+ gas_mixture_list |= atmos_machine.return_airs_for_reconcilation(src)
var/total_thermal_energy = 0
var/total_heat_capacity = 0
diff --git a/code/modules/atmospherics/machinery/other/meter.dm b/code/modules/atmospherics/machinery/other/meter.dm
index 9781ad4a96a64..077d373bbe733 100644
--- a/code/modules/atmospherics/machinery/other/meter.dm
+++ b/code/modules/atmospherics/machinery/other/meter.dm
@@ -68,16 +68,16 @@
return 0
var/env_pressure = environment.return_pressure()
- if(env_pressure <= 0.15*ONE_ATMOSPHERE)
+ if(env_pressure <= 0.15 * ONE_ATMOSPHERE)
icon_state = "meter0"
- else if(env_pressure <= 1.8*ONE_ATMOSPHERE)
- var/val = round(env_pressure/(ONE_ATMOSPHERE*0.3) + 0.5)
+ else if(env_pressure <= 1.8 * ONE_ATMOSPHERE)
+ var/val = round(env_pressure / (ONE_ATMOSPHERE * 0.3) + 0.5)
icon_state = "meter1_[val]"
- else if(env_pressure <= 30*ONE_ATMOSPHERE)
- var/val = round(env_pressure/(ONE_ATMOSPHERE*5)-0.35) + 1
+ else if(env_pressure <= 30 * ONE_ATMOSPHERE)
+ var/val = round(env_pressure / (ONE_ATMOSPHERE * 5) - 0.35) + 1
icon_state = "meter2_[val]"
- else if(env_pressure <= 59*ONE_ATMOSPHERE)
- var/val = round(env_pressure/(ONE_ATMOSPHERE*5) - 6) + 1
+ else if(env_pressure <= 59 * ONE_ATMOSPHERE)
+ var/val = round(env_pressure / (ONE_ATMOSPHERE * 5) - 6) + 1
icon_state = "meter3_[val]"
else
icon_state = "meter4"
@@ -110,9 +110,10 @@
. = ..()
. += status()
-/obj/machinery/meter/wrench_act(mob/user, obj/item/I)
- to_chat(user, "You begin to unfasten \the [src]...")
- if (I.use_tool(src, user, 40, volume=50))
+/obj/machinery/meter/wrench_act(mob/user, obj/item/wrench)
+ ..()
+ to_chat(user, ("You begin to unfasten \the [src]..."))
+ if (wrench.use_tool(src, user, 40, volume=50))
user.visible_message(
"[user] unfastens \the [src].",
"You unfasten \the [src].",
diff --git a/code/modules/atmospherics/machinery/pipes/bridge_pipe.dm b/code/modules/atmospherics/machinery/pipes/bridge_pipe.dm
new file mode 100644
index 0000000000000..d4adfdb0d3a3d
--- /dev/null
+++ b/code/modules/atmospherics/machinery/pipes/bridge_pipe.dm
@@ -0,0 +1,29 @@
+/obj/machinery/atmospherics/pipe/bridge_pipe
+ icon = 'icons/obj/atmospherics/pipes/bridge_pipe.dmi'
+ icon_state = "bridge_center"
+
+ name = "bridge pipe"
+ desc = "A one meter section of regular pipe used to connect pipenets over pipes."
+
+ dir = SOUTH
+ initialize_directions = NORTH | SOUTH
+ pipe_flags = PIPING_CARDINAL_AUTONORMALIZE | PIPING_BRIDGE
+ device_type = BINARY
+
+ construction_type = /obj/item/pipe/binary
+ pipe_state = "bridge_center"
+
+/obj/machinery/atmospherics/pipe/bridge_pipe/set_init_directions()
+ switch(dir)
+ if(NORTH, SOUTH)
+ initialize_directions = SOUTH|NORTH
+ if(EAST, WEST)
+ initialize_directions = EAST|WEST
+
+/obj/machinery/atmospherics/pipe/bridge_pipe/update_overlays()
+ . = ..()
+ var/mutable_appearance/center = mutable_appearance('icons/obj/atmospherics/pipes/bridge_pipe.dmi', "bridge_center")
+ PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer)
+ . += center
+
+ layer = HIGH_PIPE_LAYER //to stay above all sorts of pipes
diff --git a/code/modules/atmospherics/machinery/pipes/color_adapter.dm b/code/modules/atmospherics/machinery/pipes/color_adapter.dm
new file mode 100644
index 0000000000000..2468b3f943e3f
--- /dev/null
+++ b/code/modules/atmospherics/machinery/pipes/color_adapter.dm
@@ -0,0 +1,63 @@
+/obj/machinery/atmospherics/pipe/color_adapter
+ icon = 'icons/obj/atmospherics/pipes/color_adapter.dmi'
+ icon_state = "adapter_map-3"
+
+ name = "color adapter"
+ desc = "A one meter section of regular pipe used to connect different colored pipes."
+
+ dir = SOUTH
+ initialize_directions = NORTH | SOUTH
+ pipe_flags = PIPING_CARDINAL_AUTONORMALIZE | PIPING_ALL_COLORS | PIPING_BRIDGE
+ device_type = BINARY
+
+ construction_type = /obj/item/pipe/binary
+ pipe_state = "adapter_center"
+
+ paintable = FALSE
+ hide = FALSE
+
+ ///cache for the icons
+ var/static/list/mutable_appearance/center_cache = list()
+
+/obj/machinery/atmospherics/pipe/color_adapter/Initialize(mapload)
+ icon_state = ""
+ . = ..()
+
+/obj/machinery/atmospherics/pipe/color_adapter/set_init_directions()
+ switch(dir)
+ if(NORTH, SOUTH)
+ initialize_directions = SOUTH|NORTH
+ if(EAST, WEST)
+ initialize_directions = EAST|WEST
+
+/obj/machinery/atmospherics/pipe/color_adapter/update_overlays()
+ . = ..()
+ var/mutable_appearance/center = center_cache["[piping_layer]"]
+ if(!center)
+ center = mutable_appearance(icon, "adapter_center")
+ PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer)
+ center_cache["[piping_layer]"] = center
+ . += center
+
+ update_layer()
+
+ //Add non-broken pieces
+ for(var/i in 1 to device_type)
+ if(!nodes[i])
+ continue
+ var/image/pipe = get_pipe_image('icons/obj/atmospherics/pipes/manifold.dmi', "pipe-3", get_dir(src, nodes[i]), nodes[i].pipe_color)
+ PIPING_LAYER_DOUBLE_SHIFT(pipe, piping_layer)
+ pipe.layer = layer + 0.01
+ . += pipe
+
+/obj/machinery/atmospherics/pipe/color_adapter/layer1
+ icon_state = "adapter_map-1"
+
+/obj/machinery/atmospherics/pipe/color_adapter/layer2
+ icon_state = "adapter_map-2"
+
+/obj/machinery/atmospherics/pipe/color_adapter/layer4
+ icon_state = "adapter_map-4"
+
+/obj/machinery/atmospherics/pipe/color_adapter/layer5
+ icon_state = "adapter_map-5"
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 df9e5cf3d2f87..18e2e63d1c3ff 100644
--- a/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm
+++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm
@@ -23,19 +23,19 @@
var/environment_temperature = 0
var/datum/gas_mixture/pipe_air = return_air()
- var/turf/T = loc
- if(istype(T))
- if(T.blocks_air)
- environment_temperature = T.return_temperature()
+ var/turf/local_turf = loc
+ if(istype(local_turf))
+ if(islava(local_turf))
+ environment_temperature = 5000 //Yuck
+ else if(local_turf.blocks_air)
+ environment_temperature = local_turf.temperature
else
- var/turf/open/OT = T
- environment_temperature = OT.GetTemperature()
- else if(T != null)
- environment_temperature = T.return_temperature()
-
- if(pipe_air != null)
- if(abs(environment_temperature-pipe_air.return_temperature()) > minimum_temperature_difference)
- parent.temperature_interact(T, volume, thermal_conductivity)
+ var/turf/open/open_local = local_turf
+ environment_temperature = open_local.GetTemperature()
+ else
+ environment_temperature = local_turf.temperature
+ if(abs(environment_temperature-pipe_air.temperature) > minimum_temperature_difference)
+ parent.temperature_interact(local_turf, volume, thermal_conductivity)
//heatup/cooldown any mobs buckled to ourselves based on our temperature
@@ -43,11 +43,10 @@
var/hc = pipe_air.heat_capacity()
var/mob/living/heat_source = buckled_mobs[1]
//Best guess-estimate of the total bodytemperature of all the mobs, since they share the same environment it's ~ok~ to guess like this
- var/avg_temp = (pipe_air.return_temperature() * hc + (heat_source.bodytemperature * buckled_mobs.len) * 3500) / (hc + (buckled_mobs ? buckled_mobs.len * 3500 : 0))
- for(var/m in buckled_mobs)
- var/mob/living/L = m
- L.bodytemperature = avg_temp
- pipe_air.temperature = (avg_temp)
+ var/avg_temp = (pipe_air.temperature * hc + (heat_source.bodytemperature * buckled_mobs.len) * 3500) / (hc + (buckled_mobs ? buckled_mobs.len * 3500 : 0))
+ for(var/mob/living/buckled_mob as anything in buckled_mobs)
+ buckled_mob.bodytemperature = avg_temp
+ pipe_air.temperature = avg_temp
/obj/machinery/atmospherics/pipe/heat_exchanging/process(delta_time)
if(!parent)
@@ -73,9 +72,12 @@
animate(src, color = rgb(h_r, h_g, h_b), time = 20, easing = SINE_EASING)
//burn any mobs buckled based on temperature
- if(has_buckled_mobs())
- var/heat_limit = 1000
- if(pipe_air.return_temperature() > heat_limit + 1)
- for(var/m in buckled_mobs)
- var/mob/living/buckled_mob = m
- buckled_mob.apply_damage(delta_time * 2 * log(pipe_air.return_temperature() - heat_limit), BURN, BODY_ZONE_CHEST)
+ if(!has_buckled_mobs())
+ return
+ var/heat_limit = 1000
+ if(pipe_air.temperature > heat_limit + 1)
+ for(var/mob/living/buckled_mob as anything in buckled_mobs)
+ buckled_mob.apply_damage(delta_time * 2 * log(pipe_air.temperature - heat_limit), BURN, BODY_ZONE_CHEST)
+
+/obj/machinery/atmospherics/pipe/heat_exchanging/update_pipe_icon()
+ return
diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm
index c59c3c743312f..c3012562a2e59 100644
--- a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm
+++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm
@@ -35,9 +35,7 @@
//Add non-broken pieces
for(var/i in 1 to device_type)
if(nodes[i])
- add_overlay( get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) )
-
- update_layer()
+ . += get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i]))
/obj/machinery/atmospherics/pipe/heat_exchanging/manifold/layer2
piping_layer = 2
diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm
index a321f7967e464..4ac90338b907e 100644
--- a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm
+++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm
@@ -33,8 +33,7 @@
//Add non-broken pieces
for(var/i in 1 to device_type)
if(nodes[i])
- add_overlay( get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) )
-
+ . += get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i]))
update_layer()
/obj/machinery/atmospherics/pipe/heat_exchanging/manifold4w/layer2
diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm
index 7c43cd771af20..3266979ca8282 100644
--- a/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm
+++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm
@@ -15,7 +15,7 @@
pipe_state = "he"
/obj/machinery/atmospherics/pipe/heat_exchanging/simple/set_init_directions()
- if(dir in GLOB.diagonals)
+ if(ISDIAGONALDIR(dir))
initialize_directions = dir
return
switch(dir)
diff --git a/code/modules/atmospherics/machinery/pipes/layermanifold.dm b/code/modules/atmospherics/machinery/pipes/layermanifold.dm
index 23221c20045db..f6e5cfb226997 100644
--- a/code/modules/atmospherics/machinery/pipes/layermanifold.dm
+++ b/code/modules/atmospherics/machinery/pipes/layermanifold.dm
@@ -30,11 +30,16 @@
return ..()
/obj/machinery/atmospherics/pipe/layer_manifold/Destroy()
- nullifyAllNodes()
+ nullify_all_nodes()
return ..()
-/obj/machinery/atmospherics/pipe/layer_manifold/proc/nullifyAllNodes()
- var/list/obj/machinery/atmospherics/needs_nullifying = get_all_connected_nodes()
+/obj/machinery/atmospherics/pipe/layer_manifold/update_pipe_icon()
+ return
+
+/obj/machinery/atmospherics/pipe/layer_manifold/proc/nullify_all_nodes()
+ for(var/obj/machinery/atmospherics/node in nodes)
+ node.disconnect(src)
+ SSair.add_to_rebuild_queue(node)
front_nodes = null
back_nodes = null
nodes = list()
@@ -55,14 +60,17 @@
for(var/node in back_nodes)
add_attached_images(node)
-/obj/machinery/atmospherics/pipe/layer_manifold/proc/add_attached_images(obj/machinery/atmospherics/A)
- if(!A)
+/obj/machinery/atmospherics/pipe/layer_manifold/proc/get_attached_images(obj/machinery/atmospherics/machine_check)
+ if(!machine_check)
return
- if(istype(A, /obj/machinery/atmospherics/pipe/layer_manifold))
+
+ . = list()
+
+ if(istype(machine_check, /obj/machinery/atmospherics/pipe/layer_manifold))
for(var/i in PIPING_LAYER_MIN to PIPING_LAYER_MAX)
- add_attached_image(get_dir(src, A), i)
- return
- add_attached_image(get_dir(src, A), A.piping_layer, A.pipe_color)
+ . += get_attached_image(get_dir(src, machine_check), i, COLOR_VERY_LIGHT_GRAY)
+ return
+ . += get_attached_image(get_dir(src, machine_check), machine_check.piping_layer, machine_check.pipe_color)
/obj/machinery/atmospherics/pipe/layer_manifold/proc/add_attached_image(p_dir, p_layer, p_color = null)
var/image/I
@@ -105,7 +113,7 @@
/obj/machinery/atmospherics/pipe/layer_manifold/atmos_init()
normalize_cardinal_directions()
- findAllConnections()
+ find_all_connections()
/obj/machinery/atmospherics/pipe/layer_manifold/set_piping_layer()
piping_layer = PIPING_LAYER_DEFAULT
@@ -115,14 +123,13 @@
/obj/machinery/atmospherics/pipe/layer_manifold/disconnect(obj/machinery/atmospherics/reference)
if(istype(reference, /obj/machinery/atmospherics/pipe))
- var/obj/machinery/atmospherics/pipe/P = reference
- P.destroy_network()
- while(reference in get_all_connected_nodes())
- if(reference in nodes)
- var/i = nodes.Find(reference)
- nodes[i] = null
- if(reference in front_nodes)
- var/i = front_nodes.Find(reference)
+ var/obj/machinery/atmospherics/pipe/pipe_reference = reference
+ pipe_reference.destroy_network()
+ while(reference in nodes)
+ var/i = nodes.Find(reference)
+ nodes[i] = null
+ i = front_nodes.Find(reference)
+ if(i)
front_nodes[i] = null
if(reference in back_nodes)
var/i = back_nodes.Find(reference)
diff --git a/code/modules/atmospherics/machinery/pipes/multiz.dm b/code/modules/atmospherics/machinery/pipes/multiz.dm
index 3c0aeb6e915a0..39a9a6d87457d 100644
--- a/code/modules/atmospherics/machinery/pipes/multiz.dm
+++ b/code/modules/atmospherics/machinery/pipes/multiz.dm
@@ -16,8 +16,11 @@
construction_type = /obj/item/pipe/directional
pipe_state = "multiz"
+ ///Our central icon
var/mutable_appearance/center = null
+ ///The pipe icon
var/mutable_appearance/pipe = null
+ ///Reference to the node
var/obj/machinery/atmospherics/front_node = null
@@ -45,14 +48,16 @@
/// Attempts to locate a multiz pipe that's above us, if it finds one it merges us into its pipenet
/obj/machinery/atmospherics/pipe/multiz/pipeline_expansion()
- var/turf/T = get_turf(src)
- for(var/obj/machinery/atmospherics/pipe/multiz/above in GET_TURF_ABOVE(T))
- if(above.piping_layer == piping_layer)
- nodes += above
- above.nodes += src // Two way travel :)
- for(var/obj/machinery/atmospherics/pipe/multiz/below in GET_TURF_BELOW(T))
- if(below.piping_layer == piping_layer)
- below.pipeline_expansion() // If we've got one below us, force it to add us on facebook
+ var/turf/local_turf = get_turf(src)
+ for(var/obj/machinery/atmospherics/pipe/multiz/above in SSmapping.get_turf_above(local_turf))
+ if(!is_connectable(above, piping_layer))
+ continue
+ nodes += above
+ above.nodes += src //Two way travel :)
+ for(var/obj/machinery/atmospherics/pipe/multiz/below in SSmapping.get_turf_below(local_turf))
+ if(!is_connectable(below, piping_layer))
+ continue
+ below.pipeline_expansion() //If we've got one below us, force it to add us on facebook
return ..()
// MAPPING
diff --git a/code/modules/atmospherics/machinery/pipes/pipes.dm b/code/modules/atmospherics/machinery/pipes/pipes.dm
index bc62bfb3faa1d..277db30f24cc8 100644
--- a/code/modules/atmospherics/machinery/pipes/pipes.dm
+++ b/code/modules/atmospherics/machinery/pipes/pipes.dm
@@ -17,7 +17,7 @@
/obj/machinery/atmospherics/pipe/New()
add_atom_colour(pipe_color, FIXED_COLOUR_PRIORITY)
volume = 35 * device_type
- ..()
+ . = ..()
///I have no idea why there's a new and at this point I'm too afraid to ask
/obj/machinery/atmospherics/pipe/Initialize(mapload)
@@ -27,10 +27,10 @@
AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE) //if changing this, change the subtypes RemoveElements too, because thats how bespoke works
/obj/machinery/atmospherics/pipe/nullify_node(i)
- var/obj/machinery/atmospherics/oldN = nodes[i]
- ..()
- if(oldN)
- SSair.add_to_rebuild_queue(oldN)
+ 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)
@@ -62,9 +62,9 @@
return air_temporary.remove(amount)
return parent.air.remove(amount)
-/obj/machinery/atmospherics/pipe/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/pipe_meter))
- var/obj/item/pipe_meter/meter = W
+/obj/machinery/atmospherics/pipe/attackby(obj/item/item, mob/user, params)
+ if(istype(item, /obj/item/pipe_meter))
+ var/obj/item/pipe_meter/meter = item
user.dropItemToGround(meter)
meter.setAttachLayer(piping_layer)
else
@@ -73,8 +73,8 @@
/obj/machinery/atmospherics/pipe/return_pipenet()
return parent
-/obj/machinery/atmospherics/pipe/set_pipenet(datum/pipeline/P)
- parent = P
+/obj/machinery/atmospherics/pipe/set_pipenet(datum/pipeline/pipenet_to_set)
+ parent = pipenet_to_set
/obj/machinery/atmospherics/pipe/Destroy()
QDEL_NULL(parent)
@@ -82,13 +82,14 @@
releaseAirToTurf()
QDEL_NULL(air_temporary)
- var/turf/T = loc
- for(var/obj/machinery/meter/meter in T)
- if(meter.target == src)
- var/obj/item/pipe_meter/PM = new (T)
- meter.transfer_fingerprints_to(PM)
- qdel(meter)
- . = ..()
+ var/turf/local_turf = loc
+ for(var/obj/machinery/meter/meter in local_turf)
+ if(meter.target != src)
+ continue
+ var/obj/item/pipe_meter/meter_object = new (local_turf)
+ meter.transfer_fingerprints_to(meter_object)
+ qdel(meter)
+ return ..()
/obj/machinery/atmospherics/pipe/update_icon()
. = ..()
@@ -96,9 +97,10 @@
/obj/machinery/atmospherics/pipe/proc/update_node_icon()
for(var/i in 1 to device_type)
- if(nodes[i])
- var/obj/machinery/atmospherics/N = nodes[i]
- N.update_icon()
+ if(!nodes[i])
+ continue
+ var/obj/machinery/atmospherics/current_node = nodes[i]
+ current_node.update_icon()
/obj/machinery/atmospherics/pipe/return_pipenets()
. = list(parent)
diff --git a/code/modules/atmospherics/machinery/pipes/smart.dm b/code/modules/atmospherics/machinery/pipes/smart.dm
new file mode 100644
index 0000000000000..5099aeefc7ba5
--- /dev/null
+++ b/code/modules/atmospherics/machinery/pipes/smart.dm
@@ -0,0 +1,89 @@
+GLOBAL_LIST_INIT(atmos_components, typecacheof(list(/obj/machinery/atmospherics)))
+//Smart pipes... or are they?
+/obj/machinery/atmospherics/pipe/smart
+ icon = 'icons/obj/atmospherics/pipes/simple.dmi'
+ icon_state = "pipe11-3"
+
+ name = "pipe"
+ desc = "A one meter section of regular pipe."
+
+ device_type = QUATERNARY
+ construction_type = /obj/item/pipe/quaternary
+ pipe_state = "manifold4w"
+ ///Current active connections
+ var/connections = NONE
+
+/obj/machinery/atmospherics/pipe/smart/update_pipe_icon()
+ icon = 'icons/obj/atmospherics/pipes/pipes_bitmask.dmi'
+ connections = NONE
+
+ for(var/i in 1 to device_type)
+ if(!nodes[i])
+ continue
+ var/obj/machinery/atmospherics/node = nodes[i]
+ var/connected_dir = get_dir(src, node)
+ connections |= connected_dir
+ var/bitfield = CARDINAL_TO_FULLPIPES(connections)
+ dir = check_binary_direction(connections)
+
+ // If we dont have enough bits to make a proper sprite, add some shortpipe bits
+
+ // Smart pipe icons differ from classic pipe icons in that we stop adding
+ // short pipe directions as soon as we find a valid sprite, rather than
+ // adding in all connectable directions.
+ // This prevents a lot of visual clutter, though it does make it harder to
+ // notice completely disconnected pipes.
+ if(ISSTUB(connections))
+ var/bits_to_add = NONE
+ if(connections != NONE)
+ bits_to_add |= REVERSE_DIR(connections) & initialize_directions
+ var/candidates = initialize_directions
+ var/shift = 0
+ // Note that candidates "should" never reach 0, as stub pipes are not allowed and break things
+ while (ISSTUB(connections | bits_to_add) && (candidates >> shift) != 0)
+ bits_to_add |= candidates & (1 << shift)
+ shift += 1
+ bitfield |= CARDINAL_TO_SHORTPIPES(bits_to_add)
+
+ icon_state = "[bitfield]_[piping_layer]"
+
+/obj/machinery/atmospherics/pipe/smart/set_init_directions(init_dir)
+ if(init_dir)
+ initialize_directions = init_dir
+ else
+ initialize_directions = ALL_CARDINALS
+
+/obj/machinery/atmospherics/pipe/smart/proc/check_binary_direction(direction)
+ switch(direction)
+ if(EAST|WEST)
+ return EAST
+ if(SOUTH|NORTH)
+ return SOUTH
+ else
+ return direction
+
+/obj/machinery/atmospherics/pipe/smart/proc/check_manifold_direction(direction)
+ switch(direction)
+ if(NORTH|SOUTH|EAST)
+ return WEST
+ if(NORTH|SOUTH|WEST)
+ return EAST
+ if(NORTH|WEST|EAST)
+ return SOUTH
+ if(SOUTH|WEST|EAST)
+ return NORTH
+ else
+ return null
+
+//mapping helpers
+/obj/machinery/atmospherics/pipe/smart/simple
+ icon = 'icons/obj/atmospherics/pipes/simple.dmi'
+ icon_state = "pipe11-3"
+
+/obj/machinery/atmospherics/pipe/smart/manifold
+ icon = 'icons/obj/atmospherics/pipes/manifold.dmi'
+ icon_state = "manifold-3"
+
+/obj/machinery/atmospherics/pipe/smart/manifold4w
+ icon = 'icons/obj/atmospherics/pipes/manifold.dmi'
+ icon_state = "manifold4w-3"
diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
index d63373de7ddef..46f6af572f588 100644
--- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
+++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
@@ -37,9 +37,8 @@
return //Indestructable cans shouldn't release air
//This explosion will destroy the can, release its air.
- var/turf/T = get_turf(src)
- T.assume_air(air_contents)
- T.air_update_turf(FALSE, FALSE)
+ var/turf/local_turf = get_turf(src)
+ local_turf.assume_air(air_contents)
return ..()
@@ -132,48 +131,50 @@
update_appearance()
return TRUE
-/obj/machinery/portable_atmospherics/attackby(obj/item/W, mob/user, params)
- if(istype(W, /obj/item/tank))
- if(!(machine_stat & BROKEN))
- var/obj/item/tank/T = W
- if(!user.transferItemToLoc(T, src))
- return
- to_chat(user, "[holding ? "In one smooth motion you pop [holding] out of [src]'s connector and replace it with [T]" : "You insert [T] into [src]"].")
- investigate_log("had its internal [holding] swapped with [T] by [key_name(user)].", INVESTIGATE_ATMOS)
- replace_tank(user, FALSE, T)
- update_appearance()
- else if(W.tool_behaviour == TOOL_WRENCH)
- if(!(machine_stat & BROKEN))
- if(connected_port)
- investigate_log("was disconnected from [connected_port] by [key_name(user)].", INVESTIGATE_ATMOS)
- disconnect()
- W.play_tool_sound(src)
- user.visible_message( \
- "[user] disconnects [src].", \
- "You unfasten [src] from the port.", \
- "You hear a ratchet.")
- update_appearance()
- return
- else
- var/obj/machinery/atmospherics/components/unary/portables_connector/possible_port = locate(/obj/machinery/atmospherics/components/unary/portables_connector) in loc
- if(!possible_port)
- to_chat(user, "Nothing happens.")
- return
- if(!connect(possible_port))
- to_chat(user, "[name] failed to connect to the port.")
- return
- W.play_tool_sound(src)
- user.visible_message( \
- "[user] connects [src].", \
- "You fasten [src] to the port.", \
- "You hear a ratchet.")
- update_appearance()
- investigate_log("was connected to [possible_port] by [key_name(user)].", INVESTIGATE_ATMOS)
- else
+/obj/machinery/portable_atmospherics/attackby(obj/item/item, mob/user, params)
+ if(!istype(item, /obj/item/tank))
return ..()
+ if(machine_stat & BROKEN)
+ return FALSE
+ var/obj/item/tank/insert_tank = item
+ if(!user.transferItemToLoc(insert_tank, src))
+ return FALSE
+ to_chat(user, span_notice("[holding ? "In one smooth motion you pop [holding] out of [src]'s connector and replace it with [insert_tank]" : "You insert [insert_tank] into [src]"]."))
+ investigate_log("had its internal [holding] swapped with [insert_tank] by [key_name(user)].", INVESTIGATE_ATMOS)
+ replace_tank(user, FALSE, insert_tank)
+ update_appearance()
+
+/obj/machinery/portable_atmospherics/wrench_act(mob/living/user, obj/item/wrench)
+ if(machine_stat & BROKEN)
+ return FALSE
+ if(connected_port)
+ investigate_log("was disconnected from [connected_port] by [key_name(user)].", INVESTIGATE_ATMOS)
+ disconnect()
+ wrench.play_tool_sound(src)
+ user.visible_message( \
+ "[user] disconnects [src].", \
+ span_notice("You unfasten [src] from the port."), \
+ span_hear("You hear a ratchet."))
+ update_appearance()
+ return TRUE
+ var/obj/machinery/atmospherics/components/unary/portables_connector/possible_port = locate(/obj/machinery/atmospherics/components/unary/portables_connector) in loc
+ if(!possible_port)
+ to_chat(user, span_notice("Nothing happens."))
+ return FALSE
+ if(!connect(possible_port))
+ to_chat(user, span_notice("[name] failed to connect to the port."))
+ return FALSE
+ wrench.play_tool_sound(src)
+ user.visible_message( \
+ "[user] connects [src].", \
+ span_notice("You fasten [src] to the port."), \
+ span_hear("You hear a ratchet."))
+ update_appearance()
+ investigate_log("was connected to [possible_port] by [key_name(user)].", INVESTIGATE_ATMOS)
+ return TRUE
-/obj/machinery/portable_atmospherics/attacked_by(obj/item/I, mob/user)
- if(I.force < 10 && !(machine_stat & BROKEN))
+/obj/machinery/portable_atmospherics/attacked_by(obj/item/item, mob/user)
+ if(item.force < 10 && !(machine_stat & BROKEN))
take_damage(0)
else
investigate_log("was smacked with \a [I] by [key_name(user)].", INVESTIGATE_ATMOS)
diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm
index 1031492e4aea8..3bf122b83a345 100644
--- a/code/modules/atmospherics/machinery/portable/pump.dm
+++ b/code/modules/atmospherics/machinery/portable/pump.dm
@@ -84,10 +84,8 @@
investigate_log("a portable pump was set to [attached_pump.target_pressure] kPa by [parent.get_creator()].", INVESTIGATE_ATMOS)
/obj/machinery/portable_atmospherics/pump/Destroy()
- var/turf/T = get_turf(src)
- T.assume_air(air_contents)
- air_update_turf(FALSE, FALSE)
- QDEL_NULL(pump)
+ var/turf/local_turf = get_turf(src)
+ local_turf.assume_air(air_contents)
return ..()
/obj/machinery/portable_atmospherics/pump/update_icon()
@@ -105,15 +103,15 @@
pump.airs[2] = null
return
- var/turf/T = get_turf(src)
- var/datum/gas_mixture/temp_air_contents = return_air()
- var/datum/gas_mixture/temp_holding_air_contents = holding_return_air()
+ var/turf/local_turf = get_turf(src)
+ var/datum/gas_mixture/sending
+ var/datum/gas_mixture/receiving
if(direction == PUMP_OUT) // Hook up the internal pump.
- pump.airs[1] = holding ? temp_holding_air_contents : temp_air_contents
- pump.airs[2] = holding ? temp_air_contents : T.return_air()
+ sending = (holding ? holding.return_air() : air_contents)
+ receiving = (holding ? air_contents : local_turf.return_air())
else
- pump.airs[1] = holding ? temp_air_contents : T.return_air()
- pump.airs[2] = holding ? temp_holding_air_contents : temp_air_contents
+ sending = (holding ? air_contents : local_turf.return_air())
+ receiving = (holding ? holding.return_air() : air_contents)
pump.process_atmos() // Pump gas.
if(!holding)
diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm
index d4f4dcbf805af..9f89a8fa2c99c 100644
--- a/code/modules/atmospherics/machinery/portable/scrubber.dm
+++ b/code/modules/atmospherics/machinery/portable/scrubber.dm
@@ -151,7 +151,7 @@
if(!holding)
var/turf/T = get_turf(src)
- for(var/turf/AT in T.GetAtmosAdjacentTurfs(alldir = TRUE))
+ for(var/turf/AT in T.get_atmos_adjacent_turfs(alldir = TRUE))
scrub(AT.return_air())
return ..()
diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm
index cdc7c63d497ff..a56078ce18d75 100644
--- a/code/modules/mob/living/simple_animal/bot/bot.dm
+++ b/code/modules/mob/living/simple_animal/bot/bot.dm
@@ -463,10 +463,8 @@ Pass the desired type path itself, declaring a temporary var beforehand is not r
var/turf/T = get_turf(src)
if(!T)
return
- var/list/adjacent = T.GetAtmosAdjacentTurfs(1)
- var/atom/final_result
- var/static/list/turf_typecache = typecacheof(/turf)
- if(shuffle) //If we were on the same tile as another bot, let's randomize our choices so we dont both go the same way
+ var/list/adjacent = T.get_atmos_adjacent_turfs(1)
+ if(shuffle) //If we were on the same tile as another bot, let's randomize our choices so we dont both go the same way
adjacent = shuffle(adjacent)
shuffle = FALSE
for(var/turf/scan as() in adjacent)//Let's see if there's something right next to us first!
diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm
index d36021d7a6fec..6c5be8f80e919 100644
--- a/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm
+++ b/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm
@@ -57,7 +57,7 @@
. = ..()
if(banana_time && banana_time < world.time)
var/turf/T = get_turf(src)
- var/list/adjacent = T.GetAtmosAdjacentTurfs(1)
+ var/list/adjacent = T.get_atmos_adjacent_turfs(1)
new banana_type(pick(adjacent))
banana_time = world.time + rand(30,60)
diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm
index bf8b25f1295b5..773afb9538b43 100644
--- a/code/modules/power/singularity/containment_field.dm
+++ b/code/modules/power/singularity/containment_field.dm
@@ -11,6 +11,7 @@
use_power = NO_POWER_USE
interaction_flags_atom = NONE
interaction_flags_machine = NONE
+ can_atmos_pass = ATMOS_PASS_NO
light_range = 4
layer = ABOVE_OBJ_LAYER
var/obj/machinery/field/generator/FG1 = null
diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm
index 0af3d05f9b767..0b997177818b7 100644
--- a/code/modules/power/singularity/field_generator.dm
+++ b/code/modules/power/singularity/field_generator.dm
@@ -32,6 +32,7 @@ field_generator power level display
density = TRUE
use_power = NO_POWER_USE
max_integrity = 500
+ can_atmos_pass = ATMOS_PASS_YES
//100% immune to lasers and energy projectiles since it absorbs their energy.
armor = list(MELEE = 25, BULLET = 10, LASER = 100, ENERGY = 100, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 70, STAMINA = 0)
var/power_level = 0
@@ -182,6 +183,7 @@ field_generator power level display
/obj/machinery/field/generator/proc/turn_off()
active = FG_OFFLINE
+ can_atmos_pass = ATMOS_PASS_YES
air_update_turf(TRUE, FALSE)
can_atmos_pass = ATMOS_PASS_YES
spawn(1)
diff --git a/code/modules/reagents/chem_splash.dm b/code/modules/reagents/chem_splash.dm
index 431754b4fce67..13f36942604eb 100644
--- a/code/modules/reagents/chem_splash.dm
+++ b/code/modules/reagents/chem_splash.dm
@@ -45,7 +45,7 @@
for(var/turf/T as() in turflist)
if(accessible[T])
continue
- for(var/thing in T.GetAtmosAdjacentTurfs(alldir = TRUE))
+ for(var/thing in T.get_atmos_adjacent_turfs(alldir = TRUE))
var/turf/NT = thing
if(!(NT in accessible))
continue
diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm
index b87db205e14be..0afa12ed91a37 100644
--- a/code/modules/shuttle/on_move.dm
+++ b/code/modules/shuttle/on_move.dm
@@ -279,8 +279,8 @@ All ShuttleMove procs go here
A.add_member(src)
SSair.add_to_rebuild_queue(src)
else
- // atmos_init() calls update_icon(), so we don't need to call it
- update_icon()
+ // atmos_init() calls update_appearance(), so we don't need to call it
+ update_appearance()
/obj/machinery/navbeacon/beforeShuttleMove(turf/newT, rotation, move_mode, obj/docking_port/mobile/moving_dock)
. = ..()
From 07c00e75a4d077af5c3a90523ce1de4ac2b608df Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 19 Aug 2024 23:18:28 +0200
Subject: [PATCH 042/114] smartpipes tried to sneak in, begone!
This reverts commit 9a4e8565bf6471c29923e31452a6f7a4f8b4c034.
---
code/__DEFINES/atmospherics/atmos_helpers.dm | 2 +-
code/controllers/subsystem/air.dm | 9 +-
.../effects/effect_system/effects_foam.dm | 2 +-
.../effects/effect_system/effects_smoke.dm | 2 +-
code/game/objects/effects/portals.dm | 2 -
.../objects/effects/spawners/bombspawner.dm | 8 +-
code/game/objects/items/flamethrower.dm | 4 +-
code/game/objects/structures/aliens.dm | 4 +-
code/game/objects/structures/holosign.dm | 3 -
.../objects/structures/windoor_assembly.dm | 8 +-
code/game/objects/structures/window.dm | 5 +-
code/game/shuttle_engines.dm | 3 +-
code/game/turfs/open/floor/reinf_floor.dm | 2 +-
code/game/turfs/open/openspace.dm | 2 +-
code/modules/art/statues.dm | 579 ------------------
.../environmental/LINDA_system.dm | 135 ++--
.../environmental/LINDA_turf_tile.dm | 249 ++++----
.../atmospherics/machinery/atmosmachinery.dm | 155 +----
.../components/binary_devices/circulator.dm | 7 +-
.../components/binary_devices/dp_vent_pump.dm | 10 +-
.../components/binary_devices/passive_gate.dm | 8 -
.../binary_devices/pressure_valve.dm | 10 -
.../components/binary_devices/pump.dm | 9 +-
.../binary_devices/thermomachine.dm | 515 ----------------
.../components/binary_devices/valve.dm | 10 -
.../components/binary_devices/volume_pump.dm | 8 +-
.../machinery/components/components_base.dm | 42 +-
.../machinery/components/fusion/hfr_parts.dm | 503 ---------------
.../gas_recipe_machines/crystallizer.dm | 339 ----------
.../atmospherics/machinery/components/tank.dm | 553 -----------------
.../components/trinary_devices/filter.dm | 21 +-
.../components/trinary_devices/mixer.dm | 22 +-
.../trinary_devices/trinary_devices.dm | 1 -
.../unary_devices/bluespace_sender.dm | 178 ------
.../components/unary_devices/cryo.dm | 4 +-
.../unary_devices/heat_exchanger.dm | 15 +-
.../unary_devices/outlet_injector.dm | 13 +-
.../components/unary_devices/passive_vent.dm | 2 +-
.../unary_devices/portables_connector.dm | 12 +-
.../components/unary_devices/unary_devices.dm | 2 -
.../components/unary_devices/vent_pump.dm | 25 +-
.../components/unary_devices/vent_scrubber.dm | 45 +-
.../atmospherics/machinery/datum_pipeline.dm | 19 +-
.../atmospherics/machinery/other/meter.dm | 21 +-
.../machinery/pipes/bridge_pipe.dm | 29 -
.../machinery/pipes/color_adapter.dm | 63 --
.../machinery/pipes/heat_exchange/he_pipes.dm | 48 +-
.../machinery/pipes/heat_exchange/manifold.dm | 4 +-
.../pipes/heat_exchange/manifold4w.dm | 3 +-
.../machinery/pipes/heat_exchange/simple.dm | 2 +-
.../machinery/pipes/layermanifold.dm | 43 +-
.../atmospherics/machinery/pipes/multiz.dm | 21 +-
.../atmospherics/machinery/pipes/pipes.dm | 42 +-
.../atmospherics/machinery/pipes/smart.dm | 89 ---
.../portable/portable_atmospherics.dm | 87 ++-
.../atmospherics/machinery/portable/pump.dm | 20 +-
.../machinery/portable/scrubber.dm | 2 +-
.../mob/living/simple_animal/bot/bot.dm | 6 +-
.../simple_animal/hostile/retaliate/clown.dm | 2 +-
.../power/singularity/containment_field.dm | 1 -
.../power/singularity/field_generator.dm | 2 -
code/modules/reagents/chem_splash.dm | 2 +-
code/modules/shuttle/on_move.dm | 4 +-
63 files changed, 479 insertions(+), 3559 deletions(-)
delete mode 100644 code/modules/art/statues.dm
delete mode 100644 code/modules/atmospherics/machinery/components/binary_devices/thermomachine.dm
delete mode 100644 code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm
delete mode 100644 code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm
delete mode 100644 code/modules/atmospherics/machinery/components/tank.dm
delete mode 100644 code/modules/atmospherics/machinery/components/unary_devices/bluespace_sender.dm
delete mode 100644 code/modules/atmospherics/machinery/pipes/bridge_pipe.dm
delete mode 100644 code/modules/atmospherics/machinery/pipes/color_adapter.dm
delete mode 100644 code/modules/atmospherics/machinery/pipes/smart.dm
diff --git a/code/__DEFINES/atmospherics/atmos_helpers.dm b/code/__DEFINES/atmospherics/atmos_helpers.dm
index 887021476467c..c546c9d745111 100644
--- a/code/__DEFINES/atmospherics/atmos_helpers.dm
+++ b/code/__DEFINES/atmospherics/atmos_helpers.dm
@@ -2,7 +2,7 @@
///Check if the turfs allows gas passage based on density, do not use.
#define CANATMOSPASS(A, O) ( A.can_atmos_pass == ATMOS_PASS_PROC ? A.can_atmos_pass(O) : ( A.can_atmos_pass == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_pass ) )
///Check if the turfs allows gas passage on a z level, do not use.
-#define CANVERTICALATMOSPASS(A, O) ( A.can_atmos_pass_vertical == ATMOS_PASS_PROC ? A.can_atmos_pass(O, TRUE) : ( A.can_atmos_pass_vertical == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_pass_vertical ) )
+#define CANVERTICALATMOSPASS(A, O) ( A.can_atmos_passVertical == ATMOS_PASS_PROC ? A.can_atmos_pass(O, TRUE) : ( A.can_atmos_passVertical == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_passVertical ) )
//Helpers
///Moves the icon of the device based on the piping layer and on the direction
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index 34d9e8fc7576e..aa5ae4e5e562b 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -623,12 +623,9 @@ GLOBAL_LIST_EMPTY(colored_images)
if(!pipe_init_dirs_cache[type])
pipe_init_dirs_cache[type] = list()
- if(!pipe_init_dirs_cache[type]["[init_dir]"])
- pipe_init_dirs_cache[type]["[init_dir]"] = list()
-
- if(!pipe_init_dirs_cache[type]["[init_dir]"]["[dir]"])
- var/obj/machinery/atmospherics/temp = new type(null, FALSE, dir, init_dir)
- pipe_init_dirs_cache[type]["[init_dir]"]["[dir]"] = temp.get_init_directions()
+ if(!pipe_init_dirs_cache[type]["[dir]"])
+ var/obj/machinery/atmospherics/temp = new type(null, FALSE, dir)
+ pipe_init_dirs_cache[type]["[dir]"] = temp.get_init_directions()
qdel(temp)
return pipe_init_dirs_cache[type]["[dir]"]
diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm
index 8f55cf1023ce3..23994b07202ea 100644
--- a/code/game/objects/effects/effect_system/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/effects_foam.dm
@@ -193,7 +193,7 @@
/obj/effect/particle_effect/foam/proc/spread_foam()
var/turf/t_loc = get_turf(src)
- for(var/turf/T in t_loc.get_atmos_adjacent_turfs())
+ for(var/turf/T in t_loc.GetAtmosAdjacentTurfs())
var/obj/effect/particle_effect/foam/foundfoam = locate() in T //Don't spread foam where there's already foam!
if(foundfoam)
continue
diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm
index 4eea8f4d46c19..a969544c09669 100644
--- a/code/game/objects/effects/effect_system/effects_smoke.dm
+++ b/code/game/objects/effects/effect_system/effects_smoke.dm
@@ -91,7 +91,7 @@
if(!t_loc)
return
var/list/newsmokes = list()
- for(var/turf/T in t_loc.get_atmos_adjacent_turfs())
+ for(var/turf/T in t_loc.GetAtmosAdjacentTurfs(!circle))
var/obj/effect/particle_effect/smoke/foundsmoke = locate() in T //Don't spread smoke where there's already smoke!
if(foundsmoke)
continue
diff --git a/code/game/objects/effects/portals.dm b/code/game/objects/effects/portals.dm
index f509df340dccb..6e276151487f0 100644
--- a/code/game/objects/effects/portals.dm
+++ b/code/game/objects/effects/portals.dm
@@ -143,12 +143,10 @@
if(istype(atmos_source))
if(istype(atmos_destination) && !atmos_source.Adjacent(atmos_destination) && !CANATMOSPASS(atmos_destination, atmos_source))
LAZYREMOVE(atmos_source.atmos_adjacent_turfs, atmos_destination)
- atmos_source.immediate_calculate_adjacent_turfs() //Just in case they were next to each other
atmos_source = null
if(istype(atmos_destination))
if(istype(atmos_source) && !atmos_destination.Adjacent(atmos_source) && !CANATMOSPASS(atmos_source, atmos_destination))
LAZYREMOVE(atmos_destination.atmos_adjacent_turfs, atmos_source)
- atmos_destination.immediate_calculate_adjacent_turfs()
atmos_destination = null
/obj/effect/portal/Destroy(force) //Calls on_portal_destroy(destroyed portal, location of destroyed portal) on creator if creator has such call.
diff --git a/code/game/objects/effects/spawners/bombspawner.dm b/code/game/objects/effects/spawners/bombspawner.dm
index 63dbe14b0e027..6dd0fd43fadb3 100644
--- a/code/game/objects/effects/spawners/bombspawner.dm
+++ b/code/game/objects/effects/spawners/bombspawner.dm
@@ -30,10 +30,10 @@
oxygen_mix.gases[/datum/gas/oxygen][MOLES] = pressure_o*oxygen_mix.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o))
oxygen_mix.temperature = CELSIUS_TO_KELVIN(temp_o)
- V.tank_one = plasma_tank
- V.tank_two = oxygen_tank
- plasma_tank.master = V
- oxygen_tank.master = V
+ V.tank_one = PT
+ V.tank_two = OT
+ PT.master = V
+ OT.master = V
if(assembly_type)
var/obj/item/assembly/A = new assembly_type(V)
diff --git a/code/game/objects/items/flamethrower.dm b/code/game/objects/items/flamethrower.dm
index 9e0a51f5b1f68..a82b7a9dd0292 100644
--- a/code/game/objects/items/flamethrower.dm
+++ b/code/game/objects/items/flamethrower.dm
@@ -198,8 +198,8 @@
var/turf/previousturf = get_turf(src)
for(var/turf/T in turflist)
if(T == previousturf)
- continue //so we don't burn the tile we be standin on
- var/list/turfs_sharing_with_prev = previousturf.get_atmos_adjacent_turfs(alldir=1)
+ continue //so we don't burn the tile we be standin on
+ var/list/turfs_sharing_with_prev = previousturf.GetAtmosAdjacentTurfs(alldir=1)
if(!(T in turfs_sharing_with_prev))
break
if(igniter)
diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm
index 40ae9681508e9..40cfb310587b1 100644
--- a/code/game/objects/structures/aliens.dm
+++ b/code/game/objects/structures/aliens.dm
@@ -185,8 +185,8 @@
qdel(src)
return FALSE
- for(var/turf/T in U.get_atmos_adjacent_turfs())
- if(locate(/obj/structure/alien/weeds) in T)
+ for(var/turf/T in U.GetAtmosAdjacentTurfs())
+ if((locate(/obj/structure/alien/weeds) in T))
continue
if(is_type_in_typecache(T, blacklisted_turfs))
diff --git a/code/game/objects/structures/holosign.dm b/code/game/objects/structures/holosign.dm
index ef22a437e98ff..4db9d35f37002 100644
--- a/code/game/objects/structures/holosign.dm
+++ b/code/game/objects/structures/holosign.dm
@@ -109,9 +109,6 @@
ADD_TRAIT(local, TRAIT_FIREDOOR_STOP, TRAIT_GENERIC)
air_update_turf(TRUE, TRUE)
-/obj/structure/holosign/barrier/atmos/block_superconductivity() //Didn't used to do this, but it's "normal", and will help ease heat flow transitions with the players.
- return TRUE
-
/obj/structure/holosign/barrier/atmos/Destroy()
var/turf/local = get_turf(loc)
REMOVE_TRAIT(local, TRAIT_FIREDOOR_STOP, TRAIT_GENERIC)
diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm
index 010a72bc49312..0286d36e70594 100644
--- a/code/game/objects/structures/windoor_assembly.dm
+++ b/code/game/objects/structures/windoor_assembly.dm
@@ -26,10 +26,10 @@
var/created_name = null
//Vars to help with the icon's name
- var/facing = "l" //Does the windoor open to the left or right?
- var/secure = FALSE //Whether or not this creates a secure windoor
- var/state = "01" //How far the door assembly has progressed
- can_atmos_pass = ATMOS_PASS_PROC
+ var/facing = "l" //Does the windoor open to the left or right?
+ var/secure = FALSE //Whether or not this creates a secure windoor
+ var/state = "01" //How far the door assembly has progressed
+
/obj/structure/windoor_assembly/Initialize(mapload, loc, set_dir)
. = ..()
diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm
index 7b7e0084ec0e6..deead8ca24343 100644
--- a/code/game/objects/structures/window.dm
+++ b/code/game/objects/structures/window.dm
@@ -467,10 +467,7 @@
explosion_block = 2
glass_type = /obj/item/stack/sheet/plasmarglass
-/obj/structure/window/reinforced/plasma/block_superconductivity()
- return TRUE
-
-/obj/structure/window/reinforced/plasma/spawner/east
+/obj/structure/window/plasma/reinforced/spawner/east
dir = EAST
/obj/structure/window/plasma/reinforced/spawner/west
diff --git a/code/game/shuttle_engines.dm b/code/game/shuttle_engines.dm
index caa813fd7f35c..7fc2d2d0b5eba 100644
--- a/code/game/shuttle_engines.dm
+++ b/code/game/shuttle_engines.dm
@@ -8,8 +8,7 @@
icon = 'icons/turf/shuttle.dmi'
resistance_flags = LAVA_PROOF | FIRE_PROOF | ACID_PROOF
max_integrity = 500
- armor = list(MELEE = 100, BULLET = 10, LASER = 10, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 70) //default + ignores melee
- can_atmos_pass = ATMOS_PASS_DENSITY
+ armor = list(MELEE = 100, BULLET = 10, LASER = 10, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 70, STAMINA = 0) //default + ignores melee
/obj/structure/shuttle/engine
name = "engine"
diff --git a/code/game/turfs/open/floor/reinf_floor.dm b/code/game/turfs/open/floor/reinf_floor.dm
index 65000cf9f13e5..0b154861f03f8 100644
--- a/code/game/turfs/open/floor/reinf_floor.dm
+++ b/code/game/turfs/open/floor/reinf_floor.dm
@@ -131,7 +131,7 @@
floor_tile = null
var/obj/effect/clockwork/overlay/floor/bloodcult/realappearance
can_atmos_pass = ATMOS_PASS_NO
- can_atmos_pass_vertical = ATMOS_PASS_NO
+ can_atmos_passVertical = ATMOS_PASS_NO
/turf/open/floor/engine/cult/Initialize(mapload)
diff --git a/code/game/turfs/open/openspace.dm b/code/game/turfs/open/openspace.dm
index b603ddff1c12f..e3ffe3e53743c 100644
--- a/code/game/turfs/open/openspace.dm
+++ b/code/game/turfs/open/openspace.dm
@@ -3,7 +3,7 @@
desc = "Watch your step!"
icon_state = "invisible"
baseturfs = /turf/open/openspace
- can_atmos_pass_vertical = ATMOS_PASS_YES
+ can_atmos_passVertical = ATMOS_PASS_YES
overfloor_placed = FALSE
underfloor_accessibility = UNDERFLOOR_INTERACTABLE
allow_z_travel = TRUE
diff --git a/code/modules/art/statues.dm b/code/modules/art/statues.dm
deleted file mode 100644
index de9ecb770d67b..0000000000000
--- a/code/modules/art/statues.dm
+++ /dev/null
@@ -1,579 +0,0 @@
-/obj/structure/statue
- name = "statue"
- desc = "Placeholder. Yell at Firecage if you SOMEHOW see this."
- icon = 'icons/obj/statue.dmi'
- icon_state = ""
- density = TRUE
- anchored = FALSE
- max_integrity = 100
- can_atmos_pass = ATMOS_PASS_DENSITY
- material_modifier = 0.5
- material_flags = MATERIAL_EFFECTS | MATERIAL_AFFECT_STATISTICS
- blocks_emissive = EMISSIVE_BLOCK_UNIQUE
- /// Beauty component mood modifier
- var/impressiveness = 15
- /// Art component subtype added to this statue
- var/art_type = /datum/element/art
- /// Abstract root type
- var/abstract_type = /obj/structure/statue
-
-/obj/structure/statue/Initialize(mapload)
- . = ..()
- AddElement(art_type, impressiveness)
- AddElement(/datum/element/beauty, impressiveness * 75)
- AddComponent(/datum/component/simple_rotation, ROTATION_ALTCLICK | ROTATION_CLOCKWISE, CALLBACK(src, .proc/can_user_rotate), CALLBACK(src, .proc/can_be_rotated), null)
-
-/obj/structure/statue/proc/can_be_rotated(mob/user)
- if(!anchored)
- return TRUE
- to_chat(user, span_warning("It's bolted to the floor, you'll need to unwrench it first."))
-
-/obj/structure/statue/proc/can_user_rotate(mob/user)
- return user.canUseTopic(src, BE_CLOSE, NO_DEXTERITY, FALSE, !iscyborg(user))
-
-/obj/structure/statue/attackby(obj/item/W, mob/living/user, params)
- add_fingerprint(user)
- if(!(flags_1 & NODECONSTRUCT_1))
- if(default_unfasten_wrench(user, W))
- return
- if(W.tool_behaviour == TOOL_WELDER)
- if(!W.tool_start_check(user, amount=0))
- return FALSE
-
- user.visible_message(span_notice("[user] is slicing apart the [name]."), \
- span_notice("You are slicing apart the [name]..."))
- if(W.use_tool(src, user, 40, volume=50))
- user.visible_message(span_notice("[user] slices apart the [name]."), \
- span_notice("You slice apart the [name]!"))
- deconstruct(TRUE)
- return
- return ..()
-
-/obj/structure/statue/deconstruct(disassembled = TRUE)
- if(!(flags_1 & NODECONSTRUCT_1))
- var/amount_mod = disassembled ? 0 : -2
- for(var/mat in custom_materials)
- var/datum/material/custom_material = GET_MATERIAL_REF(mat)
- var/amount = max(0,round(custom_materials[mat]/MINERAL_MATERIAL_AMOUNT) + amount_mod)
- if(amount > 0)
- new custom_material.sheet_type(drop_location(),amount)
- qdel(src)
-
-//////////////////////////////////////STATUES/////////////////////////////////////////////////////////////
-////////////////////////uranium///////////////////////////////////
-
-/obj/structure/statue/uranium
- max_integrity = 300
- light_range = 2
- custom_materials = list(/datum/material/uranium=MINERAL_MATERIAL_AMOUNT*5)
- impressiveness = 25 // radiation makes an impression
- abstract_type = /obj/structure/statue/uranium
-
-/obj/structure/statue/uranium/nuke
- name = "statue of a nuclear fission explosive"
- desc = "This is a grand statue of a Nuclear Explosive. It has a sickening green colour."
- icon_state = "nuke"
-
-/obj/structure/statue/uranium/eng
- name = "Statue of an engineer"
- desc = "This statue has a sickening green colour."
- icon_state = "eng"
-
-////////////////////////////plasma///////////////////////////////////////////////////////////////////////
-
-/obj/structure/statue/plasma
- max_integrity = 200
- impressiveness = 20
- desc = "This statue is suitably made from plasma."
- custom_materials = list(/datum/material/plasma=MINERAL_MATERIAL_AMOUNT*5)
- abstract_type = /obj/structure/statue/plasma
-
-/obj/structure/statue/plasma/scientist
- name = "statue of a scientist"
- icon_state = "sci"
-
-/obj/structure/statue/plasma/xeno
- name = "statue of a xenomorph"
- icon_state = "xeno"
-
-/obj/structure/statue/plasma/Initialize(mapload)
- . = ..()
- AddElement(/datum/element/atmos_sensitive, mapload)
-
-/obj/structure/statue/plasma/bullet_act(obj/projectile/Proj)
- var/burn = FALSE
- if(!(Proj.nodamage) && Proj.damage_type == BURN && !QDELETED(src))
- burn = TRUE
- if(burn)
- var/turf/T = get_turf(src)
- if(Proj.firer)
- message_admins("Plasma statue ignited by [ADMIN_LOOKUPFLW(Proj.firer)] in [ADMIN_VERBOSEJMP(T)]")
- log_game("Plasma statue ignited by [key_name(Proj.firer)] in [AREACOORD(T)]")
- else
- message_admins("Plasma statue ignited by [Proj]. No known firer, in [ADMIN_VERBOSEJMP(T)]")
- log_game("Plasma statue ignited by [Proj] in [AREACOORD(T)]. No known firer.")
- PlasmaBurn(2500)
- . = ..()
-
-/obj/structure/statue/plasma/attackby(obj/item/W, mob/user, params)
- if(W.get_temperature() > 300 && !QDELETED(src))//If the temperature of the object is over 300, then ignite
- var/turf/T = get_turf(src)
- message_admins("Plasma statue ignited by [ADMIN_LOOKUPFLW(user)] in [ADMIN_VERBOSEJMP(T)]")
- log_game("Plasma statue ignited by [key_name(user)] in [AREACOORD(T)]")
- ignite(W.get_temperature())
- else
- return ..()
-
-/obj/structure/statue/plasma/should_atmos_process(datum/gas_mixture/air, exposed_temperature)
- return exposed_temperature > 300
-
-/obj/structure/statue/plasma/atmos_expose(datum/gas_mixture/air, exposed_temperature)
- PlasmaBurn(exposed_temperature)
-
-/obj/structure/statue/plasma/proc/PlasmaBurn(temperature)
- if(QDELETED(src))
- return
- if(custom_materials[/datum/material/plasma])
- var/plasma_amount = round(custom_materials[/datum/material/plasma]/MINERAL_MATERIAL_AMOUNT)
- atmos_spawn_air("plasma=[plasma_amount*10];TEMP=[temperature]")
- deconstruct(FALSE)
-
-/obj/structure/statue/plasma/proc/ignite(exposed_temperature)
- if(exposed_temperature > 300)
- PlasmaBurn(exposed_temperature)
-
-//////////////////////gold///////////////////////////////////////
-
-/obj/structure/statue/gold
- max_integrity = 300
- impressiveness = 25
- desc = "This is a highly valuable statue made from gold."
- custom_materials = list(/datum/material/gold=MINERAL_MATERIAL_AMOUNT*5)
- abstract_type = /obj/structure/statue/gold
-
-/obj/structure/statue/gold/hos
- name = "statue of the head of security"
- icon_state = "hos"
-
-/obj/structure/statue/gold/hop
- name = "statue of the head of personnel"
- icon_state = "hop"
-
-/obj/structure/statue/gold/cmo
- name = "statue of the chief medical officer"
- icon_state = "cmo"
-
-/obj/structure/statue/gold/ce
- name = "statue of the chief engineer"
- icon_state = "ce"
-
-/obj/structure/statue/gold/rd
- name = "statue of the research director"
- icon_state = "rd"
-
-//////////////////////////silver///////////////////////////////////////
-
-/obj/structure/statue/silver
- max_integrity = 300
- impressiveness = 25
- desc = "This is a valuable statue made from silver."
- custom_materials = list(/datum/material/silver=MINERAL_MATERIAL_AMOUNT*5)
- abstract_type = /obj/structure/statue/silver
-
-/obj/structure/statue/silver/md
- name = "statue of a medical officer"
- icon_state = "md"
-
-/obj/structure/statue/silver/janitor
- name = "statue of a janitor"
- icon_state = "jani"
-
-/obj/structure/statue/silver/sec
- name = "statue of a security officer"
- icon_state = "sec"
-
-/obj/structure/statue/silver/secborg
- name = "statue of a security cyborg"
- icon_state = "secborg"
-
-/obj/structure/statue/silver/medborg
- name = "statue of a medical cyborg"
- icon_state = "medborg"
-
-/////////////////////////diamond/////////////////////////////////////////
-
-/obj/structure/statue/diamond
- max_integrity = 1000
- impressiveness = 50
- desc = "This is a very expensive diamond statue."
- custom_materials = list(/datum/material/diamond=MINERAL_MATERIAL_AMOUNT*5)
- abstract_type = /obj/structure/statue/diamond
-
-/obj/structure/statue/diamond/captain
- name = "statue of THE captain."
- icon_state = "cap"
-
-/obj/structure/statue/diamond/ai1
- name = "statue of the AI hologram."
- icon_state = "ai1"
-
-/obj/structure/statue/diamond/ai2
- name = "statue of the AI core."
- icon_state = "ai2"
-
-////////////////////////bananium///////////////////////////////////////
-
-/obj/structure/statue/bananium
- max_integrity = 300
- impressiveness = 50
- desc = "A bananium statue with a small engraving:'HOOOOOOONK'."
- custom_materials = list(/datum/material/bananium=MINERAL_MATERIAL_AMOUNT*5)
- abstract_type = /obj/structure/statue/bananium
-
-/obj/structure/statue/bananium/clown
- name = "statue of a clown"
- icon_state = "clown"
-
-/////////////////////sandstone/////////////////////////////////////////
-
-/obj/structure/statue/sandstone
- max_integrity = 50
- impressiveness = 15
- custom_materials = list(/datum/material/sandstone=MINERAL_MATERIAL_AMOUNT*5)
- abstract_type = /obj/structure/statue/sandstone
-
-/obj/structure/statue/sandstone/assistant
- name = "statue of an assistant"
- desc = "A cheap statue of sandstone for a greyshirt."
- icon_state = "assist"
-
-
-/obj/structure/statue/sandstone/venus //call me when we add marble i guess
- name = "statue of a pure maiden"
- desc = "An ancient marble statue. The subject is depicted with a floor-length braid and is wielding a toolbox. By Jove, it's easily the most gorgeous depiction of a woman you've ever seen. The artist must truly be a master of his craft. Shame about the broken arm, though."
- icon = 'icons/obj/statuelarge.dmi'
- icon_state = "venus"
-
-/////////////////////snow/////////////////////////////////////////
-
-/obj/structure/statue/snow
- max_integrity = 50
- custom_materials = list(/datum/material/snow=MINERAL_MATERIAL_AMOUNT*5)
- abstract_type = /obj/structure/statue/snow
-
-/obj/structure/statue/snow/snowman
- name = "snowman"
- desc = "Several lumps of snow put together to form a snowman."
- icon_state = "snowman"
-
-/obj/structure/statue/snow/snowlegion
- name = "snowlegion"
- desc = "Looks like that weird kid with the tiger plushie has been round here again."
- icon_state = "snowlegion"
-
-///////////////////////////////bronze///////////////////////////////////
-
-/obj/structure/statue/bronze
- custom_materials = list(/datum/material/bronze=MINERAL_MATERIAL_AMOUNT*5)
- abstract_type = /obj/structure/statue/bronze
-
-/obj/structure/statue/bronze/marx
- name = "\improper Karl Marx bust"
- desc = "A bust depicting a certain 19th century economist. You get the feeling a specter is haunting the station."
- icon_state = "marx"
- art_type = /datum/element/art/rev
-
-///////////Elder Atmosian///////////////////////////////////////////
-
-/obj/structure/statue/elder_atmosian
- name = "Elder Atmosian"
- desc = "A statue of an Elder Atmosian, capable of bending the laws of thermodynamics to their will."
- icon_state = "eng"
- custom_materials = list(/datum/material/metalhydrogen = MINERAL_MATERIAL_AMOUNT*10)
- max_integrity = 1000
- impressiveness = 100
- abstract_type = /obj/structure/statue/elder_atmosian //This one is uncarvable
-
-/obj/item/chisel
- name = "chisel"
- desc = "Breaking and making art since 4000 BC. This one uses advanced technology to allow the creation of lifelike moving statues."
- icon = 'icons/obj/statue.dmi'
- icon_state = "chisel"
- inhand_icon_state = "screwdriver_nuke"
- lefthand_file = 'icons/mob/inhands/equipment/tools_lefthand.dmi'
- righthand_file = 'icons/mob/inhands/equipment/tools_righthand.dmi'
- flags_1 = CONDUCT_1
- slot_flags = ITEM_SLOT_BELT
- force = 5
- w_class = WEIGHT_CLASS_TINY
- throwforce = 5
- throw_speed = 3
- throw_range = 5
- custom_materials = list(/datum/material/iron=75)
- attack_verb_continuous = list("stabs")
- attack_verb_simple = list("stab")
- hitsound = 'sound/weapons/bladeslice.ogg'
- usesound = list('sound/items/screwdriver.ogg', 'sound/items/screwdriver2.ogg')
- drop_sound = 'sound/items/handling/screwdriver_drop.ogg'
- pickup_sound = 'sound/items/handling/screwdriver_pickup.ogg'
- sharpness = SHARP_POINTY
- tool_behaviour = TOOL_RUSTSCRAPER
- toolspeed = 3 // You're gonna have a bad time
-
- /// Block we're currently carving in
- var/obj/structure/carving_block/prepared_block
- /// If tracked user moves we stop sculpting
- var/mob/living/tracked_user
- /// Currently sculpting
- var/sculpting = FALSE
-
-/obj/item/chisel/Initialize(mapload)
- . = ..()
- AddElement(/datum/element/eyestab)
- AddElement(/datum/element/wall_engraver)
-
-/obj/item/chisel/Destroy()
- prepared_block = null
- tracked_user = null
- return ..()
-
-/*
-Hit the block to start
-Point with the chisel at the target to choose what to sculpt or hit block to choose from preset statue types.
-Hit block again to start sculpting.
-Moving interrupts
-*/
-/obj/item/chisel/pre_attack(atom/A, mob/living/user, params)
- . = ..()
- if(sculpting)
- return
- if(istype(A,/obj/structure/carving_block))
- if(A == prepared_block && (prepared_block.current_target || prepared_block.current_preset_type))
- start_sculpting(user)
- else if(!prepared_block)
- set_block(A,user)
- else if(A == prepared_block)
- show_generic_statues_prompt(user)
- return TRUE
- else if(prepared_block) //We're aiming at something next to us with block prepared
- prepared_block.set_target(A,user)
- return TRUE
-
-// We aim at something distant.
-/obj/item/chisel/afterattack(atom/target, mob/user, proximity_flag, click_parameters)
- . = ..()
- if(!proximity_flag && !sculpting && prepared_block && ismovable(target) && prepared_block.completion == 0)
- prepared_block.set_target(target,user)
-
-/obj/item/chisel/proc/start_sculpting(mob/living/user)
- to_chat(user,span_notice("You start sculpting [prepared_block]."),type=MESSAGE_TYPE_INFO)
- sculpting = TRUE
- //How long whole process takes
- var/sculpting_time = 30 SECONDS
- //Single interruptible progress period
- var/sculpting_period = round(sculpting_time / world.icon_size) //this is just so it reveals pixels line by line for each.
- var/interrupted = FALSE
- var/remaining_time = sculpting_time - (prepared_block.completion * sculpting_time)
-
- var/datum/progressbar/total_progress_bar = new(user, sculpting_time, prepared_block )
- while(remaining_time > 0 && !interrupted)
- if(do_after(user,sculpting_period, target = prepared_block, progress = FALSE))
- remaining_time -= sculpting_period
- prepared_block.set_completion((sculpting_time - remaining_time)/sculpting_time)
- total_progress_bar.update(sculpting_time - remaining_time)
- else
- interrupted = TRUE
- total_progress_bar.end_progress()
- if(!interrupted && !QDELETED(prepared_block))
- prepared_block.create_statue()
- to_chat(user,span_notice("The statue is finished!"),type=MESSAGE_TYPE_INFO)
- break_sculpting()
-
-/obj/item/chisel/proc/set_block(obj/structure/carving_block/B,mob/living/user)
- prepared_block = B
- tracked_user = user
- RegisterSignal(tracked_user,COMSIG_MOVABLE_MOVED,.proc/break_sculpting)
- to_chat(user,span_notice("You prepare to work on [B]."),type=MESSAGE_TYPE_INFO)
-
-/obj/item/chisel/dropped(mob/user, silent)
- . = ..()
- break_sculpting()
-
-/obj/item/chisel/proc/break_sculpting()
- SIGNAL_HANDLER
- sculpting = FALSE
- if(prepared_block && prepared_block.completion == 0)
- prepared_block.reset_target()
- prepared_block = null
- if(tracked_user)
- UnregisterSignal(tracked_user,COMSIG_MOVABLE_MOVED)
- tracked_user = null
-
-/obj/item/chisel/proc/show_generic_statues_prompt(mob/living/user)
- var/list/choices = list()
- for(var/statue_path in prepared_block.get_possible_statues())
- var/obj/structure/statue/S = statue_path
- choices[statue_path] = image(icon=initial(S.icon),icon_state=initial(S.icon_state))
- var/choice = show_radial_menu(user, prepared_block , choices, require_near = TRUE)
- if(choice)
- prepared_block.current_preset_type = choice
- var/image/chosen_looks = choices[choice]
- prepared_block.current_target = chosen_looks.appearance
- var/obj/structure/statue/S = choice
- to_chat(user,span_notice("You decide to sculpt [prepared_block] into [initial(S.name)]."),type=MESSAGE_TYPE_INFO)
-
-
-/obj/structure/carving_block
- name = "block"
- desc = "ready for sculpting."
- icon = 'icons/obj/statue.dmi'
- icon_state = "block"
- material_flags = MATERIAL_EFFECTS | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS | MATERIAL_ADD_PREFIX
- density = TRUE
- material_modifier = 0.5 //50% effectiveness of materials
-
- /// The thing it will look like - Unmodified resulting statue appearance
- var/current_target
- /// Currently chosen preset statue type
- var/current_preset_type
- //Table of required materials for each non-abstract statue type
- var/static/list/statue_costs
- /// statue completion from 0 to 1.0
- var/completion = 0
- /// Greyscaled target with cutout filter
- var/mutable_appearance/target_appearance_with_filters
- /// HSV color filters parameters
- var/static/list/greyscale_with_value_bump = list(0,0,0, 0,0,0, 0,0,1, 0,0,-0.05)
-
-/obj/structure/carving_block/Destroy()
- current_target = null
- target_appearance_with_filters = null
- return ..()
-
-/obj/structure/carving_block/proc/set_target(atom/movable/target,mob/living/user)
- if(!is_viable_target(target))
- to_chat(user,"You won't be able to carve that.")
- return
- if(istype(target,/obj/structure/statue/custom))
- var/obj/structure/statue/custom/original = target
- current_target = original.content_ma
- else
- current_target = target.appearance
- var/mutable_appearance/ma = current_target
- to_chat(user,span_notice("You decide to sculpt [src] into [ma.name]."),type=MESSAGE_TYPE_INFO)
-
-/obj/structure/carving_block/proc/reset_target()
- current_target = null
- current_preset_type = null
- target_appearance_with_filters = null
-
-/obj/structure/carving_block/update_overlays()
- . = ..()
- if(!target_appearance_with_filters)
- return
- //We're only keeping one instance here that changes in the middle so we have to clone it to avoid managed overlay issues
- var/mutable_appearance/clone = new(target_appearance_with_filters)
- . += clone
-
-/obj/structure/carving_block/proc/is_viable_target(atom/movable/target)
- //Only things on turfs
- if(!isturf(target.loc))
- return FALSE
- //No big icon things
- var/icon/thing_icon = icon(target.icon, target.icon_state)
- if(thing_icon.Height() != world.icon_size || thing_icon.Width() != world.icon_size)
- return FALSE
- return TRUE
-
-/obj/structure/carving_block/proc/create_statue()
- if(current_preset_type)
- var/obj/structure/statue/preset_statue = new current_preset_type(get_turf(src))
- preset_statue.set_custom_materials(custom_materials)
- qdel(src)
- else if(current_target)
- var/obj/structure/statue/custom/new_statue = new(get_turf(src))
- new_statue.set_visuals(current_target)
- new_statue.set_custom_materials(custom_materials)
- var/mutable_appearance/ma = current_target
- new_statue.name = "statue of [ma.name]"
- new_statue.desc = "statue depicting [ma.name]"
- qdel(src)
-
-/obj/structure/carving_block/proc/set_completion(value)
- if(!current_target)
- return
- if(!target_appearance_with_filters)
- target_appearance_with_filters = new(current_target)
- // KEEP_APART in case carving block gets KEEP_TOGETHER from somewhere like material texture filters.
- target_appearance_with_filters.appearance_flags |= KEEP_TOGETHER | KEEP_APART
- //Doesn't use filter helpers because MAs aren't atoms
- target_appearance_with_filters.filters = filter(type="color",color=greyscale_with_value_bump,space=FILTER_COLOR_HSV)
- completion = value
- var/static/icon/white = icon('icons/effects/alphacolors.dmi', "white")
- switch(value)
- if(0)
- //delete uncovered and reset filters
- remove_filter("partial_uncover")
- target_appearance_with_filters = null
- else
- var/mask_offset = min(world.icon_size,round(completion * world.icon_size))
- remove_filter("partial_uncover")
- add_filter("partial_uncover", 1, alpha_mask_filter(icon = white, y = -mask_offset))
- target_appearance_with_filters.filters = filter(type="alpha",icon=white,y=-mask_offset,flags=MASK_INVERSE)
- update_appearance()
-
-
-/// Returns a list of preset statues carvable from this block depending on the custom materials
-/obj/structure/carving_block/proc/get_possible_statues()
- . = list()
- if(!statue_costs)
- statue_costs = build_statue_cost_table()
- for(var/statue_path in statue_costs)
- var/list/carving_cost = statue_costs[statue_path]
- var/enough_materials = TRUE
- for(var/required_material in carving_cost)
- if(!has_material_type(required_material, TRUE, carving_cost[required_material]))
- enough_materials = FALSE
- break
- if(enough_materials)
- . += statue_path
-
-/obj/structure/carving_block/proc/build_statue_cost_table()
- . = list()
- for(var/statue_type in subtypesof(/obj/structure/statue) - /obj/structure/statue/custom)
- var/obj/structure/statue/S = new statue_type()
- if(!S.icon_state || S.abstract_type == S.type || !S.custom_materials)
- continue
- .[S.type] = S.custom_materials
- qdel(S)
-
-/obj/structure/statue/custom
- name = "custom statue"
- icon_state = "base"
- obj_flags = CAN_BE_HIT | UNIQUE_RENAME
- appearance_flags = TILE_BOUND | PIXEL_SCALE | KEEP_TOGETHER //Added keep together in case targets has weird layering
- material_flags = MATERIAL_EFFECTS | MATERIAL_COLOR | MATERIAL_AFFECT_STATISTICS
- /// primary statue overlay
- var/mutable_appearance/content_ma
- var/static/list/greyscale_with_value_bump = list(0,0,0, 0,0,0, 0,0,1, 0,0,-0.05)
-
-/obj/structure/statue/custom/Destroy()
- content_ma = null
- return ..()
-
-/obj/structure/statue/custom/proc/set_visuals(model_appearance)
- if(content_ma)
- QDEL_NULL(content_ma)
- content_ma = new
- content_ma.appearance = model_appearance
- content_ma.pixel_x = 0
- content_ma.pixel_y = 0
- content_ma.alpha = 255
- content_ma.appearance_flags &= ~KEEP_APART //Don't want this
- content_ma.filters = filter(type="color",color=greyscale_with_value_bump,space=FILTER_COLOR_HSV)
- update_appearance()
-
-/obj/structure/statue/custom/update_overlays()
- . = ..()
- if(content_ma)
- . += content_ma
diff --git a/code/modules/atmospherics/environmental/LINDA_system.dm b/code/modules/atmospherics/environmental/LINDA_system.dm
index 88eeb654e4165..c3943a5406587 100644
--- a/code/modules/atmospherics/environmental/LINDA_system.dm
+++ b/code/modules/atmospherics/environmental/LINDA_system.dm
@@ -1,10 +1,7 @@
-/atom
- ///Check if atmos can pass in this atom (ATMOS_PASS_YES, ATMOS_PASS_NO, ATMOS_PASS_DENSITY, ATMOS_PASS_PROC)
- var/can_atmos_pass = ATMOS_PASS_YES
- ///Zlevel check for can_atmos_pass
- var/can_atmos_pass_vertical = ATMOS_PASS_YES
+/atom/var/can_atmos_pass = ATMOS_PASS_YES
+/atom/var/can_atmos_passVertical = ATMOS_PASS_YES
-/atom/proc/can_atmos_pass(turf/target_turf)
+/atom/proc/can_atmos_pass(turf/T)
switch (can_atmos_pass)
if (ATMOS_PASS_PROC)
return ATMOS_PASS_YES
@@ -13,69 +10,65 @@
else
return can_atmos_pass
-/turf
- can_atmos_pass = ATMOS_PASS_NO
- can_atmos_pass_vertical = ATMOS_PASS_NO
+/turf/can_atmos_pass = ATMOS_PASS_NO
+/turf/can_atmos_passVertical = ATMOS_PASS_NO
-/turf/open
- can_atmos_pass = ATMOS_PASS_PROC
- can_atmos_pass_vertical = ATMOS_PASS_PROC
+/turf/open/can_atmos_pass = ATMOS_PASS_PROC
+/turf/open/can_atmos_passVertical = ATMOS_PASS_PROC
//Do NOT use this to see if 2 turfs are connected, it mutates state, and we cache that info anyhow. Use TURFS_CAN_SHARE or TURF_SHARES depending on your usecase
-/turf/open/can_atmos_pass(turf/target_turf, vertical = FALSE)
- var/direction = vertical ? get_dir_multiz(src, target_turf) : get_dir(src, target_turf)
- var/opposite_direction = REVERSE_DIR(direction)
- var/can_pass = FALSE
- if(vertical && !(zAirOut(direction, target_turf) && target_turf.zAirIn(direction, src)))
- can_pass = TRUE
- if(blocks_air || target_turf.blocks_air)
- can_pass = TRUE
- if (target_turf == src)
- return !can_pass
- for(var/obj/checked_object in contents + target_turf.contents)
- var/turf/other = (checked_object.loc == src ? target_turf : src)
- if(!(vertical? (CANVERTICALATMOSPASS(checked_object, other)) : (CANATMOSPASS(checked_object, other))))
- can_pass = TRUE
- if(checked_object.block_superconductivity()) //the direction and open/closed are already checked on can_atmos_pass() so there are no arguments
- atmos_supeconductivity |= direction
- target_turf.atmos_supeconductivity |= opposite_direction
- return FALSE //no need to keep going, we got all we asked
-
- atmos_supeconductivity &= ~direction
- target_turf.atmos_supeconductivity &= ~opposite_direction
-
- return !can_pass
-
-/atom/movable/proc/block_superconductivity() // objects that block air and don't let superconductivity act
+/turf/open/can_atmos_pass(turf/T, vertical = FALSE)
+ var/dir = vertical? get_dir_multiz(src, T) : get_dir(src, T)
+ var/opp = REVERSE_DIR(dir)
+ var/R = FALSE
+ if(vertical && !(zAirOut(dir, T) && T.zAirIn(dir, src)))
+ R = TRUE
+ if(blocks_air || T.blocks_air)
+ R = TRUE
+ if (T == src)
+ return !R
+ 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.block_superconductivity()) //the direction and open/closed are already checked on can_atmos_pass() so there are no arguments
+ atmos_supeconductivity |= dir
+ T.atmos_supeconductivity |= opp
+ return FALSE //no need to keep going, we got all we asked
+
+ atmos_supeconductivity &= ~dir
+ T.atmos_supeconductivity &= ~opp
+
+ return !R
+
+/atom/movable/proc/block_superconductivity() // objects that block air and don't let superconductivity act. Only firelocks atm.
return FALSE
/turf/proc/immediate_calculate_adjacent_turfs()
var/canpass = CANATMOSPASS(src, src)
var/canvpass = CANVERTICALATMOSPASS(src, src)
for(var/direction in GLOB.cardinals_multiz)
- var/turf/current_turf = get_step_multiz(src, direction)
- if(!isopenturf(current_turf))
+ var/turf/T = get_step_multiz(src, direction)
+ if(!isopenturf(T))
continue
- if(!(blocks_air || current_turf.blocks_air) && ((direction & (UP|DOWN)) ? (canvpass && CANVERTICALATMOSPASS(current_turf, src)) : (canpass && CANATMOSPASS(current_turf, src))) )
+ if(!(blocks_air || T.blocks_air) && ((direction & (UP|DOWN))? (canvpass && CANVERTICALATMOSPASS(T, src)) : (canpass && CANATMOSPASS(T, src))) )
LAZYINITLIST(atmos_adjacent_turfs)
- LAZYINITLIST(current_turf.atmos_adjacent_turfs)
- atmos_adjacent_turfs[current_turf] = TRUE
- current_turf.atmos_adjacent_turfs[src] = TRUE
+ LAZYINITLIST(T.atmos_adjacent_turfs)
+ atmos_adjacent_turfs[T] = TRUE
+ T.atmos_adjacent_turfs[src] = TRUE
else
if (atmos_adjacent_turfs)
- atmos_adjacent_turfs -= current_turf
- if (current_turf.atmos_adjacent_turfs)
- current_turf.atmos_adjacent_turfs -= src
- UNSETEMPTY(current_turf.atmos_adjacent_turfs)
+ atmos_adjacent_turfs -= T
+ if (T.atmos_adjacent_turfs)
+ T.atmos_adjacent_turfs -= src
+ UNSETEMPTY(T.atmos_adjacent_turfs)
UNSETEMPTY(atmos_adjacent_turfs)
src.atmos_adjacent_turfs = atmos_adjacent_turfs
-/**
- * returns a list of adjacent turfs that can share air with this one.
- * alldir includes adjacent diagonal tiles that can share
- * air with both of the related adjacent cardinal tiles
-**/
-/turf/proc/get_atmos_adjacent_turfs(alldir = 0)
+//returns a list of adjacent turfs that can share air with this one.
+//alldir includes adjacent diagonal tiles that can share
+// air with both of the related adjacent cardinal tiles
+/turf/proc/GetAtmosAdjacentTurfs(alldir = 0)
var/adjacent_turfs
if (atmos_adjacent_turfs)
adjacent_turfs = atmos_adjacent_turfs.Copy()
@@ -89,29 +82,27 @@
for (var/direction in GLOB.diagonals_multiz)
var/matching_directions = 0
- var/turf/checked_turf = get_step_multiz(current_location, direction)
- if(!checked_turf)
+ var/turf/S = get_step_multiz(current_location, direction)
+ if(!S)
continue
for (var/check_direction in GLOB.cardinals_multiz)
- var/turf/secondary_turf = get_step(checked_turf, check_direction)
- if(!checked_turf.atmos_adjacent_turfs || !checked_turf.atmos_adjacent_turfs[secondary_turf])
+ var/turf/checkTurf = get_step(S, check_direction)
+ if(!S.atmos_adjacent_turfs || !S.atmos_adjacent_turfs[checkTurf])
continue
- if (adjacent_turfs[secondary_turf])
+ if (adjacent_turfs[checkTurf])
matching_directions++
if (matching_directions >= 2)
- adjacent_turfs += checked_turf
+ adjacent_turfs += S
break
return adjacent_turfs
/atom/proc/air_update_turf(update = FALSE, remove = FALSE)
- var/turf/local_turf = get_turf(loc)
- if(!local_turf)
- return
- local_turf.air_update_turf(update, remove)
+ var/turf/T = get_turf(loc)
+ T.air_update_turf(update, remove)
/**
* A helper proc for dealing with atmos changes
@@ -130,24 +121,24 @@
else
SSair.add_to_active(src)
-/atom/movable/proc/move_update_air(turf/target_turf)
- if(isturf(target_turf))
- target_turf.air_update_turf(TRUE, FALSE) //You're empty now
+/atom/movable/proc/move_update_air(turf/T)
+ if(isturf(T))
+ T.air_update_turf(TRUE, FALSE) //You're empty now
air_update_turf(TRUE, TRUE) //You aren't
/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/local_turf = get_turf(src)
- if(!istype(local_turf))
+ var/turf/open/T = get_turf(src)
+ if(!istype(T))
return
- local_turf.atmos_spawn_air(text)
+ T.atmos_spawn_air(text)
/turf/open/atmos_spawn_air(text)
if(!text || !air)
return
- var/datum/gas_mixture/turf_mixture = new
- turf_mixture.parse_gas_string(text)
+ var/datum/gas_mixture/G = new
+ G.parse_gas_string(text)
- air.merge(turf_mixture)
+ air.merge(G)
archive()
SSair.add_to_active(src)
diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
index 5bce3594540e8..e501ef607a4d4 100644
--- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
+++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
@@ -1,9 +1,7 @@
/turf
- ///used for temperature calculations in superconduction
+ //used for temperature calculations
var/thermal_conductivity = 0.05
- ///Amount of heat necessary to activate some atmos processes (there is a weird usage of this var because is compared directly to the temperature instead of heat energy)
var/heat_capacity = INFINITY //This should be opt in rather then opt out
- ///Archived version of the temperature on a turf
var/temperature_archived
///list of turfs adjacent to us that air can flow onto
@@ -11,39 +9,29 @@
///bitfield of dirs in which we are superconducitng
var/atmos_supeconductivity = NONE
- ///used to determine whether we should archive
+ //used to determine whether we should archive
var/archived_cycle = 0
var/current_cycle = 0
- /**
- * 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
- * approximation of MOLES_O2STANDARD and MOLES_N2STANDARD pending byond allowing constant expressions to be embedded in constant strings
- * If someone will place 0 of some gas there, SHIT WILL BREAK. Do not do that.
- **/
+ //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
var/initial_gas_mix = OPENTURF_DEFAULT_ATMOS
+ //approximation of MOLES_O2STANDARD and MOLES_N2STANDARD pending byond allowing constant expressions to be embedded in constant strings
+ // If someone will place 0 of some gas there, SHIT WILL BREAK. Do not do that.
/turf/open
//used for spacewind
- ///Pressure difference between two turfs
var/pressure_difference = 0
- ///Where the difference come from (from higher pressure to lower pressure)
var/pressure_direction = 0
- ///Excited group we are part of
var/datum/excited_group/excited_group
- ///Are we active?
var/excited = FALSE
- ///Our gas mix
var/datum/gas_mixture/turf/air
- ///If there is an active hotspot on us store a reference to it here
var/obj/effect/hotspot/active_hotspot
- ///Whether or not we are a planetary turf
var/planetary_atmos = FALSE //air will revert to initial_gas_mix
- ///gas IDs of current active gas overlays
- var/list/atmos_overlay_types
+ var/list/atmos_overlay_types //gas IDs of current active gas overlays
var/significant_share_ticker = 0
#ifdef TRACK_MAX_SHARE
var/max_share = 0
@@ -64,8 +52,8 @@
if(active_hotspot)
QDEL_NULL(active_hotspot)
// Adds the adjacent turfs to the current atmos processing
- for(var/near_turf in atmos_adjacent_turfs)
- SSair.add_to_active(near_turf)
+ for(var/T in atmos_adjacent_turfs)
+ SSair.add_to_active(T)
return ..()
/////////////////GAS MIXTURE PROCS///////////////////
@@ -83,9 +71,9 @@
update_visuals()
return removed
-/turf/open/proc/copy_air_with_tile(turf/open/target_turf)
- if(istype(target_turf))
- air.copy_from(target_turf.air)
+/turf/open/proc/copy_air_with_tile(turf/open/T)
+ if(istype(T))
+ air.copy_from(T.air)
/turf/open/proc/copy_air(datum/gas_mixture/copy)
if(copy)
@@ -93,9 +81,9 @@
/turf/return_air()
RETURN_TYPE(/datum/gas_mixture)
- var/datum/gas_mixture/copied_mixture = new
- copied_mixture.copy_from_turf(src)
- return copied_mixture
+ var/datum/gas_mixture/GM = new
+ GM.copy_from_turf(src)
+ return GM
/turf/open/return_air()
RETURN_TYPE(/datum/gas_mixture)
@@ -293,11 +281,11 @@
should_share_air = TRUE
else if(our_air.compare(enemy_air)) //Lets see if you're up for it
SSair.add_to_active(enemy_tile) //Add yourself young man
- var/datum/excited_group/existing_group = our_excited_group || enemy_excited_group || new
+ var/datum/excited_group/EG = our_excited_group || enemy_excited_group || new
if(!our_excited_group)
- existing_group.add_turf(src)
+ EG.add_turf(src)
if(!enemy_excited_group)
- existing_group.add_turf(enemy_tile)
+ EG.add_turf(enemy_tile)
our_excited_group = excited_group
should_share_air = TRUE
@@ -316,19 +304,19 @@
/******************* GROUP HANDLING FINISH *********************************************************************/
if (planetary_atmos) //share our air with the "atmosphere" "above" the turf
- var/datum/gas_mixture/planetary_mix = SSair.planetary[initial_gas_mix]
+ var/datum/gas_mixture/G = SSair.planetary[initial_gas_mix]
// archive ourself again so we don't accidentally share more gas than we currently have
archive()
- if(our_air.compare(planetary_mix))
+ if(our_air.compare(G))
if(!our_excited_group)
- var/datum/excited_group/new_group = new
- new_group.add_turf(src)
+ var/datum/excited_group/EG = new
+ EG.add_turf(src)
our_excited_group = excited_group
// shares 4/5 of our difference in moles with the atmosphere
- our_air.share(planetary_mix, 0.25)
+ our_air.share(G, 0.25)
// temperature share with the atmosphere with an inflated heat capacity to simulate faster sharing with a large atmosphere
- our_air.temperature_share(planetary_mix, OPEN_HEAT_TRANSFER_COEFFICIENT, planetary_mix.temperature_archived, planetary_mix.heat_capacity() * 5)
- planetary_mix.garbage_collect()
+ our_air.temperature_share(G, OPEN_HEAT_TRANSFER_COEFFICIENT, G.temperature_archived, G.heat_capacity() * 5)
+ G.garbage_collect()
PLANET_SHARE_CHECK
our_air.react(src)
@@ -345,32 +333,30 @@
//////////////////////////SPACEWIND/////////////////////////////
-/turf/open/proc/consider_pressure_difference(turf/target_turf, difference)
+/turf/open/proc/consider_pressure_difference(turf/T, difference)
SSair.high_pressure_delta |= src
if(difference > pressure_difference)
- pressure_direction = get_dir(src, target_turf)
+ pressure_direction = get_dir(src, T)
pressure_difference = difference
/turf/open/proc/high_pressure_movements()
- var/atom/movable/moving_atom
+ var/atom/movable/M
for(var/thing in src)
- moving_atom = thing
- if (!moving_atom.anchored && !moving_atom.pulledby && moving_atom.last_high_pressure_movement_air_cycle < SSair.times_fired)
- moving_atom.experience_pressure_difference(pressure_difference, pressure_direction)
+ M = thing
+ if (!M.anchored && !M.pulledby && M.last_high_pressure_movement_air_cycle < SSair.times_fired)
+ M.experience_pressure_difference(pressure_difference, pressure_direction)
-/atom/movable
- ///How much delta pressure is needed for us to move
- var/pressure_resistance = 10
- var/last_high_pressure_movement_air_cycle = 0
+/atom/movable/var/pressure_resistance = 10
+/atom/movable/var/last_high_pressure_movement_air_cycle = 0
/atom/movable/proc/experience_pressure_difference(pressure_difference, direction, pressure_resistance_prob_delta = 0)
var/const/PROBABILITY_OFFSET = 25
var/const/PROBABILITY_BASE_PRECENT = 75
- var/max_force = sqrt(pressure_difference) * (MOVE_FORCE_DEFAULT / 5)
+ var/max_force = sqrt(pressure_difference)*(MOVE_FORCE_DEFAULT / 5)
set waitfor = FALSE
var/move_prob = 100
if (pressure_resistance > 0)
- move_prob = (pressure_difference / pressure_resistance * PROBABILITY_BASE_PRECENT) - PROBABILITY_OFFSET
+ move_prob = (pressure_difference/pressure_resistance*PROBABILITY_BASE_PRECENT)-PROBABILITY_OFFSET
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))))
step(src, direction)
@@ -388,75 +374,72 @@
We solve this with excited group cleanup. See the documentation for more details.
*/
/datum/excited_group
- ///Stores a reference to the turfs we are controlling
var/list/turf_list = list()
- ///If this is over EXCITED_GROUP_BREAKDOWN_CYCLES we call self_breakdown()
var/breakdown_cooldown = 0
- ///If this is over EXCITED_GROUP_DISMANTLE_CYCLES we call dismantle()
var/dismantle_cooldown = 0
- ///Used for debug to show the excited groups active and their turfs
var/should_display = FALSE
- ///Id of the index color of the displayed group
var/display_id = 0
- ///Wrapping loop of the index colors
var/static/wrapping_id = 0
/datum/excited_group/New()
SSair.excited_groups += src
-/datum/excited_group/proc/add_turf(turf/open/target_turf)
- turf_list += target_turf
- target_turf.excited_group = src
+/datum/excited_group/proc/add_turf(turf/open/T)
+ turf_list += T
+ T.excited_group = src
dismantle_cooldown = 0
if(should_display || SSair.display_all_groups)
- display_turf(target_turf)
-
-/datum/excited_group/proc/merge_groups(datum/excited_group/target_group)
- if(turf_list.len > target_group.turf_list.len)
- SSair.excited_groups -= target_group
- for(var/turf/open/group_member as anything in target_group.turf_list)
- group_member.excited_group = src
- turf_list += group_member
- should_display = target_group.should_display | should_display
+ display_turf(T)
+
+/datum/excited_group/proc/merge_groups(datum/excited_group/E)
+ if(turf_list.len > E.turf_list.len)
+ SSair.excited_groups -= E
+ for(var/t in E.turf_list)
+ var/turf/open/T = t
+ T.excited_group = src
+ turf_list += T
+ should_display = E.should_display | should_display
if(should_display || SSair.display_all_groups)
- target_group.hide_turfs()
+ E.hide_turfs()
display_turfs()
- breakdown_cooldown = min(breakdown_cooldown, target_group.breakdown_cooldown) //Take the smaller of the two options
+ breakdown_cooldown = min(breakdown_cooldown, E.breakdown_cooldown) //Take the smaller of the two options
dismantle_cooldown = 0
else
SSair.excited_groups -= src
- for(var/turf/open/group_member as anything in turf_list)
- group_member.excited_group = target_group
- target_group.turf_list += group_member
- target_group.should_display = target_group.should_display | should_display
- if(target_group.should_display || SSair.display_all_groups)
+ for(var/t in turf_list)
+ var/turf/open/T = t
+ T.excited_group = E
+ E.turf_list += T
+ E.should_display = E.should_display | should_display
+ if(E.should_display || SSair.display_all_groups)
hide_turfs()
- target_group.display_turfs()
- target_group.breakdown_cooldown = min(breakdown_cooldown, target_group.breakdown_cooldown)
- target_group.dismantle_cooldown = 0
+ E.display_turfs()
+ E.breakdown_cooldown = min(breakdown_cooldown, E.breakdown_cooldown)
+ E.dismantle_cooldown = 0
/datum/excited_group/proc/reset_cooldowns()
breakdown_cooldown = 0
dismantle_cooldown = 0
/datum/excited_group/proc/self_breakdown(roundstart = FALSE, poke_turfs = FALSE)
- var/datum/gas_mixture/shared_mix = new
+ var/datum/gas_mixture/A = new
//make local for sanic speed
- var/list/shared_gases = shared_mix.gases
+ var/list/A_gases = A.gases
var/list/turf_list = src.turf_list
var/turflen = turf_list.len
var/imumutable_in_group = FALSE
var/energy = 0
var/heat_cap = 0
- for(var/turf/open/group_member as anything in turf_list)
+ for(var/t in turf_list)
+ var/turf/open/T = t
//Cache?
- var/datum/gas_mixture/turf/mix = group_member.air
- if (roundstart && istype(group_member.air, /datum/gas_mixture/immutable))
+ var/datum/gas_mixture/turf/mix = T.air
+ if (roundstart && istype(T.air, /datum/gas_mixture/immutable))
imumutable_in_group = TRUE
- shared_mix.copy_from(group_member.air) //This had better be immutable young man
- shared_gases = shared_mix.gases //update the cache
+ A.copy_from(T.air) //This had better be immutable young man
+ A_gases = A.gases //update the cache
break
//"borrowing" this code from merge(), I need to play with the temp portion. Lets expand it out
//temperature = (giver.temperature * giver_heat_capacity + temperature * self_heat_capacity) / combined_heat_capacity
@@ -466,35 +449,37 @@
var/list/giver_gases = mix.gases
for(var/giver_id in giver_gases)
- ASSERT_GAS(giver_id, shared_mix)
- shared_gases[giver_id][MOLES] += giver_gases[giver_id][MOLES]
+ ASSERT_GAS(giver_id, A)
+ A_gases[giver_id][MOLES] += giver_gases[giver_id][MOLES]
if(!imumutable_in_group)
- shared_mix.temperature = energy / heat_cap
- for(var/id in shared_gases)
- shared_gases[id][MOLES] /= turflen
- shared_mix.garbage_collect()
-
- for(var/turf/open/group_member as anything in turf_list)
- if(group_member.planetary_atmos) //We do this as a hack to try and minimize unneeded excited group spread over planetary turfs
- group_member.air.copy_from(SSair.planetary[group_member.initial_gas_mix]) //Comes with a cost of "slower" drains, but it's worth it
+ A.temperature = energy / heat_cap
+ for(var/id in A_gases)
+ A_gases[id][MOLES] /= turflen
+ A.garbage_collect()
+
+ for(var/t in turf_list)
+ var/turf/open/T = t
+ if(T.planetary_atmos) //We do this as a hack to try and minimize unneeded excited group spread over planetary turfs
+ T.air.copy_from(SSair.planetary[T.initial_gas_mix]) //Comes with a cost of "slower" drains, but it's worth it
else
- group_member.air.copy_from(shared_mix) //Otherwise just set the mix to a copy of our equalized mix
- group_member.update_visuals()
+ T.air.copy_from(A) //Otherwise just set the mix to a copy of our equalized mix
+ T.update_visuals()
if(poke_turfs) //Because we only activate all these once every breakdown, in event of lag due to this code and slow space + vent things, increase the wait time for breakdowns
- SSair.add_to_active(group_member)
- group_member.significant_share_ticker = EXCITED_GROUP_DISMANTLE_CYCLES //Max out the ticker, if they don't share next tick, nuke em
+ SSair.add_to_active(T)
+ T.significant_share_ticker = EXCITED_GROUP_DISMANTLE_CYCLES //Max out the ticker, if they don't share next tick, nuke em
breakdown_cooldown = 0
///Dismantles the excited group, puts allll the turfs to sleep
/datum/excited_group/proc/dismantle()
- for(var/turf/open/current_turf as anything in turf_list)
- current_turf.excited = FALSE
- current_turf.significant_share_ticker = 0
- SSair.active_turfs -= current_turf
+ for(var/t in turf_list)
+ var/turf/open/T = t
+ T.excited = FALSE
+ T.significant_share_ticker = 0
+ SSair.active_turfs -= T
#ifdef VISUALIZE_ACTIVE_TURFS //Use this when you want details about how the turfs are moving, display_all_groups should work for normal operation
- current_turf.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, COLOR_VIBRANT_LIME)
+ T.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, COLOR_VIBRANT_LIME)
#endif
garbage_collect()
@@ -502,8 +487,9 @@
/datum/excited_group/proc/garbage_collect()
if(display_id) //If we ever did make those changes
hide_turfs()
- for(var/turf/open/current_turf as anything in turf_list)
- current_turf.excited_group = null
+ for(var/t in turf_list)
+ var/turf/open/T = t
+ T.excited_group = null
turf_list.Cut()
SSair.excited_groups -= src
if(SSair.currentpart == SSAIR_EXCITEDGROUPS)
@@ -556,8 +542,8 @@ Then we space some of our heat, and think about if we should stop conducting.
if(blocks_air)
return ..()
for(var/direction in GLOB.cardinals)
- var/turf/checked_turf = get_step(src, direction)
- if(!(checked_turf in atmos_adjacent_turfs) && !(atmos_supeconductivity & direction))
+ var/turf/T = get_step(src, direction)
+ if(!(T in atmos_adjacent_turfs) && !(atmos_supeconductivity & direction))
. |= direction
///These two procs are a bit of a web, I belive in you
@@ -570,11 +556,12 @@ Then we space some of our heat, and think about if we should stop conducting.
/turf/open/neighbor_conduct_with_src(turf/other)
if(blocks_air)
- return ..()
+ ..()
+ return
if(!other.blocks_air) //Both tiles are open
- var/turf/open/open_other = other
- open_other.air.temperature_share(air, WINDOW_HEAT_TRANSFER_COEFFICIENT)
+ var/turf/open/T = other
+ T.air.temperature_share(air, WINDOW_HEAT_TRANSFER_COEFFICIENT)
else //Open but neighbor is solid
temperature_share_open_to_solid(other)
SSair.add_to_active(src)
@@ -585,19 +572,18 @@ Then we space some of our heat, and think about if we should stop conducting.
if(conductivity_directions)
//Conduct with tiles around me
for(var/direction in GLOB.cardinals)
- if(!(conductivity_directions & direction))
- continue
- var/turf/neighbor = get_step(src, direction)
+ if(conductivity_directions & direction)
+ var/turf/neighbor = get_step(src,direction)
- if(!neighbor.thermal_conductivity)
- continue
+ if(!neighbor.thermal_conductivity)
+ continue
- if(neighbor.archived_cycle < SSair.times_fired)
- neighbor.archive()
+ if(neighbor.archived_cycle < SSair.times_fired)
+ neighbor.archive()
- neighbor.neighbor_conduct_with_src(src)
+ neighbor.neighbor_conduct_with_src(src)
- neighbor.consider_superconductivity()
+ neighbor.consider_superconductivity()
radiate_to_spess()
@@ -636,14 +622,13 @@ Then we space some of our heat, and think about if we should stop conducting.
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
- return
- var/delta_temperature = (temperature_archived - TCMB) //hardcoded space temperature
- if(heat_capacity <= 0 || abs(delta_temperature) <= MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
- return
- var/heat = thermal_conductivity * delta_temperature * \
- (heat_capacity * HEAT_CAPACITY_VACUUM / (heat_capacity + HEAT_CAPACITY_VACUUM))
- temperature -= heat/heat_capacity
+ 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)
@@ -651,7 +636,9 @@ Then we space some of our heat, and think about if we should stop conducting.
/turf/proc/share_temperature_mutual_solid(turf/sharer, conduction_coefficient) //This is all just heat sharing, don't get freaked out
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)) //The larger the combined capacity the less is shared
- temperature -= heat / heat_capacity //The higher your own heat cap the less heat you get from this arrangement
- sharer.temperature += heat / sharer.heat_capacity
+
+ var/heat = conduction_coefficient*delta_temperature* \
+ (heat_capacity*sharer.heat_capacity/(heat_capacity+sharer.heat_capacity)) //The larger the combined capacity the less is shared
+
+ temperature -= heat/heat_capacity //The higher your own heat cap the less heat you get from this arrangement
+ sharer.temperature += heat/sharer.heat_capacity
diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm
index 19ee92b44d433..21dd8785959a7 100644
--- a/code/modules/atmospherics/machinery/atmosmachinery.dm
+++ b/code/modules/atmospherics/machinery/atmosmachinery.dm
@@ -64,7 +64,7 @@
..()
if(process)
SSair.start_processing_machine(src)
- set_init_directions(init_dir)
+ set_init_directions()
/obj/machinery/atmospherics/Destroy()
for(var/i in 1 to device_type)
@@ -96,31 +96,19 @@
/obj/machinery/atmospherics/proc/get_rebuild_targets()
return
-/**
- * Called on destroy(mostly deconstruction) and when moving nodes around, disconnect the nodes from the network
- * Arguments:
- * * i - is the current iteration of the node, based on the device_type (from 1 to 4)
- */
/obj/machinery/atmospherics/proc/nullify_node(i)
- if(!nodes[i])
- return
- var/obj/machinery/atmospherics/node_machine = nodes[i]
- node_machine.disconnect(src)
- nodes[i] = null
+ if(nodes[i])
+ var/obj/machinery/atmospherics/N = nodes[i]
+ N.disconnect(src)
+ nodes[i] = null
-/**
- * Getter for node_connects
- *
- * Return a list of the nodes that can connect to other machines, get called by atmos_init()
- */
/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 & init_directions)
+ if(D & get_init_directions())
if(D in node_connects)
continue
node_connects[i] = D
@@ -134,13 +122,7 @@
if(WEST)
setDir(EAST)
-/**
- * Initialize for atmos devices
- *
- * initialize the nodes for each pipe/device, this is called just after the air controller sets up turfs
- * Arguments:
- * * list/node_connects - a list of the nodes on the device that can make a connection to other machines
- */
+//this is called just after the air controller sets up turfs
/obj/machinery/atmospherics/proc/atmos_init(list/node_connects)
if(!node_connects) //for pipes where order of nodes doesn't matter
node_connects = get_node_connects()
@@ -152,76 +134,25 @@
break
update_icon()
-/**
- * setter for pipe layers
- *
- * Set the layer of the pipe that the device has to a new_layer
- * Arguments:
- * * new_layer - the layer at which we want the piping_layer to be (1 to 5)
- */
/obj/machinery/atmospherics/proc/set_piping_layer(new_layer)
piping_layer = (pipe_flags & PIPING_DEFAULT_LAYER_ONLY) ? PIPING_LAYER_DEFAULT : new_layer
update_icon()
-/obj/machinery/atmospherics/update_icon()
- layer = initial(layer) + piping_layer / 1000
- return ..()
-
-/**
- * Check if a node can actually exists by connecting to another machine
- * called on atmos_init()
- * Arguments:
- * * obj/machinery/atmospherics/target - the machine we are connecting to
- * * iteration - the current node we are checking (from 1 to 4)
- */
/obj/machinery/atmospherics/proc/can_be_node(obj/machinery/atmospherics/target, iteration)
return connection_check(target, piping_layer)
-/**
- * Find a connecting /obj/machinery/atmospherics in specified direction, called by relaymove()
- * used by ventcrawling mobs to check if they can move inside a pipe in a specific direction
- * Arguments:
- * * direction - the direction we are checking against
- * * prompted_layer - the piping_layer we are inside
- */
+//Find a connecting /obj/machinery/atmospherics in specified direction
/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) && !istype(target, /obj/machinery/atmospherics/pipe/multiz))
if(connection_check(target, prompted_layer))
return target
-/**
- * Check the connection between two nodes
- *
- * Check if our machine and the target machine are connectable by both calling isConnectable and by checking that the directions and piping_layer are compatible
- * called by can_be_node() (for building a network) and find_connecting() (for ventcrawling)
- * Arguments:
- * * obj/machinery/atmospherics/target - the machinery we want to connect to
- * * given_layer - the piping_layer we are checking
- */
/obj/machinery/atmospherics/proc/connection_check(obj/machinery/atmospherics/target, given_layer)
- if(is_connectable(target, given_layer) && target.is_connectable(src, given_layer) && check_init_directions(target))
+ if(is_connectable(target, given_layer) && target.is_connectable(src, given_layer) && (target.initialize_directions & get_dir(target,src) || istype(target, /obj/machinery/atmospherics/pipe/multiz)))
return TRUE
return FALSE
-/**
- * check if the initialized direction are the same on both sides (or if is a multiz adapter)
- * returns TRUE or FALSE if the connection is possible or not
- * Arguments:
- * * obj/machinery/atmospherics/target - the machinery we want to connect to
- */
-/obj/machinery/atmospherics/proc/check_init_directions(obj/machinery/atmospherics/target)
- if((initialize_directions & get_dir(src, target) && target.initialize_directions & get_dir(target,src)) || istype(target, /obj/machinery/atmospherics/pipe/multiz))
- return TRUE
- return FALSE
-
-/**
- * check if the piping layer and color are the same on both sides (grey can connect to all colors)
- * returns TRUE or FALSE if the connection is possible or not
- * Arguments:
- * * obj/machinery/atmospherics/target - the machinery we want to connect to
- * * given_layer - the piping_layer we are connecting to
- */
/obj/machinery/atmospherics/proc/is_connectable(obj/machinery/atmospherics/target, given_layer)
if(isnull(given_layer))
given_layer = piping_layer
@@ -229,55 +160,27 @@
return TRUE
return FALSE
-/**
- * Called on construction and when expanding the datum_pipeline, returns the nodes of the device
- */
/obj/machinery/atmospherics/proc/pipeline_expansion()
return nodes
-/**
- * Set the initial directions of the device (NORTH || SOUTH || EAST || WEST), called on New()
- */
-/obj/machinery/atmospherics/proc/set_init_directions(init_dir)
+/obj/machinery/atmospherics/proc/set_init_directions()
return
-/**
- * Getter of initial directions
- */
/obj/machinery/atmospherics/proc/get_init_directions()
return initialize_directions
-/**
- * Called by add_member() in datum_pipeline.dm, returns the parent network the device is connected to
- */
/obj/machinery/atmospherics/proc/return_pipenet()
return
-/**
- * Called by add_machinery_member() in datum_pipeline.dm, returns a list of gas_mixtures and assigns them into other_airs (by addMachineryMember) to allow pressure redistribution for the machineries.
- */
-/obj/machinery/atmospherics/proc/return_pipenet_airs()
+/obj/machinery/atmospherics/proc/return_pipenetAir()
return
-/**
- * Called by build_pipeline() and add_member() in datum_pipeline.dm, set the network the device is connected to, to the datum pipeline it has reference
- */
/obj/machinery/atmospherics/proc/set_pipenet()
return
-/**
- * Similar to set_pipenet() but instead of setting a network to a pipeline, it replaces the old pipeline with a new one, called by Merge() in datum_pipeline.dm
- */
/obj/machinery/atmospherics/proc/replace_pipenet()
return
-/**
- * Disconnects the nodes
- *
- * Called by nullify_node(), it disconnects two nodes by removing the reference id from the node itself that called this proc
- * Arguments:
- * * obj/machinery/atmospherics/reference - the machinery we are removing from the node connection
- */
/obj/machinery/atmospherics/proc/disconnect(obj/machinery/atmospherics/reference)
if(istype(reference, /obj/machinery/atmospherics/pipe))
var/obj/machinery/atmospherics/pipe/P = reference
@@ -364,31 +267,27 @@
. = stored
..()
-/**
- * Getter for piping layer shifted, pipe colored overlays
- *
- * Creates the image for the pipe underlay that all components use, called by get_pipe_underlay() in components_base.dm
- * Arguments:
- * * iconfile - path of the iconstate we are using (ex: 'icons/obj/atmospherics/components/thermomachine.dmi')
- * * iconstate - the image we are using inside the file
- * * direction - the direction of our device
- * * color - the color (in hex value, like #559900) that the pipe should have
- * * piping_layer - the piping_layer the device is in, used inside PIPING_LAYER_SHIFT
- * * trinary - if TRUE we also use PIPING_FORWARD_SHIFT on layer 1 and 5 for trinary devices (filters and mixers)
- */
-/obj/machinery/atmospherics/proc/get_pipe_image(iconfile, iconstate, direction, color = COLOR_VERY_LIGHT_GRAY, piping_layer = 3, trinary = FALSE)
- var/image/pipe_overlay = image(iconfile, iconstate, dir = direction)
- pipe_overlay.color = color
- PIPING_LAYER_SHIFT(pipe_overlay, piping_layer)
- if(trinary == TRUE && (piping_layer == 1 || piping_layer == 5))
- PIPING_FORWARD_SHIFT(pipe_overlay, piping_layer, 2)
- return pipe_overlay
+/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(iconsetids[iconset] == null)
+ iconsetids[iconset] = num2text(iconsetids.len + 1)
+
+ //Generate a unique identifier for this image combination
+ var/identifier = iconsetids[iconset] + "_[iconstate]_[direction]_[col]_[piping_layer]"
+
+ if((!(. = pipeimages[identifier])))
+ var/image/pipe_overlay
+ pipe_overlay = . = pipeimages[identifier] = image(iconset, iconstate, dir = direction)
+ pipe_overlay.color = col
+ PIPING_LAYER_SHIFT(pipe_overlay, piping_layer)
+ if(trinary && (piping_layer == 1 || piping_layer == 5))
+ PIPING_FORWARD_SHIFT(pipe_overlay, piping_layer, 2)
/obj/machinery/atmospherics/on_construction(obj_color, set_layer)
if(can_unwrench)
add_atom_colour(obj_color, FIXED_COLOUR_PRIORITY)
pipe_color = obj_color
- update_name()
set_piping_layer(set_layer)
atmos_init()
var/list/nodes = pipeline_expansion()
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
index 5388683552d7d..7adc98419a59f 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/circulator.dm
@@ -96,14 +96,11 @@
if(node1)
node1.disconnect(src)
nodes[1] = null
- if(parents[1])
- nullify_pipenet(parents[1])
-
+ nullifyPipenet(parents[1])
if(node2)
node2.disconnect(src)
nodes[2] = null
- if(parents[2])
- nullify_pipenet(parents[2])
+ nullifyPipenet(parents[2])
if(anchored)
set_init_directions()
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 f6cb9bdc9910f..3868afd9099ec 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
@@ -47,7 +47,7 @@
/obj/machinery/atmospherics/components/binary/dp_vent_pump/update_icon_nopipes()
cut_overlays()
if(showpipe)
- var/image/cap = get_pipe_image(icon, "dpvent_cap", dir, pipe_color, piping_layer = piping_layer)
+ var/image/cap = get_pipe_image(icon, "dpvent_cap", dir, piping_layer = piping_layer)
add_overlay(cap)
if(welded)
@@ -108,20 +108,12 @@
//Radio remote control
-/**
- * Called in atmos_init(), used to change or remove the radio frequency from the component
- * Arguments:
- * * -new_frequency: the frequency that should be used for the radio to attach to the component, use 0 to remove the radio
- */
/obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA)
-/**
- * Called in atmos_init(), send the component status to the radio device connected
- */
/obj/machinery/atmospherics/components/binary/dp_vent_pump/proc/broadcast_status()
if(!radio_connection)
return
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 d9ce0b2510217..9b7f616ad9336 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/passive_gate.dm
@@ -67,20 +67,12 @@ Passive gate is similar to the regular pump except:
//Radio remote control
-/**
- * Called in atmos_init(), used to change or remove the radio frequency from the component
- * Arguments:
- * * -new_frequency: the frequency that should be used for the radio to attach to the component, use 0 to remove the radio
- */
/obj/machinery/atmospherics/components/binary/passive_gate/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA)
-/**
- * Called in atmos_init(), send the component status to the radio device connected
- */
/obj/machinery/atmospherics/components/binary/passive_gate/proc/broadcast_status()
if(!radio_connection)
return
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 72d3571ef8c59..b659fd39c72df 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/pressure_valve.dm
@@ -66,22 +66,12 @@
is_gas_flowing = FALSE
update_icon_nopipes()
-//Radio remote control
-
-/**
- * Called in atmos_init(), used to change or remove the radio frequency from the component
- * Arguments:
- * * -new_frequency: the frequency that should be used for the radio to attach to the component, use 0 to remove the radio
- */
/obj/machinery/atmospherics/components/binary/pressure_valve/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA)
-/**
- * Called in atmos_init(), send the component status to the radio device connected
- */
/obj/machinery/atmospherics/components/binary/pressure_valve/proc/broadcast_status()
if(!radio_connection)
return
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
index 5312987fcc767..3a0782e947471 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/pump.dm
@@ -72,20 +72,13 @@
on = active
SEND_SIGNAL(src, COMSIG_PUMP_SET_ON, on)
-/**
- * Called in atmos_init(), used to change or remove the radio frequency from the component
- * Arguments:
- * * -new_frequency: the frequency that should be used for the radio to attach to the component, use 0 to remove the radio
- */
+//Radio remote control
/obj/machinery/atmospherics/components/binary/pump/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
frequency = new_frequency
if(frequency)
radio_connection = SSradio.add_object(src, frequency, filter = RADIO_ATMOSIA)
-/**
- * Called in atmos_init(), send the component status to the radio device connected
- */
/obj/machinery/atmospherics/components/binary/pump/proc/broadcast_status()
if(!radio_connection)
return
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/thermomachine.dm b/code/modules/atmospherics/machinery/components/binary_devices/thermomachine.dm
deleted file mode 100644
index ad4aaf777cba0..0000000000000
--- a/code/modules/atmospherics/machinery/components/binary_devices/thermomachine.dm
+++ /dev/null
@@ -1,515 +0,0 @@
-#define THERMOMACHINE_SAFE_TEMPERATURE 500000
-#define THERMOMACHINE_POWER_CONVERSION 0.01
-
-/obj/machinery/atmospherics/components/binary/thermomachine
- icon = 'icons/obj/atmospherics/components/thermomachine.dmi'
- icon_state = "thermo_base"
-
- name = "Temperature control unit"
- desc = "Heats or cools gas in connected pipes."
-
- density = TRUE
- max_integrity = 300
- armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 100, BOMB = 0, BIO = 100, RAD = 100, FIRE = 80, ACID = 30)
- layer = OBJ_LAYER
- circuit = /obj/item/circuitboard/machine/thermomachine
-
- hide = TRUE
-
- move_resist = MOVE_RESIST_DEFAULT
- vent_movement = NONE
- pipe_flags = PIPING_ONE_PER_TURF
-
- greyscale_config = /datum/greyscale_config/thermomachine
- greyscale_colors = COLOR_VIBRANT_LIME
-
- set_dir_on_move = FALSE
-
- var/min_temperature = T20C //actual temperature will be defined by RefreshParts() and by the cooling var
- var/max_temperature = T20C //actual temperature will be defined by RefreshParts() and by the cooling var
- var/target_temperature = T20C
- var/heat_capacity = 0
- var/interactive = TRUE // So mapmakers can disable interaction.
- var/cooling = TRUE
- var/base_heating = 140
- var/base_cooling = 170
- var/use_enviroment_heat = FALSE
- var/skipping_work = FALSE
- var/safeties = TRUE
- var/lastwarning
- var/color_index = 1
-
- // Efficiency dictates how much we throttle the heat exchange process.
- var/efficiency = 1
- ///Efficiency minimum amount, min 0.25, max 1 (works best on higher laser tiers)
- var/parts_efficiency = 1
-
-/obj/machinery/atmospherics/components/binary/thermomachine/Initialize(mapload)
- . = ..()
- RefreshParts()
- update_appearance()
-
-/obj/machinery/atmospherics/components/binary/thermomachine/is_connectable()
- if(!anchored || panel_open)
- return FALSE
- . = ..()
-
-/obj/machinery/atmospherics/components/binary/thermomachine/get_node_connects()
- return list(dir, turn(dir, 180))
-
-/obj/machinery/atmospherics/components/binary/thermomachine/on_construction(obj_color, set_layer)
- var/obj/item/circuitboard/machine/thermomachine/board = circuit
- if(board)
- piping_layer = board.pipe_layer
- set_layer = piping_layer
-
- if(check_pipe_on_turf())
- deconstruct(TRUE)
- return
- return..()
-
-/obj/machinery/atmospherics/components/binary/thermomachine/RefreshParts()
- var/calculated_bin_rating
- for(var/obj/item/stock_parts/matter_bin/bin in component_parts)
- calculated_bin_rating += bin.rating
- heat_capacity = 7500 * ((calculated_bin_rating - 1) ** 2)
- min_temperature = T20C
- max_temperature = T20C
- var/calculated_laser_rating
- for(var/obj/item/stock_parts/micro_laser/laser in component_parts)
- calculated_laser_rating += laser.rating
- min_temperature = max(T0C - (base_cooling + calculated_laser_rating * 15), TCMB) //73.15K with T1 stock parts
- max_temperature = T20C + (base_heating * calculated_laser_rating) //573.15K with T1 stock parts
- parts_efficiency = min(calculated_laser_rating * 0.125, 1)
-
-/obj/machinery/atmospherics/components/binary/thermomachine/update_icon_state()
- switch(target_temperature)
- if(BODYTEMP_HEAT_WARNING_3 to INFINITY)
- greyscale_colors = COLOR_RED
- if(BODYTEMP_HEAT_WARNING_2 to BODYTEMP_HEAT_WARNING_3)
- greyscale_colors = COLOR_ORANGE
- if(BODYTEMP_HEAT_WARNING_1 to BODYTEMP_HEAT_WARNING_2)
- greyscale_colors = COLOR_YELLOW
- if(BODYTEMP_COLD_WARNING_1 to BODYTEMP_HEAT_WARNING_1)
- greyscale_colors = COLOR_VIBRANT_LIME
- if(BODYTEMP_COLD_WARNING_2 to BODYTEMP_COLD_WARNING_1)
- greyscale_colors = COLOR_CYAN
- if(BODYTEMP_COLD_WARNING_3 to BODYTEMP_COLD_WARNING_2)
- greyscale_colors = COLOR_BLUE
- else
- greyscale_colors = COLOR_VIOLET
-
- set_greyscale(colors=greyscale_colors)
-
- if(panel_open)
- icon_state = "thermo-open"
- return ..()
- if(on && is_operational)
- if(skipping_work)
- icon_state = "thermo_1_blinking"
- else
- icon_state = "thermo_1"
- return ..()
- icon_state = "thermo_base"
- return ..()
-
-/obj/machinery/atmospherics/components/binary/thermomachine/update_overlays()
- . = ..()
- if(!initial(icon))
- return
- var/mutable_appearance/thermo_overlay = new(initial(icon))
- . += get_pipe_image(thermo_overlay, "pipe", dir, COLOR_LIME, piping_layer)
- . += get_pipe_image(thermo_overlay, "pipe", turn(dir, 180), COLOR_MOSTLY_PURE_RED, piping_layer)
-
-/obj/machinery/atmospherics/components/binary/thermomachine/examine(mob/user)
- . = ..()
- if(obj_flags & EMAGGED)
- . += span_notice("Something seems wrong with [src]'s thermal safeties.")
- . += span_notice("With the panel open:")
- . += span_notice("-use a wrench with left-click to rotate [src] and right-click to unanchor it.")
- . += span_notice("-use a multitool with left-click to change the piping layer and right-click to change the piping color.")
- . += span_notice("The thermostat is set to [target_temperature]K ([(T0C-target_temperature)*-1]C).")
- if(in_range(user, src) || isobserver(user))
- . += span_notice("Heat capacity at [heat_capacity] Joules per Kelvin.")
- . += span_notice("Temperature range [min_temperature]K - [max_temperature]K ([(T0C-min_temperature)*-1]C - [(T0C-max_temperature)*-1]C).")
-
-/obj/machinery/atmospherics/components/binary/thermomachine/AltClick(mob/living/user)
- if(!can_interact(user))
- return
- target_temperature = T20C
- investigate_log("was set to [target_temperature] K by [key_name(user)]", INVESTIGATE_ATMOS)
- balloon_alert(user, "temperature reset to [target_temperature] K")
-
-/** Performs heat calculation for the freezer. The full equation for this whole process is:
- * T3 = (C1*T1 + (C1*C2)/(C1+C2)*(T2-T1)*E) / C1.
- * T4 = (C1*T1 - (C1*C2)/(C1+C2)*(T2-T1)*E + M) / C1.
- * C1 is main port heat capacity, T1 is the temp.
- * C2 and T2 is for the heat capacity of the freezer and temperature that we desire respectively.
- * T3 is the temperature we get, T4 is the exchange target (heat reservoir).
- * M is the motor heat.
- * E is the efficiency variable. At E=1 and M=0 it works out to be ((C1*T1)+(C2*T2))/(C1+C2).
- */
-/obj/machinery/atmospherics/components/binary/thermomachine/process_atmos()
- if(!is_operational || !on) //if it has no power or its switched off, dont process atmos
- on = FALSE
- update_appearance()
- return
-
- var/turf/local_turf = get_turf(src)
- if(!local_turf)
- on = FALSE
- update_appearance()
- return
-
- // The gas we want to cool/heat
- var/datum/gas_mixture/main_port = airs[1]
- var/datum/gas_mixture/exchange_target = airs[2]
-
- // The difference between target and what we need to heat/cool. Positive if heating, negative if cooling.
- var/temperature_target_delta = target_temperature - main_port.temperature
-
- // This variable holds the (C1*C2)/(C1+C2)*(T2-T1) part of the equation.
- var/heat_amount = temperature_target_delta * (main_port.heat_capacity() * heat_capacity / (main_port.heat_capacity() + heat_capacity))
-
- // Motor heat is the heat added to both ports of the thermomachine at every tick.
- var/motor_heat = 5000
- if(abs(temperature_target_delta) < 5) //Allow the machine to work more finely on lower temperature differences.
- motor_heat = 0
-
- // Automatic Switching. Longer if check to prevent unecessary update_appearances.
- if ((cooling && temperature_target_delta > 0) || (!cooling && temperature_target_delta < 0))
- cooling = temperature_target_delta <= 0 // Thermomachines that reached the target will default to cooling.
- update_appearance()
-
- skipping_work = FALSE
-
- if (main_port.total_moles() < 0.01)
- skipping_work = TRUE
- return
-
- // Efficiency should be a proc level variable, but we need it for the ui.
- // This is to reset the value when we are heating.
- efficiency = 1
-
- var/mole_efficiency = 1
- var/mole_eff_main_port = 1
- var/mole_eff_thermal_port = 1
- if(cooling)
- // Exchange target is the thing we are paired with, be it enviroment or the red port.
- if(use_enviroment_heat)
- exchange_target = local_turf.return_air()
- else
- exchange_target = airs[2]
-
- if(exchange_target.total_moles() < 5)
- mole_eff_thermal_port = 0.1
- else
- mole_eff_thermal_port = max(1 - (1 / (exchange_target.total_moles() + 1)) * 5, 0.1)
-
- if(main_port.total_moles() < 5)
- mole_eff_main_port = 0.1
- else
- mole_eff_main_port = max(1 - (1 / (main_port.total_moles() + 1)) * 5, 0.1)
-
- mole_efficiency = min(mole_eff_main_port, mole_eff_thermal_port)
-
- if(cooling)
- if (exchange_target.total_moles() < 0.01)
- skipping_work = TRUE
- return
-
- // The hotter the heat reservoir is, the larger the malus.
- var/temperature_exchange_delta = exchange_target.temperature - main_port.temperature
- // Log 1 is already 0, going any lower will result in a negative number.
- efficiency = clamp(1 - log(10, max(1, temperature_exchange_delta)) * 0.08, 0.65, 1)
- // We take an extra efficiency malus for enviroments where the mol is too low.
- // Cases of log(0) will be caught by the early return above.
- if (use_enviroment_heat)
- efficiency *= clamp(log(1.55, exchange_target.total_moles()) * 0.15, 0.65, 1)
-
- efficiency *= mole_efficiency
- efficiency = max(efficiency, parts_efficiency)
-
- if (exchange_target.temperature > THERMOMACHINE_SAFE_TEMPERATURE && safeties)
- on = FALSE
- visible_message(span_warning("The heat reservoir has reached critical levels, shutting down..."))
- update_appearance()
- return
-
- else if(exchange_target.temperature > THERMOMACHINE_SAFE_TEMPERATURE && !safeties)
- if((REALTIMEOFDAY - lastwarning) / 5 >= WARNING_DELAY)
- lastwarning = REALTIMEOFDAY
- visible_message(span_warning("The heat reservoir has reached critical levels!"))
- if(check_explosion(exchange_target.temperature))
- explode()
- return PROCESS_KILL //We're dying anyway, so let's stop processing
-
- exchange_target.temperature = max((THERMAL_ENERGY(exchange_target) - (heat_amount * efficiency) + motor_heat) / exchange_target.heat_capacity(), TCMB)
-
- if(!cooling)
- efficiency *= mole_efficiency
- efficiency = max(efficiency, parts_efficiency)
-
- main_port.temperature = max((THERMAL_ENERGY(main_port) + (heat_amount * efficiency)) / main_port.heat_capacity(), TCMB)
-
- heat_amount = min(abs(heat_amount), 1e8) * THERMOMACHINE_POWER_CONVERSION
- var/power_usage = 0
- var/power_efficiency = max(efficiency, 0.4)
- if(abs(temperature_target_delta) > 1)
- power_usage = (heat_amount * 0.05 + idle_power_usage) ** (1.05 - (5e7 * power_efficiency) / (max(5e7, heat_amount)))
- else
- power_usage = idle_power_usage
-
- use_power(power_usage)
- update_appearance()
- update_parents()
-
-/obj/machinery/atmospherics/components/binary/thermomachine/attackby(obj/item/item, mob/user, params)
- if(!on && item.tool_behaviour == TOOL_SCREWDRIVER)
- if(!anchored)
- to_chat(user, span_notice("Anchor [src] first!"))
- return
- if(default_deconstruction_screwdriver(user, "thermo-open", "thermo-0", item))
- change_pipe_connection(panel_open)
- return
- if(default_change_direction_wrench(user, item))
- return
- if(default_deconstruction_crowbar(item))
- return
-
- if(panel_open && item.tool_behaviour == TOOL_MULTITOOL)
- piping_layer = (piping_layer >= PIPING_LAYER_MAX) ? PIPING_LAYER_MIN : (piping_layer + 1)
- to_chat(user, span_notice("You change the circuitboard to layer [piping_layer]."))
- update_appearance()
- return
- return ..()
-
-/obj/machinery/atmospherics/components/binary/thermomachine/default_change_direction_wrench(mob/user, obj/item/I)
- if(!..())
- return FALSE
- set_init_directions()
- update_appearance()
- return TRUE
-
-/obj/machinery/atmospherics/components/binary/thermomachine/proc/change_pipe_connection(disconnect)
- if(disconnect)
- disconnect_pipes()
- return
- connect_pipes()
-
-/obj/machinery/atmospherics/components/binary/thermomachine/proc/connect_pipes()
- var/obj/machinery/atmospherics/node1 = nodes[1]
- var/obj/machinery/atmospherics/node2 = nodes[2]
- atmos_init()
- node1 = nodes[1]
- if(node1)
- node1.atmos_init()
- node1.add_member(src)
- node2 = nodes[2]
- if(node2)
- node2.atmos_init()
- node2.add_member(src)
- SSair.add_to_rebuild_queue(src)
-
-/obj/machinery/atmospherics/components/binary/thermomachine/proc/disconnect_pipes()
- var/obj/machinery/atmospherics/node1 = nodes[1]
- var/obj/machinery/atmospherics/node2 = nodes[2]
- 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(node2)
- if(src in node2.nodes) //Only if it's actually connected. On-pipe version would is one-sided.
- node2.disconnect(src)
- nodes[2] = null
- if(parents[1])
- nullify_pipenet(parents[1])
- if(parents[2])
- nullify_pipenet(parents[2])
-
-/obj/machinery/atmospherics/components/binary/thermomachine/attackby_secondary(obj/item/item, mob/user, params)
- . = ..()
- if(panel_open && item.tool_behaviour == TOOL_WRENCH && !check_pipe_on_turf())
- if(default_unfasten_wrench(user, item))
- return SECONDARY_ATTACK_CONTINUE_CHAIN
- if(panel_open && item.tool_behaviour == TOOL_MULTITOOL)
- color_index = (color_index >= GLOB.pipe_paint_colors.len) ? (color_index = 1) : (color_index = 1 + color_index)
- pipe_color = GLOB.pipe_paint_colors[GLOB.pipe_paint_colors[color_index]]
- visible_message("You set [src] pipe color to [GLOB.pipe_color_name[pipe_color]].")
- update_appearance()
- return SECONDARY_ATTACK_CONTINUE_CHAIN
- return SECONDARY_ATTACK_CONTINUE_CHAIN
-
-/obj/machinery/atmospherics/components/binary/thermomachine/proc/check_pipe_on_turf()
- for(var/obj/machinery/atmospherics/device in get_turf(src))
- if(device == src)
- continue
- if(device.piping_layer == piping_layer)
- visible_message(span_warning("A pipe is hogging the ports, remove the obstruction or change the machine piping layer."))
- return TRUE
- return FALSE
-
-/obj/machinery/atmospherics/components/binary/thermomachine/multitool_act(mob/living/user, obj/item/multitool/multitool)
- if(!istype(multitool))
- return
- if(panel_open && !anchored)
- piping_layer = (piping_layer >= PIPING_LAYER_MAX) ? PIPING_LAYER_MIN : (piping_layer + 1)
- to_chat(user, span_notice("You change the circuitboard to layer [piping_layer]."))
- update_appearance()
-
-/obj/machinery/atmospherics/components/binary/thermomachine/emag_act(mob/user)
- . = ..()
- if(!(obj_flags & EMAGGED))
- if(!do_after(user, 1 SECONDS, src))
- return
- var/datum/effect_system/spark_spread/sparks = new
- sparks.set_up(5, 0, src)
- sparks.attach(src)
- sparks.start()
- obj_flags |= EMAGGED
- user.visible_message(span_warning("You emag [src], overwriting thermal safety restrictions."))
- log_game("[key_name(user)] emagged [src] at [AREACOORD(src)], overwriting thermal safety restrictions.")
-
-/obj/machinery/atmospherics/components/binary/thermomachine/emp_act()
- . = ..()
- if(!(obj_flags & EMAGGED))
- var/datum/effect_system/spark_spread/sparks = new
- sparks.set_up(5, 0, src)
- sparks.attach(src)
- sparks.start()
- obj_flags |= EMAGGED
- safeties = FALSE
-
-/obj/machinery/atmospherics/components/binary/thermomachine/proc/check_explosion(temperature)
- if(temperature < THERMOMACHINE_SAFE_TEMPERATURE + 2000)
- return FALSE
- if(prob(log(6, temperature) * 10)) //75% at 500000, 100% at 1e8
- return TRUE
-
-/obj/machinery/atmospherics/components/binary/thermomachine/proc/explode()
- explosion(loc, 0, 0, 3, 3, TRUE, explosion_cause = src)
- var/datum/gas_mixture/main_port = airs[1]
- var/datum/gas_mixture/exchange_target = airs[2]
- if(main_port)
- loc.assume_air(main_port.remove_ratio(1))
- if(exchange_target)
- loc.assume_air(exchange_target.remove_ratio(1))
- qdel(src)
-
-/obj/machinery/atmospherics/components/binary/thermomachine/ui_status(mob/user)
- if(interactive)
- return ..()
- return UI_CLOSE
-
-/obj/machinery/atmospherics/components/binary/thermomachine/ui_interact(mob/user, datum/tgui/ui)
- if(panel_open)
- return
- ui = SStgui.try_update_ui(user, src, ui)
- if(!ui)
- ui = new(user, src, "ThermoMachine", name)
- ui.open()
-
-/obj/machinery/atmospherics/components/binary/thermomachine/ui_data(mob/user)
- var/list/data = list()
- data["on"] = on
- data["cooling"] = cooling
-
- data["min"] = min_temperature
- data["max"] = max_temperature
- data["target"] = target_temperature
- data["initial"] = initial(target_temperature)
-
- var/datum/gas_mixture/air1 = airs[1]
- data["temperature"] = air1.temperature
- data["pressure"] = air1.return_pressure()
- data["efficiency"] = efficiency
-
- data["use_env_heat"] = use_enviroment_heat
- data["skipping_work"] = skipping_work
- data["safeties"] = safeties
- var/hacked = (obj_flags & EMAGGED) ? TRUE : FALSE
- data["hacked"] = hacked
- return data
-
-/obj/machinery/atmospherics/components/binary/thermomachine/ui_act(action, params)
- . = ..()
- if(.)
- return
-
- switch(action)
- if("power")
- on = !on
- update_use_power(on ? ACTIVE_POWER_USE : IDLE_POWER_USE)
- investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS)
- . = TRUE
- if("cooling")
- cooling = !cooling
- investigate_log("was changed to [cooling ? "cooling" : "heating"] by [key_name(usr)]", INVESTIGATE_ATMOS)
- . = TRUE
- if("target")
- var/target = params["target"]
- var/adjust = text2num(params["adjust"])
- if(target == "input")
- target = input("Set new target ([min_temperature]-[max_temperature] K):", name, target_temperature) as num|null
- if(!isnull(target))
- . = TRUE
- else if(adjust)
- target = target_temperature + adjust
- . = TRUE
- else if(text2num(target) != null)
- target = text2num(target)
- . = TRUE
- if(.)
- target_temperature = clamp(target, min_temperature, max_temperature)
- investigate_log("was set to [target_temperature] K by [key_name(usr)]", INVESTIGATE_ATMOS)
- if("use_env_heat")
- use_enviroment_heat = !use_enviroment_heat
- . = TRUE
- if("safeties")
- safeties = !safeties
- investigate_log("[key_name(usr)] turned off the [src] safeties", INVESTIGATE_ATMOS)
- . = TRUE
-
- update_appearance()
-
-/obj/machinery/atmospherics/components/binary/thermomachine/CtrlClick(mob/living/user)
- if(!panel_open)
- if(!can_interact(user))
- return
- on = !on
- investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS)
- update_appearance()
- return
- . = ..()
-
-/obj/machinery/atmospherics/components/binary/thermomachine/freezer
- cooling = TRUE
-
-/obj/machinery/atmospherics/components/binary/thermomachine/freezer/on
- on = TRUE
- icon_state = "thermo_base_1"
-
-/obj/machinery/atmospherics/components/binary/thermomachine/freezer/on/Initialize(mapload)
- . = ..()
- if(target_temperature == initial(target_temperature))
- target_temperature = min_temperature
-
-/obj/machinery/atmospherics/components/binary/thermomachine/freezer/on/coldroom
- name = "Cold room temperature control unit"
- icon_state = "thermo_base_1"
- greyscale_colors = COLOR_CYAN
- cooling = TRUE
-
-/obj/machinery/atmospherics/components/binary/thermomachine/freezer/on/coldroom/Initialize(mapload)
- . = ..()
- target_temperature = COLD_ROOM_TEMP
-
-/obj/machinery/atmospherics/components/binary/thermomachine/heater
- cooling = FALSE
-
-/obj/machinery/atmospherics/components/binary/thermomachine/heater/on
- on = TRUE
- icon_state = "thermo_base_1"
-
-#undef THERMOMACHINE_SAFE_TEMPERATURE
-#undef THERMOMACHINE_POWER_CONVERSION
diff --git a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm
index 7465d3b5cb5e9..ba1d7403ea844 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/valve.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/valve.dm
@@ -52,16 +52,6 @@ It's like a regular ol' straight pipe, but you can turn it on and off.
update_icon_nopipes()
investigate_log("was closed by [usr ? key_name(usr) : "a remote signal"]", INVESTIGATE_ATMOS)
-
-// 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/interact(mob/user)
add_fingerprint(usr)
if(switching)
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 61d7198b395c5..84c0a789aa97c 100644
--- a/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
+++ b/code/modules/atmospherics/machinery/components/binary_devices/volume_pump.dm
@@ -95,11 +95,6 @@
if(overclocked)
. += "Its warning light is on[on ? " and it's spewing gas!" : "."]"
-/**
- * Called in atmos_init(), used to change or remove the radio frequency from the component
- * Arguments:
- * * -new_frequency: the frequency that should be used for the radio to attach to the component, use 0 to remove the radio
- */
/obj/machinery/atmospherics/components/binary/volume_pump/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
frequency = new_frequency
@@ -108,6 +103,7 @@
/obj/machinery/atmospherics/components/binary/volume_pump/proc/broadcast_status()
if(!radio_connection)
+ return
var/datum/signal/signal = new(list(
"tag" = id,
@@ -136,7 +132,7 @@
return data
/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 7f683b8b210c8..b3ee7f4893b7e 100644
--- a/code/modules/atmospherics/machinery/components/components_base.dm
+++ b/code/modules/atmospherics/machinery/components/components_base.dm
@@ -23,11 +23,9 @@
..()
for(var/i in 1 to device_type)
- if(airs[i])
- continue
- var/datum/gas_mixture/component_mixture = new
- component_mixture.volume = 200
- airs[i] = component_mixture
+ var/datum/gas_mixture/A = new
+ A.volume = 200
+ airs[i] = A
/obj/machinery/atmospherics/components/Initialize()
. = ..()
@@ -95,8 +93,8 @@
/obj/machinery/atmospherics/components/nullify_node(i)
if(parents[i])
- nullify_pipenet(parents[i])
- airs[i] = null
+ nullifyPipenet(parents[i])
+ QDEL_NULL(airs[i])
return ..()
/obj/machinery/atmospherics/components/on_construction()
@@ -122,9 +120,9 @@
* Arguments:
* * -reference: the pipeline the component is attached to
*/
-/obj/machinery/atmospherics/components/proc/nullify_pipenet(datum/pipeline/reference)
+/obj/machinery/atmospherics/components/proc/nullifyPipenet(datum/pipeline/reference)
if(!reference)
- CRASH("nullify_pipenet(null) called by [type] on [COORD(src)]")
+ CRASH("nullifyPipenet(null) called by [type] on [COORD(src)]")
for (var/i in 1 to parents.len)
if (parents[i] == reference)
@@ -143,10 +141,10 @@
if(!length(reference.other_atmos_machines) && !length(reference.members))
if(QDESTROYING(reference))
- CRASH("nullify_pipenet() called on qdeleting [reference]")
+ CRASH("nullifyPipenet() called on qdeleting [reference]")
qdel(reference)
-/obj/machinery/atmospherics/components/return_pipenet_airs(datum/pipeline/reference)
+/obj/machinery/atmospherics/components/return_pipenetAirs(datum/pipeline/reference)
var/list/returned_air = list()
for (var/i in 1 to parents.len)
@@ -159,11 +157,11 @@
return list(nodes[parents.Find(reference)])
return ..()
-/obj/machinery/atmospherics/components/set_pipenet(datum/pipeline/reference, obj/machinery/atmospherics/target_component)
- parents[nodes.Find(target_component)] = reference
+/obj/machinery/atmospherics/components/set_pipenet(datum/pipeline/reference, obj/machinery/atmospherics/A)
+ parents[nodes.Find(A)] = reference
-/obj/machinery/atmospherics/components/return_pipenet(obj/machinery/atmospherics/target_component = nodes[1]) //returns parents[1] if called without argument
- return parents[nodes.Find(target_component)]
+/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/replace_pipenet(datum/pipeline/Old, datum/pipeline/New)
parents[parents.Find(Old)] = New
@@ -171,11 +169,11 @@
/obj/machinery/atmospherics/components/unsafe_pressure_release(mob/user, pressures)
. = ..()
- var/turf/current_turf = get_turf(src)
- if(!current_turf)
+ var/turf/T = get_turf(src)
+ if(!T)
return
//Remove the gas from airs and assume it
- var/datum/gas_mixture/environment = current_turf.return_air()
+ var/datum/gas_mixture/environment = T.return_air()
var/lost = null
var/times_lost = 0
for(var/i in 1 to device_type)
@@ -191,7 +189,8 @@
to_release = air.remove(shared_loss)
continue
to_release.merge(air.remove(shared_loss))
- current_turf.assume_air(to_release)
+ T.assume_air(to_release)
+ air_update_turf(FALSE, FALSE)
// Helpers
@@ -218,11 +217,6 @@
for(var/i in 1 to device_type)
. += return_pipenet(nodes[i])
-/// When this machine is in a pipenet that is reconciling airs, this proc can add airs to the calculation.
-/// Can be either a list of airs or a single air mix.
-/obj/machinery/atmospherics/components/proc/return_airs_for_reconcilation(datum/pipeline/requester)
- return list()
-
// UI Stuff
/obj/machinery/atmospherics/components/ui_status(mob/user)
diff --git a/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm b/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm
deleted file mode 100644
index 5ea71e5933a38..0000000000000
--- a/code/modules/atmospherics/machinery/components/fusion/hfr_parts.dm
+++ /dev/null
@@ -1,503 +0,0 @@
-/**
- * This file contain the eight parts surrounding the main core, those are: fuel input, moderator input, waste output, interface and the corners
- * The file also contain the guicode of the machine
- */
-/obj/machinery/atmospherics/components/unary/hypertorus
- icon = 'icons/obj/atmospherics/components/hypertorus.dmi'
- icon_state = "core"
-
- name = "thermomachine"
- desc = "Heats or cools gas in connected pipes."
- anchored = TRUE
- density = TRUE
- resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF
- layer = OBJ_LAYER
- pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY
- circuit = /obj/item/circuitboard/machine/thermomachine
- ///Vars for the state of the icon of the object (open, off, active)
- var/icon_state_open
- var/icon_state_off
- var/icon_state_active
- ///Check if the machine has been activated
- var/active = FALSE
- ///Check if fusion has started
- var/fusion_started = FALSE
- ///Check if the machine is cracked open
- var/cracked = FALSE
-
-/obj/machinery/atmospherics/components/unary/hypertorus/Initialize(mapload)
- . = ..()
- initialize_directions = dir
-
-/obj/machinery/atmospherics/components/unary/hypertorus/examine(mob/user)
- . = ..()
- . += span_notice("[src] can be rotated by first opening the panel with a screwdriver and then using a wrench on it.")
-
-/obj/machinery/atmospherics/components/unary/hypertorus/attackby(obj/item/I, mob/user, params)
- if(!fusion_started)
- if(default_deconstruction_screwdriver(user, icon_state_open, icon_state_off, I))
- return
- if(default_change_direction_wrench(user, I))
- return
- if(default_deconstruction_crowbar(I))
- return
- return ..()
-
-/obj/machinery/atmospherics/components/unary/hypertorus/welder_act(mob/living/user, obj/item/tool)
- if(!cracked)
- return FALSE
- if(user.combat_mode)
- return FALSE
- balloon_alert(user, "You start repairing the crack...")
- if(tool.use_tool(src, user, 10 SECONDS, volume=30, amount=5))
- balloon_alert(user, "You repaired the crack.")
- cracked = FALSE
- update_appearance()
-
-/obj/machinery/atmospherics/components/unary/hypertorus/default_change_direction_wrench(mob/user, obj/item/I)
- . = ..()
- if(.)
- set_init_directions()
- var/obj/machinery/atmospherics/node = nodes[1]
- if(node)
- node.disconnect(src)
- nodes[1] = null
- if(parents[1])
- nullify_pipenet(parents[1])
- atmos_init()
- node = nodes[1]
- if(node)
- node.atmos_init()
- node.add_member(src)
- SSair.add_to_rebuild_queue(src)
-
-/obj/machinery/atmospherics/components/unary/hypertorus/update_icon_state()
- if(panel_open)
- icon_state = icon_state_open
- return ..()
- if(active)
- icon_state = icon_state_active
- return ..()
- icon_state = icon_state_off
- return ..()
-
-/obj/machinery/atmospherics/components/unary/hypertorus/update_overlays()
- . = ..()
- if(!cracked)
- return
- var/image/crack = image(icon, icon_state = "crack")
- crack.dir = dir
- . += crack
-
-/obj/machinery/atmospherics/components/unary/hypertorus/fuel_input
- name = "HFR fuel input port"
- desc = "Input port for the Hypertorus Fusion Reactor, designed to take in only Hydrogen and Tritium in gas forms."
- icon_state = "fuel_input_off"
- icon_state_open = "fuel_input_open"
- icon_state_off = "fuel_input_off"
- icon_state_active = "fuel_input_active"
- circuit = /obj/item/circuitboard/machine/HFR_fuel_input
-
-/obj/machinery/atmospherics/components/unary/hypertorus/waste_output
- name = "HFR waste output port"
- desc = "Waste port for the Hypertorus Fusion Reactor, designed to output the hot waste gases coming from the core of the machine."
- icon_state = "waste_output_off"
- icon_state_open = "waste_output_open"
- icon_state_off = "waste_output_off"
- icon_state_active = "waste_output_active"
- circuit = /obj/item/circuitboard/machine/HFR_waste_output
-
-/obj/machinery/atmospherics/components/unary/hypertorus/moderator_input
- name = "HFR moderator input port"
- desc = "Moderator port for the Hypertorus Fusion Reactor, designed to move gases inside the machine to cool and control the flow of the reaction."
- icon_state = "moderator_input_off"
- icon_state_open = "moderator_input_open"
- icon_state_off = "moderator_input_off"
- icon_state_active = "moderator_input_active"
- circuit = /obj/item/circuitboard/machine/HFR_moderator_input
-
-/*
-* Interface and corners
-*/
-/obj/machinery/hypertorus
- name = "hypertorus_core"
- desc = "hypertorus_core"
- icon = 'icons/obj/atmospherics/components/hypertorus.dmi'
- icon_state = "core"
- move_resist = INFINITY
- anchored = TRUE
- density = TRUE
- resistance_flags = INDESTRUCTIBLE | LAVA_PROOF | FIRE_PROOF | UNACIDABLE | ACID_PROOF | FREEZE_PROOF
- power_channel = AREA_USAGE_ENVIRON
- var/active = FALSE
- var/icon_state_open
- var/icon_state_off
- var/icon_state_active
- var/fusion_started = FALSE
-
-/obj/machinery/hypertorus/examine(mob/user)
- . = ..()
- . += span_notice("[src] can be rotated by first opening the panel with a screwdriver and then using a wrench on it.")
-
-/obj/machinery/hypertorus/attackby(obj/item/I, mob/user, params)
- if(!fusion_started)
- if(default_deconstruction_screwdriver(user, icon_state_open, icon_state_off, I))
- return
- if(default_change_direction_wrench(user, I))
- return
- if(default_deconstruction_crowbar(I))
- return
- return ..()
-
-/obj/machinery/hypertorus/update_icon_state()
- if(panel_open)
- icon_state = icon_state_open
- return ..()
- if(active)
- icon_state = icon_state_active
- return ..()
- icon_state = icon_state_off
- return ..()
-
-/obj/machinery/hypertorus/interface
- name = "HFR interface"
- desc = "Interface for the HFR to control the flow of the reaction."
- icon_state = "interface_off"
- circuit = /obj/item/circuitboard/machine/HFR_interface
- var/obj/machinery/atmospherics/components/unary/hypertorus/core/connected_core
- icon_state_off = "interface_off"
- icon_state_open = "interface_open"
- icon_state_active = "interface_active"
-
-/obj/machinery/hypertorus/interface/Destroy()
- if(connected_core)
- connected_core = null
- return..()
-
-/obj/machinery/hypertorus/interface/multitool_act(mob/living/user, obj/item/I)
- . = ..()
- var/turf/T = get_step(src,turn(dir,180))
- var/obj/machinery/atmospherics/components/unary/hypertorus/core/centre = locate() in T
-
- if(!centre || !centre.check_part_connectivity())
- to_chat(user, span_notice("Check all parts and then try again."))
- return TRUE
- new/obj/item/paper/guides/jobs/atmos/hypertorus(loc)
- connected_core = centre
-
- connected_core.activate(user)
- return TRUE
-
-/obj/machinery/hypertorus/interface/ui_interact(mob/user, datum/tgui/ui)
- if(active)
- ui = SStgui.try_update_ui(user, src, ui)
- if(!ui)
- ui = new(user, src, "Hypertorus", name)
- ui.open()
- else
- to_chat(user, span_notice("Activate the machine first by using a multitool on the interface."))
-
-/obj/machinery/hypertorus/interface/ui_static_data()
- var/data = list()
- data["selected_fuel"] = list(list("name" = "Nothing", "id" = null))
- for(var/path in GLOB.hfr_fuels_list)
- var/datum/hfr_fuel/recipe = GLOB.hfr_fuels_list[path]
- data["selected_fuel"] += list(list("name" = recipe.name, "id" = recipe.id))
- return data
-
-/obj/machinery/hypertorus/interface/ui_data()
- var/data = list()
-
- if(connected_core.selected_fuel)
- data["selected"] = connected_core.selected_fuel.id
- else
- data["selected"] = ""
-
- var/list/product_gases
- if(!connected_core.selected_fuel)
- product_gases = list("Select a fuel mix to see the output")
- else
- product_gases = list("The [connected_core.selected_fuel.name] mix will produce the following gases:")
- for(var/gas_type in connected_core.selected_fuel.secondary_products)
- var/datum/gas/gas_produced = gas_type
- product_gases += "-[initial(gas_produced.name)]"
- var/minimum_temp = connected_core.selected_fuel.negative_temperature_multiplier < 1 ? "Decrease" : "Increase"
- var/maximum_temp = connected_core.selected_fuel.positive_temperature_multiplier < 1 ? "Decrease" : "Increase"
- var/energy = connected_core.selected_fuel.energy_concentration_multiplier > 1 ? "Decrease" : "Increase"
- var/fuel_consumption = connected_core.selected_fuel.fuel_consumption_multiplier < 1 ? "Decrease" : "Increase"
- var/fuel_production = connected_core.selected_fuel.gas_production_multiplier < 1 ? "Decrease" : "Increase"
- product_gases += "The fuel mix will"
- product_gases += "-[minimum_temp] the maximum cooling by a factor of [connected_core.selected_fuel.negative_temperature_multiplier]"
- product_gases += "-[maximum_temp] the maximum heating by a factor of [connected_core.selected_fuel.positive_temperature_multiplier]"
- product_gases += "-[energy] the energy output consumption by a factor of [1 / connected_core.selected_fuel.energy_concentration_multiplier]"
- product_gases += "-[fuel_consumption] the fuel consumption by a factor of [connected_core.selected_fuel.fuel_consumption_multiplier]"
- product_gases += "-[fuel_production] the gas production by a factor of [connected_core.selected_fuel.gas_production_multiplier]"
- product_gases += "-Maximum fusion temperature with this mix: [FUSION_MAXIMUM_TEMPERATURE * connected_core.selected_fuel.temperature_change_multiplier] K."
-
- data["product_gases"] = product_gases.Join("\n")
-
- //Internal Fusion gases
- var/list/fusion_gasdata = list()
- if(connected_core.internal_fusion.total_moles())
- for(var/gasid in connected_core.internal_fusion.gases)
- fusion_gasdata.Add(list(list(
- "name"= connected_core.internal_fusion.gases[gasid][GAS_META][META_GAS_NAME],
- "amount" = round(connected_core.internal_fusion.gases[gasid][MOLES], 0.01),
- )))
- else
- for(var/gasid in connected_core.internal_fusion.gases)
- fusion_gasdata.Add(list(list(
- "name"= connected_core.internal_fusion.gases[gasid][GAS_META][META_GAS_NAME],
- "amount" = 0,
- )))
- //Moderator gases
- var/list/moderator_gasdata = list()
- if(connected_core.moderator_internal.total_moles())
- for(var/gasid in connected_core.moderator_internal.gases)
- moderator_gasdata.Add(list(list(
- "name"= connected_core.moderator_internal.gases[gasid][GAS_META][META_GAS_NAME],
- "amount" = round(connected_core.moderator_internal.gases[gasid][MOLES], 0.01),
- )))
- else
- for(var/gasid in connected_core.moderator_internal.gases)
- moderator_gasdata.Add(list(list(
- "name"= connected_core.moderator_internal.gases[gasid][GAS_META][META_GAS_NAME],
- "amount" = 0,
- )))
-
- data["fusion_gases"] = fusion_gasdata
- data["moderator_gases"] = moderator_gasdata
-
- data["energy_level"] = connected_core.energy
- data["heat_limiter_modifier"] = connected_core.heat_limiter_modifier
- data["heat_output"] = abs(connected_core.heat_output)
- data["heat_output_bool"] = connected_core.heat_output >= 0 ? "" : "-"
-
- data["heating_conductor"] = connected_core.heating_conductor
- data["magnetic_constrictor"] = connected_core.magnetic_constrictor
- data["fuel_injection_rate"] = connected_core.fuel_injection_rate
- data["moderator_injection_rate"] = connected_core.moderator_injection_rate
- data["current_damper"] = connected_core.current_damper
-
- data["power_level"] = connected_core.power_level
- data["iron_content"] = connected_core.iron_content
- data["integrity"] = connected_core.get_integrity_percent()
-
- data["start_power"] = connected_core.start_power
- data["start_cooling"] = connected_core.start_cooling
- data["start_fuel"] = connected_core.start_fuel
- data["start_moderator"] = connected_core.start_moderator
-
- data["internal_fusion_temperature"] = connected_core.fusion_temperature
- data["moderator_internal_temperature"] = connected_core.moderator_temperature
- data["internal_output_temperature"] = connected_core.output_temperature
- data["internal_coolant_temperature"] = connected_core.coolant_temperature
-
- data["waste_remove"] = connected_core.waste_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)))
-
- data["cooling_volume"] = connected_core.airs[1].volume
- data["mod_filtering_rate"] = connected_core.moderator_filtering_rate
-
- return data
-
-/obj/machinery/hypertorus/interface/ui_act(action, params)
- . = ..()
- if(.)
- return
- switch(action)
- if("start_power")
- connected_core.start_power = !connected_core.start_power
- connected_core.update_use_power(connected_core.start_power ? ACTIVE_POWER_USE : IDLE_POWER_USE)
- . = TRUE
- if("start_cooling")
- connected_core.start_cooling = !connected_core.start_cooling
- . = TRUE
- if("start_fuel")
- connected_core.start_fuel = !connected_core.start_fuel
- . = TRUE
- if("start_moderator")
- connected_core.start_moderator = !connected_core.start_moderator
- . = TRUE
- if("heating_conductor")
- var/heating_conductor = text2num(params["heating_conductor"])
- if(heating_conductor != null)
- connected_core.heating_conductor = clamp(heating_conductor, 50, 500)
- . = TRUE
- if("magnetic_constrictor")
- var/magnetic_constrictor = text2num(params["magnetic_constrictor"])
- if(magnetic_constrictor != null)
- connected_core.magnetic_constrictor = clamp(magnetic_constrictor, 50, 1000)
- . = TRUE
- if("fuel_injection_rate")
- var/fuel_injection_rate = text2num(params["fuel_injection_rate"])
- if(fuel_injection_rate != null)
- connected_core.fuel_injection_rate = clamp(fuel_injection_rate, 0.5, 150)
- . = TRUE
- if("moderator_injection_rate")
- var/moderator_injection_rate = text2num(params["moderator_injection_rate"])
- if(moderator_injection_rate != null)
- connected_core.moderator_injection_rate = clamp(moderator_injection_rate, 0.5, 150)
- . = TRUE
- if("current_damper")
- var/current_damper = text2num(params["current_damper"])
- if(current_damper != null)
- connected_core.current_damper = clamp(current_damper, 0, 1000)
- . = TRUE
- if("waste_remove")
- connected_core.waste_remove = !connected_core.waste_remove
- . = TRUE
- if("filter")
- connected_core.moderator_scrubbing ^= gas_id2path(params["mode"])
- . = TRUE
- if("mod_filtering_rate")
- var/mod_filtering_rate = text2num(params["mod_filtering_rate"])
- if(mod_filtering_rate != null)
- connected_core.moderator_filtering_rate = clamp(mod_filtering_rate, 5, 200)
- . = TRUE
- if("fuel")
- connected_core.selected_fuel = null
- var/fuel_mix = "nothing"
- var/datum/hfr_fuel/fuel = null
- if(params["mode"] != "")
- fuel = GLOB.hfr_fuels_list[params["mode"]]
- if(fuel)
- connected_core.selected_fuel = fuel
- fuel_mix = fuel.name
- if(connected_core.internal_fusion.total_moles())
- connected_core.dump_gases()
- connected_core.update_parents() //prevent the machine from stopping because of the recipe change and the pipenet not updating
- connected_core.linked_input.update_parents()
- connected_core.linked_output.update_parents()
- connected_core.linked_moderator.update_parents()
- investigate_log("was set to recipe [fuel_mix ? fuel_mix : "null"] by [key_name(usr)]", INVESTIGATE_ATMOS)
- . = TRUE
- if("cooling_volume")
- var/cooling_volume = text2num(params["cooling_volume"])
- if(cooling_volume != null)
- connected_core.airs[1].volume = clamp(cooling_volume, 50, 2000)
- . = TRUE
-
-/obj/machinery/hypertorus/corner
- name = "HFR corner"
- desc = "Structural piece of the machine."
- icon_state = "corner_off"
- circuit = /obj/item/circuitboard/machine/HFR_corner
- icon_state_off = "corner_off"
- icon_state_open = "corner_open"
- icon_state_active = "corner_active"
- dir = SOUTHEAST
-
-/obj/item/paper/guides/jobs/atmos/hypertorus
- name = "paper- 'Quick guide to safe handling of the HFR'"
- info = "How to safely(TM) operate the Hypertorus \
- -Build the machine as it�s shown in the main guide. \
- -Make a 50/50 gasmix of tritium and hydrogen totalling around 2000 moles. \
- -Start the machine, fill up the cooling loop with plasma/hypernoblium and use space or freezers to cool it. \
- -Connect the fuel mix into the fuel injector port, allow only 1000 moles into the machine to ease the kickstart of the reaction \
- -Set the Heat conductor to 500 when starting the reaction, reset it to 100 when power level is higher than 1 \
- -In the event of a meltdown, set the heat conductor to max and set the current damper to max. Set the fuel injection to min. \
- If the heat output doesn�t go negative, try changing the magnetic costrictors untill heat output goes negative. \
- Make the cooling stronger, put high heat capacity gases inside the moderator (hypernoblium will help dealing with the problem)
\
- Warnings: \
- -You cannot dismantle the machine if the power level is over 0 \
- -You cannot power of the machine if the power level is over 0 \
- -You cannot dispose of waste gases if power level is over 5 \
- -You cannot remove gases from the fusion mix if they are not helium and antinoblium \
- -Hypernoblium will decrease the power of the mix by a lot \
- -Antinoblium will INCREASE the power of the mix by a lot more \
- -High heat capacity gases are harder to heat/cool \
- -Low heat capacity gases are easier to heat/cool \
- -The machine consumes 50 KW per power level, reaching 350 KW at power level 6 so prepare the SM accordingly \
- -In case of a power shortage, the fusion reaction will CONTINUE but the cooling will STOP
\
- The writer of the quick guide will not be held responsible for misuses and meltdown caused by the use of the guide, \
- use more advanced guides to understando how the various gases will act as moderators."
-
-/obj/item/hfr_box
- name = "HFR box"
- desc = "If you see this, call the police."
- icon = 'icons/obj/atmospherics/components/hypertorus.dmi'
- icon_state = "box"
- ///What kind of box are we handling?
- var/box_type = "impossible"
- ///What's the path of the machine we making
- var/part_path
-
-/obj/item/hfr_box/corner
- name = "HFR box corner"
- desc = "Place this as the corner of your 3x3 multiblock fusion reactor"
- icon_state = "box_corner"
- box_type = "corner"
- part_path = /obj/machinery/hypertorus/corner
-
-/obj/item/hfr_box/body
- name = "HFR box body"
- desc = "Place this on the sides of the core box of your 3x3 multiblock fusion reactor"
- box_type = "body"
- icon_state = "box_body"
-
-/obj/item/hfr_box/body/fuel_input
- name = "HFR box fuel input"
- part_path = /obj/machinery/atmospherics/components/unary/hypertorus/fuel_input
-
-/obj/item/hfr_box/body/moderator_input
- name = "HFR box moderator input"
- part_path = /obj/machinery/atmospherics/components/unary/hypertorus/moderator_input
-
-/obj/item/hfr_box/body/waste_output
- name = "HFR box waste output"
- part_path = /obj/machinery/atmospherics/components/unary/hypertorus/waste_output
-
-/obj/item/hfr_box/body/interface
- name = "HFR box interface"
- part_path = /obj/machinery/hypertorus/interface
-
-/obj/item/hfr_box/core
- name = "HFR box core"
- desc = "Activate this with a multitool to deploy the full machine after setting up the other boxes"
- icon_state = "box_core"
- box_type = "core"
- part_path = /obj/machinery/atmospherics/components/unary/hypertorus/core
-
-/obj/item/hfr_box/core/multitool_act(mob/living/user, obj/item/I)
- . = ..()
- var/list/parts = list()
- for(var/obj/item/hfr_box/box in orange(1,src))
- var/direction = get_dir(src, box)
- if(box.box_type == "corner")
- if(ISDIAGONALDIR(direction))
- box.dir = direction
- parts |= box
- continue
- if(box.box_type == "body")
- if(direction in GLOB.cardinals)
- box.dir = direction
- parts |= box
- continue
- if(parts.len == 8)
- build_reactor(parts)
- return
-
-/obj/item/hfr_box/core/proc/build_reactor(list/parts)
- for(var/obj/item/hfr_box/box in parts)
- if(box.box_type == "corner")
- var/obj/machinery/hypertorus/corner/corner = new box.part_path(box.loc)
- corner.dir = box.dir
- qdel(box)
- continue
- if(box.box_type == "body")
- var/location = get_turf(box)
- if(box.part_path != /obj/machinery/hypertorus/interface)
- var/obj/machinery/atmospherics/components/unary/hypertorus/part = new box.part_path(location, TRUE, box.dir)
- part.dir = box.dir
- else
- var/obj/machinery/hypertorus/interface/part = new box.part_path(location)
- part.dir = box.dir
- qdel(box)
- continue
-
- new/obj/machinery/atmospherics/components/unary/hypertorus/core(loc, TRUE)
- qdel(src)
diff --git a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm b/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm
deleted file mode 100644
index 2fb7a673631da..0000000000000
--- a/code/modules/atmospherics/machinery/components/gas_recipe_machines/crystallizer.dm
+++ /dev/null
@@ -1,339 +0,0 @@
-#define MIN_PROGRESS_AMOUNT 3
-#define MIN_DEVIATION_RATE 0.90
-#define MAX_DEVIATION_RATE 1.1
-#define HIGH_CONDUCTIVITY_RATIO 0.95
-
-/obj/machinery/atmospherics/components/binary/crystallizer
- icon = 'icons/obj/atmospherics/components/machines.dmi'
- icon_state = "crystallizer-off"
- name = "crystallizer"
- desc = "Used to crystallize or solidify gases."
- layer = ABOVE_MOB_LAYER
- density = TRUE
- max_integrity = 300
- armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 100, BOMB = 0, BIO = 100, RAD = 100, FIRE = 80, ACID = 30)
- circuit = /obj/item/circuitboard/machine/crystallizer
- pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY
- vent_movement = NONE
-
- ///Base icon state for the machine to be used in update_icon()
- var/base_icon = "crystallizer"
- ///Internal Gas mix used for processing the gases that have been put in
- var/datum/gas_mixture/internal
- ///Var that controls how much gas gets injected in moles per tick
- var/gas_input = 0
- ///Saves the progress during the processing of the items
- var/progress_bar = 0
- ///Stores the amount of lost quality
- var/quality_loss = 0
- ///Stores the recipe selected by the user in the GUI
- var/datum/gas_recipe/selected_recipe = null
- ///Stores the total amount of moles needed for the current recipe
- var/total_recipe_moles = 0
-
-/obj/machinery/atmospherics/components/binary/crystallizer/Initialize(mapload)
- . = ..()
- internal = new
-
-/obj/machinery/atmospherics/components/binary/crystallizer/attackby(obj/item/I, mob/user, params)
- if(!on)
- if(default_deconstruction_screwdriver(user, "[base_icon]-open", "[base_icon]-off", I))
- return
- if(default_change_direction_wrench(user, I))
- return
- if(default_deconstruction_crowbar(I))
- return
- return ..()
-
-/obj/machinery/atmospherics/components/binary/crystallizer/default_change_direction_wrench(mob/user, obj/item/I)
- . = ..()
- if(!.)
- return FALSE
- set_init_directions()
- var/obj/machinery/atmospherics/node1 = nodes[1]
- var/obj/machinery/atmospherics/node2 = nodes[2]
- 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(node2)
- if(src in node2.nodes) //Only if it's actually connected. On-pipe version would is one-sided.
- node2.disconnect(src)
- nodes[2] = null
-
- if(parents[1])
- nullify_pipenet(parents[1])
- if(parents[2])
- nullify_pipenet(parents[2])
-
- atmos_init()
- node1 = nodes[1]
- if(node1)
- node1.atmos_init()
- node1.add_member(src)
- node2 = nodes[2]
- if(node2)
- 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()
- var/mutable_appearance/pipe_appearance1 = mutable_appearance('icons/obj/atmospherics/pipes/pipe_underlays.dmi', "intact_[dir]_[piping_layer]", layer = GAS_SCRUBBER_LAYER)
- pipe_appearance1.color = COLOR_LIME
- var/mutable_appearance/pipe_appearance2 = mutable_appearance('icons/obj/atmospherics/pipes/pipe_underlays.dmi', "intact_[turn(dir, 180)]_[piping_layer]", layer = GAS_SCRUBBER_LAYER)
- pipe_appearance2.color = COLOR_MOSTLY_PURE_RED
- . += pipe_appearance1
- . += pipe_appearance2
-
-/obj/machinery/atmospherics/components/binary/crystallizer/update_icon_state()
- . = ..()
- if(panel_open)
- icon_state = "[base_icon]-open"
- else if(on && is_operational)
- icon_state = "[base_icon]-on"
- else
- icon_state = "[base_icon]-off"
-
-/obj/machinery/atmospherics/components/binary/crystallizer/attackby_secondary(mob/user)
- if(!can_interact(user))
- return
- on = !on
- investigate_log("was turned [on ? "on" : "off"] by [key_name(user)]", INVESTIGATE_ATMOS)
- update_icon()
-
-///Checks if the reaction temperature is inside the range of temperature + a little deviation
-/obj/machinery/atmospherics/components/binary/crystallizer/proc/check_temp_requirements()
- if(internal.temperature >= selected_recipe.min_temp * MIN_DEVIATION_RATE && internal.temperature <= selected_recipe.max_temp * MAX_DEVIATION_RATE)
- return TRUE
- return FALSE
-
-///Injects the gases from the input inside the internal gasmix, the amount is dependant on the gas_input var
-/obj/machinery/atmospherics/components/binary/crystallizer/proc/inject_gases()
- var/datum/gas_mixture/contents = airs[2]
- for(var/gas_type in selected_recipe.requirements)
- if(!contents.gases[gas_type] || !contents.gases[gas_type][MOLES])
- continue
- if(internal.gases[gas_type] && internal.gases[gas_type][MOLES] >= selected_recipe.requirements[gas_type] * 2)
- continue
- internal.merge(contents.remove_specific(gas_type, contents.gases[gas_type][MOLES] * gas_input))
-
-///Checks if the gases required are all inside
-/obj/machinery/atmospherics/components/binary/crystallizer/proc/internal_check()
- var/gas_check = 0
- for(var/gas_type in selected_recipe.requirements)
- if(!internal.gases[gas_type] || !internal.gases[gas_type][MOLES])
- return FALSE
- if(internal.gases[gas_type][MOLES] >= selected_recipe.requirements[gas_type])
- gas_check++
- if(gas_check == selected_recipe.requirements.len)
- return TRUE
- return FALSE
-
-///Calculation for the heat of the various gas mixes and controls the quality of the item
-/obj/machinery/atmospherics/components/binary/crystallizer/proc/heat_calculations()
- if( (internal.temperature >= (selected_recipe.min_temp * MIN_DEVIATION_RATE) && internal.temperature <= selected_recipe.min_temp) || \
- (internal.temperature >= selected_recipe.max_temp && internal.temperature <= (selected_recipe.max_temp * MAX_DEVIATION_RATE)))
- quality_loss = min(quality_loss + 1.5, 100)
-
- var/median_temperature = (selected_recipe.max_temp - selected_recipe.min_temp) * 0.5
- if(internal.temperature >= (median_temperature * MIN_DEVIATION_RATE) && internal.temperature <= (median_temperature * MAX_DEVIATION_RATE))
- quality_loss = max(quality_loss - 5.5, -100)
-
- if(selected_recipe.reaction_type == "endothermic")
- internal.temperature = max(internal.temperature - (selected_recipe.energy_release / internal.heat_capacity()), TCMB)
- update_parents()
- else if(selected_recipe.reaction_type == "exothermic")
- internal.temperature = max(internal.temperature + (selected_recipe.energy_release / internal.heat_capacity()), TCMB)
- update_parents()
-
-///Conduction between the internal gasmix and the moderating (cooling/heating) gasmix.
-/obj/machinery/atmospherics/components/binary/crystallizer/proc/heat_conduction()
- var/datum/gas_mixture/cooling_port = airs[1]
- if(cooling_port.total_moles() > MINIMUM_MOLE_COUNT)
- if(internal.total_moles() > 0)
- var/coolant_temperature_delta = cooling_port.temperature - internal.temperature
- var/cooling_heat_capacity = cooling_port.heat_capacity()
- var/internal_heat_capacity = internal.heat_capacity()
- var/cooling_heat_amount = HIGH_CONDUCTIVITY_RATIO * coolant_temperature_delta * (cooling_heat_capacity * internal_heat_capacity / (cooling_heat_capacity + internal_heat_capacity))
- cooling_port.temperature = max(cooling_port.temperature - cooling_heat_amount / cooling_heat_capacity, TCMB)
- internal.temperature = max(internal.temperature + cooling_heat_amount / internal_heat_capacity, TCMB)
- update_parents()
-
-///Calculate the total moles needed for the recipe
-/obj/machinery/atmospherics/components/binary/crystallizer/proc/moles_calculations()
- var/amounts = 0
- for(var/gas_type in selected_recipe.requirements)
- amounts += selected_recipe.requirements[gas_type]
- total_recipe_moles = amounts
-
-///Removes the gases from the internal gasmix when the recipe is changed
-/obj/machinery/atmospherics/components/binary/crystallizer/proc/dump_gases()
- var/datum/gas_mixture/remove = internal.remove(internal.total_moles())
- airs[2].merge(remove)
- internal.garbage_collect()
-
-/obj/machinery/atmospherics/components/binary/crystallizer/process_atmos()
- if(!on || !is_operational || selected_recipe == null)
- return
-
- inject_gases()
-
- if(!internal.total_moles())
- return
-
- heat_conduction()
-
- if(internal_check())
- if(check_temp_requirements())
- heat_calculations()
- progress_bar = min(progress_bar + (MIN_PROGRESS_AMOUNT * 5 / (round(log(10, total_recipe_moles * 0.1), 0.01))), 100)
- else
- quality_loss = min(quality_loss + 0.5, 100)
- progress_bar = max(progress_bar - 1, 0)
- if(progress_bar != 100)
- update_parents()
- return
- progress_bar = 0
-
- for(var/gas_type in selected_recipe.requirements)
- var/amount_consumed = selected_recipe.requirements[gas_type] + quality_loss * 5
- if(internal.gases[gas_type][MOLES] < amount_consumed)
- quality_loss = min(quality_loss + 10, 100)
- internal.remove_specific(gas_type, amount_consumed)
-
- var/total_quality = clamp(50 - quality_loss, 0, 100)
- var/quality_control
- switch(total_quality)
- if(100)
- quality_control = "Masterwork"
- if(95 to 99)
- quality_control = "Supreme"
- if(75 to 94)
- quality_control = "Good"
- if(65 to 74)
- quality_control = "Decent"
- if(55 to 64)
- quality_control = "Average"
- if(35 to 54)
- quality_control = "Ok"
- if(15 to 34)
- quality_control = "Poor"
- if(5 to 14)
- quality_control = "Ugly"
- if(1 to 4)
- quality_control = "Cracked"
- if(0)
- quality_control = "Oh God why"
-
- for(var/path in selected_recipe.products)
- var/amount_produced = selected_recipe.products[path]
- for(var/i in 1 to amount_produced)
- var/obj/creation = new path(get_step(src, SOUTH))
- creation.name = "[quality_control] [creation.name]"
- if(selected_recipe.dangerous)
- investigate_log("has been created in the crystallizer.", INVESTIGATE_SUPERMATTER)
- message_admins("[src] has been created in the crystallizer [ADMIN_JMP(src)].")
-
-
- quality_loss = 0
- update_parents()
-
-/obj/machinery/atmospherics/components/binary/crystallizer/ui_interact(mob/user, datum/tgui/ui)
- ui = SStgui.try_update_ui(user, src, ui)
- if(!ui)
- ui = new(user, src, "Crystallizer", name)
- ui.open()
-
-/obj/machinery/atmospherics/components/binary/crystallizer/ui_static_data()
- var/data = list()
- data["selected_recipes"] = list(list("name" = "Nothing", "id" = ""))
- for(var/path in GLOB.gas_recipe_meta)
- var/datum/gas_recipe/recipe = GLOB.gas_recipe_meta[path]
- if(recipe.machine_type != "Crystallizer")
- continue
- data["selected_recipes"] += list(list("name" = recipe.name, "id" = recipe.id))
- return data
-
-/obj/machinery/atmospherics/components/binary/crystallizer/ui_data()
- var/data = list()
- data["on"] = on
-
- if(selected_recipe)
- data["selected"] = selected_recipe.id
- else
- data["selected"] = ""
-
- var/list/internal_gas_data = list()
- if(internal.total_moles())
- for(var/gasid in internal.gases)
- internal_gas_data.Add(list(list(
- "name"= internal.gases[gasid][GAS_META][META_GAS_NAME],
- "amount" = round(internal.gases[gasid][MOLES], 0.01),
- )))
- else
- for(var/gasid in internal.gases)
- internal_gas_data.Add(list(list(
- "name"= internal.gases[gasid][GAS_META][META_GAS_NAME],
- "amount" = 0,
- )))
- data["internal_gas_data"] = internal_gas_data
-
- var/list/requirements
- if(!selected_recipe)
- requirements = list("Select a recipe to see the requirements")
- 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 += "In a temperature range between [selected_recipe.min_temp] K and [selected_recipe.max_temp] K"
- requirements += "The crystallization reaction will be [selected_recipe.reaction_type]"
- data["requirements"] = requirements.Join("\n")
-
- var/temperature
- if(internal.total_moles())
- temperature = internal.temperature
- else
- temperature = 0
- data["internal_temperature"] = temperature
- data["progress_bar"] = progress_bar
- data["gas_input"] = gas_input
- return data
-
-/obj/machinery/atmospherics/components/binary/crystallizer/ui_act(action, params)
- . = ..()
- if(.)
- return
- switch(action)
- if("power")
- on = !on
- investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS)
- . = TRUE
- if("recipe")
- selected_recipe = null
- var/recipe_name = "nothing"
- var/datum/gas_recipe/recipe = GLOB.gas_recipe_meta[params["mode"]]
- if(internal.total_moles())
- dump_gases()
- quality_loss = 0
- progress_bar = 0
- if(recipe && recipe.id != "")
- selected_recipe = recipe
- recipe_name = recipe.name
- update_parents() //prevent the machine from stopping because of the recipe change and the pipenet not updating
- moles_calculations()
- investigate_log("was set to recipe [recipe_name ? recipe_name : "null"] by [key_name(usr)]", INVESTIGATE_ATMOS)
- . = TRUE
- if("gas_input")
- var/_gas_input = params["gas_input"]
- gas_input = clamp(_gas_input, 0, 250)
- update_icon()
-
-#undef MIN_PROGRESS_AMOUNT
-#undef MIN_DEVIATION_RATE
-#undef MAX_DEVIATION_RATE
-#undef HIGH_CONDUCTIVITY_RATIO
diff --git a/code/modules/atmospherics/machinery/components/tank.dm b/code/modules/atmospherics/machinery/components/tank.dm
deleted file mode 100644
index 51bb68b9489c4..0000000000000
--- a/code/modules/atmospherics/machinery/components/tank.dm
+++ /dev/null
@@ -1,553 +0,0 @@
-/obj/machinery/atmospherics/components/tank
- icon = 'icons/obj/atmospherics/stationary_canisters.dmi'
- icon_state = "smooth"
-
- name = "pressure tank"
- desc = "A large vessel containing pressurized gas."
-
- max_integrity = 800
- integrity_failure = 0.2
- density = TRUE
- layer = ABOVE_WINDOW_LAYER
-
- custom_materials = list(/datum/material/iron = 20000) // plasteel is not a material to prevent two bugs: one where the default pressure is 1.5 times higher as plasteel's material modifier is added, and a second one where the tank names could be "plasteel plasteel" tanks
- material_flags = MATERIAL_EFFECTS | MATERIAL_GREYSCALE | MATERIAL_ADD_PREFIX | MATERIAL_AFFECT_STATISTICS
-
- pipe_flags = PIPING_ONE_PER_TURF
- device_type = QUATERNARY
- initialize_directions = NONE
- custom_reconcilation = TRUE
-
- smoothing_flags = SMOOTH_CORNERS | SMOOTH_OBJ
- smoothing_groups = list(SMOOTH_GROUP_GAS_TANK)
- canSmoothWith = list(SMOOTH_GROUP_GAS_TANK)
- appearance_flags = KEEP_TOGETHER
-
- greyscale_config = /datum/greyscale_config/stationary_canister
- greyscale_colors = "#ffffff"
-
- ///The image showing the gases inside of the tank
- var/image/window
-
- /// The volume of the gas mixture
- var/volume = 2500 //in liters
- /// The max pressure of the gas mixture before damaging the tank
- var/max_pressure = 20000
- /// The typepath of the gas this tank should be filled with.
- var/gas_type = null
-
- ///Reference to the gas mix inside the tank
- var/datum/gas_mixture/air_contents
-
- /// The sounds that play when the tank is breaking from overpressure
- var/static/list/breaking_sounds = list(
- 'sound/effects/structure_stress/pop1.ogg',
- 'sound/effects/structure_stress/pop2.ogg',
- 'sound/effects/structure_stress/pop3.ogg',
- )
-
- /// Shared images for the knob overlay representing a side of the tank that is open to connections
- var/static/list/knob_overlays
-
- /// Number of crack states to fill the list with. This exists because I'm lazy and didn't want to keeping adding more things manually to the below list.
- var/crack_states_count = 10
- /// The icon states for the cracks in the tank dmi
- var/static/list/crack_states
-
- /// The merger id used to create/get the merger group in charge of handling tanks that share an internal gas storage
- var/merger_id = "stationary_tanks"
- /// The typecache of types which are allowed to merge internal storage
- var/static/list/merger_typecache
-
-/obj/machinery/atmospherics/components/tank/Initialize(mapload)
- . = ..()
-
- if(!knob_overlays)
- knob_overlays = list()
- for(var/dir in GLOB.cardinals)
- knob_overlays["[dir]"] = image('icons/obj/atmospherics/stationary_canisters.dmi', icon_state = "knob", dir = dir, layer = FLOAT_LAYER)
-
- if(!crack_states)
- crack_states = list()
- for(var/i in 1 to crack_states_count)
- crack_states += "crack[i]"
-
- if(!merger_typecache)
- merger_typecache = typecacheof(/obj/machinery/atmospherics/components/tank)
-
- AddComponent(/datum/component/gas_leaker, leak_rate = 0.05)
- AddElement(/datum/element/volatile_gas_storage)
- AddElement(/datum/element/crackable, 'icons/obj/atmospherics/stationary_canisters.dmi', crack_states)
-
- RegisterSignal(src, COMSIG_MERGER_ADDING, .proc/merger_adding)
- RegisterSignal(src, COMSIG_MERGER_REMOVING, .proc/merger_removing)
- RegisterSignal(src, COMSIG_ATOM_SMOOTHED_ICON, .proc/smoothed)
-
- air_contents = new
- air_contents.temperature = T20C
- air_contents.volume = volume
- refresh_pressure_limit()
-
- if(gas_type)
- fill_to_pressure(gas_type)
-
- QUEUE_SMOOTH(src)
- QUEUE_SMOOTH_NEIGHBORS(src)
-
- // Mapped in tanks should automatically connect to adjacent pipenets in the direction set in dir
- if(mapload)
- initialize_directions = dir
-
- return INITIALIZE_HINT_LATELOAD
-
-// We late initialize here so all stationary tanks have time to set up their
-// initial gas mixes and signal registrations.
-/obj/machinery/atmospherics/components/tank/LateInitialize()
- . = ..()
- GetMergeGroup(merger_id, merger_typecache)
-
-/obj/machinery/atmospherics/components/tank/Destroy()
- QUEUE_SMOOTH_NEIGHBORS(src)
- return ..()
-
-/obj/machinery/atmospherics/components/tank/examine(mob/user, thats)
- . = ..()
- var/wrench_hint = EXAMINE_HINT("wrench")
- if(!initialize_directions)
- . += span_notice("A pipe port can be opened with a [wrench_hint].")
- else
- . += span_notice("The pipe port can be moved or closed with a [wrench_hint].")
- . += span_notice("A holographic sticker on it says that its maximum safe pressure is: [siunit_pressure(max_pressure, 0)].")
-
-/obj/machinery/atmospherics/components/tank/set_custom_materials(list/materials, multiplier)
- . = ..()
- refresh_pressure_limit()
-
-/// Recalculates pressure based on the current max integrity compared to original
-/obj/machinery/atmospherics/components/tank/proc/refresh_pressure_limit()
- var/max_pressure_multiplier = max_integrity / initial(max_integrity)
- max_pressure = max_pressure_multiplier * initial(max_pressure)
-
-/// Fills the tank to the maximum safe pressure.
-/// Safety margin is a multiplier for the cap for the purpose of this proc so it doesn't have to be filled completely.
-/obj/machinery/atmospherics/components/tank/proc/fill_to_pressure(gastype, safety_margin = 0.5)
- var/pressure_limit = max_pressure * safety_margin
-
- var/moles_to_add = (pressure_limit * air_contents.volume) / (R_IDEAL_GAS_EQUATION * air_contents.temperature)
- air_contents.assert_gas(gastype)
- air_contents.gases[gastype][MOLES] += moles_to_add
- air_contents.archive()
-
-/obj/machinery/atmospherics/components/tank/process_atmos()
- if(air_contents.react(src))
- update_parents()
-
- if(air_contents.return_pressure() > max_pressure)
- take_damage(0.1, BRUTE, sound_effect = FALSE)
- if(prob(40))
- playsound(src, pick(breaking_sounds), 30, vary = TRUE)
-
- refresh_window()
-
-///////////////////////////////////////////////////////////////////
-// Pipenet stuff
-
-/obj/machinery/atmospherics/components/tank/return_analyzable_air()
- return air_contents
-
-/obj/machinery/atmospherics/components/tank/return_airs_for_reconcilation(datum/pipeline/requester)
- . = ..()
- if(!air_contents)
- return
- . += air_contents
-
-/obj/machinery/atmospherics/components/tank/return_pipenets_for_reconcilation(datum/pipeline/requester)
- . = ..()
- var/datum/merger/merge_group = GetMergeGroup(merger_id, merger_typecache)
- for(var/obj/machinery/atmospherics/components/tank/tank as anything in merge_group.members)
- . += tank.parents
-
-/obj/machinery/atmospherics/components/tank/proc/toggle_side_port(new_dir)
- if(initialize_directions & new_dir)
- initialize_directions &= ~new_dir
- else
- initialize_directions |= new_dir
-
- for(var/i in 1 to length(nodes))
- var/obj/machinery/atmospherics/components/node = nodes[i]
- if(!node)
- continue
- if(src in node.nodes)
- node.disconnect(src)
- nodes[i] = null
- if(parents[i])
- nullify_pipenet(parents[i])
-
- atmos_init()
-
- for(var/obj/machinery/atmospherics/components/node as anything in nodes)
- if(!node)
- continue
- node.atmos_init()
- node.add_member(src)
- SSair.add_to_rebuild_queue(src)
-
- update_parents()
-
-///////////////////////////////////////////////////////////////////
-// Merger handling
-
-/obj/machinery/atmospherics/components/tank/proc/merger_adding(obj/machinery/atmospherics/components/tank/us, datum/merger/new_merger)
- SIGNAL_HANDLER
- if(new_merger.id != merger_id)
- return
- RegisterSignal(new_merger, COMSIG_MERGER_REFRESH_COMPLETE, .proc/merger_refresh_complete)
-
-/obj/machinery/atmospherics/components/tank/proc/merger_removing(obj/machinery/atmospherics/components/tank/us, datum/merger/old_merger)
- SIGNAL_HANDLER
- if(old_merger.id != merger_id)
- return
- UnregisterSignal(old_merger, COMSIG_MERGER_REFRESH_COMPLETE)
-
-/// Handles the combined gas tank for the entire merger group, only the origin tank actualy runs this.
-/obj/machinery/atmospherics/components/tank/proc/merger_refresh_complete(datum/merger/merger, list/leaving_members, list/joining_members)
- SIGNAL_HANDLER
- if(merger.origin != src)
- return
- var/shares = length(merger.members) + length(leaving_members) - length(joining_members)
- for(var/obj/machinery/atmospherics/components/tank/leaver as anything in leaving_members)
- var/datum/gas_mixture/gas_share = air_contents.remove_ratio(1 / shares--)
- air_contents.volume -= leaver.volume
- leaver.air_contents = gas_share
- leaver.update_appearance()
-
- for(var/obj/machinery/atmospherics/components/tank/joiner as anything in joining_members)
- if(joiner == src)
- continue
- var/datum/gas_mixture/joiner_share = joiner.air_contents
- if(joiner_share)
- air_contents.merge(joiner_share)
- joiner.air_contents = air_contents
- air_contents.volume += joiner.volume
- joiner.update_appearance()
-
- for(var/dir in GLOB.cardinals)
- if(dir & initialize_directions & merger.members[src])
- toggle_side_port(dir)
-
-///////////////////////////////////////////////////////////////////
-// Appearance stuff
-
-/obj/machinery/atmospherics/components/tank/proc/smoothed()
- SIGNAL_HANDLER
- refresh_window()
-
-/obj/machinery/atmospherics/components/tank/update_appearance()
- . = ..()
- refresh_window()
-
-/obj/machinery/atmospherics/components/tank/update_overlays()
- . = ..()
- if(!initialize_directions)
- return
- for(var/dir in GLOB.cardinals)
- if(initialize_directions & dir)
- . += knob_overlays["[dir]"]
-
-/obj/machinery/atmospherics/components/tank/update_greyscale()
- . = ..()
- refresh_window()
-
-/obj/machinery/atmospherics/components/tank/proc/refresh_window()
- cut_overlay(window)
-
- if(!air_contents)
- window = null
- return
-
- window = image(icon, icon_state = "window-bg", layer = FLOAT_LAYER)
-
- var/list/new_underlays = list()
- for(var/obj/effect/overlay/gas/gas as anything in air_contents.return_visuals())
- var/image/new_underlay = image(gas.icon, icon_state = gas.icon_state, layer = FLOAT_LAYER)
- new_underlay.filters = alpha_mask_filter(icon = icon(icon, icon_state = "window-bg"))
- new_underlays += new_underlay
-
- var/image/foreground = image(icon, icon_state = "window-fg", layer = FLOAT_LAYER)
- foreground.underlays = new_underlays
- window.overlays = list(foreground)
-
- add_overlay(window)
-
-///////////////////////////////////////////////////////////////////
-// Tool interactions
-
-/obj/machinery/atmospherics/components/tank/wrench_act(mob/living/user, obj/item/item)
- . = TRUE
- var/new_dir = get_dir(src, user)
-
- if(new_dir in GLOB.diagonals)
- return
-
- item.play_tool_sound(src, 10)
- if(!item.use_tool(src, user, 3 SECONDS))
- return
-
- toggle_side_port(new_dir)
-
- item.play_tool_sound(src, 50)
-
-/obj/machinery/atmospherics/components/tank/welder_act(mob/living/user, obj/item/tool)
- . = ..()
- . = TRUE
- if(atom_integrity >= max_integrity)
- return
- if(!tool.tool_start_check(user, amount = 0))
- return
- to_chat(user, span_notice("You begin to repair the cracks in the gas tank..."))
- var/repair_amount = max_integrity / 10
- do
- if(!tool.use_tool(src, user, 2.5 SECONDS, volume = 40))
- return
- while(repair_damage(repair_amount))
- to_chat(user, span_notice("The gas tank has been fully repaired and all cracks sealed."))
-
-/obj/machinery/atmospherics/components/tank/welder_act_secondary(mob/living/user, obj/item/tool)
- . = ..()
- . = TRUE
- to_chat(user, span_notice("You begin cutting open the gas tank..."))
- var/turf/current_location = get_turf(src)
- var/datum/gas_mixture/airmix = current_location.return_air()
-
- var/time_taken = 4 SECONDS
-
- if(air_contents.return_pressure() > airmix.return_pressure())
- time_taken *= 2
- to_chat(user, span_warning("The tank seems to be pressurized, are you sure this is a good idea?"))
-
- if(!tool.use_tool(src, user, time_taken, volume = 60))
- return
-
- deconstruct(disassembled=TRUE)
- to_chat(user, span_notice("You finish cutting open the sealed gas tank, revealing the innards."))
-
-/obj/machinery/atmospherics/components/tank/deconstruct(disassembled)
- var/turf/location = drop_location()
- . = ..()
- if(!disassembled)
- return
- var/obj/structure/tank_frame/frame = new(location)
- frame.construction_state = TANK_PLATING_UNSECURED
- frame.material_end_product = custom_materials[2].type
- frame.update_appearance()
-
-///////////////////////////////////////////////////////////////////
-// Gas tank variants
-
-/obj/machinery/atmospherics/components/tank/air
- name = "pressure tank (Air)"
-
-/obj/machinery/atmospherics/components/tank/air/Initialize(mapload)
- . = ..()
- fill_to_pressure(/datum/gas/oxygen, safety_margin = (O2STANDARD * 0.5))
- fill_to_pressure(/datum/gas/nitrogen, safety_margin = (N2STANDARD * 0.5))
-
-/obj/machinery/atmospherics/components/tank/carbon_dioxide
- gas_type = /datum/gas/carbon_dioxide
-
-/obj/machinery/atmospherics/components/tank/plasma
- gas_type = /datum/gas/plasma
-
-/obj/machinery/atmospherics/components/tank/nitrogen
- gas_type = /datum/gas/nitrogen
-
-/obj/machinery/atmospherics/components/tank/oxygen
- gas_type = /datum/gas/oxygen
-
-/obj/machinery/atmospherics/components/tank/nitrous
- gas_type = /datum/gas/nitrous_oxide
-
-/obj/machinery/atmospherics/components/tank/bz
- gas_type = /datum/gas/bz
-
-/obj/machinery/atmospherics/components/tank/freon
- gas_type = /datum/gas/freon
-
-/obj/machinery/atmospherics/components/tank/halon
- gas_type = /datum/gas/halon
-
-/obj/machinery/atmospherics/components/tank/healium
- gas_type = /datum/gas/healium
-
-/obj/machinery/atmospherics/components/tank/hydrogen
- gas_type = /datum/gas/hydrogen
-
-/obj/machinery/atmospherics/components/tank/hypernoblium
- gas_type = /datum/gas/hypernoblium
-
-/obj/machinery/atmospherics/components/tank/miasma
- gas_type = /datum/gas/miasma
-
-/obj/machinery/atmospherics/components/tank/nitryl
- gas_type = /datum/gas/nitryl
-
-/obj/machinery/atmospherics/components/tank/pluoxium
- gas_type = /datum/gas/pluoxium
-
-/obj/machinery/atmospherics/components/tank/proto_nitrate
- gas_type = /datum/gas/proto_nitrate
-
-/obj/machinery/atmospherics/components/tank/stimulum
- gas_type = /datum/gas/stimulum
-
-/obj/machinery/atmospherics/components/tank/tritium
- gas_type = /datum/gas/tritium
-
-/obj/machinery/atmospherics/components/tank/water_vapor
- gas_type = /datum/gas/water_vapor
-
-/obj/machinery/atmospherics/components/tank/zauker
- gas_type = /datum/gas/zauker
-
-/obj/machinery/atmospherics/components/tank/helium
- gas_type = /datum/gas/helium
-
-/obj/machinery/atmospherics/components/tank/antinoblium
- gas_type = /datum/gas/antinoblium
-
-///////////////////////////////////////////////////////////////////
-// Tank Frame Structure
-
-/obj/structure/tank_frame
- icon = 'icons/obj/atmospherics/stationary_canisters.dmi'
- icon_state = "frame"
- anchored = FALSE
- density = TRUE
- custom_materials = list(/datum/material/alloy/plasteel = 4000)
- var/construction_state = TANK_FRAME
- var/datum/material/material_end_product
-
-/obj/structure/tank_frame/examine(mob/user)
- . = ..()
- var/wrenched_hint = EXAMINE_HINT("wrenched")
-
- if(!anchored)
- . += span_notice("[src] has not been [wrenched_hint] to the floor yet.")
- else
- . += span_notice("[src] is [wrenched_hint] to the floor.")
-
- switch(construction_state)
- if(TANK_FRAME)
- var/screwed_hint = EXAMINE_HINT("screwed")
- var/plating_hint = EXAMINE_HINT("metal plating")
- . += span_notice("[src] is [screwed_hint] together and now just needs some [plating_hint].")
- if(TANK_PLATING_UNSECURED)
- var/crowbar_hint = EXAMINE_HINT("crowbar")
- var/welder_hint = EXAMINE_HINT("welder")
- . += span_notice("The plating has been firmly attached and would need a [crowbar_hint] to detach, but still needs to be sealed by a [welder_hint].")
-
-/obj/structure/tank_frame/deconstruct(disassembled)
- if(disassembled)
- for(var/datum/material/mat as anything in custom_materials)
- new mat.sheet_type(drop_location())
- return ..()
-
-/obj/structure/tank_frame/update_icon(updates)
- . = ..()
- switch(construction_state)
- if(TANK_FRAME)
- icon_state = "frame"
- if(TANK_PLATING_UNSECURED)
- icon_state = "plated_frame"
-
-/obj/structure/tank_frame/attackby(obj/item/item, mob/living/user, params)
- if(construction_state == TANK_FRAME && istype(item, /obj/item/stack) && add_plating(user, item))
- return
- return ..()
-
-/obj/structure/tank_frame/wrench_act(mob/living/user, obj/item/tool)
- . = ..()
- return default_unfasten_wrench(user, tool, 0.5 SECONDS)
-
-/obj/structure/tank_frame/screwdriver_act_secondary(mob/living/user, obj/item/tool)
- . = ..()
- if(construction_state != TANK_FRAME)
- return
- . = TRUE
- to_chat(user, span_notice("You begin taking apart [src]."))
- if(!tool.use_tool(src, user, 1 SECONDS))
- return
- deconstruct(TRUE)
- to_chat(user, span_notice("[src] has been taken apart."))
-
-/obj/structure/tank_frame/proc/add_plating(mob/living/user, obj/item/stack/stack)
- . = FALSE
- var/datum/material/stack_mat = GET_MATERIAL_REF(stack.material_type)
- if(!(MAT_CATEGORY_RIGID in stack_mat.categories))
- to_chat(user, span_notice("This material doesn't seem rigid enough to hold the shape of a tank..."))
- return
-
- . = TRUE
- to_chat(user, span_notice("You begin adding [stack] to [src]..."))
- if(!stack.use_tool(src, user, 3 SECONDS))
- return
- if(!stack.use(20))
- var/amount_more
- switch(stack.amount)
- if(0) // Wat?
- amount_more = "any at all"
- if(1 to 4)
- amount_more = "a lot more"
- if(5 to 9)
- amount_more = "about four times as much"
- if(10 to 15)
- amount_more = "about twice as much"
- if(16 to 20)
- amount_more = "just a bit more"
- else
- amount_more = "an indeterminate amount more"
- to_chat(user, span_notice("You don't have enough [stack] to add all the plating. Maybe [amount_more]."))
- return
-
- material_end_product = stack_mat
- construction_state = TANK_PLATING_UNSECURED
- update_appearance()
- to_chat(user, span_notice("You finish attaching [stack] to [src]."))
-
-/obj/structure/tank_frame/crowbar_act_secondary(mob/living/user, obj/item/tool)
- . = ..()
- if(construction_state != TANK_PLATING_UNSECURED)
- return
- . = TRUE
- to_chat(user, span_notice("You start prying off the outer plating..."))
- if(!tool.use_tool(src, user, 2 SECONDS))
- return
- construction_state = TANK_FRAME
- new material_end_product.sheet_type(drop_location(), 20)
- material_end_product = null
- update_appearance()
-
-/obj/structure/tank_frame/welder_act(mob/living/user, obj/item/tool)
- . = ..()
- if(construction_state != TANK_PLATING_UNSECURED)
- return
- . = TRUE
- if(!anchored)
- to_chat(user, span_notice("You need to wrench [src] to the floor before finishing."))
- return
- if(!tool.tool_start_check(user, amount = 0))
- return
- to_chat(user, span_notice("You begin sealing the outer plating with the welder..."))
- if(!tool.use_tool(src, user, 2 SECONDS, volume = 60))
- return
-
- var/turf/build_location = drop_location()
- if(!isturf(build_location))
- return
- var/obj/machinery/atmospherics/components/tank/new_tank = new(build_location)
- var/list/new_custom_materials = list()
- new_custom_materials[material_end_product] = 20000
- new_tank.set_custom_materials(new_custom_materials)
- new_tank.on_construction(new_tank.pipe_color, new_tank.piping_layer)
- to_chat(user, span_notice("[new_tank] has been sealed and is ready to accept gases."))
- qdel(src)
diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
index ade69b0de301c..f703a90024ddd 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
@@ -6,18 +6,15 @@
desc = "Very useful for filtering gasses."
can_unwrench = TRUE
- construction_type = /obj/item/pipe/trinary/flippable
- pipe_state = "filter"
-
- ///Rate of transfer of the gases to the outputs
var/transfer_rate = MAX_TRANSFER_RATE
- ///What gas are we filtering
var/filter_type = null
- ///Frequency id for connecting to the NTNet
var/frequency = 0
- ///Reference to the radio datum
var/datum/radio_frequency/radio_connection
+ construction_type = /obj/item/pipe/trinary/flippable
+ pipe_state = "filter"
+
+
/obj/machinery/atmospherics/components/trinary/filter/CtrlClick(mob/user)
if(can_interact(user))
on = !on
@@ -50,7 +47,15 @@
continue
var/obj/machinery/atmospherics/node = find_connecting(direction)
- . += get_pipe_image(icon, "cap", direction, pipe_color, piping_layer, TRUE)
+ var/image/cap
+ if(node)
+ cap = get_pipe_image(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer, trinary = TRUE)
+ else
+ cap = get_pipe_image(icon, "cap", direction, piping_layer = piping_layer, trinary = TRUE)
+
+ add_overlay(cap)
+
+ return ..()
/obj/machinery/atmospherics/components/trinary/filter/update_icon_nopipes()
var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational
diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
index e8c0f05e0e77b..ae1e1c63d25f8 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/mixer.dm
@@ -6,15 +6,17 @@
desc = "Very useful for mixing gasses."
can_unwrench = TRUE
- construction_type = /obj/item/pipe/trinary/flippable
- pipe_state = "mixer"
- ///Output pressure target
var/target_pressure = ONE_ATMOSPHERE
- ///Ratio between the node 1 and 2, determines the amount of gas transfered, sums up to 1
var/node1_concentration = 0.5
- ///Ratio between the node 1 and 2, determines the amount of gas transfered, sums up to 1
var/node2_concentration = 0.5
+
+ construction_type = /obj/item/pipe/trinary/flippable
+ pipe_state = "mixer"
+
+
+
+
//node 3 is the outlet, nodes 1 & 2 are intakes
/obj/machinery/atmospherics/components/trinary/mixer/CtrlClick(mob/user)
@@ -39,7 +41,15 @@
continue
var/obj/machinery/atmospherics/node = find_connecting(direction)
- . += get_pipe_image(icon, "cap", direction, pipe_color, piping_layer, TRUE)
+ var/image/cap
+ if(node)
+ cap = get_pipe_image(icon, "cap", direction, node.pipe_color, piping_layer = piping_layer, trinary = TRUE)
+ else
+ cap = get_pipe_image(icon, "cap", direction, piping_layer = piping_layer, trinary = TRUE)
+
+ add_overlay(cap)
+
+ return ..()
/obj/machinery/atmospherics/components/trinary/mixer/update_icon_nopipes()
var/on_state = on && nodes[1] && nodes[2] && nodes[3] && is_operational
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 35afd91778fec..d96b7244eb47d 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/trinary_devices.dm
@@ -7,7 +7,6 @@
layer = GAS_FILTER_LAYER
pipe_flags = PIPING_ONE_PER_TURF
- ///Flips the node connections so that the first and third ports are swapped
var/flipped = FALSE
/obj/machinery/atmospherics/components/trinary/set_init_directions()
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/bluespace_sender.dm b/code/modules/atmospherics/machinery/components/unary_devices/bluespace_sender.dm
deleted file mode 100644
index ba88a1edc4c8d..0000000000000
--- a/code/modules/atmospherics/machinery/components/unary_devices/bluespace_sender.dm
+++ /dev/null
@@ -1,178 +0,0 @@
-/obj/machinery/atmospherics/components/unary/bluespace_sender
- icon = 'icons/obj/atmospherics/components/bluespace_gas_selling.dmi'
- icon_state = "bluespace_sender_off"
- name = "Bluespace Gas Sender"
- desc = "Sends gases to the bluespace network to be shared with the connected vendors, who knows what's beyond!"
-
- density = TRUE
- max_integrity = 300
- armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 100, BOMB = 0, BIO = 100, RAD = 100, FIRE = 80, ACID = 30)
- layer = OBJ_LAYER
- circuit = /obj/item/circuitboard/machine/bluespace_sender
- pipe_flags = PIPING_ONE_PER_TURF | PIPING_DEFAULT_LAYER_ONLY
-
- ///Base icon name for updating the appearance
- var/base_icon = "bluespace_sender"
- ///Gas mixture containing the inserted gases and that is connected to the vendors
- var/datum/gas_mixture/bluespace_network
- ///Rate of gas transfer inside the network (from 0 to 1)
- var/gas_transfer_rate = 0.5
- ///A base price for each and every gases, in case you don't want to change them
- var/list/base_prices = list()
- ///List storing all the vendors connected to the machine
- var/list/vendors
- ///Amount of credits gained from each vendor
- var/credits_gained = 0
-
-/obj/machinery/atmospherics/components/unary/bluespace_sender/Initialize(mapload)
- . = ..()
- initialize_directions = dir
- bluespace_network = new
- for(var/gas_id in GLOB.meta_gas_info)
- bluespace_network.assert_gas(gas_id)
- for(var/gas_id in GLOB.meta_gas_info)
- var/datum/gas/gas = gas_id
- base_prices[gas_id] = initial(gas.base_value)
-
- update_appearance()
-
-/obj/machinery/atmospherics/components/unary/bluespace_sender/Destroy()
- if(bluespace_network.total_moles())
- var/turf/local_turf = get_turf(src)
- local_turf.assume_air(bluespace_network)
- return ..()
-
-/obj/machinery/atmospherics/components/unary/bluespace_sender/update_icon_state()
- if(panel_open)
- icon_state = "[base_icon]_open"
- return ..()
- if(on && is_operational)
- icon_state = "[base_icon]_on"
- return ..()
- icon_state = "[base_icon]_off"
- return ..()
-
-/obj/machinery/atmospherics/components/unary/bluespace_sender/update_overlays()
- . = ..()
- . += get_pipe_image(icon, "pipe", dir, , piping_layer)
- if(showpipe)
- . += get_pipe_image(icon, "pipe", initialize_directions)
-
-/obj/machinery/atmospherics/components/unary/bluespace_sender/process_atmos()
- if(!is_operational || !on || !nodes[1]) //if it has no power or its switched off, dont process atmos
- return
-
- var/datum/gas_mixture/content = airs[1]
- var/datum/gas_mixture/remove = content.remove_ratio(gas_transfer_rate)
- bluespace_network.merge(remove)
- bluespace_network.temperature = T20C
- update_parents()
-
-/obj/machinery/atmospherics/components/unary/bluespace_sender/attackby(obj/item/item, mob/user, params)
- if(!on)
- if(default_deconstruction_screwdriver(user, "[base_icon]_open", "[base_icon]_off", item))
- update_appearance()
- return
- if(default_change_direction_wrench(user, item))
- return
- if(item.tool_behaviour == TOOL_CROWBAR && panel_open && bluespace_network.total_moles() > 0)
- say("WARNING - Bluespace network can contain hazardous gases, deconstruct with caution!")
- if(!do_after(user, 3 SECONDS, src))
- return
- if(default_deconstruction_crowbar(item))
- return
- return ..()
-
-/obj/machinery/atmospherics/components/unary/bluespace_sender/default_change_direction_wrench(mob/user, obj/item/item)
- if(!..())
- return FALSE
- set_init_directions()
- 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])
- nullify_pipenet(parents[1])
-
- atmos_init()
- node = nodes[1]
- if(node)
- node.atmos_init()
- node.add_member(src)
- SSair.add_to_rebuild_queue(src)
- return TRUE
-
-/obj/machinery/atmospherics/components/unary/bluespace_sender/multitool_act(mob/living/user, obj/item/item)
- var/obj/item/multitool/multitool = item
- multitool.buffer = src
- to_chat(user, span_notice("You store linkage information in [item]'s buffer."))
- return TRUE
-
-/obj/machinery/atmospherics/components/unary/bluespace_sender/ui_interact(mob/user, datum/tgui/ui)
- ui = SStgui.try_update_ui(user, src, ui)
- if(!ui)
- ui = new(user, src, "BluespaceSender", name)
- ui.open()
-
-/obj/machinery/atmospherics/components/unary/bluespace_sender/ui_data(mob/user)
- var/list/data = list()
- data["on"] = on
- data["gas_transfer_rate"] = gas_transfer_rate
- var/list/bluespace_gasdata = list()
- if(bluespace_network.total_moles())
- for(var/gas_id in bluespace_network.gases)
- bluespace_gasdata.Add(list(list(
- "name" = bluespace_network.gases[gas_id][GAS_META][META_GAS_NAME],
- "id" = bluespace_network.gases[gas_id][GAS_META][META_GAS_ID],
- "amount" = round(bluespace_network.gases[gas_id][MOLES], 0.01),
- "price" = base_prices[gas_id],
- )))
- else
- for(var/gas_id in bluespace_network.gases)
- bluespace_gasdata.Add(list(list(
- "name" = bluespace_network.gases[gas_id][GAS_META][META_GAS_NAME],
- "id" = "",
- "amount" = 0,
- "price" = 0,
- )))
- data["bluespace_network_gases"] = bluespace_gasdata
- var/list/vendors_list = list()
- if(vendors)
- for(var/obj/machinery/bluespace_vendor/vendor in vendors)
- vendors_list.Add(list(list(
- "name" = vendor.name,
- "area" = get_area(vendor),
- )))
- data["vendors_list"] = vendors_list
- data["credits"] = credits_gained
- return data
-
-/obj/machinery/atmospherics/components/unary/bluespace_sender/ui_act(action, params)
- . = ..()
- if(.)
- return
-
- switch(action)
- if("power")
- on = !on
- investigate_log("was turned [on ? "on" : "off"] by [key_name(usr)]", INVESTIGATE_ATMOS)
- update_appearance()
- . = TRUE
-
- if("rate")
- gas_transfer_rate = clamp(params["rate"], 0, 1)
- . = TRUE
-
- if("price")
- var/gas_type = gas_id2path(params["gas_type"])
- base_prices[gas_type] = clamp(params["gas_price"], 0, 100)
- . = TRUE
-
- if("retrieve")
- if(bluespace_network.total_moles() > 0)
- var/datum/gas_mixture/remove = bluespace_network.remove(bluespace_network.total_moles())
- airs[1].merge(remove)
- update_parents()
- bluespace_network.garbage_collect()
- . = TRUE
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
index 131a77a7be70d..da1af112e4539 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
@@ -473,9 +473,7 @@
if(node)
node.disconnect(src)
nodes[1] = null
- if(parents[1])
- nullify_pipenet(parents[1])
-
+ nullifyPipenet(parents[1])
atmos_init()
node = nodes[1]
if(node)
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 3e74715fb3399..5068730358e5d 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/heat_exchanger.dm
@@ -44,9 +44,10 @@
target.partner_ref = WEAKREF(src)
break
- . = ..()
+ ..()
/obj/machinery/atmospherics/components/unary/heat_exchanger/process_atmos()
+ ..()
var/obj/machinery/atmospherics/components/unary/heat_exchanger/partner = partner_ref?.resolve()
if(!partner)
partner_ref = null
@@ -68,14 +69,14 @@
var/other_old_temperature = partner_air_contents.return_temperature()
if(combined_heat_capacity > 0)
- var/combined_energy = partnerair_contents.temperature * other_air_heat_capacity + air_heat_capacity * air_contents.temperature
+ var/combined_energy = partner_air_contents.return_temperature()*other_air_heat_capacity + air_heat_capacity*air_contents.return_temperature()
- var/new_temperature = combined_energy / combined_heat_capacity
- air_contents.temperature = new_temperature
- partnerair_contents.temperature = new_temperature
+ var/new_temperature = combined_energy/combined_heat_capacity
+ air_contents.temperature = (new_temperature)
+ partner_air_contents.temperature = (new_temperature)
- if(abs(old_temperature - air_contents.temperature) > 1)
+ if(abs(old_temperature-air_contents.return_temperature()) > 1)
update_parents()
- if(abs(other_old_temperature - partnerair_contents.temperature) > 1)
+ if(abs(other_old_temperature-partner_air_contents.return_temperature()) > 1)
partner.update_parents()
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 712876b51c992..b17de0ebc83b1 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/outlet_injector.dm
@@ -8,18 +8,15 @@
can_unwrench = TRUE
shift_underlay_only = FALSE
hide = TRUE
- layer = GAS_SCRUBBER_LAYER
- pipe_state = "injector"
+
resistance_flags = FIRE_PROOF | UNACIDABLE | ACID_PROOF //really helpful in building gas chambers for xenomorphs
- ///Variable used for radio frequency injection
- var/injecting = FALSE
- ///Rate of operation of the device
+ var/injecting = 0
+
var/volume_rate = 50
- ///Frequency id for connecting to the NTNet
var/frequency = 0
- ///Reference to the radio datum
+ var/id = null
var/datum/radio_frequency/radio_connection
interacts_with_air = TRUE
@@ -53,7 +50,7 @@
cut_overlays()
if(showpipe)
// everything is already shifted so don't shift the cap
- add_overlay(get_pipe_image(icon, "inje_cap", initialize_directions, pipe_color))
+ add_overlay(get_pipe_image(icon, "inje_cap", initialize_directions))
if(!nodes[1] || !on || !is_operational)
icon_state = "inje_off"
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 3853d3f46e2c3..a07c6b078d8a9 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/passive_vent.dm
@@ -15,7 +15,7 @@
/obj/machinery/atmospherics/components/unary/passive_vent/update_icon_nopipes()
cut_overlays()
if(showpipe)
- var/image/cap = get_pipe_image(icon, "vent_cap", initialize_directions, pipe_color)
+ var/image/cap = get_pipe_image(icon, "vent_cap", initialize_directions)
add_overlay(cap)
icon_state = "passive_vent"
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 5241577d7ab9d..3a49035d50cc9 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm
@@ -14,13 +14,12 @@
pipe_flags = PIPING_ONE_PER_TURF
pipe_state = "connector"
- ///Reference to the connected device
var/obj/machinery/portable_atmospherics/connected_device
var/obj/machinery/atmospherics/components/unary/portables_connector/connect_to
/obj/machinery/atmospherics/components/unary/portables_connector/New()
- . = ..()
+ ..()
var/datum/gas_mixture/air_contents = airs[1]
air_contents.volume = 0
@@ -32,8 +31,7 @@
/obj/machinery/atmospherics/components/unary/portables_connector/update_icon_nopipes()
icon_state = "connector"
if(showpipe)
- cut_overlays()
- var/image/cap = get_pipe_image(icon, "connector_cap", initialize_directions, pipe_color)
+ var/image/cap = get_pipe_image(icon, "connector_cap", initialize_directions)
add_overlay(cap)
/obj/machinery/atmospherics/components/unary/portables_connector/process_atmos()
@@ -41,12 +39,6 @@
return
update_parents()
-/obj/machinery/atmospherics/components/unary/portables_connector/return_airs_for_reconcilation(datum/pipeline/requester)
- . = ..()
- if(!connected_device)
- return
- . += connected_device.return_air()
-
/obj/machinery/atmospherics/components/unary/portables_connector/can_unwrench(mob/user)
. = ..()
if(. && connected_device)
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 51c5ef23f1157..b2956b70067ba 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/unary_devices.dm
@@ -5,9 +5,7 @@
device_type = UNARY
pipe_flags = PIPING_ONE_PER_TURF
construction_type = /obj/item/pipe/directional
- ///Unique id of the device
var/uid
- ///Increases to prevent duplicated Ids
var/static/gl_uid = 1
FASTDMM_PROP(\
pipe_type = PIPE_TYPE_NODE,\
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 8d3efbeebeac5..c32fd4d7cafa3 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_pump.dm
@@ -21,27 +21,22 @@
interacts_with_air = TRUE
- ///Direction of pumping the gas (RELEASING or SIPHONING)
var/pump_direction = RELEASING
- ///Should we check internal pressure, external pressure, both or none? (EXT_BOUND, INT_BOUND, NO_BOUND)
+
var/pressure_checks = EXT_BOUND
- ///The external pressure threshold (default 101 kPa)
var/external_pressure_bound = ONE_ATMOSPHERE
- ///The internal pressure threshold (default 0 kPa)
var/internal_pressure_bound = 0
// EXT_BOUND: Do not pass external_pressure_bound
// INT_BOUND: Do not pass internal_pressure_bound
// NO_BOUND: Do not pass either
- ///Frequency id for connecting to the NTNet
var/frequency = FREQ_ATMOS_CONTROL
- ///Reference to the radio datum
var/datum/radio_frequency/radio_connection
- ///Radio connection to the air alarm
var/radio_filter_out
- ///Radio connection from the air alarm
var/radio_filter_in
+ var/obj/machinery/advanced_airlock_controller/aac = null
+
/obj/machinery/atmospherics/components/unary/vent_pump/New()
if(!id_tag)
id_tag = id_tag = SSnetworks.assign_random_name()
@@ -122,9 +117,8 @@
pressure_delta = min(pressure_delta, (air_contents.return_pressure() - internal_pressure_bound))
if(pressure_delta > 0)
- if(air_contents.temperature > 0)
- var/transfer_moles = (pressure_delta * environment.volume) / (air_contents.temperature * R_IDEAL_GAS_EQUATION)
- var/datum/gas_mixture/removed = air_contents.remove(transfer_moles)
+ if(air_contents.return_temperature() > 0 && air_contents.return_volume() > 0)
+ var/transfer_moles = (pressure_delta*environment.return_volume())/(air_contents.return_temperature() * R_IDEAL_GAS_EQUATION)
loc.assume_air_moles(air_contents, transfer_moles)
air_update_turf(FALSE, FALSE)
@@ -258,12 +252,11 @@
broadcast_status()
update_icon()
-/obj/machinery/atmospherics/components/unary/vent_pump/welder_act(mob/living/user, obj/item/welder)
- ..()
- if(!welder.tool_start_check(user, amount=0))
+/obj/machinery/atmospherics/components/unary/vent_pump/welder_act(mob/living/user, obj/item/I)
+ if(!I.tool_start_check(user, amount=0))
return TRUE
- to_chat(user, span_notice("You begin welding the vent..."))
- if(welder.use_tool(src, user, 20, volume=50))
+ to_chat(user, "You begin welding the vent...")
+ if(I.use_tool(src, user, 20, volume=50))
if(!welded)
user.visible_message("[user] welds the vent shut.", "You weld the vent shut.", "You hear welding.")
welded = TRUE
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 958561010087c..d9ac9e9dd75a9 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
@@ -31,26 +31,6 @@
pipe_state = "scrubber"
- ///The mode of the scrubber (SCRUBBING or SIPHONING)
- var/scrubbing = SCRUBBING //0 = siphoning, 1 = scrubbing
- ///The list of gases we are filtering
- var/filter_types = list(/datum/gas/carbon_dioxide)
- ///Rate of the scrubber to remove gases from the air
- var/volume_rate = 200
- ///is this scrubber acting on the 3x3 area around it.
- var/widenet = FALSE
- ///List of the turfs near the scrubber, used for widenet
- var/list/turf/adjacent_turfs = list()
-
- ///Frequency id for connecting to the NTNet
- var/frequency = FREQ_ATMOS_CONTROL
- ///Reference to the radio datum
- var/datum/radio_frequency/radio_connection
- ///Radio connection to the air alarm
- var/radio_filter_out
- ///Radio connection from the air alarm
- var/radio_filter_in
-
/obj/machinery/atmospherics/components/unary/vent_scrubber/New()
if(!id_tag)
id_tag = SSnetworks.assign_random_name()
@@ -142,19 +122,14 @@
return TRUE
-/obj/machinery/atmospherics/components/unary/vent_scrubber/update_name()
- . = ..()
- var/area/scrub_area = get_area(src)
- name = "\proper [scrub_area.name] [name] [id_tag]"
-
/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
+ radio_filter_in = frequency==initial(frequency)?(RADIO_FROM_AIRALARM):null
+ radio_filter_out = frequency==initial(frequency)?(RADIO_TO_AIRALARM):null
if(frequency)
set_frequency(frequency)
broadcast_status()
check_turfs()
- . = ..()
+ ..()
/obj/machinery/atmospherics/components/unary/vent_scrubber/process_atmos()
..()
@@ -201,8 +176,9 @@
/obj/machinery/atmospherics/components/unary/vent_scrubber/proc/check_turfs()
adjacent_turfs.Cut()
- var/turf/local_turf = get_turf(src)
- adjacent_turfs = local_turf.get_atmos_adjacent_turfs(alldir = TRUE)
+ var/turf/T = get_turf(src)
+ if(istype(T))
+ adjacent_turfs = T.GetAtmosAdjacentTurfs(alldir = 1)
/obj/machinery/atmospherics/components/unary/vent_scrubber/receive_signal(datum/signal/signal)
if(!is_operational || !signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
@@ -252,12 +228,11 @@
. = ..()
update_icon_nopipes()
-/obj/machinery/atmospherics/components/unary/vent_scrubber/welder_act(mob/living/user, obj/item/welder)
- ..()
- if(!welder.tool_start_check(user, amount=0))
+/obj/machinery/atmospherics/components/unary/vent_scrubber/welder_act(mob/living/user, obj/item/I)
+ if(!I.tool_start_check(user, amount=0))
return TRUE
- to_chat(user, ("Now welding the scrubber."))
- if(welder.use_tool(src, user, 20, volume=50))
+ to_chat(user, "Now welding the scrubber.")
+ if(I.use_tool(src, user, 20, volume=50))
if(!welded)
user.visible_message("[user] welds the scrubber shut.","You weld the scrubber shut.", "You hear welding.")
welded = TRUE
diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm
index 47730e1a1460b..0eee42ffbc314 100644
--- a/code/modules/atmospherics/machinery/datum_pipeline.dm
+++ b/code/modules/atmospherics/machinery/datum_pipeline.dm
@@ -28,7 +28,7 @@
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)
+ considered_component.nullifyPipenet(src)
return ..()
/datum/pipeline/process()
@@ -121,7 +121,7 @@
/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)
+ var/list/returned_airs = considered_component.return_pipenetAirs(src)
if (!length(returned_airs) || (null in returned_airs))
stack_trace("add_machinery_member: 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])")
@@ -256,11 +256,16 @@
continue
gas_mixture_list += pipeline.other_airs
gas_mixture_list += pipeline.air
- for(var/obj/machinery/atmospherics/components/atmos_machine as anything in pipeline.other_atmos_machines)
- if(!atmos_machine.custom_reconcilation)
- continue
- pipeline_list |= atmos_machine.return_pipenets_for_reconcilation(src)
- gas_mixture_list |= atmos_machine.return_airs_for_reconcilation(src)
+ for(var/atmosmch in pipeline.other_atmos_machines)
+ if (istype(atmosmch, /obj/machinery/atmospherics/components/binary/valve))
+ var/obj/machinery/atmospherics/components/binary/valve/considered_valve = atmosmch
+ if(considered_valve.on)
+ pipeline_list |= considered_valve.parents[1]
+ pipeline_list |= considered_valve.parents[2]
+ else if (istype(atmosmch, /obj/machinery/atmospherics/components/unary/portables_connector))
+ var/obj/machinery/atmospherics/components/unary/portables_connector/considered_connector = atmosmch
+ if(considered_connector.connected_device)
+ gas_mixture_list += considered_connector.connected_device.return_air()
var/total_thermal_energy = 0
var/total_heat_capacity = 0
diff --git a/code/modules/atmospherics/machinery/other/meter.dm b/code/modules/atmospherics/machinery/other/meter.dm
index 077d373bbe733..9781ad4a96a64 100644
--- a/code/modules/atmospherics/machinery/other/meter.dm
+++ b/code/modules/atmospherics/machinery/other/meter.dm
@@ -68,16 +68,16 @@
return 0
var/env_pressure = environment.return_pressure()
- if(env_pressure <= 0.15 * ONE_ATMOSPHERE)
+ if(env_pressure <= 0.15*ONE_ATMOSPHERE)
icon_state = "meter0"
- else if(env_pressure <= 1.8 * ONE_ATMOSPHERE)
- var/val = round(env_pressure / (ONE_ATMOSPHERE * 0.3) + 0.5)
+ else if(env_pressure <= 1.8*ONE_ATMOSPHERE)
+ var/val = round(env_pressure/(ONE_ATMOSPHERE*0.3) + 0.5)
icon_state = "meter1_[val]"
- else if(env_pressure <= 30 * ONE_ATMOSPHERE)
- var/val = round(env_pressure / (ONE_ATMOSPHERE * 5) - 0.35) + 1
+ else if(env_pressure <= 30*ONE_ATMOSPHERE)
+ var/val = round(env_pressure/(ONE_ATMOSPHERE*5)-0.35) + 1
icon_state = "meter2_[val]"
- else if(env_pressure <= 59 * ONE_ATMOSPHERE)
- var/val = round(env_pressure / (ONE_ATMOSPHERE * 5) - 6) + 1
+ else if(env_pressure <= 59*ONE_ATMOSPHERE)
+ var/val = round(env_pressure/(ONE_ATMOSPHERE*5) - 6) + 1
icon_state = "meter3_[val]"
else
icon_state = "meter4"
@@ -110,10 +110,9 @@
. = ..()
. += status()
-/obj/machinery/meter/wrench_act(mob/user, obj/item/wrench)
- ..()
- to_chat(user, ("You begin to unfasten \the [src]..."))
- if (wrench.use_tool(src, user, 40, volume=50))
+/obj/machinery/meter/wrench_act(mob/user, obj/item/I)
+ to_chat(user, "You begin to unfasten \the [src]...")
+ if (I.use_tool(src, user, 40, volume=50))
user.visible_message(
"[user] unfastens \the [src].",
"You unfasten \the [src].",
diff --git a/code/modules/atmospherics/machinery/pipes/bridge_pipe.dm b/code/modules/atmospherics/machinery/pipes/bridge_pipe.dm
deleted file mode 100644
index d4adfdb0d3a3d..0000000000000
--- a/code/modules/atmospherics/machinery/pipes/bridge_pipe.dm
+++ /dev/null
@@ -1,29 +0,0 @@
-/obj/machinery/atmospherics/pipe/bridge_pipe
- icon = 'icons/obj/atmospherics/pipes/bridge_pipe.dmi'
- icon_state = "bridge_center"
-
- name = "bridge pipe"
- desc = "A one meter section of regular pipe used to connect pipenets over pipes."
-
- dir = SOUTH
- initialize_directions = NORTH | SOUTH
- pipe_flags = PIPING_CARDINAL_AUTONORMALIZE | PIPING_BRIDGE
- device_type = BINARY
-
- construction_type = /obj/item/pipe/binary
- pipe_state = "bridge_center"
-
-/obj/machinery/atmospherics/pipe/bridge_pipe/set_init_directions()
- switch(dir)
- if(NORTH, SOUTH)
- initialize_directions = SOUTH|NORTH
- if(EAST, WEST)
- initialize_directions = EAST|WEST
-
-/obj/machinery/atmospherics/pipe/bridge_pipe/update_overlays()
- . = ..()
- var/mutable_appearance/center = mutable_appearance('icons/obj/atmospherics/pipes/bridge_pipe.dmi', "bridge_center")
- PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer)
- . += center
-
- layer = HIGH_PIPE_LAYER //to stay above all sorts of pipes
diff --git a/code/modules/atmospherics/machinery/pipes/color_adapter.dm b/code/modules/atmospherics/machinery/pipes/color_adapter.dm
deleted file mode 100644
index 2468b3f943e3f..0000000000000
--- a/code/modules/atmospherics/machinery/pipes/color_adapter.dm
+++ /dev/null
@@ -1,63 +0,0 @@
-/obj/machinery/atmospherics/pipe/color_adapter
- icon = 'icons/obj/atmospherics/pipes/color_adapter.dmi'
- icon_state = "adapter_map-3"
-
- name = "color adapter"
- desc = "A one meter section of regular pipe used to connect different colored pipes."
-
- dir = SOUTH
- initialize_directions = NORTH | SOUTH
- pipe_flags = PIPING_CARDINAL_AUTONORMALIZE | PIPING_ALL_COLORS | PIPING_BRIDGE
- device_type = BINARY
-
- construction_type = /obj/item/pipe/binary
- pipe_state = "adapter_center"
-
- paintable = FALSE
- hide = FALSE
-
- ///cache for the icons
- var/static/list/mutable_appearance/center_cache = list()
-
-/obj/machinery/atmospherics/pipe/color_adapter/Initialize(mapload)
- icon_state = ""
- . = ..()
-
-/obj/machinery/atmospherics/pipe/color_adapter/set_init_directions()
- switch(dir)
- if(NORTH, SOUTH)
- initialize_directions = SOUTH|NORTH
- if(EAST, WEST)
- initialize_directions = EAST|WEST
-
-/obj/machinery/atmospherics/pipe/color_adapter/update_overlays()
- . = ..()
- var/mutable_appearance/center = center_cache["[piping_layer]"]
- if(!center)
- center = mutable_appearance(icon, "adapter_center")
- PIPING_LAYER_DOUBLE_SHIFT(center, piping_layer)
- center_cache["[piping_layer]"] = center
- . += center
-
- update_layer()
-
- //Add non-broken pieces
- for(var/i in 1 to device_type)
- if(!nodes[i])
- continue
- var/image/pipe = get_pipe_image('icons/obj/atmospherics/pipes/manifold.dmi', "pipe-3", get_dir(src, nodes[i]), nodes[i].pipe_color)
- PIPING_LAYER_DOUBLE_SHIFT(pipe, piping_layer)
- pipe.layer = layer + 0.01
- . += pipe
-
-/obj/machinery/atmospherics/pipe/color_adapter/layer1
- icon_state = "adapter_map-1"
-
-/obj/machinery/atmospherics/pipe/color_adapter/layer2
- icon_state = "adapter_map-2"
-
-/obj/machinery/atmospherics/pipe/color_adapter/layer4
- icon_state = "adapter_map-4"
-
-/obj/machinery/atmospherics/pipe/color_adapter/layer5
- icon_state = "adapter_map-5"
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 18e2e63d1c3ff..df9e5cf3d2f87 100644
--- a/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm
+++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/he_pipes.dm
@@ -23,19 +23,19 @@
var/environment_temperature = 0
var/datum/gas_mixture/pipe_air = return_air()
- var/turf/local_turf = loc
- if(istype(local_turf))
- if(islava(local_turf))
- environment_temperature = 5000 //Yuck
- else if(local_turf.blocks_air)
- environment_temperature = local_turf.temperature
+ var/turf/T = loc
+ if(istype(T))
+ if(T.blocks_air)
+ environment_temperature = T.return_temperature()
else
- var/turf/open/open_local = local_turf
- environment_temperature = open_local.GetTemperature()
- else
- environment_temperature = local_turf.temperature
- if(abs(environment_temperature-pipe_air.temperature) > minimum_temperature_difference)
- parent.temperature_interact(local_turf, volume, thermal_conductivity)
+ var/turf/open/OT = T
+ environment_temperature = OT.GetTemperature()
+ else if(T != null)
+ environment_temperature = T.return_temperature()
+
+ if(pipe_air != null)
+ if(abs(environment_temperature-pipe_air.return_temperature()) > minimum_temperature_difference)
+ parent.temperature_interact(T, volume, thermal_conductivity)
//heatup/cooldown any mobs buckled to ourselves based on our temperature
@@ -43,10 +43,11 @@
var/hc = pipe_air.heat_capacity()
var/mob/living/heat_source = buckled_mobs[1]
//Best guess-estimate of the total bodytemperature of all the mobs, since they share the same environment it's ~ok~ to guess like this
- var/avg_temp = (pipe_air.temperature * hc + (heat_source.bodytemperature * buckled_mobs.len) * 3500) / (hc + (buckled_mobs ? buckled_mobs.len * 3500 : 0))
- for(var/mob/living/buckled_mob as anything in buckled_mobs)
- buckled_mob.bodytemperature = avg_temp
- pipe_air.temperature = avg_temp
+ var/avg_temp = (pipe_air.return_temperature() * hc + (heat_source.bodytemperature * buckled_mobs.len) * 3500) / (hc + (buckled_mobs ? buckled_mobs.len * 3500 : 0))
+ for(var/m in buckled_mobs)
+ var/mob/living/L = m
+ L.bodytemperature = avg_temp
+ pipe_air.temperature = (avg_temp)
/obj/machinery/atmospherics/pipe/heat_exchanging/process(delta_time)
if(!parent)
@@ -72,12 +73,9 @@
animate(src, color = rgb(h_r, h_g, h_b), time = 20, easing = SINE_EASING)
//burn any mobs buckled based on temperature
- if(!has_buckled_mobs())
- return
- var/heat_limit = 1000
- if(pipe_air.temperature > heat_limit + 1)
- for(var/mob/living/buckled_mob as anything in buckled_mobs)
- buckled_mob.apply_damage(delta_time * 2 * log(pipe_air.temperature - heat_limit), BURN, BODY_ZONE_CHEST)
-
-/obj/machinery/atmospherics/pipe/heat_exchanging/update_pipe_icon()
- return
+ if(has_buckled_mobs())
+ var/heat_limit = 1000
+ if(pipe_air.return_temperature() > heat_limit + 1)
+ for(var/m in buckled_mobs)
+ var/mob/living/buckled_mob = m
+ buckled_mob.apply_damage(delta_time * 2 * log(pipe_air.return_temperature() - heat_limit), BURN, BODY_ZONE_CHEST)
diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm
index c3012562a2e59..c59c3c743312f 100644
--- a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm
+++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold.dm
@@ -35,7 +35,9 @@
//Add non-broken pieces
for(var/i in 1 to device_type)
if(nodes[i])
- . += get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i]))
+ add_overlay( get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) )
+
+ update_layer()
/obj/machinery/atmospherics/pipe/heat_exchanging/manifold/layer2
piping_layer = 2
diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm
index 4ac90338b907e..a321f7967e464 100644
--- a/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm
+++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/manifold4w.dm
@@ -33,7 +33,8 @@
//Add non-broken pieces
for(var/i in 1 to device_type)
if(nodes[i])
- . += get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i]))
+ add_overlay( get_pipe_image(icon, "pipe-[piping_layer]", get_dir(src, nodes[i])) )
+
update_layer()
/obj/machinery/atmospherics/pipe/heat_exchanging/manifold4w/layer2
diff --git a/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm b/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm
index 3266979ca8282..7c43cd771af20 100644
--- a/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm
+++ b/code/modules/atmospherics/machinery/pipes/heat_exchange/simple.dm
@@ -15,7 +15,7 @@
pipe_state = "he"
/obj/machinery/atmospherics/pipe/heat_exchanging/simple/set_init_directions()
- if(ISDIAGONALDIR(dir))
+ if(dir in GLOB.diagonals)
initialize_directions = dir
return
switch(dir)
diff --git a/code/modules/atmospherics/machinery/pipes/layermanifold.dm b/code/modules/atmospherics/machinery/pipes/layermanifold.dm
index f6e5cfb226997..23221c20045db 100644
--- a/code/modules/atmospherics/machinery/pipes/layermanifold.dm
+++ b/code/modules/atmospherics/machinery/pipes/layermanifold.dm
@@ -30,16 +30,11 @@
return ..()
/obj/machinery/atmospherics/pipe/layer_manifold/Destroy()
- nullify_all_nodes()
+ nullifyAllNodes()
return ..()
-/obj/machinery/atmospherics/pipe/layer_manifold/update_pipe_icon()
- return
-
-/obj/machinery/atmospherics/pipe/layer_manifold/proc/nullify_all_nodes()
- for(var/obj/machinery/atmospherics/node in nodes)
- node.disconnect(src)
- SSair.add_to_rebuild_queue(node)
+/obj/machinery/atmospherics/pipe/layer_manifold/proc/nullifyAllNodes()
+ var/list/obj/machinery/atmospherics/needs_nullifying = get_all_connected_nodes()
front_nodes = null
back_nodes = null
nodes = list()
@@ -60,17 +55,14 @@
for(var/node in back_nodes)
add_attached_images(node)
-/obj/machinery/atmospherics/pipe/layer_manifold/proc/get_attached_images(obj/machinery/atmospherics/machine_check)
- if(!machine_check)
+/obj/machinery/atmospherics/pipe/layer_manifold/proc/add_attached_images(obj/machinery/atmospherics/A)
+ if(!A)
return
-
- . = list()
-
- if(istype(machine_check, /obj/machinery/atmospherics/pipe/layer_manifold))
+ if(istype(A, /obj/machinery/atmospherics/pipe/layer_manifold))
for(var/i in PIPING_LAYER_MIN to PIPING_LAYER_MAX)
- . += get_attached_image(get_dir(src, machine_check), i, COLOR_VERY_LIGHT_GRAY)
- return
- . += get_attached_image(get_dir(src, machine_check), machine_check.piping_layer, machine_check.pipe_color)
+ add_attached_image(get_dir(src, A), i)
+ return
+ add_attached_image(get_dir(src, A), A.piping_layer, A.pipe_color)
/obj/machinery/atmospherics/pipe/layer_manifold/proc/add_attached_image(p_dir, p_layer, p_color = null)
var/image/I
@@ -113,7 +105,7 @@
/obj/machinery/atmospherics/pipe/layer_manifold/atmos_init()
normalize_cardinal_directions()
- find_all_connections()
+ findAllConnections()
/obj/machinery/atmospherics/pipe/layer_manifold/set_piping_layer()
piping_layer = PIPING_LAYER_DEFAULT
@@ -123,13 +115,14 @@
/obj/machinery/atmospherics/pipe/layer_manifold/disconnect(obj/machinery/atmospherics/reference)
if(istype(reference, /obj/machinery/atmospherics/pipe))
- var/obj/machinery/atmospherics/pipe/pipe_reference = reference
- pipe_reference.destroy_network()
- while(reference in nodes)
- var/i = nodes.Find(reference)
- nodes[i] = null
- i = front_nodes.Find(reference)
- if(i)
+ var/obj/machinery/atmospherics/pipe/P = reference
+ P.destroy_network()
+ while(reference in get_all_connected_nodes())
+ if(reference in nodes)
+ var/i = nodes.Find(reference)
+ nodes[i] = null
+ if(reference in front_nodes)
+ var/i = front_nodes.Find(reference)
front_nodes[i] = null
if(reference in back_nodes)
var/i = back_nodes.Find(reference)
diff --git a/code/modules/atmospherics/machinery/pipes/multiz.dm b/code/modules/atmospherics/machinery/pipes/multiz.dm
index 39a9a6d87457d..3c0aeb6e915a0 100644
--- a/code/modules/atmospherics/machinery/pipes/multiz.dm
+++ b/code/modules/atmospherics/machinery/pipes/multiz.dm
@@ -16,11 +16,8 @@
construction_type = /obj/item/pipe/directional
pipe_state = "multiz"
- ///Our central icon
var/mutable_appearance/center = null
- ///The pipe icon
var/mutable_appearance/pipe = null
- ///Reference to the node
var/obj/machinery/atmospherics/front_node = null
@@ -48,16 +45,14 @@
/// Attempts to locate a multiz pipe that's above us, if it finds one it merges us into its pipenet
/obj/machinery/atmospherics/pipe/multiz/pipeline_expansion()
- var/turf/local_turf = get_turf(src)
- for(var/obj/machinery/atmospherics/pipe/multiz/above in SSmapping.get_turf_above(local_turf))
- if(!is_connectable(above, piping_layer))
- continue
- nodes += above
- above.nodes += src //Two way travel :)
- for(var/obj/machinery/atmospherics/pipe/multiz/below in SSmapping.get_turf_below(local_turf))
- if(!is_connectable(below, piping_layer))
- continue
- below.pipeline_expansion() //If we've got one below us, force it to add us on facebook
+ var/turf/T = get_turf(src)
+ for(var/obj/machinery/atmospherics/pipe/multiz/above in GET_TURF_ABOVE(T))
+ if(above.piping_layer == piping_layer)
+ nodes += above
+ above.nodes += src // Two way travel :)
+ for(var/obj/machinery/atmospherics/pipe/multiz/below in GET_TURF_BELOW(T))
+ if(below.piping_layer == piping_layer)
+ below.pipeline_expansion() // If we've got one below us, force it to add us on facebook
return ..()
// MAPPING
diff --git a/code/modules/atmospherics/machinery/pipes/pipes.dm b/code/modules/atmospherics/machinery/pipes/pipes.dm
index 277db30f24cc8..bc62bfb3faa1d 100644
--- a/code/modules/atmospherics/machinery/pipes/pipes.dm
+++ b/code/modules/atmospherics/machinery/pipes/pipes.dm
@@ -17,7 +17,7 @@
/obj/machinery/atmospherics/pipe/New()
add_atom_colour(pipe_color, FIXED_COLOUR_PRIORITY)
volume = 35 * device_type
- . = ..()
+ ..()
///I have no idea why there's a new and at this point I'm too afraid to ask
/obj/machinery/atmospherics/pipe/Initialize(mapload)
@@ -27,10 +27,10 @@
AddElement(/datum/element/undertile, TRAIT_T_RAY_VISIBLE) //if changing this, change the subtypes RemoveElements too, because thats how bespoke works
/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)
+ var/obj/machinery/atmospherics/oldN = nodes[i]
+ ..()
+ if(oldN)
+ SSair.add_to_rebuild_queue(oldN)
/obj/machinery/atmospherics/pipe/destroy_network()
QDEL_NULL(parent)
@@ -62,9 +62,9 @@
return air_temporary.remove(amount)
return parent.air.remove(amount)
-/obj/machinery/atmospherics/pipe/attackby(obj/item/item, mob/user, params)
- if(istype(item, /obj/item/pipe_meter))
- var/obj/item/pipe_meter/meter = item
+/obj/machinery/atmospherics/pipe/attackby(obj/item/W, mob/user, params)
+ if(istype(W, /obj/item/pipe_meter))
+ var/obj/item/pipe_meter/meter = W
user.dropItemToGround(meter)
meter.setAttachLayer(piping_layer)
else
@@ -73,8 +73,8 @@
/obj/machinery/atmospherics/pipe/return_pipenet()
return parent
-/obj/machinery/atmospherics/pipe/set_pipenet(datum/pipeline/pipenet_to_set)
- parent = pipenet_to_set
+/obj/machinery/atmospherics/pipe/set_pipenet(datum/pipeline/P)
+ parent = P
/obj/machinery/atmospherics/pipe/Destroy()
QDEL_NULL(parent)
@@ -82,14 +82,13 @@
releaseAirToTurf()
QDEL_NULL(air_temporary)
- var/turf/local_turf = loc
- for(var/obj/machinery/meter/meter in local_turf)
- if(meter.target != src)
- continue
- var/obj/item/pipe_meter/meter_object = new (local_turf)
- meter.transfer_fingerprints_to(meter_object)
- qdel(meter)
- return ..()
+ var/turf/T = loc
+ for(var/obj/machinery/meter/meter in T)
+ if(meter.target == src)
+ var/obj/item/pipe_meter/PM = new (T)
+ meter.transfer_fingerprints_to(PM)
+ qdel(meter)
+ . = ..()
/obj/machinery/atmospherics/pipe/update_icon()
. = ..()
@@ -97,10 +96,9 @@
/obj/machinery/atmospherics/pipe/proc/update_node_icon()
for(var/i in 1 to device_type)
- if(!nodes[i])
- continue
- var/obj/machinery/atmospherics/current_node = nodes[i]
- current_node.update_icon()
+ if(nodes[i])
+ var/obj/machinery/atmospherics/N = nodes[i]
+ N.update_icon()
/obj/machinery/atmospherics/pipe/return_pipenets()
. = list(parent)
diff --git a/code/modules/atmospherics/machinery/pipes/smart.dm b/code/modules/atmospherics/machinery/pipes/smart.dm
deleted file mode 100644
index 5099aeefc7ba5..0000000000000
--- a/code/modules/atmospherics/machinery/pipes/smart.dm
+++ /dev/null
@@ -1,89 +0,0 @@
-GLOBAL_LIST_INIT(atmos_components, typecacheof(list(/obj/machinery/atmospherics)))
-//Smart pipes... or are they?
-/obj/machinery/atmospherics/pipe/smart
- icon = 'icons/obj/atmospherics/pipes/simple.dmi'
- icon_state = "pipe11-3"
-
- name = "pipe"
- desc = "A one meter section of regular pipe."
-
- device_type = QUATERNARY
- construction_type = /obj/item/pipe/quaternary
- pipe_state = "manifold4w"
- ///Current active connections
- var/connections = NONE
-
-/obj/machinery/atmospherics/pipe/smart/update_pipe_icon()
- icon = 'icons/obj/atmospherics/pipes/pipes_bitmask.dmi'
- connections = NONE
-
- for(var/i in 1 to device_type)
- if(!nodes[i])
- continue
- var/obj/machinery/atmospherics/node = nodes[i]
- var/connected_dir = get_dir(src, node)
- connections |= connected_dir
- var/bitfield = CARDINAL_TO_FULLPIPES(connections)
- dir = check_binary_direction(connections)
-
- // If we dont have enough bits to make a proper sprite, add some shortpipe bits
-
- // Smart pipe icons differ from classic pipe icons in that we stop adding
- // short pipe directions as soon as we find a valid sprite, rather than
- // adding in all connectable directions.
- // This prevents a lot of visual clutter, though it does make it harder to
- // notice completely disconnected pipes.
- if(ISSTUB(connections))
- var/bits_to_add = NONE
- if(connections != NONE)
- bits_to_add |= REVERSE_DIR(connections) & initialize_directions
- var/candidates = initialize_directions
- var/shift = 0
- // Note that candidates "should" never reach 0, as stub pipes are not allowed and break things
- while (ISSTUB(connections | bits_to_add) && (candidates >> shift) != 0)
- bits_to_add |= candidates & (1 << shift)
- shift += 1
- bitfield |= CARDINAL_TO_SHORTPIPES(bits_to_add)
-
- icon_state = "[bitfield]_[piping_layer]"
-
-/obj/machinery/atmospherics/pipe/smart/set_init_directions(init_dir)
- if(init_dir)
- initialize_directions = init_dir
- else
- initialize_directions = ALL_CARDINALS
-
-/obj/machinery/atmospherics/pipe/smart/proc/check_binary_direction(direction)
- switch(direction)
- if(EAST|WEST)
- return EAST
- if(SOUTH|NORTH)
- return SOUTH
- else
- return direction
-
-/obj/machinery/atmospherics/pipe/smart/proc/check_manifold_direction(direction)
- switch(direction)
- if(NORTH|SOUTH|EAST)
- return WEST
- if(NORTH|SOUTH|WEST)
- return EAST
- if(NORTH|WEST|EAST)
- return SOUTH
- if(SOUTH|WEST|EAST)
- return NORTH
- else
- return null
-
-//mapping helpers
-/obj/machinery/atmospherics/pipe/smart/simple
- icon = 'icons/obj/atmospherics/pipes/simple.dmi'
- icon_state = "pipe11-3"
-
-/obj/machinery/atmospherics/pipe/smart/manifold
- icon = 'icons/obj/atmospherics/pipes/manifold.dmi'
- icon_state = "manifold-3"
-
-/obj/machinery/atmospherics/pipe/smart/manifold4w
- icon = 'icons/obj/atmospherics/pipes/manifold.dmi'
- icon_state = "manifold4w-3"
diff --git a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
index 46f6af572f588..d63373de7ddef 100644
--- a/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
+++ b/code/modules/atmospherics/machinery/portable/portable_atmospherics.dm
@@ -37,8 +37,9 @@
return //Indestructable cans shouldn't release air
//This explosion will destroy the can, release its air.
- var/turf/local_turf = get_turf(src)
- local_turf.assume_air(air_contents)
+ var/turf/T = get_turf(src)
+ T.assume_air(air_contents)
+ T.air_update_turf(FALSE, FALSE)
return ..()
@@ -131,50 +132,48 @@
update_appearance()
return TRUE
-/obj/machinery/portable_atmospherics/attackby(obj/item/item, mob/user, params)
- if(!istype(item, /obj/item/tank))
+/obj/machinery/portable_atmospherics/attackby(obj/item/W, mob/user, params)
+ if(istype(W, /obj/item/tank))
+ if(!(machine_stat & BROKEN))
+ var/obj/item/tank/T = W
+ if(!user.transferItemToLoc(T, src))
+ return
+ to_chat(user, "[holding ? "In one smooth motion you pop [holding] out of [src]'s connector and replace it with [T]" : "You insert [T] into [src]"].")
+ investigate_log("had its internal [holding] swapped with [T] by [key_name(user)].", INVESTIGATE_ATMOS)
+ replace_tank(user, FALSE, T)
+ update_appearance()
+ else if(W.tool_behaviour == TOOL_WRENCH)
+ if(!(machine_stat & BROKEN))
+ if(connected_port)
+ investigate_log("was disconnected from [connected_port] by [key_name(user)].", INVESTIGATE_ATMOS)
+ disconnect()
+ W.play_tool_sound(src)
+ user.visible_message( \
+ "[user] disconnects [src].", \
+ "You unfasten [src] from the port.", \
+ "You hear a ratchet.")
+ update_appearance()
+ return
+ else
+ var/obj/machinery/atmospherics/components/unary/portables_connector/possible_port = locate(/obj/machinery/atmospherics/components/unary/portables_connector) in loc
+ if(!possible_port)
+ to_chat(user, "Nothing happens.")
+ return
+ if(!connect(possible_port))
+ to_chat(user, "[name] failed to connect to the port.")
+ return
+ W.play_tool_sound(src)
+ user.visible_message( \
+ "[user] connects [src].", \
+ "You fasten [src] to the port.", \
+ "You hear a ratchet.")
+ update_appearance()
+ investigate_log("was connected to [possible_port] by [key_name(user)].", INVESTIGATE_ATMOS)
+ else
return ..()
- if(machine_stat & BROKEN)
- return FALSE
- var/obj/item/tank/insert_tank = item
- if(!user.transferItemToLoc(insert_tank, src))
- return FALSE
- to_chat(user, span_notice("[holding ? "In one smooth motion you pop [holding] out of [src]'s connector and replace it with [insert_tank]" : "You insert [insert_tank] into [src]"]."))
- investigate_log("had its internal [holding] swapped with [insert_tank] by [key_name(user)].", INVESTIGATE_ATMOS)
- replace_tank(user, FALSE, insert_tank)
- update_appearance()
-
-/obj/machinery/portable_atmospherics/wrench_act(mob/living/user, obj/item/wrench)
- if(machine_stat & BROKEN)
- return FALSE
- if(connected_port)
- investigate_log("was disconnected from [connected_port] by [key_name(user)].", INVESTIGATE_ATMOS)
- disconnect()
- wrench.play_tool_sound(src)
- user.visible_message( \
- "[user] disconnects [src].", \
- span_notice("You unfasten [src] from the port."), \
- span_hear("You hear a ratchet."))
- update_appearance()
- return TRUE
- var/obj/machinery/atmospherics/components/unary/portables_connector/possible_port = locate(/obj/machinery/atmospherics/components/unary/portables_connector) in loc
- if(!possible_port)
- to_chat(user, span_notice("Nothing happens."))
- return FALSE
- if(!connect(possible_port))
- to_chat(user, span_notice("[name] failed to connect to the port."))
- return FALSE
- wrench.play_tool_sound(src)
- user.visible_message( \
- "[user] connects [src].", \
- span_notice("You fasten [src] to the port."), \
- span_hear("You hear a ratchet."))
- update_appearance()
- investigate_log("was connected to [possible_port] by [key_name(user)].", INVESTIGATE_ATMOS)
- return TRUE
-/obj/machinery/portable_atmospherics/attacked_by(obj/item/item, mob/user)
- if(item.force < 10 && !(machine_stat & BROKEN))
+/obj/machinery/portable_atmospherics/attacked_by(obj/item/I, mob/user)
+ if(I.force < 10 && !(machine_stat & BROKEN))
take_damage(0)
else
investigate_log("was smacked with \a [I] by [key_name(user)].", INVESTIGATE_ATMOS)
diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm
index 3bf122b83a345..1031492e4aea8 100644
--- a/code/modules/atmospherics/machinery/portable/pump.dm
+++ b/code/modules/atmospherics/machinery/portable/pump.dm
@@ -84,8 +84,10 @@
investigate_log("a portable pump was set to [attached_pump.target_pressure] kPa by [parent.get_creator()].", INVESTIGATE_ATMOS)
/obj/machinery/portable_atmospherics/pump/Destroy()
- var/turf/local_turf = get_turf(src)
- local_turf.assume_air(air_contents)
+ var/turf/T = get_turf(src)
+ T.assume_air(air_contents)
+ air_update_turf(FALSE, FALSE)
+ QDEL_NULL(pump)
return ..()
/obj/machinery/portable_atmospherics/pump/update_icon()
@@ -103,15 +105,15 @@
pump.airs[2] = null
return
- var/turf/local_turf = get_turf(src)
- var/datum/gas_mixture/sending
- var/datum/gas_mixture/receiving
+ var/turf/T = get_turf(src)
+ var/datum/gas_mixture/temp_air_contents = return_air()
+ var/datum/gas_mixture/temp_holding_air_contents = holding_return_air()
if(direction == PUMP_OUT) // Hook up the internal pump.
- sending = (holding ? holding.return_air() : air_contents)
- receiving = (holding ? air_contents : local_turf.return_air())
+ pump.airs[1] = holding ? temp_holding_air_contents : temp_air_contents
+ pump.airs[2] = holding ? temp_air_contents : T.return_air()
else
- sending = (holding ? air_contents : local_turf.return_air())
- receiving = (holding ? holding.return_air() : air_contents)
+ pump.airs[1] = holding ? temp_air_contents : T.return_air()
+ pump.airs[2] = holding ? temp_holding_air_contents : temp_air_contents
pump.process_atmos() // Pump gas.
if(!holding)
diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm
index 9f89a8fa2c99c..d4f4dcbf805af 100644
--- a/code/modules/atmospherics/machinery/portable/scrubber.dm
+++ b/code/modules/atmospherics/machinery/portable/scrubber.dm
@@ -151,7 +151,7 @@
if(!holding)
var/turf/T = get_turf(src)
- for(var/turf/AT in T.get_atmos_adjacent_turfs(alldir = TRUE))
+ for(var/turf/AT in T.GetAtmosAdjacentTurfs(alldir = TRUE))
scrub(AT.return_air())
return ..()
diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm
index a56078ce18d75..cdc7c63d497ff 100644
--- a/code/modules/mob/living/simple_animal/bot/bot.dm
+++ b/code/modules/mob/living/simple_animal/bot/bot.dm
@@ -463,8 +463,10 @@ Pass the desired type path itself, declaring a temporary var beforehand is not r
var/turf/T = get_turf(src)
if(!T)
return
- var/list/adjacent = T.get_atmos_adjacent_turfs(1)
- if(shuffle) //If we were on the same tile as another bot, let's randomize our choices so we dont both go the same way
+ var/list/adjacent = T.GetAtmosAdjacentTurfs(1)
+ var/atom/final_result
+ var/static/list/turf_typecache = typecacheof(/turf)
+ if(shuffle) //If we were on the same tile as another bot, let's randomize our choices so we dont both go the same way
adjacent = shuffle(adjacent)
shuffle = FALSE
for(var/turf/scan as() in adjacent)//Let's see if there's something right next to us first!
diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm
index 6c5be8f80e919..d36021d7a6fec 100644
--- a/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm
+++ b/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm
@@ -57,7 +57,7 @@
. = ..()
if(banana_time && banana_time < world.time)
var/turf/T = get_turf(src)
- var/list/adjacent = T.get_atmos_adjacent_turfs(1)
+ var/list/adjacent = T.GetAtmosAdjacentTurfs(1)
new banana_type(pick(adjacent))
banana_time = world.time + rand(30,60)
diff --git a/code/modules/power/singularity/containment_field.dm b/code/modules/power/singularity/containment_field.dm
index 773afb9538b43..bf8b25f1295b5 100644
--- a/code/modules/power/singularity/containment_field.dm
+++ b/code/modules/power/singularity/containment_field.dm
@@ -11,7 +11,6 @@
use_power = NO_POWER_USE
interaction_flags_atom = NONE
interaction_flags_machine = NONE
- can_atmos_pass = ATMOS_PASS_NO
light_range = 4
layer = ABOVE_OBJ_LAYER
var/obj/machinery/field/generator/FG1 = null
diff --git a/code/modules/power/singularity/field_generator.dm b/code/modules/power/singularity/field_generator.dm
index 0b997177818b7..0af3d05f9b767 100644
--- a/code/modules/power/singularity/field_generator.dm
+++ b/code/modules/power/singularity/field_generator.dm
@@ -32,7 +32,6 @@ field_generator power level display
density = TRUE
use_power = NO_POWER_USE
max_integrity = 500
- can_atmos_pass = ATMOS_PASS_YES
//100% immune to lasers and energy projectiles since it absorbs their energy.
armor = list(MELEE = 25, BULLET = 10, LASER = 100, ENERGY = 100, BOMB = 0, BIO = 0, RAD = 0, FIRE = 50, ACID = 70, STAMINA = 0)
var/power_level = 0
@@ -183,7 +182,6 @@ field_generator power level display
/obj/machinery/field/generator/proc/turn_off()
active = FG_OFFLINE
- can_atmos_pass = ATMOS_PASS_YES
air_update_turf(TRUE, FALSE)
can_atmos_pass = ATMOS_PASS_YES
spawn(1)
diff --git a/code/modules/reagents/chem_splash.dm b/code/modules/reagents/chem_splash.dm
index 13f36942604eb..431754b4fce67 100644
--- a/code/modules/reagents/chem_splash.dm
+++ b/code/modules/reagents/chem_splash.dm
@@ -45,7 +45,7 @@
for(var/turf/T as() in turflist)
if(accessible[T])
continue
- for(var/thing in T.get_atmos_adjacent_turfs(alldir = TRUE))
+ for(var/thing in T.GetAtmosAdjacentTurfs(alldir = TRUE))
var/turf/NT = thing
if(!(NT in accessible))
continue
diff --git a/code/modules/shuttle/on_move.dm b/code/modules/shuttle/on_move.dm
index 0afa12ed91a37..b87db205e14be 100644
--- a/code/modules/shuttle/on_move.dm
+++ b/code/modules/shuttle/on_move.dm
@@ -279,8 +279,8 @@ All ShuttleMove procs go here
A.add_member(src)
SSair.add_to_rebuild_queue(src)
else
- // atmos_init() calls update_appearance(), so we don't need to call it
- update_appearance()
+ // atmos_init() calls update_icon(), so we don't need to call it
+ update_icon()
/obj/machinery/navbeacon/beforeShuttleMove(turf/newT, rotation, move_mode, obj/docking_port/mobile/moving_dock)
. = ..()
From 22b5e0be895287e4b2a1e311674eb4634db56a36 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Mon, 26 Aug 2024 12:00:33 +0200
Subject: [PATCH 043/114] Small thingy
---
code/game/objects/effects/spawners/bombspawner.dm | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/code/game/objects/effects/spawners/bombspawner.dm b/code/game/objects/effects/spawners/bombspawner.dm
index 6dd0fd43fadb3..63dbe14b0e027 100644
--- a/code/game/objects/effects/spawners/bombspawner.dm
+++ b/code/game/objects/effects/spawners/bombspawner.dm
@@ -30,10 +30,10 @@
oxygen_mix.gases[/datum/gas/oxygen][MOLES] = pressure_o*oxygen_mix.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o))
oxygen_mix.temperature = CELSIUS_TO_KELVIN(temp_o)
- V.tank_one = PT
- V.tank_two = OT
- PT.master = V
- OT.master = V
+ V.tank_one = plasma_tank
+ V.tank_two = oxygen_tank
+ plasma_tank.master = V
+ oxygen_tank.master = V
if(assembly_type)
var/obj/item/assembly/A = new assembly_type(V)
From 10765fe25bc5c44133a5f27543eba3b49c2e7993 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Mon, 26 Aug 2024 12:07:36 +0200
Subject: [PATCH 044/114] Test
From 0f5c2d4fda2adb043ad66eed41b1041ea8cc42fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Mon, 26 Aug 2024 12:50:48 +0200
Subject: [PATCH 045/114] Some additional fixes
---
code/__DEFINES/atmospherics/atmos_helpers.dm | 3 +++
code/game/objects/items/tanks/tanks.dm | 7 ++-----
code/modules/admin/admin_verbs.dm | 1 -
code/modules/atmospherics/environmental/LINDA_turf_tile.dm | 6 +++---
code/modules/atmospherics/gasmixtures/gas_mixture.dm | 7 +------
5 files changed, 9 insertions(+), 15 deletions(-)
diff --git a/code/__DEFINES/atmospherics/atmos_helpers.dm b/code/__DEFINES/atmospherics/atmos_helpers.dm
index c546c9d745111..67ccdb4321240 100644
--- a/code/__DEFINES/atmospherics/atmos_helpers.dm
+++ b/code/__DEFINES/atmospherics/atmos_helpers.dm
@@ -38,6 +38,9 @@
///Adds a gas to a gas mixture but checks if is already present, faster than the same proc
#define ASSERT_GAS(gas_id, gas_mixture) if (!gas_mixture.gases[gas_id]) { ADD_GAS(gas_id, gas_mixture.gases) };
+///Adds a gas to a gas LIST but checks if is already present, accepts a list instead of a datum, so faster if the list is locally cached
+#define ASSERT_GAS_IN_LIST(gas_id, gases) if (!gases[gas_id]) { ADD_GAS(gas_id, gases) };
+
//prefer this to gas_mixture/total_moles in performance critical areas
///Calculate the total moles of the gas mixture, faster than the proc, good for performance critical areas
#define TOTAL_MOLES(cached_gases, out_var)\
diff --git a/code/game/objects/items/tanks/tanks.dm b/code/game/objects/items/tanks/tanks.dm
index 2684bf5e57dd9..6bcffe69215e3 100644
--- a/code/game/objects/items/tanks/tanks.dm
+++ b/code/game/objects/items/tanks/tanks.dm
@@ -27,6 +27,7 @@
var/mob/living/carbon/breathing_mob = null
///Used by process() to track if there's a reason to process each tick
var/excited = TRUE
+ var/leaking = FALSE
/obj/item/tank/dropped(mob/living/user, silent)
. = ..()
@@ -262,13 +263,12 @@
//Allow for reactions
excited = (excited | air_contents.react(src))
excited = (excited | handle_tolerances(delta_time))
- excited = (excited | leaking)
if(!excited)
STOP_PROCESSING(SSobj, src)
excited = FALSE
- if(QDELETED(src) || !leaking || !air_contents)
+ if(QDELETED(src) || !air_contents)
return
var/atom/location = loc
if(!location)
@@ -335,10 +335,7 @@
/// Handles the tank springing a leak.
/obj/item/tank/obj_break(damage_flag)
. = ..()
- if(leaking)
- return
- leaking = TRUE
START_PROCESSING(SSobj, src)
if(obj_integrity < 0) // So we don't play the alerts while we are exploding or rupturing.
diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm
index f0493a958711c..88a3610baea4a 100644
--- a/code/modules/admin/admin_verbs.dm
+++ b/code/modules/admin/admin_verbs.dm
@@ -190,7 +190,6 @@ GLOBAL_PROTECT(admin_verbs_debug)
/client/proc/reload_configuration,
/client/proc/give_all_spells,
/datum/admins/proc/create_or_modify_area,
- /datum/admins/proc/fixcorruption,
#ifdef TESTING
/client/proc/check_missing_sprites,
/client/proc/run_dynamic_simulations,
diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
index e501ef607a4d4..3ba815f593ec3 100644
--- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
+++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
@@ -101,9 +101,9 @@
if(to_be_destroyed && exposed_temperature >= max_fire_temperature_sustained)
max_fire_temperature_sustained = min(exposed_temperature, max_fire_temperature_sustained + heat_capacity / 4) //Ramp up to 100% yeah?
if(to_be_destroyed && !changing_turf)
- burn()
+ turf_burn()
-/turf/proc/burn()
+/turf/proc/turf_burn()
burn_tile()
var/chance_of_deletion
if (heat_capacity) //beware of division by zero
@@ -116,7 +116,7 @@
else
to_be_destroyed = FALSE
-/turf/open/burn()
+/turf/open/turf_burn()
if(!active_hotspot) //Might not even be needed since excited groups are no longer cringe
..()
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index 7a0258157cf2e..18ea56916c354 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -42,7 +42,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
/// Used for analyzer feedback - not initialized until its used
var/list/analyzer_results
/// Whether to call garbage_collect() on the sharer during shares, used for immutable mixtures
- var/gc_share = FALSE
+ var/gc_share = FALSE
/datum/gas_mixture/New(volume)
gases = new
@@ -110,11 +110,6 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
var/cached_gases = gases
TOTAL_MOLES(cached_gases, .)
-/// Calculate moles for a specific gas in the mixture
-/datum/gas_mixture/proc/total_moles_specific(gas_id)
- var/cached_gases = gases
- TOTAL_MOLES_SPECIFIC(cached_gases, gas_id, .)
-
/// Checks to see if gas amount exists in mixture.
/// Do NOT use this in code where performance matters!
/// It's better to batch calls to garbage_collect(), especially in places where you're checking many gastypes
From fa7f5eb00cc704ed072cfbbb47cbdc00f05a1c45 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Mon, 26 Aug 2024 13:00:34 +0200
Subject: [PATCH 046/114] Some more misc fixes
---
code/game/objects/items/powerfist.dm | 2 +-
code/modules/admin/verbs/debug.dm | 3 ++-
code/modules/atmospherics/gasmixtures/gas_mixture.dm | 8 --------
code/modules/atmospherics/machinery/portable/canister.dm | 2 +-
4 files changed, 4 insertions(+), 11 deletions(-)
diff --git a/code/game/objects/items/powerfist.dm b/code/game/objects/items/powerfist.dm
index a670aff702805..8b97679142686 100644
--- a/code/game/objects/items/powerfist.dm
+++ b/code/game/objects/items/powerfist.dm
@@ -29,7 +29,7 @@
return
if(tank)
. += "[icon2html(tank, user)] It has \a [tank] mounted onto it."
- . += "Its pressure gauge reads [round(tank.return_air().total_moles(), 0.01)] mol at [round(tank.air_contents.return_pressure(),0.01)] kPa."
+ . += "Its pressure gauge reads [round(tank.air_contents.total_moles(), 0.01)] mol at [round(tank.air_contents.return_pressure(),0.01)] kPa."
/obj/item/melee/powerfist/attackby(obj/item/W, mob/user, params)
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index 52bf7d6bdb081..6de8b69cf439c 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -624,7 +624,8 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
if(Rad.anchored)
if(!Rad.loaded_tank)
var/obj/item/tank/internals/plasma/Plasma = new/obj/item/tank/internals/plasma(Rad)
- Plasma.return_air().gases[/datum/gas/plasma][MOLES] = 70
+ var/datum/gas_mixture/plasma_air = Plasma.return_air()
+ plasma_air.gases[/datum/gas/plasma][MOLES] = 70
Rad.drainratio = 0
Rad.loaded_tank = Plasma
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index 18ea56916c354..dee2e6f5b88de 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -1,11 +1,3 @@
-/*
-What are the archived variables for?
-Calculations are done using the archived variables with the results merged into the regular variables.
-This prevents race conditions that arise based on the order of tile processing.
-*/
-#define MINIMUM_HEAT_CAPACITY 0.0003
-#define MINIMUM_MOLE_COUNT 0.01
-#define MOLAR_ACCURACY 1E-4
/**
*I feel the need to document what happens here. Basically this is used
*catch rounding errors, and make gas go away in small portions.
diff --git a/code/modules/atmospherics/machinery/portable/canister.dm b/code/modules/atmospherics/machinery/portable/canister.dm
index 2455abda4295b..3b477f8a568f8 100644
--- a/code/modules/atmospherics/machinery/portable/canister.dm
+++ b/code/modules/atmospherics/machinery/portable/canister.dm
@@ -441,7 +441,7 @@
var/datum/gas_mixture/holding_mix = holding.return_air()
data["holdingTank"] = list()
data["holdingTank"]["name"] = holding.name
- data["holdingTank"]["tankPressure"] = round(holding.holding_mix.return_pressure())
+ data["holdingTank"]["tankPressure"] = round(holding_mix.return_pressure())
return data
/obj/machinery/portable_atmospherics/canister/ui_act(action, params)
From 22c0109c43f92c09ac0f5b2f5b25f51996a13351 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Mon, 26 Aug 2024 15:57:53 +0200
Subject: [PATCH 047/114] Edits the gas types to add breathing reagents,
alerts, and balance some missing fusion powers
---
.../atmospherics/gasmixtures/gas_types.dm | 29 +++++++++++++++++--
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/code/modules/atmospherics/gasmixtures/gas_types.dm b/code/modules/atmospherics/gasmixtures/gas_types.dm
index 68fffae0cd90a..5389db043da1b 100644
--- a/code/modules/atmospherics/gasmixtures/gas_types.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_types.dm
@@ -59,6 +59,16 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
/datum/gas/nitrogen
id = "n2"
specific_heat = 20
+ 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
+ )
+ )
name = "Nitrogen"
rarity = 1000
@@ -66,6 +76,18 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
id = "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
+ )
+ )
+ fusion_power = 3
rarity = 700
/datum/gas/plasma
@@ -84,6 +106,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
gas_overlay = "water_vapor"
moles_visible = MOLES_GAS_VISIBLE
fusion_power = 8
+ breath_reagent = /datum/reagent/water
rarity = 500
/datum/gas/hypernoblium
@@ -102,7 +125,6 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
name = "Nitrous Oxide"
gas_overlay = "nitrous_oxide"
moles_visible = MOLES_GAS_VISIBLE * 2
- fusion_power = 10
dangerous = TRUE
rarity = 600
@@ -112,6 +134,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
name = "Nitryl"
gas_overlay = "nitryl"
moles_visible = MOLES_GAS_VISIBLE
+ fusion_power = 15
dangerous = TRUE
rarity = 100
@@ -122,7 +145,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
gas_overlay = "tritium"
moles_visible = MOLES_GAS_VISIBLE
dangerous = TRUE
- fusion_power = 5
+ fusion_power = 1
rarity = 300
/datum/gas/bz
@@ -144,7 +167,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
id = "pluox"
specific_heat = 80
name = "Pluoxium"
- fusion_power = -10
+ fusion_power = 10
rarity = 200
/obj/effect/overlay/gas
From 4e70541d5da102b60185518a062b7281117eca8e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Mon, 26 Aug 2024 19:01:27 +0200
Subject: [PATCH 048/114] Changes a very confusing variable name and fixes a
bit more of things
---
beestation.dme | 2 +-
code/__DEFINES/atmospherics/atmos_core.dm | 8 +++++
.../breathing_classes.dm | 9 +++++
.../atmospherics/gasmixtures/gas_mixture.dm | 2 +-
.../atmospherics/gasmixtures/gas_types.dm | 11 ++++--
.../atmospherics/gasmixtures/reactions.dm | 2 +-
code/modules/surgery/organs/lungs.dm | 36 +++++++++----------
7 files changed, 47 insertions(+), 23 deletions(-)
rename code/modules/atmospherics/{auxgm => gasmixtures}/breathing_classes.dm (82%)
diff --git a/beestation.dme b/beestation.dme
index a606975406d62..f02820f8c6f79 100644
--- a/beestation.dme
+++ b/beestation.dme
@@ -2163,10 +2163,10 @@
#include "code\modules\asset_cache\spritesheet\batched\universal_icon.dm"
#include "code\modules\asset_cache\transports\asset_transport.dm"
#include "code\modules\asset_cache\transports\webroot_transport.dm"
-#include "code\modules\atmospherics\auxgm\breathing_classes.dm"
#include "code\modules\atmospherics\environmental\LINDA_fire.dm"
#include "code\modules\atmospherics\environmental\LINDA_system.dm"
#include "code\modules\atmospherics\environmental\LINDA_turf_tile.dm"
+#include "code\modules\atmospherics\gasmixtures\breathing_classes.dm"
#include "code\modules\atmospherics\gasmixtures\gas_mixture.dm"
#include "code\modules\atmospherics\gasmixtures\gas_types.dm"
#include "code\modules\atmospherics\gasmixtures\immutable_mixtures.dm"
diff --git a/code/__DEFINES/atmospherics/atmos_core.dm b/code/__DEFINES/atmospherics/atmos_core.dm
index 8f5388b5d2c45..103f989b873fe 100644
--- a/code/__DEFINES/atmospherics/atmos_core.dm
+++ b/code/__DEFINES/atmospherics/atmos_core.dm
@@ -20,6 +20,14 @@
#define META_GAS_ID 6
///Power of the gas when used in the current iteration of fusion
#define META_GAS_FUSION_POWER 7
+///Defines the alert that should jump out if the quantity of a gas affects to a point it's too much or not enough
+#define META_GAS_BREATH_ALERT_INFO 8
+///Defines the reagents applied on breathing the gas
+#define META_GAS_BREATH_REAGENT 9
+///Defines the gas to which this gas is a result of breathing
+#define META_GAS_BREATH_RESULTS 10
+
+
//ATMOS
//stuff you should probably leave well alone!
/// kPa*L/(K*mol)
diff --git a/code/modules/atmospherics/auxgm/breathing_classes.dm b/code/modules/atmospherics/gasmixtures/breathing_classes.dm
similarity index 82%
rename from code/modules/atmospherics/auxgm/breathing_classes.dm
rename to code/modules/atmospherics/gasmixtures/breathing_classes.dm
index 069251562472a..a42d016d35326 100644
--- a/code/modules/atmospherics/auxgm/breathing_classes.dm
+++ b/code/modules/atmospherics/gasmixtures/breathing_classes.dm
@@ -41,3 +41,12 @@
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
+
+/proc/breathing_class_list()
+ var/list/breathing_classes = list()
+ 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
+ return breathing_classes
+
+GLOBAL_LIST_INIT(breathing_class_info, breathing_class_list())
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index dee2e6f5b88de..884c8257fa883 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -462,7 +462,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
if(!length(cached_gases))
return
- var/lis/maximum = list()
+ var/list/maximum = list()
var/list/pre_formation = list()
var/list/mid_formation = list()
var/list/post_formation = list()
diff --git a/code/modules/atmospherics/gasmixtures/gas_types.dm b/code/modules/atmospherics/gasmixtures/gas_types.dm
index 5389db043da1b..0163caf45aa4b 100644
--- a/code/modules/atmospherics/gasmixtures/gas_types.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_types.dm
@@ -20,6 +20,10 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
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_info[META_GAS_BREATH_ALERT_INFO] = intial(gas.breath_alert_info)
+ gas_info[META_GAS_BREATH_REAGENT] = initial(gas.breath_reagent)
+ gas_info[META_GAS_BREATH_RESULTS] = initial(gas.breath_results)
+
.[gas_path] = gas_info
/proc/gas_id2path(id)
@@ -49,6 +53,9 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
var/dangerous = FALSE //currently used by canisters
var/fusion_power = 0 //How much the gas accelerates a fusion reaction
var/rarity = 0 // relative rarity compared to other gases, used when setting up the reactions list.
+ var/list/breath_alert_info = null
+ var/breath_reagent = null
+ var/breath_results = null
/datum/gas/oxygen
id = "o2"
@@ -59,7 +66,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
/datum/gas/nitrogen
id = "n2"
specific_heat = 20
- breath_alert_info = list(
+ breath_alert_info = list(
not_enough_alert = list(
alert_category = "not_enough_nitro",
alert_type = /atom/movable/screen/alert/not_enough_nitro
@@ -76,7 +83,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
id = "co2"
specific_heat = 30
name = "Carbon Dioxide"
- breath_results = GAS_O2
+ breath_results = /datum/gas/oxygen
breath_alert_info = list(
not_enough_alert = list(
alert_category = "not_enough_co2",
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index 23e1d0c4a8d14..5d1914ebacaff 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -313,7 +313,7 @@
: 4 ** (temperature_scale-FUSION_BASE_TEMPSCALE) / FUSION_SLOPE_DIVISOR)
var/gas_power = 0
for (var/gas_id in air.gases)
- gas_power += (GLOB.gas_data.fusion_powers[gas_id]*air.gases[gas_id][MOLES])
+ gas_power += (GLOB.meta_gas_info[gas_id][META_GAS_FUSION_POWER]*air.gases[gas_id][MOLES])
var/instability = MODULUS((gas_power*INSTABILITY_GAS_POWER_FACTOR),toroidal_size) //Instability effects how chaotic the behavior of the reaction is
cached_scan_results[id] = instability//used for analyzer feedback
diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index 7f320a5295717..6792a46fbc9ea 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -21,7 +21,7 @@
//Breath damage
//These thresholds are checked against what amounts to total_mix_pressure * (gas_type_mols/total_mols)
- var/breathing_class = BREATH_OXY // can be a gas instead of a breathing class
+ var/gas_breathed = 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
@@ -91,9 +91,9 @@
LAZYNULL(thrown_alerts)
/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(
+ gas_min[gas_breathed] = safe_breath_min
+ gas_max[gas_breathed] = safe_breath_max
+ gas_damage[gas_breathed] = list(
min = safe_breath_dam_min,
max = safe_breath_dam_max,
damage_type = safe_damage_type
@@ -142,14 +142,14 @@
H.failed_last_breath = TRUE
var/alert_category
var/alert_type
- if(ispath(breathing_class))
- var/datum/breathing_class/class = GLOB.gas_data.breathing_classes[breathing_class]
+ if(ispath(gas_breathed))
+ var/datum/gas_breathed/class = GLOB.gas_data.breathing_classes[gas_breathed]
alert_category = class.low_alert_category
alert_type = class.low_alert_datum
else
- 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"]
+ var/list/alert = GLOB.meta_gas_info[gas_breathed][META_GAS_BREATH_ALERT_INFO]
+ if(alert)
+ var/list/alert = breath_alert_info[gas_breathed]["not_enough_alert"]
alert_category = alert["alert_category"]
alert_type = alert["alert_type"]
throw_alert_for(H, alert_category, alert_type)
@@ -174,7 +174,7 @@
var/alert_category = null
var/alert_type = null
if(ispath(entry))
- var/datum/breathing_class/class = breathing_classes[entry]
+ var/datum/gas_breathed/class = breathing_classes[entry]
var/list/gases = class.gases
var/list/products = class.products
alert_category = class.low_alert_category
@@ -213,16 +213,16 @@
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/gas_breathed/gas_breathed = 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)
+ if(ispath(gas_breathed))
+ gas_breathed = breathing_classes[gas_breathed]
+ alert_category = gas_breathed.high_alert_category
+ alert_type = gas_breathed.high_alert_datum
+ danger_reagent = gas_breathed.danger_reagent
+ found_pp = gas_breathed.get_effective_pp(breath)
else
danger_reagent = danger_reagents[entry]
if(entry in breath_alert_info)
@@ -366,7 +366,7 @@
desc = "A spongy rib-shaped mass for filtering plasma from the air."
icon_state = "lungs-plasma"
- breathing_class = BREATH_PLASMA
+ gas_breathed = BREATH_PLASMA
/obj/item/organ/lungs/plasmaman/populate_gas_info()
..()
From a81317ea37df67f0da822915424388b941a68582 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Mon, 26 Aug 2024 19:39:53 +0200
Subject: [PATCH 049/114] Reverts lung.dm, that was fucking stupid but this
code is fucking stupid I wanna kill myself what the fuck aaaa
---
code/modules/surgery/organs/lungs.dm | 36 ++++++++++++++--------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index 6792a46fbc9ea..7f320a5295717 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -21,7 +21,7 @@
//Breath damage
//These thresholds are checked against what amounts to total_mix_pressure * (gas_type_mols/total_mols)
- var/gas_breathed = BREATH_OXY // can be a gas instead of a breathing class
+ 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
@@ -91,9 +91,9 @@
LAZYNULL(thrown_alerts)
/obj/item/organ/lungs/proc/populate_gas_info()
- gas_min[gas_breathed] = safe_breath_min
- gas_max[gas_breathed] = safe_breath_max
- gas_damage[gas_breathed] = list(
+ 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
@@ -142,14 +142,14 @@
H.failed_last_breath = TRUE
var/alert_category
var/alert_type
- if(ispath(gas_breathed))
- var/datum/gas_breathed/class = GLOB.gas_data.breathing_classes[gas_breathed]
+ 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
- var/list/alert = GLOB.meta_gas_info[gas_breathed][META_GAS_BREATH_ALERT_INFO]
- if(alert)
- var/list/alert = breath_alert_info[gas_breathed]["not_enough_alert"]
+ 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"]
throw_alert_for(H, alert_category, alert_type)
@@ -174,7 +174,7 @@
var/alert_category = null
var/alert_type = null
if(ispath(entry))
- var/datum/gas_breathed/class = breathing_classes[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
@@ -213,16 +213,16 @@
var/list/danger_reagents = GLOB.gas_data.breath_reagents_dangerous
for(var/entry in gas_max)
var/found_pp = 0
- var/datum/gas_breathed/gas_breathed = entry
+ var/datum/breathing_class/breathing_class = entry
var/datum/reagent/danger_reagent = null
var/alert_category = null
var/alert_type = null
- if(ispath(gas_breathed))
- gas_breathed = breathing_classes[gas_breathed]
- alert_category = gas_breathed.high_alert_category
- alert_type = gas_breathed.high_alert_datum
- danger_reagent = gas_breathed.danger_reagent
- found_pp = gas_breathed.get_effective_pp(breath)
+ 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
danger_reagent = danger_reagents[entry]
if(entry in breath_alert_info)
@@ -366,7 +366,7 @@
desc = "A spongy rib-shaped mass for filtering plasma from the air."
icon_state = "lungs-plasma"
- gas_breathed = BREATH_PLASMA
+ breathing_class = BREATH_PLASMA
/obj/item/organ/lungs/plasmaman/populate_gas_info()
..()
From 5e1987049d6ea63fac42fc88d8ce63bfed09d572 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Mon, 26 Aug 2024 20:02:40 +0200
Subject: [PATCH 050/114] lung code adapted
---
code/__DEFINES/atmospherics/atmos_core.dm | 2 ++
.../atmospherics/gasmixtures/gas_types.dm | 4 ++-
code/modules/surgery/organs/lungs.dm | 31 ++++++++-----------
3 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/code/__DEFINES/atmospherics/atmos_core.dm b/code/__DEFINES/atmospherics/atmos_core.dm
index 103f989b873fe..4708d97e29487 100644
--- a/code/__DEFINES/atmospherics/atmos_core.dm
+++ b/code/__DEFINES/atmospherics/atmos_core.dm
@@ -26,6 +26,8 @@
#define META_GAS_BREATH_REAGENT 9
///Defines the gas to which this gas is a result of breathing
#define META_GAS_BREATH_RESULTS 10
+///Reagents applied when the gas passes its dangerous threshold
+#define META_GAS_BREATH_REAGENT_DANGEROUS 11
//ATMOS
diff --git a/code/modules/atmospherics/gasmixtures/gas_types.dm b/code/modules/atmospherics/gasmixtures/gas_types.dm
index 0163caf45aa4b..7630b091b101b 100644
--- a/code/modules/atmospherics/gasmixtures/gas_types.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_types.dm
@@ -23,6 +23,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
gas_info[META_GAS_BREATH_ALERT_INFO] = intial(gas.breath_alert_info)
gas_info[META_GAS_BREATH_REAGENT] = initial(gas.breath_reagent)
gas_info[META_GAS_BREATH_RESULTS] = initial(gas.breath_results)
+ gas_info[META_GAS_BREATH_REAGENT_DANGEROUS] = initial(gas.breath_reagent_dangerous)
.[gas_path] = gas_info
@@ -53,9 +54,10 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
var/dangerous = FALSE //currently used by canisters
var/fusion_power = 0 //How much the gas accelerates a fusion reaction
var/rarity = 0 // relative rarity compared to other gases, used when setting up the reactions list.
- var/list/breath_alert_info = null
+ var/list/breath_alert_info = list()
var/breath_reagent = null
var/breath_results = null
+ var/breath_reagent_dangerous = null
/datum/gas/oxygen
id = "o2"
diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index 7f320a5295717..16802d29a9e59 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -143,13 +143,12 @@
var/alert_category
var/alert_type
if(ispath(breathing_class))
- var/datum/breathing_class/class = GLOB.gas_data.breathing_classes[breathing_class]
+ var/datum/breathing_class/class = GLOB.breathing_class_info[breathing_class]
alert_category = class.low_alert_category
alert_type = class.low_alert_datum
else
- 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"]
+ var/list/alert = GLOB.meta_gas_info[breathing_class][META_GAS_BREATH_ALERT_INFO]?["not_enough_alert"]
+ if(alert)
alert_category = alert["alert_category"]
alert_type = alert["alert_type"]
throw_alert_for(H, alert_category, alert_type)
@@ -163,9 +162,7 @@
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/breathing_classes = GLOB.breathing_class_info
var/list/mole_adjustments = list()
for(var/entry in gas_min)
var/required_pp = 0
@@ -192,12 +189,12 @@
else
required_moles = breath.gases[entry][MOLES]
required_pp = PP_MOLES(required_moles)
- if(entry in breath_alert_info)
- var/list/alert = breath_alert_info[entry]["not_enough_alert"]
+ var/list/alert = GLOB.meta_gas_info[entry][META_GAS_BREATH_ALERT_INFO]?["not_enough_alert"]
+ if(alert)
alert_category = alert["alert_category"]
alert_type = alert["alert_type"]
mole_adjustments[entry] = -required_moles
- mole_adjustments[breath_results[entry]] = required_moles
+ mole_adjustments[GLOB.meta_gas_info[entry][META_GAS_BREATH_RESULTS]] = required_moles
if(required_pp < safe_min)
var/multiplier = handle_too_little_breath(H, required_pp, safe_min, required_moles)
if(required_moles > 0)
@@ -210,7 +207,6 @@
if(H.health >= H.crit_threshold)
H.adjustOxyLoss(-breathModifier)
clear_alert_for(H, 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
@@ -224,14 +220,14 @@
danger_reagent = breathing_class.danger_reagent
found_pp = breathing_class.get_effective_pp(breath)
else
- danger_reagent = danger_reagents[entry]
- if(entry in breath_alert_info)
- var/list/alert = breath_alert_info[entry]["too_much_alert"]
+ danger_reagent = GLOB.meta_gas_info[entry][META_GAS_BREATH_REAGENT_DANGEROUS]
+ var/list/alert = GLOB.meta_gas_info[entry][META_GAS_BREATH_ALERT_INFO]?["too_much_alert"]
+ if(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))
+ if(danger_reagent && 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
@@ -239,10 +235,9 @@
throw_alert_for(H, alert_category, alert_type)
else
clear_alert_for(H, alert_category)
- var/list/breath_reagents = GLOB.gas_data.breath_reagents
for(var/gas in breath.gases)
- if(gas in breath_reagents)
- var/datum/reagent/R = breath_reagents[gas]
+ var/datum/reagent/R = GLOB.meta_gas_info[gas][META_GAS_BREATH_REAGENT]
+ if(R)
//H.reagents.add_reagent(R, breath.gases[gas][MOLES] * R.molarity) // See next line
H.reagents.add_reagent(R, breath.gases[gas][MOLES] * 2) // 2 represents molarity of O2, we don't have citadel molarity
mole_adjustments[gas] = (gas in mole_adjustments) ? mole_adjustments[gas] - breath.gases[gas][MOLES] : -breath.gases[gas][MOLES]
From dbe3742b1d907fecfa39233ba03f326fb4a30a5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Tue, 27 Aug 2024 16:53:24 +0200
Subject: [PATCH 051/114] Misc fixes, 36 problems and why would TG do this
---
code/__DEFINES/atmospherics/atmos_helpers.dm | 2 ++
code/game/machinery/_machinery.dm | 2 --
code/game/objects/items/tanks/jetpack.dm | 7 ++-----
code/game/objects/items/tanks/tanks.dm | 15 +++++++++------
.../atmospherics/environmental/LINDA_system.dm | 15 +++++++++++++++
.../atmospherics/gasmixtures/gas_mixture.dm | 1 -
.../modules/atmospherics/gasmixtures/gas_types.dm | 4 ++--
.../atmospherics/machinery/atmosmachinery.dm | 2 +-
.../machinery/components/components_base.dm | 2 +-
.../atmospherics/machinery/datum_pipeline.dm | 5 ++---
.../atmospherics/machinery/portable/pump.dm | 2 +-
.../atmospherics/machinery/portable/scrubber.dm | 2 +-
code/modules/power/singularity/collector.dm | 2 +-
13 files changed, 37 insertions(+), 24 deletions(-)
diff --git a/code/__DEFINES/atmospherics/atmos_helpers.dm b/code/__DEFINES/atmospherics/atmos_helpers.dm
index 67ccdb4321240..f6e3208bda0ad 100644
--- a/code/__DEFINES/atmospherics/atmos_helpers.dm
+++ b/code/__DEFINES/atmospherics/atmos_helpers.dm
@@ -73,3 +73,5 @@ GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
#define TURFS_CAN_SHARE(T1, T2) (LAZYACCESS(T2.atmos_adjacent_turfs, T1) || LAZYLEN(T1.atmos_adjacent_turfs & T2.atmos_adjacent_turfs))
//Use this to see if a turf is fully blocked or not, think windows or firelocks. Fails with 1x1 non full tile windows, but it's not worth the cost.
#define TURF_SHARES(T) (LAZYLEN(T.atmos_adjacent_turfs))
+/// Rounding
+#define QUANTIZE(variable) (round((variable), (MOLAR_ACCURACY)))
diff --git a/code/game/machinery/_machinery.dm b/code/game/machinery/_machinery.dm
index 9cc9fcd0fcf16..6a00fc82e7c2b 100644
--- a/code/game/machinery/_machinery.dm
+++ b/code/game/machinery/_machinery.dm
@@ -137,8 +137,6 @@ Class Procs:
var/tgui_id // ID of TGUI interface
var/ui_style // ID of custom TGUI style (optional)
- ///Is this machine currently in the atmos machinery queue?
- var/atmos_processing = FALSE
///Is this machine currently in the atmos machinery queue, but also interacting with turf air?
var/interacts_with_air = FALSE
diff --git a/code/game/objects/items/tanks/jetpack.dm b/code/game/objects/items/tanks/jetpack.dm
index ee6e25cc15698..448f23f813e6a 100644
--- a/code/game/objects/items/tanks/jetpack.dm
+++ b/code/game/objects/items/tanks/jetpack.dm
@@ -376,11 +376,8 @@
// Consume
if(use_fuel)
- var/datum/gas_mixture/our_mix = return_air()
- our_mix.gases[/datum/gas/plasma][MOLES] = QUANTIZE(our_mix.gases[/datum/gas/plasma][MOLES] - plasma_burn_rate
-)
- our_mix.gases[/datum/gas/oxygen][MOLES] = QUANTIZE(our_mix.gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate
-))
+ our_mix.gases[/datum/gas/plasma][MOLES] = QUANTIZE(our_mix.gases[/datum/gas/plasma][MOLES] - plasma_burn_rate)
+ our_mix.gases[/datum/gas/oxygen][MOLES] = QUANTIZE(our_mix.gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate))
update_fade(15)
update_lifespan(4)
diff --git a/code/game/objects/items/tanks/tanks.dm b/code/game/objects/items/tanks/tanks.dm
index 6bcffe69215e3..68c674879aad5 100644
--- a/code/game/objects/items/tanks/tanks.dm
+++ b/code/game/objects/items/tanks/tanks.dm
@@ -1,5 +1,8 @@
#define TTV_NO_CASING_MOD 0.25
#define REACTIONS_BEFORE_EXPLOSION 3
+/// How much time (in seconds) is assumed to pass while assuming air. Used to scale overpressure/overtemp damage when assuming air.
+#define ASSUME_AIR_DT_FACTOR 1
+
/obj/item/tank
name = "tank"
@@ -232,16 +235,16 @@
return TRUE
/obj/item/tank/assume_air_moles(datum/gas_mixture/giver, moles)
+ START_PROCESSING(SSobj, src)
giver.transfer_to(air_contents, moles)
-
- check_status()
- return 1
+ handle_tolerances(ASSUME_AIR_DT_FACTOR)
+ return TRUE
/obj/item/tank/assume_air_ratio(datum/gas_mixture/giver, ratio)
+ START_PROCESSING(SSobj, src)
giver.transfer_ratio_to(air_contents, ratio)
-
- check_status()
- return 1
+ handle_tolerances(ASSUME_AIR_DT_FACTOR)
+ return TRUE
/obj/item/tank/proc/remove_air_volume(volume_to_return)
if(!air_contents)
diff --git a/code/modules/atmospherics/environmental/LINDA_system.dm b/code/modules/atmospherics/environmental/LINDA_system.dm
index c3943a5406587..c6145c22480d6 100644
--- a/code/modules/atmospherics/environmental/LINDA_system.dm
+++ b/code/modules/atmospherics/environmental/LINDA_system.dm
@@ -142,3 +142,18 @@
air.merge(G)
archive()
SSair.add_to_active(src)
+
+/turf/proc/ImmediateDisableAdjacency(disable_adjacent = TRUE)
+ if(SSair.thread_running())
+ SSadjacent_air.disable_queue[src] = disable_adjacent
+ return
+ if(disable_adjacent)
+ for(var/direction in GLOB.cardinals_multiz)
+ var/turf/T = get_step_multiz(src, direction)
+ if(!istype(T))
+ continue
+ if (T.atmos_adjacent_turfs)
+ T.atmos_adjacent_turfs -= src
+ UNSETEMPTY(T.atmos_adjacent_turfs)
+ T.__update_auxtools_turf_adjacency_info(isspaceturf(T.get_z_base_turf()), -1)
+ LAZYCLEARLIST(atmos_adjacent_turfs)
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index 884c8257fa883..d6a40130eae79 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -8,7 +8,6 @@
*So for instance round(0.5, 1) == 1. I've hardcoded a fix for this into share, by forcing the garbage collect.
*Any other attempts to fix it just killed atmos. I leave this to a greater man then I
*/
-#define QUANTIZE(variable) (round((variable), (MOLAR_ACCURACY)))
GLOBAL_LIST_INIT(meta_gas_info, meta_gas_list()) //see ATMOSPHERICS/gas_types.dm
GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
diff --git a/code/modules/atmospherics/gasmixtures/gas_types.dm b/code/modules/atmospherics/gasmixtures/gas_types.dm
index 7630b091b101b..0c653906c148d 100644
--- a/code/modules/atmospherics/gasmixtures/gas_types.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_types.dm
@@ -20,7 +20,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
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_info[META_GAS_BREATH_ALERT_INFO] = intial(gas.breath_alert_info)
+ gas_info[META_GAS_BREATH_ALERT_INFO] = gas.breath_alert_info
gas_info[META_GAS_BREATH_REAGENT] = initial(gas.breath_reagent)
gas_info[META_GAS_BREATH_RESULTS] = initial(gas.breath_results)
gas_info[META_GAS_BREATH_REAGENT_DANGEROUS] = initial(gas.breath_reagent_dangerous)
@@ -54,7 +54,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
var/dangerous = FALSE //currently used by canisters
var/fusion_power = 0 //How much the gas accelerates a fusion reaction
var/rarity = 0 // relative rarity compared to other gases, used when setting up the reactions list.
- var/list/breath_alert_info = list()
+ var/list/breath_alert_info = null
var/breath_reagent = null
var/breath_results = null
var/breath_reagent_dangerous = null
diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm
index 21dd8785959a7..04251a23661e6 100644
--- a/code/modules/atmospherics/machinery/atmosmachinery.dm
+++ b/code/modules/atmospherics/machinery/atmosmachinery.dm
@@ -172,7 +172,7 @@
/obj/machinery/atmospherics/proc/return_pipenet()
return
-/obj/machinery/atmospherics/proc/return_pipenetAir()
+/obj/machinery/atmospherics/proc/return_pipenet_airs()
return
/obj/machinery/atmospherics/proc/set_pipenet()
diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm
index b3ee7f4893b7e..ec35da0343dde 100644
--- a/code/modules/atmospherics/machinery/components/components_base.dm
+++ b/code/modules/atmospherics/machinery/components/components_base.dm
@@ -144,7 +144,7 @@
CRASH("nullifyPipenet() called on qdeleting [reference]")
qdel(reference)
-/obj/machinery/atmospherics/components/return_pipenetAirs(datum/pipeline/reference)
+/obj/machinery/atmospherics/components/return_pipenet_airs(datum/pipeline/reference)
var/list/returned_air = list()
for (var/i in 1 to parents.len)
diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm
index 0eee42ffbc314..669a412d3fee5 100644
--- a/code/modules/atmospherics/machinery/datum_pipeline.dm
+++ b/code/modules/atmospherics/machinery/datum_pipeline.dm
@@ -121,7 +121,7 @@
/datum/pipeline/proc/add_machinery_member(obj/machinery/atmospherics/components/considered_component)
other_atmos_machines |= considered_component
- var/list/returned_airs = considered_component.return_pipenetAirs(src)
+ var/list/returned_airs = considered_component.return_pipenet_airs(src)
if (!length(returned_airs) || (null in returned_airs))
stack_trace("add_machinery_member: 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])")
@@ -241,9 +241,8 @@
/datum/pipeline/proc/return_air()
. = other_airs + air
- if(null in .)
+ if(list_clear_nulls(.))
stack_trace("[src] has one or more null gas mixtures, which may cause bugs. Null mixtures will not be considered in reconcile_air().")
- return removeNullsFromList(.)
/datum/pipeline/proc/reconcile_air()
var/list/datum/gas_mixture/gas_mixture_list = list()
diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm
index 1031492e4aea8..c8bb89f4baece 100644
--- a/code/modules/atmospherics/machinery/portable/pump.dm
+++ b/code/modules/atmospherics/machinery/portable/pump.dm
@@ -107,7 +107,7 @@
var/turf/T = get_turf(src)
var/datum/gas_mixture/temp_air_contents = return_air()
- var/datum/gas_mixture/temp_holding_air_contents = holding_return_air()
+ var/datum/gas_mixture/temp_holding_air_contents = holding.return_air()
if(direction == PUMP_OUT) // Hook up the internal pump.
pump.airs[1] = holding ? temp_holding_air_contents : temp_air_contents
pump.airs[2] = holding ? temp_air_contents : T.return_air()
diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm
index d4f4dcbf805af..41f77d1599ba3 100644
--- a/code/modules/atmospherics/machinery/portable/scrubber.dm
+++ b/code/modules/atmospherics/machinery/portable/scrubber.dm
@@ -79,7 +79,7 @@
data["id_tag"] = -1 //must be defined in order to reuse code between portable and vent scrubbers
data["filter_types"] = list()
for(var/gas_type in subtypesof(/datum/gas))
- data["filter_types"] += list(list("gas_id" = GLOB.meta_gas_info[gas_type][META_GAS_ID], "gas_name" = GLOB.meta_gas_info[gas_type][META_GAS_NAME], "enabled" = (id in scrubbing)))
+ data["filter_types"] += list(list("gas_id" = GLOB.meta_gas_info[gas_type][META_GAS_ID], "gas_name" = GLOB.meta_gas_info[gas_type][META_GAS_NAME], "enabled" = (gas_type in scrubbing)))
if(holding)
data["holding"] = list()
diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm
index e9c6af9e9689b..031009d60dd43 100644
--- a/code/modules/power/singularity/collector.dm
+++ b/code/modules/power/singularity/collector.dm
@@ -87,7 +87,7 @@
toggle_power()
user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \
"You turn the [src.name] [active? "on":"off"].")
- var/fuel = loaded_tank_air.gases[/datum/gas/plasma][MOLES]
+ var/fuel = loaded_tank.air_contents.gases[/datum/gas/plasma][MOLES]
investigate_log("turned [active?"on":"off"] by [key_name(user)]. [loaded_tank?"Fuel: [round(fuel/0.29)]%":"It is empty"].", INVESTIGATE_ENGINES)
return
else
From e4397dd120bb6b669806bef0cebe1c2e60fde5fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Tue, 27 Aug 2024 17:56:40 +0200
Subject: [PATCH 052/114] Some more tgstation/61904 progress
---
code/__DEFINES/atmospherics/atmos_helpers.dm | 2 +-
code/controllers/subsystem/air.dm | 2 +-
code/game/turfs/open/floor/reinf_floor.dm | 2 +-
code/game/turfs/open/openspace.dm | 2 +-
.../environmental/LINDA_system.dm | 42 +--
.../environmental/LINDA_turf_tile.dm | 244 ++++++++++--------
.../atmospherics/machinery/atmosmachinery.dm | 9 +-
.../machinery/components/components_base.dm | 14 +-
code/modules/mapping/map_template.dm | 2 +-
9 files changed, 169 insertions(+), 150 deletions(-)
diff --git a/code/__DEFINES/atmospherics/atmos_helpers.dm b/code/__DEFINES/atmospherics/atmos_helpers.dm
index f6e3208bda0ad..030a8c0b7e284 100644
--- a/code/__DEFINES/atmospherics/atmos_helpers.dm
+++ b/code/__DEFINES/atmospherics/atmos_helpers.dm
@@ -2,7 +2,7 @@
///Check if the turfs allows gas passage based on density, do not use.
#define CANATMOSPASS(A, O) ( A.can_atmos_pass == ATMOS_PASS_PROC ? A.can_atmos_pass(O) : ( A.can_atmos_pass == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_pass ) )
///Check if the turfs allows gas passage on a z level, do not use.
-#define CANVERTICALATMOSPASS(A, O) ( A.can_atmos_passVertical == ATMOS_PASS_PROC ? A.can_atmos_pass(O, TRUE) : ( A.can_atmos_passVertical == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_passVertical ) )
+#define CANVERTICALATMOSPASS(A, O) ( A.can_atmos_pass_vertical == ATMOS_PASS_PROC ? A.can_atmos_pass(O, TRUE) : ( A.can_atmos_pass_vertical == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_pass_vertical ) )
//Helpers
///Moves the icon of the device based on the piping layer and on the direction
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index aa5ae4e5e562b..117725927b25d 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -121,7 +121,7 @@ SUBSYSTEM_DEF(air)
while(length(pause_processing))
var/turf/T = pause_processing[length(pause_processing)]
- T.ImmediateDisableAdjacency()
+ T.immediate_disable_adjacency()
//Goodbye
pause_processing.len --
//We overran this tick, stop processing
diff --git a/code/game/turfs/open/floor/reinf_floor.dm b/code/game/turfs/open/floor/reinf_floor.dm
index 0b154861f03f8..65000cf9f13e5 100644
--- a/code/game/turfs/open/floor/reinf_floor.dm
+++ b/code/game/turfs/open/floor/reinf_floor.dm
@@ -131,7 +131,7 @@
floor_tile = null
var/obj/effect/clockwork/overlay/floor/bloodcult/realappearance
can_atmos_pass = ATMOS_PASS_NO
- can_atmos_passVertical = ATMOS_PASS_NO
+ can_atmos_pass_vertical = ATMOS_PASS_NO
/turf/open/floor/engine/cult/Initialize(mapload)
diff --git a/code/game/turfs/open/openspace.dm b/code/game/turfs/open/openspace.dm
index e3ffe3e53743c..b603ddff1c12f 100644
--- a/code/game/turfs/open/openspace.dm
+++ b/code/game/turfs/open/openspace.dm
@@ -3,7 +3,7 @@
desc = "Watch your step!"
icon_state = "invisible"
baseturfs = /turf/open/openspace
- can_atmos_passVertical = ATMOS_PASS_YES
+ can_atmos_pass_vertical = ATMOS_PASS_YES
overfloor_placed = FALSE
underfloor_accessibility = UNDERFLOOR_INTERACTABLE
allow_z_travel = TRUE
diff --git a/code/modules/atmospherics/environmental/LINDA_system.dm b/code/modules/atmospherics/environmental/LINDA_system.dm
index c6145c22480d6..8c678ec710b2c 100644
--- a/code/modules/atmospherics/environmental/LINDA_system.dm
+++ b/code/modules/atmospherics/environmental/LINDA_system.dm
@@ -1,5 +1,5 @@
/atom/var/can_atmos_pass = ATMOS_PASS_YES
-/atom/var/can_atmos_passVertical = ATMOS_PASS_YES
+/atom/var/can_atmos_pass_vertical = ATMOS_PASS_YES
/atom/proc/can_atmos_pass(turf/T)
switch (can_atmos_pass)
@@ -11,10 +11,10 @@
return can_atmos_pass
/turf/can_atmos_pass = ATMOS_PASS_NO
-/turf/can_atmos_passVertical = ATMOS_PASS_NO
+/turf/can_atmos_pass_vertical = ATMOS_PASS_NO
/turf/open/can_atmos_pass = ATMOS_PASS_PROC
-/turf/open/can_atmos_passVertical = ATMOS_PASS_PROC
+/turf/open/can_atmos_pass_vertical = ATMOS_PASS_PROC
//Do NOT use this to see if 2 turfs are connected, it mutates state, and we cache that info anyhow. Use TURFS_CAN_SHARE or TURF_SHARES depending on your usecase
/turf/open/can_atmos_pass(turf/T, vertical = FALSE)
@@ -82,27 +82,29 @@
for (var/direction in GLOB.diagonals_multiz)
var/matching_directions = 0
- var/turf/S = get_step_multiz(current_location, direction)
- if(!S)
+ var/turf/checked_turf = get_step_multiz(current_location, direction)
+ if(!checked_turf)
continue
for (var/check_direction in GLOB.cardinals_multiz)
- var/turf/checkTurf = get_step(S, check_direction)
- if(!S.atmos_adjacent_turfs || !S.atmos_adjacent_turfs[checkTurf])
+ var/turf/secondary_turf = get_step(checked_turf, check_direction)
+ if(!checked_turf.atmos_adjacent_turfs || !checked_turf.atmos_adjacent_turfs[secondary_turf])
continue
if (adjacent_turfs[checkTurf])
matching_directions++
if (matching_directions >= 2)
- adjacent_turfs += S
+ adjacent_turfs += checked_turf
break
return adjacent_turfs
/atom/proc/air_update_turf(update = FALSE, remove = FALSE)
- var/turf/T = get_turf(loc)
- T.air_update_turf(update, remove)
+ var/turf/local_turf = get_turf(loc)
+ if(!local_turf)
+ return
+ local_turf.air_update_turf(update, remove)
/**
* A helper proc for dealing with atmos changes
@@ -121,29 +123,29 @@
else
SSair.add_to_active(src)
-/atom/movable/proc/move_update_air(turf/T)
- if(isturf(T))
- T.air_update_turf(TRUE, FALSE) //You're empty now
+/atom/movable/proc/move_update_air(turf/target_turf)
+ if(isturf(target_turf))
+ target_turf.air_update_turf(TRUE, FALSE) //You're empty now
air_update_turf(TRUE, TRUE) //You aren't
/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)
- if(!istype(T))
+ var/turf/open/local_turf = get_turf(src)
+ if(!istype(local_turf))
return
- T.atmos_spawn_air(text)
+ local_turf.atmos_spawn_air(text)
/turf/open/atmos_spawn_air(text)
if(!text || !air)
return
- var/datum/gas_mixture/G = new
- G.parse_gas_string(text)
+ var/datum/gas_mixture/turf_mixture = new
+ turf_mixture.parse_gas_string(text)
- air.merge(G)
+ air.merge(turf_mixture)
archive()
SSair.add_to_active(src)
-/turf/proc/ImmediateDisableAdjacency(disable_adjacent = TRUE)
+/turf/proc/immediate_disable_adjacency(disable_adjacent = TRUE)
if(SSair.thread_running())
SSadjacent_air.disable_queue[src] = disable_adjacent
return
diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
index 3ba815f593ec3..025dee1a2f277 100644
--- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
+++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
@@ -13,25 +13,37 @@
var/archived_cycle = 0
var/current_cycle = 0
- //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
+ /**
+ * 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
+ * approximation of MOLES_O2STANDARD and MOLES_N2STANDARD pending byond allowing constant expressions to be embedded in constant strings
+ * If someone will place 0 of some gas there, SHIT WILL BREAK. Do not do that.
+ **/
var/initial_gas_mix = OPENTURF_DEFAULT_ATMOS
//approximation of MOLES_O2STANDARD and MOLES_N2STANDARD pending byond allowing constant expressions to be embedded in constant strings
// If someone will place 0 of some gas there, SHIT WILL BREAK. Do not do that.
/turf/open
//used for spacewind
+ ///Pressure difference between two turfs
var/pressure_difference = 0
+ ///Where the difference come from (from higher pressure to lower pressure)
var/pressure_direction = 0
+ ///Excited group we are part of
var/datum/excited_group/excited_group
+ ///Are we active?
var/excited = FALSE
+ ///Our gas mix
var/datum/gas_mixture/turf/air
+ ///If there is an active hotspot on us store a reference to it here
var/obj/effect/hotspot/active_hotspot
+ ///Whether or not we are a planetary turf
var/planetary_atmos = FALSE //air will revert to initial_gas_mix
- var/list/atmos_overlay_types //gas IDs of current active gas overlays
+ ///gas IDs of current active gas overlays
+ var/list/atmos_overlay_types
var/significant_share_ticker = 0
#ifdef TRACK_MAX_SHARE
var/max_share = 0
@@ -52,8 +64,8 @@
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)
+ for(var/near_turf in atmos_adjacent_turfs)
+ SSair.add_to_active(near_turf)
return ..()
/////////////////GAS MIXTURE PROCS///////////////////
@@ -71,9 +83,9 @@
update_visuals()
return removed
-/turf/open/proc/copy_air_with_tile(turf/open/T)
- if(istype(T))
- air.copy_from(T.air)
+/turf/open/proc/copy_air_with_tile(turf/open/target_turf)
+ if(istype(target_turf))
+ air.copy_from(target_turf.air)
/turf/open/proc/copy_air(datum/gas_mixture/copy)
if(copy)
@@ -81,9 +93,9 @@
/turf/return_air()
RETURN_TYPE(/datum/gas_mixture)
- var/datum/gas_mixture/GM = new
- GM.copy_from_turf(src)
- return GM
+ var/datum/gas_mixture/copied_mixture = new
+ copied_mixture.copy_from_turf(src)
+ return copied_mixture
/turf/open/return_air()
RETURN_TYPE(/datum/gas_mixture)
@@ -281,11 +293,11 @@
should_share_air = TRUE
else if(our_air.compare(enemy_air)) //Lets see if you're up for it
SSair.add_to_active(enemy_tile) //Add yourself young man
- var/datum/excited_group/EG = our_excited_group || enemy_excited_group || new
+ var/datum/excited_group/existing_group = our_excited_group || enemy_excited_group || new
if(!our_excited_group)
- EG.add_turf(src)
+ existing_group.add_turf(src)
if(!enemy_excited_group)
- EG.add_turf(enemy_tile)
+ existing_group.add_turf(enemy_tile)
our_excited_group = excited_group
should_share_air = TRUE
@@ -304,19 +316,19 @@
/******************* GROUP HANDLING FINISH *********************************************************************/
if (planetary_atmos) //share our air with the "atmosphere" "above" the turf
- var/datum/gas_mixture/G = SSair.planetary[initial_gas_mix]
+ var/datum/gas_mixture/planetary_mix = SSair.planetary[initial_gas_mix]
// archive ourself again so we don't accidentally share more gas than we currently have
archive()
- if(our_air.compare(G))
+ if(our_air.compare(planetary_mix))
if(!our_excited_group)
- var/datum/excited_group/EG = new
- EG.add_turf(src)
+ var/datum/excited_group/new_group = new
+ new_group.add_turf(src)
our_excited_group = excited_group
// shares 4/5 of our difference in moles with the atmosphere
- our_air.share(G, 0.25)
+ our_air.share(planetary_mix, 0.25)
// temperature share with the atmosphere with an inflated heat capacity to simulate faster sharing with a large atmosphere
- our_air.temperature_share(G, OPEN_HEAT_TRANSFER_COEFFICIENT, G.temperature_archived, G.heat_capacity() * 5)
- G.garbage_collect()
+ our_air.temperature_share(planetary_mix, OPEN_HEAT_TRANSFER_COEFFICIENT, planetary_mix.temperature_archived, planetary_mix.heat_capacity() * 5)
+ planetary_mix.garbage_collect()
PLANET_SHARE_CHECK
our_air.react(src)
@@ -333,30 +345,32 @@
//////////////////////////SPACEWIND/////////////////////////////
-/turf/open/proc/consider_pressure_difference(turf/T, difference)
+/turf/open/proc/consider_pressure_difference(turf/target_turf, difference)
SSair.high_pressure_delta |= src
if(difference > pressure_difference)
- pressure_direction = get_dir(src, T)
+ pressure_direction = get_dir(src, target_turf)
pressure_difference = difference
/turf/open/proc/high_pressure_movements()
- var/atom/movable/M
+ var/atom/movable/moving_atom
for(var/thing in src)
- M = thing
- if (!M.anchored && !M.pulledby && M.last_high_pressure_movement_air_cycle < SSair.times_fired)
- M.experience_pressure_difference(pressure_difference, pressure_direction)
+ moving_atom = thing
+ if (!moving_atom.anchored && !moving_atom.pulledby && moving_atom.last_high_pressure_movement_air_cycle < SSair.times_fired)
+ moving_atom.experience_pressure_difference(pressure_difference, pressure_direction)
-/atom/movable/var/pressure_resistance = 10
-/atom/movable/var/last_high_pressure_movement_air_cycle = 0
+/atom/movable
+ ///How much delta pressure is needed for us to move
+ var/pressure_resistance = 10
+ var/last_high_pressure_movement_air_cycle = 0
/atom/movable/proc/experience_pressure_difference(pressure_difference, direction, pressure_resistance_prob_delta = 0)
var/const/PROBABILITY_OFFSET = 25
var/const/PROBABILITY_BASE_PRECENT = 75
- var/max_force = sqrt(pressure_difference)*(MOVE_FORCE_DEFAULT / 5)
+ var/max_force = sqrt(pressure_difference) * (MOVE_FORCE_DEFAULT / 5)
set waitfor = FALSE
var/move_prob = 100
if (pressure_resistance > 0)
- move_prob = (pressure_difference/pressure_resistance*PROBABILITY_BASE_PRECENT)-PROBABILITY_OFFSET
+ move_prob = (pressure_difference / pressure_resistance * PROBABILITY_BASE_PRECENT) - PROBABILITY_OFFSET
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))))
step(src, direction)
@@ -374,72 +388,77 @@
We solve this with excited group cleanup. See the documentation for more details.
*/
/datum/excited_group
+ ///Stores a reference to the turfs we are controlling
var/list/turf_list = list()
+ ///If this is over EXCITED_GROUP_BREAKDOWN_CYCLES we call self_breakdown()
var/breakdown_cooldown = 0
+ ///If this is over EXCITED_GROUP_DISMANTLE_CYCLES we call dismantle()
var/dismantle_cooldown = 0
+ ///Used for debug to show the excited groups active and their turfs
var/should_display = FALSE
+ ///Id of the index color of the displayed group
var/display_id = 0
+ ///Wrapping loop of the index colors
var/static/wrapping_id = 0
/datum/excited_group/New()
SSair.excited_groups += src
-/datum/excited_group/proc/add_turf(turf/open/T)
- turf_list += T
- T.excited_group = src
+/datum/excited_group/proc/add_turf(turf/open/target_turf)
+ turf_list += target_turf
+ target_turf.excited_group = src
dismantle_cooldown = 0
if(should_display || SSair.display_all_groups)
- display_turf(T)
-
-/datum/excited_group/proc/merge_groups(datum/excited_group/E)
- if(turf_list.len > E.turf_list.len)
- SSair.excited_groups -= E
- for(var/t in E.turf_list)
- var/turf/open/T = t
- T.excited_group = src
- turf_list += T
- should_display = E.should_display | should_display
+ display_turf(target_turf)
+
+/datum/excited_group/proc/merge_groups(datum/excited_group/target_group)
+ if(turf_list.len > target_group.turf_list.len)
+ SSair.excited_groups -= target_group
+ for(var/turf/open/group_member as anything in target_group.turf_list)
+ group_member.excited_group = src
+ turf_list += group_member
+ should_display = target_group.should_display | should_display
if(should_display || SSair.display_all_groups)
- E.hide_turfs()
+ target_group.hide_turfs()
display_turfs()
- breakdown_cooldown = min(breakdown_cooldown, E.breakdown_cooldown) //Take the smaller of the two options
+ breakdown_cooldown = min(breakdown_cooldown, target_group.breakdown_cooldown) //Take the smaller of the two options
dismantle_cooldown = 0
else
SSair.excited_groups -= src
- for(var/t in turf_list)
- var/turf/open/T = t
- T.excited_group = E
- E.turf_list += T
- E.should_display = E.should_display | should_display
- if(E.should_display || SSair.display_all_groups)
+ for(var/turf/open/group_member as anything in turf_list)
+ group_member.excited_group = target_group
+ target_group.turf_list += group_member
+ target_group.should_display = target_group.should_display | should_display
+ if(target_group.should_display || SSair.display_all_groups)
hide_turfs()
- E.display_turfs()
- E.breakdown_cooldown = min(breakdown_cooldown, E.breakdown_cooldown)
- E.dismantle_cooldown = 0
+ target_group.display_turfs()
+ target_group.breakdown_cooldown = min(breakdown_cooldown, target_group.breakdown_cooldown)
+ target_group.dismantle_cooldown = 0
+
/datum/excited_group/proc/reset_cooldowns()
breakdown_cooldown = 0
dismantle_cooldown = 0
+
/datum/excited_group/proc/self_breakdown(roundstart = FALSE, poke_turfs = FALSE)
- var/datum/gas_mixture/A = new
+ var/datum/gas_mixture/shared_mix = new
//make local for sanic speed
- var/list/A_gases = A.gases
+ var/list/shared_gases = shared_mix.gases
var/list/turf_list = src.turf_list
var/turflen = turf_list.len
var/imumutable_in_group = FALSE
var/energy = 0
var/heat_cap = 0
- for(var/t in turf_list)
- var/turf/open/T = t
+ for(var/turf/open/group_member as anything in turf_list)
//Cache?
- var/datum/gas_mixture/turf/mix = T.air
- if (roundstart && istype(T.air, /datum/gas_mixture/immutable))
+ var/datum/gas_mixture/turf/mix = group_member.air
+ if (roundstart && istype(group_member.air, /datum/gas_mixture/immutable))
imumutable_in_group = TRUE
- A.copy_from(T.air) //This had better be immutable young man
- A_gases = A.gases //update the cache
+ shared_mix.copy_from(group_member.air) //This had better be immutable young man
+ shared_gases = shared_mix.gases //update the cache
break
//"borrowing" this code from merge(), I need to play with the temp portion. Lets expand it out
//temperature = (giver.temperature * giver_heat_capacity + temperature * self_heat_capacity) / combined_heat_capacity
@@ -449,37 +468,35 @@
var/list/giver_gases = mix.gases
for(var/giver_id in giver_gases)
- ASSERT_GAS(giver_id, A)
- A_gases[giver_id][MOLES] += giver_gases[giver_id][MOLES]
+ ASSERT_GAS(giver_id, shared_mix)
+ shared_gases[giver_id][MOLES] += giver_gases[giver_id][MOLES]
if(!imumutable_in_group)
- A.temperature = energy / heat_cap
- for(var/id in A_gases)
- A_gases[id][MOLES] /= turflen
- A.garbage_collect()
-
- for(var/t in turf_list)
- var/turf/open/T = t
- if(T.planetary_atmos) //We do this as a hack to try and minimize unneeded excited group spread over planetary turfs
- T.air.copy_from(SSair.planetary[T.initial_gas_mix]) //Comes with a cost of "slower" drains, but it's worth it
+ shared_mix.temperature = energy / heat_cap
+ for(var/id in shared_gases)
+ shared_gases[id][MOLES] /= turflen
+ shared_mix.garbage_collect()
+
+ for(var/turf/open/group_member as anything in turf_list)
+ if(group_member.planetary_atmos) //We do this as a hack to try and minimize unneeded excited group spread over planetary turfs
+ group_member.air.copy_from(SSair.planetary[group_member.initial_gas_mix]) //Comes with a cost of "slower" drains, but it's worth it
else
- T.air.copy_from(A) //Otherwise just set the mix to a copy of our equalized mix
- T.update_visuals()
+ group_member.air.copy_from(shared_mix) //Otherwise just set the mix to a copy of our equalized mix
+ group_member.update_visuals()
if(poke_turfs) //Because we only activate all these once every breakdown, in event of lag due to this code and slow space + vent things, increase the wait time for breakdowns
- SSair.add_to_active(T)
- T.significant_share_ticker = EXCITED_GROUP_DISMANTLE_CYCLES //Max out the ticker, if they don't share next tick, nuke em
+ SSair.add_to_active(group_member)
+ group_member.significant_share_ticker = EXCITED_GROUP_DISMANTLE_CYCLES //Max out the ticker, if they don't share next tick, nuke em
breakdown_cooldown = 0
///Dismantles the excited group, puts allll the turfs to sleep
/datum/excited_group/proc/dismantle()
- for(var/t in turf_list)
- var/turf/open/T = t
- T.excited = FALSE
- T.significant_share_ticker = 0
- SSair.active_turfs -= T
+ for(var/turf/open/current_turf as anything in turf_list)
+ current_turf.excited = FALSE
+ current_turf.significant_share_ticker = 0
+ SSair.active_turfs -= current_turf
#ifdef VISUALIZE_ACTIVE_TURFS //Use this when you want details about how the turfs are moving, display_all_groups should work for normal operation
- T.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, COLOR_VIBRANT_LIME)
+ current_turf.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, COLOR_VIBRANT_LIME)
#endif
garbage_collect()
@@ -487,9 +504,8 @@
/datum/excited_group/proc/garbage_collect()
if(display_id) //If we ever did make those changes
hide_turfs()
- for(var/t in turf_list)
- var/turf/open/T = t
- T.excited_group = null
+ for(var/turf/open/current_turf as anything in turf_list)
+ current_turf.excited_group = null
turf_list.Cut()
SSair.excited_groups -= src
if(SSair.currentpart == SSAIR_EXCITEDGROUPS)
@@ -542,8 +558,8 @@ Then we space some of our heat, and think about if we should stop conducting.
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))
+ var/turf/checked_turf = get_step(src, direction)
+ if(!(checked_turf in atmos_adjacent_turfs) && !(atmos_supeconductivity & direction))
. |= direction
///These two procs are a bit of a web, I belive in you
@@ -556,34 +572,35 @@ Then we space some of our heat, and think about if we should stop conducting.
/turf/open/neighbor_conduct_with_src(turf/other)
if(blocks_air)
- ..()
- return
+ return ..()
if(!other.blocks_air) //Both tiles are open
- var/turf/open/T = other
- T.air.temperature_share(air, WINDOW_HEAT_TRANSFER_COEFFICIENT)
+ var/turf/open/open_other = other
+ open_other.air.temperature_share(air, WINDOW_HEAT_TRANSFER_COEFFICIENT)
else //Open but neighbor is solid
temperature_share_open_to_solid(other)
SSair.add_to_active(src)
+
/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(!(conductivity_directions & direction))
+ continue
+ var/turf/neighbor = get_step(src, direction)
- if(!neighbor.thermal_conductivity)
- continue
+ if(!neighbor.thermal_conductivity)
+ continue
- if(neighbor.archived_cycle < SSair.times_fired)
- neighbor.archive()
+ if(neighbor.archived_cycle < SSair.times_fired)
+ neighbor.archive()
- neighbor.neighbor_conduct_with_src(src)
+ neighbor.neighbor_conduct_with_src(src)
- neighbor.consider_superconductivity()
+ neighbor.consider_superconductivity()
radiate_to_spess()
@@ -622,13 +639,14 @@ Then we space some of our heat, and think about if we should stop conducting.
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
+ if(temperature <= T0C) //Considering 0 degC as te break even point for radiation in and out
+ return
+ var/delta_temperature = (temperature_archived - TCMB) //hardcoded space temperature
+ if(heat_capacity <= 0 || abs(delta_temperature) <= MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
+ return
+ 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)
@@ -636,9 +654,7 @@ Then we space some of our heat, and think about if we should stop conducting.
/turf/proc/share_temperature_mutual_solid(turf/sharer, conduction_coefficient) //This is all just heat sharing, don't get freaked out
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)) //The larger the combined capacity the less is shared
-
- temperature -= heat/heat_capacity //The higher your own heat cap the less heat you get from this arrangement
- sharer.temperature += heat/sharer.heat_capacity
+ var/heat = conduction_coefficient * delta_temperature * \
+ (heat_capacity * sharer.heat_capacity / (heat_capacity + sharer.heat_capacity)) //The larger the combined capacity the less is shared
+ temperature -= heat / heat_capacity //The higher your own heat cap the less heat you get from this arrangement
+ sharer.temperature += heat / sharer.heat_capacity
diff --git a/code/modules/atmospherics/machinery/atmosmachinery.dm b/code/modules/atmospherics/machinery/atmosmachinery.dm
index 04251a23661e6..6cd0cfd907059 100644
--- a/code/modules/atmospherics/machinery/atmosmachinery.dm
+++ b/code/modules/atmospherics/machinery/atmosmachinery.dm
@@ -97,10 +97,11 @@
return
/obj/machinery/atmospherics/proc/nullify_node(i)
- if(nodes[i])
- var/obj/machinery/atmospherics/N = nodes[i]
- N.disconnect(src)
- nodes[i] = null
+ if(!nodes[i])
+ return
+ var/obj/machinery/atmospherics/node_machine = nodes[i]
+ node_machine.disconnect(src)
+ nodes[i] = null
/obj/machinery/atmospherics/proc/get_node_connects()
var/list/node_connects = list()
diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm
index ec35da0343dde..3bbfa787aada9 100644
--- a/code/modules/atmospherics/machinery/components/components_base.dm
+++ b/code/modules/atmospherics/machinery/components/components_base.dm
@@ -23,9 +23,9 @@
..()
for(var/i in 1 to device_type)
- var/datum/gas_mixture/A = new
- A.volume = 200
- airs[i] = A
+ var/datum/gas_mixture/component_mixture = new
+ component_mixture.volume = 200
+ airs[i] = component_mixture
/obj/machinery/atmospherics/components/Initialize()
. = ..()
@@ -157,11 +157,11 @@
return list(nodes[parents.Find(reference)])
return ..()
-/obj/machinery/atmospherics/components/set_pipenet(datum/pipeline/reference, obj/machinery/atmospherics/A)
- parents[nodes.Find(A)] = reference
+/obj/machinery/atmospherics/components/set_pipenet(datum/pipeline/reference, obj/machinery/target_component)
+ parents[nodes.Find(target_component)] = reference
-/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/return_pipenet(obj/machinery/atmospherics/target_component = nodes[1]) //returns parents[1] if called without argument
+ return parents[nodes.Find(target_component)]
/obj/machinery/atmospherics/components/replace_pipenet(datum/pipeline/Old, datum/pipeline/New)
parents[parents.Find(Old)] = New
diff --git a/code/modules/mapping/map_template.dm b/code/modules/mapping/map_template.dm
index f855707a46082..2563893c7c38b 100644
--- a/code/modules/mapping/map_template.dm
+++ b/code/modules/mapping/map_template.dm
@@ -150,7 +150,7 @@
locate(min(T.x+width, world.maxx), min(T.y+height, world.maxy), T.z))
for(var/L in border)
var/turf/turf_to_disable = L
- turf_to_disable.ImmediateDisableAdjacency()
+ turf_to_disable.immediate_disable_adjacency()
// Accept cached maps, but don't save them automatically - we don't want
// ruins clogging up memory for the whole round.
From 463f724617317bb5d42e2d8dbbbee18a76426282 Mon Sep 17 00:00:00 2001
From: vincentiusvin <54709710+vincentiusvin@users.noreply.github.com>
Date: Wed, 19 Jan 2022 06:22:26 +0700
Subject: [PATCH 053/114] Holy shit what a bad cherry-pick, let's hope there's
no unforseen consequences :clueless: (tgstation#62320)
Ever pump hot nob into a tank of oxygen, see the pressure rise to 8000 kpa for a few seconds and have that deafening explosion sound play right after? This attempts to eliminate those by making the pressure transfer proc thingy in gas_mixture account for resulting temperature. The old one is preserved if the temperature difference isn't too big because it's most definitely more performant. The minimum temperature difference of 5 is completely arbitrary and I won't mind changing if asked. Math is a bit messy by necessity but I hope the comment is adequate.
While I'm at it i also changed the return value of those procs to return a removed gasmix instead of directly merging. I sort of needed this for a clean implementation of assume_air in #62284. Will need more testing though. Found a better solution.
Writes a small unit test to check for this too.
Cuts down on one unintended cause of explosions.
---
code/__DEFINES/atmospherics/atmos_core.dm | 3 +
code/__DEFINES/maths.dm | 8 +-
.../atmospherics/gasmixtures/gas_mixture.dm | 206 ++++++++++++++----
code/modules/unit_tests/_unit_tests.dm | 1 +
code/modules/unit_tests/gas_transfer.dm | 32 +++
5 files changed, 202 insertions(+), 48 deletions(-)
create mode 100644 code/modules/unit_tests/gas_transfer.dm
diff --git a/code/__DEFINES/atmospherics/atmos_core.dm b/code/__DEFINES/atmospherics/atmos_core.dm
index 4708d97e29487..40d2a96456250 100644
--- a/code/__DEFINES/atmospherics/atmos_core.dm
+++ b/code/__DEFINES/atmospherics/atmos_core.dm
@@ -197,3 +197,6 @@
#define MAKE_ACTIVE 2
///Disable excited group
#define KILL_EXCITED 3
+
+/// How many maximum iterations do we allow the Newton-Raphson approximation for gas pressure to do.
+#define ATMOS_PRESSURE_APPROXIMATION_ITERATIONS 10
diff --git a/code/__DEFINES/maths.dm b/code/__DEFINES/maths.dm
index e447eb3149ed0..e7a3b86930230 100644
--- a/code/__DEFINES/maths.dm
+++ b/code/__DEFINES/maths.dm
@@ -1,3 +1,9 @@
+// Remove these once we have Byond implementation.
+#define ISNAN(a) (!(a==a))
+#define ISINF(a) (!ISNAN(a) && ISNAN(a-a))
+#define IS_INF_OR_NAN(a) (ISNAN(a-a))
+// Aight dont remove the rest
+
// Credits to Nickr5 for the useful procs I've taken from his library resource.
// This file is quadruple wrapped for your pleasure
// (
@@ -99,7 +105,7 @@
. = list()
var/d = b*b - 4 * a * c
var/bottom = 2 * a
- if(d < 0)
+ if(d < 0 || IS_INF_OR_NAN(d) || IS_INF_OR_NAN(bottom))
return
var/root = sqrt(d)
. += (-b + root) / bottom
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index d6a40130eae79..d01bca3dc1d25 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -508,11 +508,19 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
if(.) //If we changed the mix to any degree
garbage_collect()
-///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)
+
+/**
+ * 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:
+ * Plas_PP = get_partial_pressure(gas_mixture.plasma)
+ * O2_PP = get_partial_pressure(gas_mixture.oxygen)
+ * get_breath_partial_pressure(gas_pp) --> gas_pp/total_moles()*breath_pp = pp
+ * get_true_breath_pressure(pp) --> gas_pp = pp/breath_pp*total_moles()
+ *
+ * 10/20*5 = 2.5
+ * 10 = 2.5/5*20
+ */
/datum/gas_mixture/proc/get_breath_partial_pressure(gas_pressure)
return (gas_pressure * R_IDEAL_GAS_EQUATION * temperature) / BREATH_VOLUME
@@ -520,64 +528,168 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
/datum/gas_mixture/proc/get_true_breath_pressure(partial_pressure)
return (partial_pressure * BREATH_VOLUME) / (R_IDEAL_GAS_EQUATION * temperature)
-///Mathematical proofs:
/**
-get_breath_partial_pressure(gas_pp) --> gas_pp/total_moles()*breath_pp = pp
-get_true_breath_pressure(pp) --> gas_pp = pp/breath_pp*total_moles()
+ * Counts how much pressure will there be if we impart MOLAR_ACCURACY amounts of our gas to the output gasmix.
+ * We do all of this without actually transferring it so dont worry about it changing the gasmix.
+ * Returns: Resulting pressure (number).
+ * Args:
+ * - output_air (gasmix).
+ */
+/datum/gas_mixture/proc/gas_pressure_minimum_transfer(datum/gas_mixture/output_air)
+ var/resulting_energy = output_air.thermal_energy() + (MOLAR_ACCURACY / total_moles() * thermal_energy())
+ var/resulting_capacity = output_air.heat_capacity() + (MOLAR_ACCURACY / total_moles() * heat_capacity())
+ return (output_air.total_moles() + MOLAR_ACCURACY) * R_IDEAL_GAS_EQUATION * (resulting_energy / resulting_capacity) / output_air.volume
-10/20*5 = 2.5
-10 = 2.5/5*20
-**/
-/// Pumps gas from src to output_air. 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()
+/** Returns the amount of gas to be pumped to a specific container.
+ * Args:
+ * - output_air. The gas mix we want to pump to.
+ * - target_pressure. The target pressure we want.
+ * - ignore_temperature. Returns a cheaper form of gas calculation, useful if the temperature difference between the two gasmixes is low or nonexistant.
+ */
+/datum/gas_mixture/proc/gas_pressure_calculate(datum/gas_mixture/output_air, target_pressure, ignore_temperature = FALSE)
+ if((total_moles() <= 0) || (temperature <= 0))
+ return FALSE
- if((target_pressure - output_starting_pressure) < 0.01)
- //No need to pump gas if target is already reached!
+ var/pressure_delta = 0
+ if((output_air.temperature <= 0) || (output_air.total_moles() <= 0))
+ ignore_temperature = TRUE
+ pressure_delta = target_pressure
+ else
+ pressure_delta = target_pressure - output_air.return_pressure()
+
+ if(pressure_delta < 0.01 || gas_pressure_minimum_transfer(output_air) > target_pressure)
return FALSE
- //Calculate necessary moles to transfer using PV=nRT
- if((total_moles() > 0) && (temperature>0))
- var/pressure_delta = target_pressure - output_starting_pressure
- var/transfer_moles = (pressure_delta*output_air.volume)/(temperature * R_IDEAL_GAS_EQUATION)
+ if(ignore_temperature)
+ return (pressure_delta*output_air.volume)/(temperature * R_IDEAL_GAS_EQUATION)
+
+ // Lower and upper bound for the moles we must transfer to reach the pressure. The answer is bound to be here somewhere.
+ var/pv = target_pressure * output_air.volume
+ var/rt_low = R_IDEAL_GAS_EQUATION * max(temperature, output_air.temperature) // Low refers to the resulting mole, this number is actually higher.
+ var/rt_high = R_IDEAL_GAS_EQUATION * min(temperature, output_air.temperature)
+ // These works by assuming our gas has extremely high heat capacity
+ // and the resultant gasmix will hit either the highest or lowest temperature possible.
+ var/lower_limit = max((pv / rt_low) - output_air.total_moles(), 0)
+ var/upper_limit = (pv / rt_high) - output_air.total_moles() // In theory this should never go below zero, the pressure_delta check above should account for this.
+
+ /*
+ * We have PV=nRT as a nice formula, we can rearrange it into nT = PV/R
+ * But now both n and T can change, since any incoming moles also change our temperature.
+ * So we need to unify both our n and T, somehow.
+ *
+ * We can rewrite T as (our old thermal energy + incoming thermal energy) divided by (our old heat capacity + incoming heat capacity)
+ * T = (W1 + n/N2 * W2) / (C1 + n/N2 * C2). C being heat capacity, W being work, N being total moles.
+ *
+ * In total we now have our equation be: (N1 + n) * (W1 + n/N2 * W2) / (C1 + n/N2 * C2) = PV/R
+ * Now you can rearrange this and find out that it's a quadratic equation and pretty much solvable with the formula. Will be a bit messy though.
+ *
+ * W2/N2n^2 +
+ * (N1*W2/N2)n + W1n - ((PV/R)*C2/N2)n +
+ * (-(PV/R)*C1) + N1W1 = 0
+ *
+ * We will represent each of these terms with A, B, and C. A for the n^2 part, B for the n^1 part, and C for the n^0 part.
+ * We then put this into the famous (-b +/- sqrt(b^2-4ac)) / 2a formula.
+ *
+ * Oh, and one more thing. By "our" we mean the gasmix in the argument. We are the incoming one here. We are number 2, target is number 1.
+ * If all this counting fucks up, we revert first to Newton's approximation, then the old simple formula.
+ */
+
+ // Our thermal energy and moles
+ var/w2 = thermal_energy()
+ var/n2 = total_moles()
+ var/c2 = heat_capacity()
+
+ // Target thermal energy and moles
+ var/w1 = output_air.thermal_energy()
+ var/n1 = output_air.total_moles()
+ var/c1 = output_air.heat_capacity()
+
+ /// The PV/R part in our equation.
+ var/pvr = pv / R_IDEAL_GAS_EQUATION
+
+ /// x^2 in the quadratic
+ var/a_value = w2/n2
+ /// x^1 in the quadratic
+ var/b_value = ((n1*w2)/n2) + w1 - (pvr*c2/n2)
+ /// x^0 in the quadratic
+ var/c_value = (-1*pvr*c1) + n1 * w1
+
+ . = gas_pressure_quadratic(a_value, b_value, c_value, lower_limit, upper_limit)
+ if(.)
+ return
+ . = gas_pressure_approximate(a_value, b_value, c_value, lower_limit, upper_limit)
+ if(.)
+ return
+ // Inaccurate and will probably explode but whatever.
+ return (pressure_delta*output_air.volume)/(temperature * R_IDEAL_GAS_EQUATION)
+
+/// Actually tries to solve the quadratic equation.
+/// Do mind that the numbers can get very big and might hit BYOND's single point float limit.
+/datum/gas_mixture/proc/gas_pressure_quadratic(a, b, c, lower_limit, upper_limit)
+ var/solution
+ if(!IS_INF_OR_NAN(a) && !IS_INF_OR_NAN(b) && !IS_INF_OR_NAN(c))
+ solution = max(SolveQuadratic(a, b, c))
+ if((solution > lower_limit) && (solution < upper_limit)) //SolveQuadratic can return nulls so be careful here
+ return solution
+ stack_trace("Failed to solve pressure quadratic equation. A: [a]. B: [b]. C:[c]. Current value = [solution]. Expected lower limit: [lower_limit]. Expected upper limit: [upper_limit].")
+ return FALSE
- //Actually transfer the gas
- var/datum/gas_mixture/removed = remove(transfer_moles)
- output_air.merge(removed)
- return TRUE
+/// Approximation of the quadratic equation using Newton-Raphson's Method.
+/// We use the slope of an approximate value to get closer to the root of a given equation.
+/datum/gas_mixture/proc/gas_pressure_approximate(a, b, c, lower_limit, upper_limit)
+ var/solution
+ if(!IS_INF_OR_NAN(a) && !IS_INF_OR_NAN(b) && !IS_INF_OR_NAN(c))
+ /// We need to start off at a reasonably good estimate. For very big numbers the amount of moles is most likely small so better start with lower_limit.
+ solution = lower_limit
+ for (var/iteration in 1 to ATMOS_PRESSURE_APPROXIMATION_ITERATIONS)
+ var/diff = (a*solution**2 + b*solution + c) / (2*a*solution + b) // f(sol) / f'(sol)
+ solution -= diff // xn+1 = xn - f(sol) / f'(sol)
+ if(abs(diff) < MOLAR_ACCURACY && (solution > lower_limit) && (solution < upper_limit))
+ return solution
+ stack_trace("Newton's Approximation for pressure failed after [ATMOS_PRESSURE_APPROXIMATION_ITERATIONS] iterations. A: [a]. B: [b]. C:[c]. Current value: [solution]. Expected lower limit: [lower_limit]. Expected upper limit: [upper_limit].")
return FALSE
+/// Pumps gas from src to output_air. Amount depends on target_pressure
+/datum/gas_mixture/proc/pump_gas_to(datum/gas_mixture/output_air, target_pressure, specific_gas = null)
+ var/temperature_delta = abs(temperature - output_air.temperature)
+ var/datum/gas_mixture/removed
+ var/transfer_moles
+
+ if(specific_gas)
+ // This is necessary because the specific heat capacity of a gas might be different from our gasmix.
+ var/datum/gas_mixture/temporary = remove_specific_ratio(specific_gas, 1)
+ transfer_moles = temporary.gas_pressure_calculate(output_air, target_pressure, temperature_delta <= 5)
+ removed = temporary.remove_specific(specific_gas, transfer_moles)
+ else
+ transfer_moles = gas_pressure_calculate(output_air, target_pressure, temperature_delta <= 5)
+ removed = remove(transfer_moles)
+
+ if(!removed)
+ return FALSE
+
+ output_air.merge(removed)
+ return TRUE
+
/// 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)
+/datum/gas_mixture/proc/release_gas_to(datum/gas_mixture/output_air, target_pressure, rate=1)
var/output_starting_pressure = output_air.return_pressure()
var/input_starting_pressure = return_pressure()
+ //Need at least 10 KPa difference to overcome friction in the mechanism
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 FALSE
+ //Can not have a pressure delta that would cause output_pressure > input_pressure
+ target_pressure = output_starting_pressure + min(target_pressure - output_starting_pressure, (input_starting_pressure - output_starting_pressure)/2)
+ var/temperature_delta = abs(temperature - output_air.temperature)
- //Calculate necessary moles to transfer using PV = nRT
- if((total_moles() > 0) && (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 = gas_pressure_calculate(output_air, target_pressure, temperature_delta <= 5)
- var/transfer_moles = (pressure_delta*output_air.volume)/(temperature * R_IDEAL_GAS_EQUATION)
+ //Actually transfer the gas
+ var/datum/gas_mixture/removed = remove(transfer_moles * rate)
- //Actually transfer the gas
- var/datum/gas_mixture/removed = remove(transfer_moles)
- output_air.merge(removed)
-
- return TRUE
- return FALSE
-
-/datum/gas_mixture/proc/scrub_into(datum/gas_mixture/target, ratio, list/gases)
- for (var/gas in gases)
- transfer_ratio_to(target, ratio)
-
-/datum/gas_mixture/proc/transfer_to(datum/gas_mixture/receiver, var/moles)
- return receiver.merge(remove(moles))
+ if(!removed)
+ return FALSE
-/datum/gas_mixture/proc/transfer_ratio_to(datum/gas_mixture/receiver, var/ratio)
- return receiver.merge(remove_ratio(ratio))
+ output_air.merge(removed)
+ return TRUE
diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm
index 844d081b281cd..678e815af7b61 100644
--- a/code/modules/unit_tests/_unit_tests.dm
+++ b/code/modules/unit_tests/_unit_tests.dm
@@ -107,6 +107,7 @@
#include "spawn_humans.dm"
#include "species_whitelists.dm"
#include "food_edibility_check.dm"
+#include "gas_transfer.dm"
#include "greyscale_config.dm"
#include "heretic_knowledge.dm"
#include "heretic_rituals.dm"
diff --git a/code/modules/unit_tests/gas_transfer.dm b/code/modules/unit_tests/gas_transfer.dm
new file mode 100644
index 0000000000000..32f973d72444a
--- /dev/null
+++ b/code/modules/unit_tests/gas_transfer.dm
@@ -0,0 +1,32 @@
+/// Test to make sure the pressure pumping proc used by things like portable pumps, pressure pumps, etc actually work.
+/datum/unit_test/atmospheric_gas_transfer
+
+/datum/unit_test/atmospheric_gas_transfer/Run()
+ for (var/tempNmoles in list(1e4, 1e6, 1e8, 1e10, 1e12))
+ var/datum/gas_mixture/first_mix = allocate(/datum/gas_mixture)
+ var/datum/gas_mixture/second_mix = allocate(/datum/gas_mixture)
+
+ first_mix.volume = 200
+ second_mix.volume = 200
+
+ ASSERT_GAS(/datum/gas/hypernoblium, first_mix)
+ ASSERT_GAS(/datum/gas/tritium, second_mix)
+ first_mix.gases[/datum/gas/hypernoblium][MOLES] = tempNmoles
+ second_mix.gases[/datum/gas/tritium][MOLES] = 200
+ first_mix.temperature = tempNmoles
+ second_mix.temperature = T20C
+
+ var/initial_pressure = second_mix.return_pressure()
+ // A constant value would be nicer but there will be cases when even MOLAR_ACCURACY amounts would far exceed the pressure so we need to scale it somewhat.
+ var/additional_pressure = (tempNmoles / 1000) + 500
+
+ /* ERROR MARGIN CALCULATION
+ * We calculate how much would the pressure change if MOLAR_ACCURACY amount of hothotgas is imparted on the cold mix.
+ * This number gets really big for very high temperatures so it's somewhat meaningless, but our main goal is to ensure the code doesn't break.
+ */
+ var/error_margin = first_mix.gas_pressure_minimum_transfer(second_mix) - initial_pressure
+
+ first_mix.pump_gas_to(second_mix, (initial_pressure + additional_pressure))
+ var/margin = abs(second_mix.return_pressure() - (initial_pressure+additional_pressure))
+
+ TEST_ASSERT(margin<=error_margin, "Gas pressure pumping test failed for [tempNmoles]. Expected pressure = [initial_pressure+additional_pressure] +/- [error_margin]. Got [second_mix.return_pressure()].")
From 1411e05c948a6c8be8d1eed25efbd756b85474b7 Mon Sep 17 00:00:00 2001
From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Date: Mon, 13 Dec 2021 18:57:59 -0800
Subject: [PATCH 054/114] Shitass cherry pick once again (tgstation#63270)
About The Pull Request
ALLLRIGHT so
Multiz atmos was letting gas flow down into things that should be well, not flowable into
Like say doors, or windows.
This is weird.
Let's get into some context on why yeah?
First, how do things work currently?
atoms have a can_atmos_pass var defined on them. This points to a define that describes how they interact with
flow.
ATMOS_PASS_NO means well, if we're asked, block any attempts at flow. This is what walls use.
ATMOS_PASS_YES means the inverse
ATMOS_PASS_DENSITY means check our current density
ATMOS_PASS_PROC means call can_atmos_pass, we need some more details about this attempt
These are effectively optimizations.
That var, can_atmos_pass is accessed by CANATMOSPASS() the macro
It's used for 3 things.
1: Can this turf share at all?
2: Can this turf share with another turf
3: Does this atom block a share to another turf
All of this logic is bundled together to weed out the weak.
Anyway, so when we added multiz atmos, we effectively made a second version of this system, but for vertical
checks.
Issue here, we don't actually need to.
The only time we care if a check is vertical or not is if we're talking to another turf, it's not like you'll
have an object that only wants to block vertical atmos.
And even if you did, that's what ATMOS_PASS_PROC is for.
As it stands we need to either ignore any object behavior, or just duplicate can_atmos_pass but again.
Silly.
So I've merged the two, and added an arg to mark if this is a verical attempt.
This'll fix things that really should block up/down but don't, like windows and doors and such.
Past that, I've cleaned can_atmos_pass up a bit so it's easier for people to understand in future.
Oh and I removed the second CANATMOSPASS from immediate_calculate_adjacent_turfs.
It isn't a huge optimization, and it's just not functional.
It ties into zAirOut and zAirIn, both of which expect to be called with a valid direction.
So if say, you open a door that's currently blocking space from leaking in from above, you end up with the door
just not asking the space above if it wants to share, since the door can't zAirOut with itself.
Let's just wipe it out.
This makes the other code much cleaner too, heals the soul.
Anyway yadeyada old as ass bug, peace is restored to the kingdom, none noticed this somehow you'd think people
would notice window plasma, etc etc.
Why It's Good For The Game
MUH SIMULATION
Also fuck window gas
Changelog
cl
fix: Fixed gas flowing into windows from above, I am.... so tired
fix: Fixes gas sometimes not moving up from below after a structure change, see above
/cl
---
code/__DEFINES/atmospherics/atmos_helpers.dm | 7 +-
code/game/machinery/doors/firedoor.dm | 2 +-
code/game/machinery/doors/windowdoor.dm | 2 +-
.../objects/structures/windoor_assembly.dm | 4 +-
code/game/objects/structures/window.dm | 2 +-
.../antagonists/blob/structures/_blob.dm | 2 +-
.../environmental/LINDA_system.dm | 87 +++++++++++--------
7 files changed, 58 insertions(+), 48 deletions(-)
diff --git a/code/__DEFINES/atmospherics/atmos_helpers.dm b/code/__DEFINES/atmospherics/atmos_helpers.dm
index 030a8c0b7e284..fb8cec5119b62 100644
--- a/code/__DEFINES/atmospherics/atmos_helpers.dm
+++ b/code/__DEFINES/atmospherics/atmos_helpers.dm
@@ -1,8 +1,7 @@
//DO NOT USE THESE FOR ACCESSING ATMOS DATA, THEY MUTATE THINGS WHEN CALLED. I WILL BEAT YOU WITH A STICK. See the actual proc for more details
-///Check if the turfs allows gas passage based on density, do not use.
-#define CANATMOSPASS(A, O) ( A.can_atmos_pass == ATMOS_PASS_PROC ? A.can_atmos_pass(O) : ( A.can_atmos_pass == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_pass ) )
-///Check if the turfs allows gas passage on a z level, do not use.
-#define CANVERTICALATMOSPASS(A, O) ( A.can_atmos_pass_vertical == ATMOS_PASS_PROC ? A.can_atmos_pass(O, TRUE) : ( A.can_atmos_pass_vertical == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_pass_vertical ) )
+///Check if an atom (A) and a turf (O) allow gas passage based on the atom's can_atmos_pass var, do not use.
+///(V) is if the share is vertical or not. True or False
+#define CANATMOSPASS(A, O, V) ( A.can_atmos_pass == ATMOS_PASS_PROC ? A.can_atmos_pass(O, V) : ( A.can_atmos_pass == ATMOS_PASS_DENSITY ? !A.density : A.can_atmos_pass ) )
//Helpers
///Moves the icon of the device based on the piping layer and on the direction
diff --git a/code/game/machinery/doors/firedoor.dm b/code/game/machinery/doors/firedoor.dm
index 768d918044af5..a84662786714e 100644
--- a/code/game/machinery/doors/firedoor.dm
+++ b/code/game/machinery/doors/firedoor.dm
@@ -471,7 +471,7 @@
leaving.Bump(src)
return COMPONENT_ATOM_BLOCK_EXIT
-/obj/machinery/door/firedoor/border_only/can_atmos_pass(turf/T)
+/obj/machinery/door/firedoor/border_only/can_atmos_pass(turf/T, vertical = FALSE)
if(get_dir(loc, T) == dir)
return !density
else
diff --git a/code/game/machinery/doors/windowdoor.dm b/code/game/machinery/doors/windowdoor.dm
index 6e21da400b20b..390f09a26dd1b 100644
--- a/code/game/machinery/doors/windowdoor.dm
+++ b/code/game/machinery/doors/windowdoor.dm
@@ -133,7 +133,7 @@
return TRUE
-/obj/machinery/door/window/can_atmos_pass(turf/T)
+/obj/machinery/door/window/can_atmos_pass(turf/T, vertical = FALSE)
if(get_dir(loc, T) == dir)
return !density
else
diff --git a/code/game/objects/structures/windoor_assembly.dm b/code/game/objects/structures/windoor_assembly.dm
index 0286d36e70594..d0bc5255ff933 100644
--- a/code/game/objects/structures/windoor_assembly.dm
+++ b/code/game/objects/structures/windoor_assembly.dm
@@ -71,11 +71,11 @@
return TRUE
-/obj/structure/windoor_assembly/can_atmos_pass(turf/T)
+/obj/structure/windoor_assembly/can_atmos_pass(turf/T, vertical = FALSE)
if(get_dir(loc, T) == dir)
return !density
else
- return 1
+ return TRUE
/obj/structure/windoor_assembly/proc/on_exit(datum/source, atom/movable/leaving, direction)
SIGNAL_HANDLER
diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm
index deead8ca24343..e8adf31e8d2a5 100644
--- a/code/game/objects/structures/window.dm
+++ b/code/game/objects/structures/window.dm
@@ -334,7 +334,7 @@
. = ..()
move_update_air(T)
-/obj/structure/window/can_atmos_pass(turf/T)
+/obj/structure/window/can_atmos_pass(turf/T, vertical = FALSE)
if(!anchored || !density)
return TRUE
return !(fulltile || dir == get_dir(loc, T))
diff --git a/code/modules/antagonists/blob/structures/_blob.dm b/code/modules/antagonists/blob/structures/_blob.dm
index 3d7daa5b98fe0..1182bcd172a78 100644
--- a/code/modules/antagonists/blob/structures/_blob.dm
+++ b/code/modules/antagonists/blob/structures/_blob.dm
@@ -68,7 +68,7 @@
/obj/structure/blob/block_superconductivity()
return atmosblock
-/obj/structure/blob/can_atmos_pass(turf/T)
+/obj/structure/blob/can_atmos_pass(turf/T, vertical = FALSE)
return !atmosblock
/obj/structure/blob/update_icon() //Updates color based on overmind color if we have an overmind.
diff --git a/code/modules/atmospherics/environmental/LINDA_system.dm b/code/modules/atmospherics/environmental/LINDA_system.dm
index 8c678ec710b2c..c07cb25ca98cb 100644
--- a/code/modules/atmospherics/environmental/LINDA_system.dm
+++ b/code/modules/atmospherics/environmental/LINDA_system.dm
@@ -1,7 +1,8 @@
-/atom/var/can_atmos_pass = ATMOS_PASS_YES
-/atom/var/can_atmos_pass_vertical = ATMOS_PASS_YES
+/atom
+ ///Check if atmos can pass in this atom (ATMOS_PASS_YES, ATMOS_PASS_NO, ATMOS_PASS_DENSITY, ATMOS_PASS_PROC)
+ var/can_atmos_pass = ATMOS_PASS_YES
-/atom/proc/can_atmos_pass(turf/T)
+/atom/proc/can_atmos_pass(turf/target_turf, vertical = FALSE)
switch (can_atmos_pass)
if (ATMOS_PASS_PROC)
return ATMOS_PASS_YES
@@ -10,48 +11,58 @@
else
return can_atmos_pass
-/turf/can_atmos_pass = ATMOS_PASS_NO
-/turf/can_atmos_pass_vertical = ATMOS_PASS_NO
-
-/turf/open/can_atmos_pass = ATMOS_PASS_PROC
-/turf/open/can_atmos_pass_vertical = ATMOS_PASS_PROC
-
-//Do NOT use this to see if 2 turfs are connected, it mutates state, and we cache that info anyhow. Use TURFS_CAN_SHARE or TURF_SHARES depending on your usecase
-/turf/open/can_atmos_pass(turf/T, vertical = FALSE)
- var/dir = vertical? get_dir_multiz(src, T) : get_dir(src, T)
- var/opp = REVERSE_DIR(dir)
- var/R = FALSE
- if(vertical && !(zAirOut(dir, T) && T.zAirIn(dir, src)))
- R = TRUE
- if(blocks_air || T.blocks_air)
- R = TRUE
- if (T == src)
- return !R
- 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.block_superconductivity()) //the direction and open/closed are already checked on can_atmos_pass() so there are no arguments
- atmos_supeconductivity |= dir
- T.atmos_supeconductivity |= opp
- return FALSE //no need to keep going, we got all we asked
-
- atmos_supeconductivity &= ~dir
- T.atmos_supeconductivity &= ~opp
-
- return !R
+/turf
+ can_atmos_pass = ATMOS_PASS_NO
+
+/turf/open
+ can_atmos_pass = ATMOS_PASS_PROC
+
+///Do NOT use this to see if 2 turfs are connected, it mutates state, and we cache that info anyhow.
+///Use TURFS_CAN_SHARE or TURF_SHARES depending on your usecase
+/turf/open/can_atmos_pass(turf/target_turf, vertical = FALSE)
+ var/can_pass = TRUE
+ var/direction = vertical ? get_dir_multiz(src, target_turf) : get_dir(src, target_turf)
+ var/opposite_direction = REVERSE_DIR(direction)
+ if(vertical && !(zAirOut(direction, target_turf) && target_turf.zAirIn(direction, src)))
+ can_pass = FALSE
+ if(blocks_air || target_turf.blocks_air)
+ can_pass = FALSE
+ //This path is a bit weird, if we're just checking with ourselves no sense asking objects on the turf
+ if (target_turf == src)
+ return can_pass
+
+ //Can't just return if canpass is false here, we need to set superconductivity
+ for(var/obj/checked_object in contents + target_turf.contents)
+ var/turf/other = (checked_object.loc == src ? target_turf : src)
+ if(CANATMOSPASS(checked_object, other, vertical))
+ continue
+ can_pass = FALSE
+ //the direction and open/closed are already checked on can_atmos_pass() so there are no arguments
+ if(checked_object.block_superconductivity())
+ atmos_supeconductivity |= direction
+ target_turf.atmos_supeconductivity |= opposite_direction
+ return FALSE //no need to keep going, we got all we asked (Is this even faster? fuck you it's soul)
+
+ //Superconductivity is a bitfield of directions we can't conduct with
+ //Yes this is really weird. Fuck you
+ atmos_supeconductivity &= ~direction
+ target_turf.atmos_supeconductivity &= ~opposite_direction
+
+ return can_pass
/atom/movable/proc/block_superconductivity() // objects that block air and don't let superconductivity act. Only firelocks atm.
return FALSE
/turf/proc/immediate_calculate_adjacent_turfs()
- var/canpass = CANATMOSPASS(src, src)
- var/canvpass = CANVERTICALATMOSPASS(src, src)
+ //Basic optimization, if we can't share why bother asking other people ya feel?
+ var/canpass = CANATMOSPASS(src, src, FALSE)
for(var/direction in GLOB.cardinals_multiz)
- var/turf/T = get_step_multiz(src, direction)
- if(!isopenturf(T))
+ var/turf/current_turf = get_step_multiz(src, direction)
+ if(!isopenturf(current_turf)) // not interested in you brother
continue
- if(!(blocks_air || T.blocks_air) && ((direction & (UP|DOWN))? (canvpass && CANVERTICALATMOSPASS(T, src)) : (canpass && CANATMOSPASS(T, src))) )
+ //Can you and me form a deeper relationship, or is this just a passing wind
+ // (direction & (UP | DOWN)) is just "is this vertical" by the by
+ if(canpass && CANATMOSPASS(current_turf, src, (direction & (UP|DOWN))) && !(blocks_air || current_turf.blocks_air))
LAZYINITLIST(atmos_adjacent_turfs)
LAZYINITLIST(T.atmos_adjacent_turfs)
atmos_adjacent_turfs[T] = TRUE
From 3848806ae4ec08b5f294e9b75c093835f21740d9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Wed, 28 Aug 2024 20:05:38 +0200
Subject: [PATCH 055/114] Fixes that got pulled out accidentally when
cherry-picking
---
code/__HELPERS/areas.dm | 2 +-
code/game/objects/effects/portals.dm | 4 +--
code/game/objects/items/peppercloud.dm | 2 +-
code/game/turfs/open/floor/reinf_floor.dm | 1 -
code/game/turfs/open/openspace.dm | 1 -
.../environmental/LINDA_system.dm | 24 +++++++++-------
.../atmospherics/gasmixtures/gas_mixture.dm | 28 +++++++++++++++++++
7 files changed, 46 insertions(+), 16 deletions(-)
diff --git a/code/__HELPERS/areas.dm b/code/__HELPERS/areas.dm
index 0ecb014e67ac1..0527104a34f57 100644
--- a/code/__HELPERS/areas.dm
+++ b/code/__HELPERS/areas.dm
@@ -34,7 +34,7 @@ GLOBAL_LIST_INIT(typecache_powerfailure_safe_areas, typecacheof(/area/engine/eng
if(break_if_found[checkT.type] || break_if_found[checkT.loc.type])
return FALSE
var/static/list/cardinal_cache = list("[NORTH]"=TRUE, "[EAST]"=TRUE, "[SOUTH]"=TRUE, "[WEST]"=TRUE)
- if(!cardinal_cache["[dir]"] || checkT.blocks_air || !CANATMOSPASS(sourceT, checkT))
+ if(!cardinal_cache["[dir]"] || checkT.blocks_air || !CANATMOSPASS(sourceT, checkT, FALSE))
continue
found_turfs += checkT // Since checkT is connected, add it to the list to be processed
diff --git a/code/game/objects/effects/portals.dm b/code/game/objects/effects/portals.dm
index 6e276151487f0..54b50fa7a7333 100644
--- a/code/game/objects/effects/portals.dm
+++ b/code/game/objects/effects/portals.dm
@@ -141,11 +141,11 @@
/obj/effect/portal/proc/unlink_atmos()
if(istype(atmos_source))
- if(istype(atmos_destination) && !atmos_source.Adjacent(atmos_destination) && !CANATMOSPASS(atmos_destination, atmos_source))
+ if(istype(atmos_destination) && !atmos_source.Adjacent(atmos_destination) && !CANATMOSPASS(atmos_destination, atmos_source, FALSE))
LAZYREMOVE(atmos_source.atmos_adjacent_turfs, atmos_destination)
atmos_source = null
if(istype(atmos_destination))
- if(istype(atmos_source) && !atmos_destination.Adjacent(atmos_source) && !CANATMOSPASS(atmos_source, atmos_destination))
+ if(istype(atmos_source) && !atmos_destination.Adjacent(atmos_source) && !CANATMOSPASS(atmos_source, atmos_destination, FALSE))
LAZYREMOVE(atmos_destination.atmos_adjacent_turfs, atmos_source)
atmos_destination = null
diff --git a/code/game/objects/items/peppercloud.dm b/code/game/objects/items/peppercloud.dm
index 65d51f58ccae0..a138152f1d7f0 100644
--- a/code/game/objects/items/peppercloud.dm
+++ b/code/game/objects/items/peppercloud.dm
@@ -69,7 +69,7 @@
var/turf/previous = get_turf(user)
var/turf/next = get_step(user, direction)
for (var/i in 1 to 2)
- if (!CANATMOSPASS(next, previous))
+ if (!CANATMOSPASS(next, previous, FALSE))
break
previous = next
next = get_step(previous, direction)
diff --git a/code/game/turfs/open/floor/reinf_floor.dm b/code/game/turfs/open/floor/reinf_floor.dm
index 65000cf9f13e5..e1314dcd979be 100644
--- a/code/game/turfs/open/floor/reinf_floor.dm
+++ b/code/game/turfs/open/floor/reinf_floor.dm
@@ -131,7 +131,6 @@
floor_tile = null
var/obj/effect/clockwork/overlay/floor/bloodcult/realappearance
can_atmos_pass = ATMOS_PASS_NO
- can_atmos_pass_vertical = ATMOS_PASS_NO
/turf/open/floor/engine/cult/Initialize(mapload)
diff --git a/code/game/turfs/open/openspace.dm b/code/game/turfs/open/openspace.dm
index b603ddff1c12f..a020f261eb3bc 100644
--- a/code/game/turfs/open/openspace.dm
+++ b/code/game/turfs/open/openspace.dm
@@ -3,7 +3,6 @@
desc = "Watch your step!"
icon_state = "invisible"
baseturfs = /turf/open/openspace
- can_atmos_pass_vertical = ATMOS_PASS_YES
overfloor_placed = FALSE
underfloor_accessibility = UNDERFLOOR_INTERACTABLE
allow_z_travel = TRUE
diff --git a/code/modules/atmospherics/environmental/LINDA_system.dm b/code/modules/atmospherics/environmental/LINDA_system.dm
index c07cb25ca98cb..e1cdf75b7afce 100644
--- a/code/modules/atmospherics/environmental/LINDA_system.dm
+++ b/code/modules/atmospherics/environmental/LINDA_system.dm
@@ -54,27 +54,31 @@
return FALSE
/turf/proc/immediate_calculate_adjacent_turfs()
- //Basic optimization, if we can't share why bother asking other people ya feel?
+ LAZYINITLIST(src.atmos_adjacent_turfs)
+ var/list/atmos_adjacent_turfs = src.atmos_adjacent_turfs
var/canpass = CANATMOSPASS(src, src, FALSE)
for(var/direction in GLOB.cardinals_multiz)
var/turf/current_turf = get_step_multiz(src, direction)
if(!isopenturf(current_turf)) // not interested in you brother
continue
+
//Can you and me form a deeper relationship, or is this just a passing wind
// (direction & (UP | DOWN)) is just "is this vertical" by the by
if(canpass && CANATMOSPASS(current_turf, src, (direction & (UP|DOWN))) && !(blocks_air || current_turf.blocks_air))
- LAZYINITLIST(atmos_adjacent_turfs)
- LAZYINITLIST(T.atmos_adjacent_turfs)
- atmos_adjacent_turfs[T] = TRUE
- T.atmos_adjacent_turfs[src] = TRUE
+ LAZYINITLIST(current_turf.atmos_adjacent_turfs)
+ atmos_adjacent_turfs[current_turf] = TRUE
+ current_turf.atmos_adjacent_turfs[src] = TRUE
else
- if (atmos_adjacent_turfs)
- atmos_adjacent_turfs -= T
- if (T.atmos_adjacent_turfs)
- T.atmos_adjacent_turfs -= src
- UNSETEMPTY(T.atmos_adjacent_turfs)
+ atmos_adjacent_turfs -= current_turf
+ if (current_turf.atmos_adjacent_turfs)
+ current_turf.atmos_adjacent_turfs -= src
+ UNSETEMPTY(current_turf.atmos_adjacent_turfs)
+ SEND_SIGNAL(current_turf, COMSIG_TURF_CALCULATED_ADJACENT_ATMOS)
+
UNSETEMPTY(atmos_adjacent_turfs)
src.atmos_adjacent_turfs = atmos_adjacent_turfs
+ SEND_SIGNAL(src, COMSIG_TURF_CALCULATED_ADJACENT_ATMOS)
+ rebuild_atmos_smoothing()
//returns a list of adjacent turfs that can share air with this one.
//alldir includes adjacent diagonal tiles that can share
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index d01bca3dc1d25..48e9457940aa8 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -650,6 +650,24 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
stack_trace("Newton's Approximation for pressure failed after [ATMOS_PRESSURE_APPROXIMATION_ITERATIONS] iterations. A: [a]. B: [b]. C:[c]. Current value: [solution]. Expected lower limit: [lower_limit]. Expected upper limit: [upper_limit].")
return FALSE
+/datum/gas_mixture/proc/remove_specific_ratio(gas_id, ratio)
+ if(ratio <= 0)
+ return null
+ ratio = min(ratio, 1)
+
+ var/list/cached_gases = gases
+ var/datum/gas_mixture/removed = new type
+ var/list/removed_gases = removed.gases //accessing datum vars is slower than proc vars
+
+ removed.temperature = temperature
+ ADD_GAS(gas_id, removed.gases)
+ removed_gases[gas_id][MOLES] = QUANTIZE(cached_gases[gas_id][MOLES] * ratio)
+ cached_gases[gas_id][MOLES] -= removed_gases[gas_id][MOLES]
+
+ garbage_collect(list(gas_id))
+
+ return removed
+
/// Pumps gas from src to output_air. Amount depends on target_pressure
/datum/gas_mixture/proc/pump_gas_to(datum/gas_mixture/output_air, target_pressure, specific_gas = null)
var/temperature_delta = abs(temperature - output_air.temperature)
@@ -693,3 +711,13 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
output_air.merge(removed)
return TRUE
+
+/datum/gas_mixture/proc/scrub_into(datum/gas_mixture/target, ratio, list/gases)
+ for (var/gas in gases)
+ transfer_ratio_to(target, ratio)
+
+/datum/gas_mixture/proc/transfer_to(datum/gas_mixture/receiver, var/moles)
+ return receiver.merge(remove(moles))
+
+/datum/gas_mixture/proc/transfer_ratio_to(datum/gas_mixture/receiver, var/ratio)
+ return receiver.merge(remove_ratio(ratio))
From 03a48e1996bc47fd49e255ca8612e2e97cdd3aec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Wed, 28 Aug 2024 20:47:23 +0200
Subject: [PATCH 056/114] Surely this won't break anything
---
code/__DEFINES/layers.dm | 3 +++
code/datums/diseases/_disease.dm | 2 +-
code/game/machinery/shuttle/shuttle_heater.dm | 1 -
.../effects/effect_system/effects_foam.dm | 2 +-
.../effects/effect_system/effects_smoke.dm | 2 +-
code/game/objects/items/flamethrower.dm | 2 +-
code/game/objects/structures/aliens.dm | 2 +-
.../atmospherics/environmental/LINDA_system.dm | 18 +++++++-----------
.../unary_devices/portables_connector.dm | 7 -------
.../components/unary_devices/vent_scrubber.dm | 2 +-
.../machinery/portable/scrubber.dm | 2 +-
.../mob/living/simple_animal/bot/bot.dm | 2 +-
.../simple_animal/hostile/retaliate/clown.dm | 2 +-
code/modules/reagents/chem_splash.dm | 2 +-
tools/Runtime Condenser/Output.txt | 2 +-
15 files changed, 21 insertions(+), 30 deletions(-)
diff --git a/code/__DEFINES/layers.dm b/code/__DEFINES/layers.dm
index 8c7bdd7fb20d7..64abada8490d0 100644
--- a/code/__DEFINES/layers.dm
+++ b/code/__DEFINES/layers.dm
@@ -146,6 +146,9 @@
/// Plane for balloon text (text that fades up)
#define BALLOON_CHAT_PLANE 651
+#define ATMOS_GROUP_PLANE 652
+#define ATMOS_GROUP_LAYER 652
+
///--------------- FULLSCREEN IMAGES ------------
#define FULLSCREEN_PLANE 500
#define FLASH_LAYER 1
diff --git a/code/datums/diseases/_disease.dm b/code/datums/diseases/_disease.dm
index 2058459838839..87e2bf66adb4f 100644
--- a/code/datums/diseases/_disease.dm
+++ b/code/datums/diseases/_disease.dm
@@ -134,7 +134,7 @@
if(end == start)
return TRUE
var/turf/Temp = get_step_towards(end, start)
- if(!CANATMOSPASS(end, Temp))
+ if(!CANATMOSPASS(end, Temp, FALSE))
return FALSE
end = Temp
diff --git a/code/game/machinery/shuttle/shuttle_heater.dm b/code/game/machinery/shuttle/shuttle_heater.dm
index 12f46c9c94118..67aada8bc0a0d 100644
--- a/code/game/machinery/shuttle/shuttle_heater.dm
+++ b/code/game/machinery/shuttle/shuttle_heater.dm
@@ -67,7 +67,6 @@
if(node)
node.atmos_init()
node.add_member(src)
- build_network()
return TRUE
/obj/machinery/atmospherics/components/unary/shuttle/heater/RefreshParts()
diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm
index 23994b07202ea..8f55cf1023ce3 100644
--- a/code/game/objects/effects/effect_system/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/effects_foam.dm
@@ -193,7 +193,7 @@
/obj/effect/particle_effect/foam/proc/spread_foam()
var/turf/t_loc = get_turf(src)
- for(var/turf/T in t_loc.GetAtmosAdjacentTurfs())
+ for(var/turf/T in t_loc.get_atmos_adjacent_turfs())
var/obj/effect/particle_effect/foam/foundfoam = locate() in T //Don't spread foam where there's already foam!
if(foundfoam)
continue
diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm
index a969544c09669..97192a395a6e2 100644
--- a/code/game/objects/effects/effect_system/effects_smoke.dm
+++ b/code/game/objects/effects/effect_system/effects_smoke.dm
@@ -91,7 +91,7 @@
if(!t_loc)
return
var/list/newsmokes = list()
- for(var/turf/T in t_loc.GetAtmosAdjacentTurfs(!circle))
+ for(var/turf/T in t_loc.get_atmos_adjacent_turfs(!circle))
var/obj/effect/particle_effect/smoke/foundsmoke = locate() in T //Don't spread smoke where there's already smoke!
if(foundsmoke)
continue
diff --git a/code/game/objects/items/flamethrower.dm b/code/game/objects/items/flamethrower.dm
index a82b7a9dd0292..8d21ec0a2f00f 100644
--- a/code/game/objects/items/flamethrower.dm
+++ b/code/game/objects/items/flamethrower.dm
@@ -199,7 +199,7 @@
for(var/turf/T in turflist)
if(T == previousturf)
continue //so we don't burn the tile we be standin on
- var/list/turfs_sharing_with_prev = previousturf.GetAtmosAdjacentTurfs(alldir=1)
+ var/list/turfs_sharing_with_prev = previousturf.get_atmos_adjacent_turfs(alldir=1)
if(!(T in turfs_sharing_with_prev))
break
if(igniter)
diff --git a/code/game/objects/structures/aliens.dm b/code/game/objects/structures/aliens.dm
index 40cfb310587b1..f2959a37719db 100644
--- a/code/game/objects/structures/aliens.dm
+++ b/code/game/objects/structures/aliens.dm
@@ -185,7 +185,7 @@
qdel(src)
return FALSE
- for(var/turf/T in U.GetAtmosAdjacentTurfs())
+ for(var/turf/T in U.get_atmos_adjacent_turfs())
if((locate(/obj/structure/alien/weeds) in T))
continue
diff --git a/code/modules/atmospherics/environmental/LINDA_system.dm b/code/modules/atmospherics/environmental/LINDA_system.dm
index e1cdf75b7afce..23d88700bb0f9 100644
--- a/code/modules/atmospherics/environmental/LINDA_system.dm
+++ b/code/modules/atmospherics/environmental/LINDA_system.dm
@@ -54,36 +54,33 @@
return FALSE
/turf/proc/immediate_calculate_adjacent_turfs()
- LAZYINITLIST(src.atmos_adjacent_turfs)
- var/list/atmos_adjacent_turfs = src.atmos_adjacent_turfs
+ //Basic optimization, if we can't share why bother asking other people ya feel?
var/canpass = CANATMOSPASS(src, src, FALSE)
for(var/direction in GLOB.cardinals_multiz)
var/turf/current_turf = get_step_multiz(src, direction)
if(!isopenturf(current_turf)) // not interested in you brother
continue
-
//Can you and me form a deeper relationship, or is this just a passing wind
// (direction & (UP | DOWN)) is just "is this vertical" by the by
if(canpass && CANATMOSPASS(current_turf, src, (direction & (UP|DOWN))) && !(blocks_air || current_turf.blocks_air))
+ LAZYINITLIST(atmos_adjacent_turfs)
LAZYINITLIST(current_turf.atmos_adjacent_turfs)
atmos_adjacent_turfs[current_turf] = TRUE
current_turf.atmos_adjacent_turfs[src] = TRUE
else
- atmos_adjacent_turfs -= current_turf
+ if (atmos_adjacent_turfs)
+ atmos_adjacent_turfs -= current_turf
if (current_turf.atmos_adjacent_turfs)
current_turf.atmos_adjacent_turfs -= src
UNSETEMPTY(current_turf.atmos_adjacent_turfs)
- SEND_SIGNAL(current_turf, COMSIG_TURF_CALCULATED_ADJACENT_ATMOS)
-
UNSETEMPTY(atmos_adjacent_turfs)
src.atmos_adjacent_turfs = atmos_adjacent_turfs
- SEND_SIGNAL(src, COMSIG_TURF_CALCULATED_ADJACENT_ATMOS)
- rebuild_atmos_smoothing()
+
//returns a list of adjacent turfs that can share air with this one.
//alldir includes adjacent diagonal tiles that can share
// air with both of the related adjacent cardinal tiles
-/turf/proc/GetAtmosAdjacentTurfs(alldir = 0)
+/turf/proc/get_atmos_adjacent_turfs(alldir = 0)
var/adjacent_turfs
if (atmos_adjacent_turfs)
adjacent_turfs = atmos_adjacent_turfs.Copy()
@@ -106,7 +103,7 @@
if(!checked_turf.atmos_adjacent_turfs || !checked_turf.atmos_adjacent_turfs[secondary_turf])
continue
- if (adjacent_turfs[checkTurf])
+ if (adjacent_turfs[secondary_turf])
matching_directions++
if (matching_directions >= 2)
@@ -172,5 +169,4 @@
if (T.atmos_adjacent_turfs)
T.atmos_adjacent_turfs -= src
UNSETEMPTY(T.atmos_adjacent_turfs)
- T.__update_auxtools_turf_adjacency_info(isspaceturf(T.get_z_base_turf()), -1)
LAZYCLEARLIST(atmos_adjacent_turfs)
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 3a49035d50cc9..c753fe6cd9fa7 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/portables_connector.dm
@@ -48,13 +48,6 @@
/obj/machinery/atmospherics/components/unary/portables_connector/portableConnectorReturnAir()
return connected_device.portableConnectorReturnAir()
-/obj/machinery/atmospherics/components/unary/portables_connector/build_network()
- . = ..()
- if(connect_to)
- var/obj/machinery/portable_atmospherics/PA = connect_to
- if(PA)
- PA.connect(src)
-
/obj/proc/portableConnectorReturnAir()
return
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 d9ac9e9dd75a9..6e7c272ee8449 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/vent_scrubber.dm
@@ -178,7 +178,7 @@
adjacent_turfs.Cut()
var/turf/T = get_turf(src)
if(istype(T))
- adjacent_turfs = T.GetAtmosAdjacentTurfs(alldir = 1)
+ adjacent_turfs = T.get_atmos_adjacent_turfs(alldir = 1)
/obj/machinery/atmospherics/components/unary/vent_scrubber/receive_signal(datum/signal/signal)
if(!is_operational || !signal.data["tag"] || (signal.data["tag"] != id_tag) || (signal.data["sigtype"]!="command"))
diff --git a/code/modules/atmospherics/machinery/portable/scrubber.dm b/code/modules/atmospherics/machinery/portable/scrubber.dm
index 41f77d1599ba3..f09a12286e6c6 100644
--- a/code/modules/atmospherics/machinery/portable/scrubber.dm
+++ b/code/modules/atmospherics/machinery/portable/scrubber.dm
@@ -151,7 +151,7 @@
if(!holding)
var/turf/T = get_turf(src)
- for(var/turf/AT in T.GetAtmosAdjacentTurfs(alldir = TRUE))
+ for(var/turf/AT in T.get_atmos_adjacent_turfs(alldir = TRUE))
scrub(AT.return_air())
return ..()
diff --git a/code/modules/mob/living/simple_animal/bot/bot.dm b/code/modules/mob/living/simple_animal/bot/bot.dm
index cdc7c63d497ff..f1386d97db95a 100644
--- a/code/modules/mob/living/simple_animal/bot/bot.dm
+++ b/code/modules/mob/living/simple_animal/bot/bot.dm
@@ -463,7 +463,7 @@ Pass the desired type path itself, declaring a temporary var beforehand is not r
var/turf/T = get_turf(src)
if(!T)
return
- var/list/adjacent = T.GetAtmosAdjacentTurfs(1)
+ var/list/adjacent = T.get_atmos_adjacent_turfs(1)
var/atom/final_result
var/static/list/turf_typecache = typecacheof(/turf)
if(shuffle) //If we were on the same tile as another bot, let's randomize our choices so we dont both go the same way
diff --git a/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm b/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm
index d36021d7a6fec..6c5be8f80e919 100644
--- a/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm
+++ b/code/modules/mob/living/simple_animal/hostile/retaliate/clown.dm
@@ -57,7 +57,7 @@
. = ..()
if(banana_time && banana_time < world.time)
var/turf/T = get_turf(src)
- var/list/adjacent = T.GetAtmosAdjacentTurfs(1)
+ var/list/adjacent = T.get_atmos_adjacent_turfs(1)
new banana_type(pick(adjacent))
banana_time = world.time + rand(30,60)
diff --git a/code/modules/reagents/chem_splash.dm b/code/modules/reagents/chem_splash.dm
index 431754b4fce67..13f36942604eb 100644
--- a/code/modules/reagents/chem_splash.dm
+++ b/code/modules/reagents/chem_splash.dm
@@ -45,7 +45,7 @@
for(var/turf/T as() in turflist)
if(accessible[T])
continue
- for(var/thing in T.GetAtmosAdjacentTurfs(alldir = TRUE))
+ for(var/thing in T.get_atmos_adjacent_turfs(alldir = TRUE))
var/turf/NT = thing
if(!(NT in accessible))
continue
diff --git a/tools/Runtime Condenser/Output.txt b/tools/Runtime Condenser/Output.txt
index e349edb7db7ab..27d5a53418321 100644
--- a/tools/Runtime Condenser/Output.txt
+++ b/tools/Runtime Condenser/Output.txt
@@ -177,7 +177,7 @@ proc name: show (/datum/html_interface/proc/show)
The following runtime has occurred 1 time(s).
-runtime error: Cannot execute null.GetAtmosAdjacentTurfs().
+runtime error: Cannot execute null.get_atmos_adjacent_turfs().
proc name: spread smoke (/obj/effect/particle_effect/smoke/proc/spread_smoke)
source file: effects_smoke.dm,74
usr: null
From 3a4adbf1dc4a1f1b0224b33821af7249dc3733ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Thu, 29 Aug 2024 01:21:19 +0200
Subject: [PATCH 057/114] let's hope i won't have to kill myself
---
code/__DEFINES/reactions.dm | 1 +
code/game/machinery/shuttle/shuttle_heater.dm | 1 -
.../atmospherics/environmental/LINDA_fire.dm | 30 +++++++++---------
.../environmental/LINDA_system.dm | 3 --
.../atmospherics/gasmixtures/reactions.dm | 31 ++++++++++++-------
5 files changed, 36 insertions(+), 30 deletions(-)
diff --git a/code/__DEFINES/reactions.dm b/code/__DEFINES/reactions.dm
index 837d7f8d0f513..158cbdcb4c6eb 100644
--- a/code/__DEFINES/reactions.dm
+++ b/code/__DEFINES/reactions.dm
@@ -7,6 +7,7 @@
#define PLASMA_MINIMUM_OXYGEN_PLASMA_RATIO 30
#define FIRE_CARBON_ENERGY_RELEASED 100000 //! Amount of heat released per mole of burnt carbon into the tile
#define FIRE_HYDROGEN_ENERGY_RELEASED 280000 //! Amount of heat released per mole of burnt hydrogen and/or tritium(hydrogen isotope)
+#define FIRE_HYDROGEN_ENERGY_WEAK 280000
#define FIRE_PLASMA_ENERGY_RELEASED 3000000 //! Amount of heat released per mole of burnt plasma into the tile
// Water Vapor:
diff --git a/code/game/machinery/shuttle/shuttle_heater.dm b/code/game/machinery/shuttle/shuttle_heater.dm
index 67aada8bc0a0d..1c5c1a2560437 100644
--- a/code/game/machinery/shuttle/shuttle_heater.dm
+++ b/code/game/machinery/shuttle/shuttle_heater.dm
@@ -98,7 +98,6 @@
return moles >= required
/obj/machinery/atmospherics/components/unary/shuttle/heater/proc/consumeFuel(var/amount)
- var/datum/gas_mixture/air_contents = airs[1]
remove_air(amount)
return
diff --git a/code/modules/atmospherics/environmental/LINDA_fire.dm b/code/modules/atmospherics/environmental/LINDA_fire.dm
index 65c445992fa52..b6504437a0d60 100644
--- a/code/modules/atmospherics/environmental/LINDA_fire.dm
+++ b/code/modules/atmospherics/environmental/LINDA_fire.dm
@@ -8,9 +8,9 @@
/turf/proc/hotspot_expose(exposed_temperature, exposed_volume, soh = 0)
return
-/**
- * Handles the creation of hotspots and initial activation of turfs.
- * Setting the conditions for the reaction to actually happen for gasmixtures
+/**
+ * Handles the creation of hotspots and initial activation of turfs.
+ * Setting the conditions for the reaction to actually happen for gasmixtures
* is handled by the hotspot itself, specifically perform_exposure().
*/
/turf/open/hotspot_expose(exposed_temperature, exposed_volume, soh)
@@ -46,7 +46,7 @@
/**
- * Hotspot objects interfaces with the temperature of turf gasmixtures while also providing visual effects.
+ * Hotspot objects interfaces with the temperature of turf gasmixtures while also providing visual effects.
* One important thing to note about hotspots are that they can roughly be divided into two categories based on the bypassing variable.
*/
/obj/effect/hotspot
@@ -62,7 +62,7 @@
light_color = LIGHT_COLOR_FIRE
/**
- * Volume is the representation of how big and healthy a fire is.
+ * Volume is the representation of how big and healthy a fire is.
* Hotspot volume will be divided by turf volume to get the ratio for temperature setting on non bypassing mode.
* Also some visual stuffs for fainter fires.
*/
@@ -91,11 +91,11 @@
* Perform interactions between the hotspot and the gasmixture.
*
* For the first tick, hotspots will take a sample of the air in the turf,
- * set the temperature equal to a certain amount, and then reacts it.
+ * set the temperature equal to a certain amount, and then reacts it.
* In some implementations the ratio comes out to around 1, so all of the air in the turf.
*
- * Afterwards if the reaction is big enough it mostly just tags along the fire,
- * copying the temperature and handling the colouring.
+ * Afterwards if the reaction is big enough it mostly just tags along the fire,
+ * copying the temperature and handling the colouring.
* If the reaction is too small it will perform like the first tick.
*
* Also calls fire_act() which handles burning.
@@ -191,8 +191,8 @@
#define INSUFFICIENT(path) (!location.air.gases[path] || location.air.gases[path][MOLES] < 0.5)
-/**
- * Regular process proc for hotspots governed by the controller.
+/**
+ * Regular process proc for hotspots governed by the controller.
* Handles the calling of perform_exposure() which handles the bulk of temperature processing.
* Burning or fire_act() are also called by perform_exposure().
* Also handles the dying and qdeletion of the hotspot and hotspot creations on adjacent cardinal turfs.
@@ -252,11 +252,11 @@
T.active_hotspot = null
return ..()
-/obj/effect/hotspot/Crossed(atom/movable/AM, oldLoc)
- ..()
- if(isliving(AM))
- var/mob/living/L = AM
- L.fire_act(temperature, volume)
+/obj/effect/hotspot/proc/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs)
+ SIGNAL_HANDLER
+ if(isliving(arrived) && !cold_fire)
+ var/mob/living/immolated = arrived
+ immolated.fire_act(temperature, volume)
/obj/effect/hotspot/singularity_pull()
return
diff --git a/code/modules/atmospherics/environmental/LINDA_system.dm b/code/modules/atmospherics/environmental/LINDA_system.dm
index 23d88700bb0f9..5d4ee7f1754b1 100644
--- a/code/modules/atmospherics/environmental/LINDA_system.dm
+++ b/code/modules/atmospherics/environmental/LINDA_system.dm
@@ -158,9 +158,6 @@
SSair.add_to_active(src)
/turf/proc/immediate_disable_adjacency(disable_adjacent = TRUE)
- if(SSair.thread_running())
- SSadjacent_air.disable_queue[src] = disable_adjacent
- return
if(disable_adjacent)
for(var/direction in GLOB.cardinals_multiz)
var/turf/T = get_step_multiz(src, direction)
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index 5d1914ebacaff..52e540be3f4c7 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -78,15 +78,24 @@
requirements = list(/datum/gas/water_vapor = MOLES_GAS_VISIBLE)
/datum/gas_reaction/water_vapor/react(datum/gas_mixture/air, datum/holder)
- var/turf/open/location = isturf(holder) ? holder : null
. = NO_REACTION
- if (air.temperature <= WATER_VAPOR_FREEZE)
- if(location?.freon_gas_act())
- . = REACTING
- else if(air.temperature <= T20C + 10)
- if(location?.water_vapor_gas_act())
- air.gases[/datum/gas/water_vapor][MOLES] -= MOLES_GAS_VISIBLE
- . = REACTING
+ if(!isturf(holder))
+ return
+
+ var/turf/open/location = holder
+ var/consumed = 0
+ switch(air.temperature)
+ if(-INFINITY to WATER_VAPOR_DEPOSITION_POINT)
+ if(location?.freeze_turf())
+ consumed = MOLES_GAS_VISIBLE
+ if(WATER_VAPOR_DEPOSITION_POINT to WATER_VAPOR_CONDENSATION_POINT)
+ location.water_vapor_gas_act()
+ consumed = MOLES_GAS_VISIBLE
+
+ if(consumed)
+ air.gases[/datum/gas/water_vapor][MOLES] -= consumed
+ SET_REACTION_RESULTS(consumed)
+ . = REACTING
//tritium combustion: combustion of oxygen and tritium (treated as hydrocarbons). creates hotspots. exothermic
/datum/gas_reaction/nitrous_decomp
@@ -158,7 +167,7 @@
ASSERT_GAS(/datum/gas/water_vapor, air) //oxygen+more-or-less hydrogen=H2O
cached_gases[/datum/gas/water_vapor][MOLES] += burned_fuel / TRITIUM_BURN_OXY_FACTOR
- energy_released += (FIRE_HYDROGEN_ENERGY_WEAK * burned_fuel)
+ energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel)
cached_results["fire"] += burned_fuel
else
@@ -279,7 +288,7 @@
/datum/gas_reaction/fusion
exclude = FALSE
- priority = 2
+ priority_group = PRIORITY_POST_FORMATION
name = "Plasmic Fusion"
id = "fusion"
@@ -512,7 +521,7 @@
return REACTING
/datum/gas_reaction/stim_ball
- priority = 7
+ priority_group = PRIORITY_POST_FORMATION
name ="Stimulum Energy Ball"
id = "stimball"
From aea248bfb05c2e9c76517cbea2dddeda196a46d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Thu, 29 Aug 2024 01:28:00 +0200
Subject: [PATCH 058/114] Compilation but instant runtimes, we might be getting
somewhere tho
---
code/controllers/subsystem/air.dm | 4 ++++
code/modules/atmospherics/environmental/LINDA_fire.dm | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index 117725927b25d..548341fe9c099 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -55,6 +55,9 @@ SUBSYSTEM_DEF(air)
var/list/pausing_z_levels = list()
var/list/pause_processing = list()
+ ///The last time the subsystem completely processed
+ var/last_complete_process = 0
+
/datum/controller/subsystem/air/stat_entry(msg)
msg += "C:{"
@@ -239,6 +242,7 @@ SUBSYSTEM_DEF(air)
resumed = FALSE
currentpart = SSAIR_PIPENETS
+ last_complete_process = world.time
SStgui.update_uis(SSair) //Lightning fast debugging motherfucker
diff --git a/code/modules/atmospherics/environmental/LINDA_fire.dm b/code/modules/atmospherics/environmental/LINDA_fire.dm
index b6504437a0d60..48a3e1e884ed6 100644
--- a/code/modules/atmospherics/environmental/LINDA_fire.dm
+++ b/code/modules/atmospherics/environmental/LINDA_fire.dm
@@ -254,7 +254,7 @@
/obj/effect/hotspot/proc/on_entered(datum/source, atom/movable/arrived, atom/old_loc, list/atom/old_locs)
SIGNAL_HANDLER
- if(isliving(arrived) && !cold_fire)
+ if(isliving(arrived))
var/mob/living/immolated = arrived
immolated.fire_act(temperature, volume)
From 6ef726b262a08b62b76228b6229d72fc0a9520e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Thu, 29 Aug 2024 02:08:34 +0200
Subject: [PATCH 059/114] it compiles, but full of runtimes
---
.github/workflows/continuous_integration.yml | 3 ---
Dockerfile | 10 ----------
code/_compile_options.dm | 15 ---------------
code/game/objects/items/tanks/jetpack.dm | 1 +
code/game/objects/items/tanks/tank_types.dm | 7 +++++++
.../transit_tubes/transit_tube_pod.dm | 3 ++-
code/game/world.dm | 3 ---
.../atmospherics/gasmixtures/gas_types.dm | 4 ++--
.../components/unary_devices/tank.dm | 3 ++-
code/modules/vehicles/mecha/_mecha.dm | 2 ++
dependencies.sh | 3 ---
tools/ci/install_auxmos.sh | 9 ---------
tools/tgs4_scripts/PreCompile.sh | 19 -------------------
13 files changed, 16 insertions(+), 66 deletions(-)
delete mode 100644 tools/ci/install_auxmos.sh
diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml
index d52ea0e45f3d5..43d94ece5f6d5 100644
--- a/.github/workflows/continuous_integration.yml
+++ b/.github/workflows/continuous_integration.yml
@@ -107,9 +107,6 @@ jobs:
sudo apt update || true
sudo apt install libssl1.1:i386
bash tools/ci/install_rust_g.sh
- - name: Install auxmos
- run: |
- bash tools/ci/install_auxmos.sh
- name: Compile Tests
run: |
source $HOME/BYOND/byond/bin/byondsetup
diff --git a/Dockerfile b/Dockerfile
index 185132e507a8f..e82cab34b1222 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -27,15 +27,6 @@ RUN git init \
&& git checkout FETCH_HEAD \
&& cargo build --release --all-features --target i686-unknown-linux-gnu
-# Build auxmos
-FROM rust-build as auxmos
-RUN git init \
- && git remote add origin https://github.com/BeeStation/auxmos \
- && /bin/bash -c "source dependencies.sh \
- && git fetch --depth 1 origin \$AUXMOS_VERSION" \
- && git checkout FETCH_HEAD \
- && cargo rustc --target=i686-unknown-linux-gnu --release --features=trit_fire_hook,plasma_fire_hook,generic_fire_hook
-
# Install nodejs which is required to deploy BeeStation
FROM base as node
COPY dependencies.sh .
@@ -51,7 +42,6 @@ ENV TG_BOOTSTRAP_NODE_LINUX=1
WORKDIR /dm-build
COPY . .
# Required to satisfy our compile_options
-COPY --from=auxmos /build/target/i686-unknown-linux-gnu/release/libauxmos.so /dm-build/auxtools/libauxmos.so
RUN tools/build/build \
&& tools/deploy.sh /deploy \
&& apt-get autoremove curl -y \
diff --git a/code/_compile_options.dm b/code/_compile_options.dm
index 931aa9e059103..4102e88a149d6 100644
--- a/code/_compile_options.dm
+++ b/code/_compile_options.dm
@@ -144,18 +144,3 @@
#warn Building with Dream Maker is no longer supported and will result in missing interface files.
#warn Switch to VSCode and when prompted install the recommended extensions, you can then either use the UI or press Ctrl+Shift+B to build the codebase.
#endif
-
-#define AUXMOS (world.system_type == MS_WINDOWS ? "auxtools/auxmos.dll" : __detect_auxmos())
-
-/proc/__detect_auxmos()
- var/static/auxmos_path
- if(!auxmos_path)
- if (fexists("./libauxmos.so"))
- auxmos_path = "./libauxmos.so"
- else if (fexists("./auxtools/libauxmos.so"))
- auxmos_path = "./auxtools/libauxmos.so"
- else if (fexists("[world.GetConfig("env", "HOME")]/.byond/bin/libauxmos.so"))
- auxmos_path = "[world.GetConfig("env", "HOME")]/.byond/bin/libauxmos.so"
- else
- CRASH("Could not find libauxmos.so")
- return auxmos_path
diff --git a/code/game/objects/items/tanks/jetpack.dm b/code/game/objects/items/tanks/jetpack.dm
index 448f23f813e6a..6dfcead56cf89 100644
--- a/code/game/objects/items/tanks/jetpack.dm
+++ b/code/game/objects/items/tanks/jetpack.dm
@@ -29,6 +29,7 @@
/obj/item/tank/jetpack/populate_gas()
if(gas_type)
+ air_contents.assert_gas(gas_type)
air_contents.gases[gas_type][MOLES] = ((6 * ONE_ATMOSPHERE * volume / (R_IDEAL_GAS_EQUATION * T20C)))
/obj/item/tank/jetpack/ui_action_click(mob/user, action)
diff --git a/code/game/objects/items/tanks/tank_types.dm b/code/game/objects/items/tanks/tank_types.dm
index fbeffd9195dc6..415cea23fcc9f 100644
--- a/code/game/objects/items/tanks/tank_types.dm
+++ b/code/game/objects/items/tanks/tank_types.dm
@@ -30,6 +30,7 @@
/obj/item/tank/internals/oxygen/populate_gas()
+ air_contents.assert_gas(/datum/gas/oxygen)
air_contents.gases[/datum/gas/oxygen][MOLES] = (6*ONE_ATMOSPHERE *volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/oxygen/yellow
@@ -56,6 +57,8 @@
force = 10
/obj/item/tank/internals/anesthetic/populate_gas()
+ air_contents.assert_gas(/datum/gas/oxygen)
+ air_contents.assert_gas(/datum/gas/nitrous_oxide)
air_contents.gases[/datum/gas/oxygen][MOLES] = (3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
air_contents.gases[/datum/gas/nitrous_oxide][MOLES] = (3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
@@ -71,6 +74,8 @@
dog_fashion = /datum/dog_fashion/back
/obj/item/tank/internals/air/populate_gas()
+ air_contents.assert_gas(/datum/gas/oxygen)
+ air_contents.assert_gas(/datum/gas/nitrogen)
air_contents.gases[/datum/gas/oxygen][MOLES] = (6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
air_contents.gases[/datum/gas/nitrogen][MOLES] = (6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
@@ -143,6 +148,7 @@
w_class = WEIGHT_CLASS_SMALL //thanks i forgot this
/obj/item/tank/internals/plasmaman/belt/full/populate_gas()
+ air_contents.assert_gas(/datum/gas/plasma)
air_contents.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasmaman/belt/empty/populate_gas()
@@ -170,6 +176,7 @@
/obj/item/tank/internals/emergency_oxygen/populate_gas()
+ air_contents.assert_gas(/datum/gas/oxygen)
air_contents.gases[/datum/gas/oxygen][MOLES] = (10*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/emergency_oxygen/empty/populate_gas()
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 5145be075b40d..6425ce9406f0a 100644
--- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
+++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
@@ -13,8 +13,9 @@
/obj/structure/transit_tube_pod/Initialize(mapload)
. = ..()
+ air_contents.assert_gas(/datum/gas/oxygen)
air_contents.gases[/datum/gas/oxygen][MOLES] = MOLES_O2STANDARD
-
+ air_contents.assert_gas(/datum/gas/nitrogen)
air_contents.gases[/datum/gas/nitrogen][MOLES] = MOLES_N2STANDARD
air_contents.temperature = T20C
diff --git a/code/game/world.dm b/code/game/world.dm
index 3e3d765fa1148..292c74305fbb1 100644
--- a/code/game/world.dm
+++ b/code/game/world.dm
@@ -32,7 +32,6 @@ GLOBAL_VAR(restart_counter)
*/
/world/proc/Genesis()
// auxtools has to go BEFORE tracy, otherwise tracy will clobber its hook addresses
- AUXTOOLS_CHECK(AUXMOS)
#ifdef USE_BYOND_TRACY
#warn USE_BYOND_TRACY is enabled
init_byond_tracy()
@@ -346,12 +345,10 @@ 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.
- AUXTOOLS_SHUTDOWN(AUXMOS)
..()
/world/Del()
shutdown_logging() // makes sure the thread is closed before end, else we terminate
- AUXTOOLS_SHUTDOWN(AUXMOS)
var/debug_server = world.GetConfig("env", "AUXTOOLS_DEBUG_DLL")
if (debug_server)
LIBCALL(debug_server, "auxtools_shutdown")()
diff --git a/code/modules/atmospherics/gasmixtures/gas_types.dm b/code/modules/atmospherics/gasmixtures/gas_types.dm
index 0c653906c148d..6cf7d2a595dda 100644
--- a/code/modules/atmospherics/gasmixtures/gas_types.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_types.dm
@@ -5,7 +5,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
/proc/meta_gas_list()
. = subtypesof(/datum/gas)
for(var/gas_path in .)
- var/list/gas_info = new(7)
+ var/list/gas_info = new(11)
var/datum/gas/gas = gas_path
gas_info[META_GAS_SPECIFIC_HEAT] = initial(gas.specific_heat)
@@ -20,7 +20,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
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_info[META_GAS_BREATH_ALERT_INFO] = gas.breath_alert_info
+ gas_info[META_GAS_BREATH_ALERT_INFO] = initial(gas.breath_alert_info)
gas_info[META_GAS_BREATH_REAGENT] = initial(gas.breath_reagent)
gas_info[META_GAS_BREATH_RESULTS] = initial(gas.breath_results)
gas_info[META_GAS_BREATH_REAGENT_DANGEROUS] = initial(gas.breath_reagent_dangerous)
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
index 871ba1e1993ac..67d863384f7bd 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
@@ -33,8 +33,9 @@
/obj/machinery/atmospherics/components/unary/tank/air/New()
..()
var/datum/gas_mixture/air_contents = airs[1]
+ air_contents.assert_gas(/datum/gas/oxygen)
air_contents.gases[/datum/gas/oxygen][MOLES] = AIR_CONTENTS * 0.2
-
+ air_contents.assert_gas(/datum/gas/nitrogen)
air_contents.gases[/datum/gas/nitrogen][MOLES] = AIR_CONTENTS * 0.8
diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm
index bd067af63d11d..c60c7dc358dbe 100644
--- a/code/modules/vehicles/mecha/_mecha.dm
+++ b/code/modules/vehicles/mecha/_mecha.dm
@@ -328,7 +328,9 @@
cabin_air = new
cabin_air.temperature = (T20C)
cabin_air.volume = 200
+ cabin_air.assert_gas(/datum/gas/oxygen)
cabin_air.gases[/datum/gas/oxygen][MOLES] = O2STANDARD*cabin_air.return_volume()/(R_IDEAL_GAS_EQUATION*cabin_air.return_temperature())
+ cabin_air.assert_gas(/datum/gas/nitrogen)
cabin_air.gases[/datum/gas/nitrogen][MOLES] = N2STANDARD*cabin_air.return_volume()/(R_IDEAL_GAS_EQUATION*cabin_air.return_temperature())
return cabin_air
diff --git a/dependencies.sh b/dependencies.sh
index 188d1cef3b815..d6dc082788254 100755
--- a/dependencies.sh
+++ b/dependencies.sh
@@ -20,8 +20,5 @@ export NODE_VERSION_PRECISE=18.14.2
# SpacemanDMM git tag
export SPACEMAN_DMM_VERSION=suite-1.7.1
-#auxmos version
-export AUXMOS_VERSION=2.2.2
-
# Python version for mapmerge and other tools
export PYTHON_VERSION=3.11.2
diff --git a/tools/ci/install_auxmos.sh b/tools/ci/install_auxmos.sh
deleted file mode 100644
index 591bcf612f19a..0000000000000
--- a/tools/ci/install_auxmos.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-
-source dependencies.sh
-
-mkdir -p ~/.byond/bin
-wget -O ~/.byond/bin/libauxmos.so "https://github.com/BeeStation/auxmos/releases/download/${AUXMOS_VERSION}/libauxmos.so"
-chmod +x ~/.byond/bin/libauxmos.so
-ldd ~/.byond/bin/libauxmos.so
diff --git a/tools/tgs4_scripts/PreCompile.sh b/tools/tgs4_scripts/PreCompile.sh
index ed588b5d33d78..5fa7810d6d1f1 100755
--- a/tools/tgs4_scripts/PreCompile.sh
+++ b/tools/tgs4_scripts/PreCompile.sh
@@ -70,25 +70,6 @@ cd ..
# I left a few potentially extraneous ones in momentarily due to an inability to test on a linux host at the moment.
apt-get install -y cmake build-essential gcc-multilib g++-multilib cmake wget
-# update auxmos
-if [ ! -d "auxmos" ]; then
- echo "Cloning Auxmos..."
- git clone https://github.com/BeeStation/auxmos
- cd auxmos
-else
- echo "Fetching Auxmos..."
- cd auxmos
- git fetch
-fi
-
-echo "Deploying Auxmos..."
-git checkout "$AUXMOS_VERSION"
-if [ -d "build" ]; then
- rm -R build
-fi
-#note, if FUSION is ever fixed this needs changed to "all_reaction_hooks"
-cargo rustc --target=i686-unknown-linux-gnu --release --features trit_fire_hook,plasma_fire_hook,generic_fire_hook -- -C target-cpu=native
-mv -f target/i686-unknown-linux-gnu/release/libauxmos.so "$1/libauxmos.so"
cd ../../..
# install or update youtube-dl when not present, or if it is present with pip3,
From d8c571a7790dcc865e4a5f1b35ae134927259beb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Thu, 29 Aug 2024 16:11:24 +0200
Subject: [PATCH 060/114] Killed some runtimes, game manages to fully
initialize now
---
code/__DEFINES/atmospherics/atmos_mapping_helpers.dm | 2 +-
code/game/turfs/open/_open.dm | 2 +-
code/modules/mob/living/simple_animal/simple_animal.dm | 7 ++++---
code/modules/mob/living/simple_animal/slime/life.dm | 2 +-
4 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/code/__DEFINES/atmospherics/atmos_mapping_helpers.dm b/code/__DEFINES/atmospherics/atmos_mapping_helpers.dm
index 0ba8f29f4e210..abb8305bbc152 100644
--- a/code/__DEFINES/atmospherics/atmos_mapping_helpers.dm
+++ b/code/__DEFINES/atmospherics/atmos_mapping_helpers.dm
@@ -33,7 +33,7 @@
#define MAXIMUM_LAVALAND_EQUIPMENT_EFFECT_PRESSURE 90
//ATMOS MIX IDS
-#define LAVALAND_DEFAULT_ATMOS "LAVALAND_ATMOS"
+#define LAVALAND_DEFAULT_ATMOS "o2=14;n2=5;co2=13;TEMP=300"
//ATMOSIA GAS MONITOR TAGS
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index fcd0c65476c37..952076b3b570e 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -289,7 +289,7 @@
/turf/open/rad_act(pulse_strength)
. = ..()
- if (air.gases[/datum/gas/carbon_dioxide][MOLES] && air.gases[/datum/gas/oxygen][MOLES])
+ if (air.gases[/datum/gas/carbon_dioxide] && air.gases[/datum/gas/oxygen])
pulse_strength = min(pulse_strength,air.gases[/datum/gas/carbon_dioxide][MOLES]*1000,air.gases[/datum/gas/oxygen][MOLES]*2000) //Ensures matter is conserved properly
air.gases[/datum/gas/carbon_dioxide][MOLES] = max(air.gases[/datum/gas/carbon_dioxide][MOLES]-(pulse_strength/1000),0)
air.gases[/datum/gas/oxygen][MOLES] = max(air.gases[/datum/gas/oxygen][MOLES]-(pulse_strength/2000),0)
diff --git a/code/modules/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm
index 38ea2741db5bf..b0c102a0e3199 100644
--- a/code/modules/mob/living/simple_animal/simple_animal.dm
+++ b/code/modules/mob/living/simple_animal/simple_animal.dm
@@ -235,10 +235,11 @@
if(isturf(loc) && isopenturf(loc))
var/turf/open/ST = loc
if(ST.air)
+ ST.air.assert_gases(/datum/gas/plasma,/datum/gas/nitrogen, /datum/gas/oxygen, /datum/gas/carbon_dioxide)
var/tox = ST.air.gases[/datum/gas/plasma][MOLES]
- var/oxy = ST.air.gases[/datum/gas/oxygen][MOLES]
- var/n2 = ST.air.gases[/datum/gas/nitrogen][MOLES]
- var/co2 = ST.air.gases[/datum/gas/carbon_dioxide][MOLES]
+ var/oxy = ST.air.gases[/datum/gas/oxygen]?[MOLES]
+ var/n2 = ST.air.gases[/datum/gas/nitrogen]?[MOLES]
+ var/co2 = ST.air.gases[/datum/gas/carbon_dioxide]?[MOLES]
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 98088c90ad480..66eb22a01e517 100644
--- a/code/modules/mob/living/simple_animal/slime/life.dm
+++ b/code/modules/mob/living/simple_animal/slime/life.dm
@@ -93,7 +93,7 @@
else
adjustBruteLoss(round(sqrt(bodytemperature)) * 2)
- if(stat != DEAD)
+ if(stat != DEAD && environment.gases[/datum/gas/bz])
var/bz_percentage = environment.total_moles() ? (environment.gases[/datum/gas/bz][MOLES] / environment.total_moles()) : 0
var/stasis = (bz_percentage >= 0.05 && bodytemperature < (T0C + 100)) || force_stasis
if(transformeffects & SLIME_EFFECT_DARK_PURPLE)
From 1e61cb6e191f434ace3017ddb8948550dc3aece3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rat=C3=B3n?=
Date: Thu, 29 Aug 2024 17:07:44 +0200
Subject: [PATCH 061/114] Last commit before computer switch, again more misc
changes, still trying to figure out why every single turf is marked active
---
code/game/turfs/turf.dm | 7 -------
1 file changed, 7 deletions(-)
diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm
index 351b017164f51..10221b029abf8 100644
--- a/code/game/turfs/turf.dm
+++ b/code/game/turfs/turf.dm
@@ -143,11 +143,6 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists)
set_custom_materials(temp_list)
ComponentInitialize()
- if(isopenturf(src))
- var/turf/open/O = src
- __auxtools_update_turf_temp_info(isspaceturf(get_z_base_turf()) && !O.planetary_atmos)
- else
- __auxtools_update_turf_temp_info(isspaceturf(get_z_base_turf()))
//Handle turf texture
var/datum/turf_texture/TT = get_turf_texture()
@@ -156,8 +151,6 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists)
return INITIALIZE_HINT_NORMAL
-/turf/proc/__auxtools_update_turf_temp_info()
-
/turf/return_temperature()
From 3aaca4295457c11b62ab5465eeda11e57b3e41c8 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sat, 31 Aug 2024 00:52:34 +0200
Subject: [PATCH 062/114] Whatever
---
code/game/objects/items/tanks/tank_types.dm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/code/game/objects/items/tanks/tank_types.dm b/code/game/objects/items/tanks/tank_types.dm
index 415cea23fcc9f..36241e36a6ff5 100644
--- a/code/game/objects/items/tanks/tank_types.dm
+++ b/code/game/objects/items/tanks/tank_types.dm
@@ -92,6 +92,7 @@
/obj/item/tank/internals/plasma/populate_gas()
+ air_contents.assert_gas(/datum/gas/plasma)
air_contents.gases[/datum/gas/plasma][MOLES] = (3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasma/attackby(obj/item/W, mob/user, params)
@@ -108,6 +109,7 @@
return ..()
/obj/item/tank/internals/plasma/full/populate_gas()
+ air_contents.assert_gas(/datum/gas/plasma)
air_contents.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasma/empty/populate_gas()
From 262a5778c75cf82cb56481db6de9cb7156fbc0c8 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sat, 31 Aug 2024 15:15:19 +0200
Subject: [PATCH 063/114] Atmos init speedup, saves 4 seconds (#69697)
* Micro optimizes ssair's turf init, saving 2 seconds
Most of this is making existing operations do more legwork, or cheaper.
I did add cycle checking to ONLY init turf linking, which required
creating a new proc.
Did some horrible horrible things in said proc to save like 0.8 seconds.
I think it was worth it.
---
code/controllers/subsystem/air.dm | 52 +++++++++++++--
code/game/turfs/closed/_closed.dm | 1 +
code/game/turfs/open/_open.dm | 17 ++---
code/game/turfs/open/space/space.dm | 3 +-
code/game/turfs/turf.dm | 8 +--
code/modules/admin/verbs/fix_air.dm | 20 ++++++
.../environmental/LINDA_system.dm | 66 +++++++++++++++++--
.../environmental/LINDA_turf_tile.dm | 18 +++--
.../atmospherics/gasmixtures/gas_mixture.dm | 43 ++++++------
.../mapGeneratorModules/helpers.dm | 2 +-
10 files changed, 177 insertions(+), 53 deletions(-)
create mode 100644 code/modules/admin/verbs/fix_air.dm
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index 548341fe9c099..ff50dda2142b8 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -33,6 +33,9 @@ SUBSYSTEM_DEF(air)
var/list/gas_reactions = list()
var/list/atmos_gen
var/list/planetary = list() //Lets cache static planetary mixes
+ /// List of gas string -> canonical gas mixture
+ var/list/strings_to_mix = list()
+
//Special functions lists
var/list/turf/active_super_conductivity = list()
@@ -506,7 +509,7 @@ SUBSYSTEM_DEF(air)
/datum/controller/subsystem/air/proc/setup_allturfs()
var/list/turfs_to_init = block(locate(1, 1, 1), locate(world.maxx, world.maxy, world.maxz))
var/list/active_turfs = src.active_turfs
- var/times_fired = ++src.times_fired
+ 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.
@@ -516,13 +519,16 @@ SUBSYSTEM_DEF(air)
active.remove_atom_colour(TEMPORARY_COLOUR_PRIORITY, COLOR_VIBRANT_LIME)
#endif
active_turfs.Cut()
+ var/time = 0
- for(var/thing in turfs_to_init)
- var/turf/T = thing
- if (T.blocks_air)
+ for(var/turf/T as anything in turfs_to_init)
+ if (!T.init_air)
continue
- T.Initalize_Atmos(times_fired)
- CHECK_TICK
+ // We pass the tick as the current step so if we sleep the step changes
+ // This way we can make setting up adjacent turfs O(n) rather then O(n^2)
+ T.Initalize_Atmos(time)
+ if(CHECK_TICK)
+ time++
if(active_turfs.len)
var/starting_ats = active_turfs.len
@@ -542,8 +548,8 @@ SUBSYSTEM_DEF(air)
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
@@ -640,6 +646,38 @@ GLOBAL_LIST_EMPTY(colored_images)
var/datum/atmosphere/atmostype = T
atmos_gen[initial(atmostype.id)] = new atmostype
+/// Takes a gas string, returns the matching mutable gas_mixture
+/datum/controller/subsystem/air/proc/parse_gas_string(gas_string)
+ var/datum/gas_mixture/cached = strings_to_mix[gas_string]
+ if(cached)
+ if(istype(cached, /datum/gas_mixture/immutable))
+ return cached
+ return cached.copy()
+
+ var/datum/gas_mixture/canonical_mix = new()
+ // We set here so any future key changes don't fuck us
+ strings_to_mix[gas_string] = canonical_mix
+ gas_string = preprocess_gas_string(gas_string)
+
+ var/list/gases = canonical_mix.gases
+ var/list/gas = params2list(gas_string)
+ if(gas["TEMP"])
+ canonical_mix.temperature = text2num(gas["TEMP"])
+ canonical_mix.temperature_archived = canonical_mix.temperature
+ gas -= "TEMP"
+ else // if we do not have a temp in the new gas mix lets assume room temp.
+ canonical_mix.temperature = T20C
+ 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
+ ADD_GAS(path, gases)
+ gases[path][MOLES] = text2num(gas[id])
+
+ if(istype(canonical_mix, /datum/gas_mixture/immutable))
+ return canonical_mix
+ return canonical_mix.copy()
+
/datum/controller/subsystem/air/proc/preprocess_gas_string(gas_string)
if(!atmos_gen)
generate_atmos()
diff --git a/code/game/turfs/closed/_closed.dm b/code/game/turfs/closed/_closed.dm
index 9b77cdb16426b..9401d0c21e78b 100644
--- a/code/game/turfs/closed/_closed.dm
+++ b/code/game/turfs/closed/_closed.dm
@@ -5,6 +5,7 @@
init_air = FALSE
blocks_air = TRUE
rad_flags = RAD_PROTECT_CONTENTS | RAD_NO_CONTAMINATE
+ init_air = FALSE
rad_insulation = RAD_MEDIUM_INSULATION
pass_flags_self = PASSCLOSEDTURF
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index 952076b3b570e..63d66b611b515 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -172,26 +172,27 @@
/turf/open/indestructible/airblock
icon_state = "bluespace"
blocks_air = TRUE
+ init_air = FALSE
baseturfs = /turf/open/indestructible/airblock
init_air = FALSE
-/turf/open/Initalize_Atmos(times_fired)
+/turf/open/Initalize_Atmos(time)
excited = FALSE
if(!blocks_air)
if(!istype(air,/datum/gas_mixture/turf))
air = new(2500,src)
air.copy_from_turf(src)
- update_visuals()
- current_cycle = times_fired
- immediate_calculate_adjacent_turfs()
- for(var/i in atmos_adjacent_turfs)
- var/turf/open/enemy_tile = i
- var/datum/gas_mixture/enemy_air = enemy_tile.return_air()
- if(!excited && air.compare(enemy_air))
+ current_cycle = time
+
+ init_immediate_calculate_adjacent_turfs()
+ for(var/turf/open/enemy_tile as anything in atmos_adjacent_turfs)
+ if(air.compare(enemy_tile.return_air()))
//testing("Active turf found. Return value of compare(): [is_active]")
excited = TRUE
SSair.active_turfs += src
+ // No sense continuing to iterate
+ return
/turf/open/proc/GetHeatCapacity()
. = air.heat_capacity()
diff --git a/code/game/turfs/open/space/space.dm b/code/game/turfs/open/space/space.dm
index 961a124b98a4d..74d37063b3db8 100644
--- a/code/game/turfs/open/space/space.dm
+++ b/code/game/turfs/open/space/space.dm
@@ -25,9 +25,10 @@
var/destination_x
var/destination_y
- var/static/datum/gas_mixture/immutable/space/space_gas
+ var/static/datum/gas_mixture/immutable/space/space_gas = new
// We do NOT want atmos adjacent turfs
init_air = FALSE
+ run_later = TRUE
plane = PLANE_SPACE
layer = SPACE_LAYER
light_power = 0.25
diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm
index 10221b029abf8..24ca5fe6c4a09 100644
--- a/code/game/turfs/turf.dm
+++ b/code/game/turfs/turf.dm
@@ -35,6 +35,9 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists)
/// Whether the turf blocks atmos from passing through it or not
var/blocks_air = FALSE
+ // If this turf should initialize atmos adjacent turfs or not
+ // Optimization, not for setting outside of initialize
+ var/init_air = TRUE
flags_1 = CAN_BE_DIRTY_1
@@ -151,11 +154,8 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists)
return INITIALIZE_HINT_NORMAL
-/turf/return_temperature()
-
-
/// Initializes our adjacent turfs. If you want to avoid this, do not override it, instead set init_air to FALSE
-/turf/proc/Initalize_Atmos(times_fired)
+/turf/proc/Initalize_Atmos(time)
CALCULATE_ADJACENT_TURFS(src, NORMAL_TURF)
/turf/Destroy(force)
diff --git a/code/modules/admin/verbs/fix_air.dm b/code/modules/admin/verbs/fix_air.dm
new file mode 100644
index 0000000000000..ef67528c7295c
--- /dev/null
+++ b/code/modules/admin/verbs/fix_air.dm
@@ -0,0 +1,20 @@
+// Proc taken from yogstation, credit to nichlas0010 for the original
+/client/proc/fix_air(turf/open/T in world)
+ set name = "Fix Air"
+ set category = "Admin.Game"
+ set desc = "Fixes air in specified radius."
+
+ if(!holder)
+ to_chat(src, "Only administrators may use this command.", confidential = TRUE)
+ return
+ if(check_rights(R_ADMIN,1))
+ var/range=input("Enter range:","Num",2) as num
+ message_admins("[key_name_admin(usr)] fixed air with range [range] in area [T.loc.name]")
+ usr.log_message("fixed air with range [range] in area [T.loc.name]", LOG_ADMIN)
+ for(var/turf/open/F in range(range,T))
+ if(F.blocks_air)
+ //skip walls
+ continue
+ var/datum/gas_mixture/GM = SSair.parse_gas_string(F.initial_gas_mix)
+ F.copy_air(GM)
+ F.update_visuals()
diff --git a/code/modules/atmospherics/environmental/LINDA_system.dm b/code/modules/atmospherics/environmental/LINDA_system.dm
index 5d4ee7f1754b1..30e97e4ba7d26 100644
--- a/code/modules/atmospherics/environmental/LINDA_system.dm
+++ b/code/modules/atmospherics/environmental/LINDA_system.dm
@@ -53,26 +53,81 @@
/atom/movable/proc/block_superconductivity() // objects that block air and don't let superconductivity act. Only firelocks atm.
return FALSE
-/turf/proc/immediate_calculate_adjacent_turfs()
+/// This proc is a more deeply optimized version of immediate_calculate_adjacent_turfs
+/// It contains dumbshit, and also stuff I just can't do at runtime
+/// If you're not editing behavior, just read that proc. It's less bad
+/turf/proc/init_immediate_calculate_adjacent_turfs()
//Basic optimization, if we can't share why bother asking other people ya feel?
+ // You know it's gonna be stupid when they include a unit test in the atmos code
+ // Yes, inlining the string concat does save 0.1 seconds
+ #ifdef UNIT_TESTS
+ ASSERT(UP == 16)
+ ASSERT(DOWN == 32)
+ #endif
+ LAZYINITLIST(src.atmos_adjacent_turfs)
+ var/list/atmos_adjacent_turfs = src.atmos_adjacent_turfs
+ var/canpass = CANATMOSPASS(src, src, FALSE)
+ // I am essentially inlineing two get_dir_multizs here, because they're way too slow on their own. I'm sorry brother
+ var/list/z_traits = SSmapping.multiz_levels[z]
+ for(var/direction in GLOB.cardinals_multiz)
+ // Yes this is a reimplementation of get_step_mutliz. It's faster tho. fuck you
+ // Oh also yes UP and DOWN do just point to +1 and -1 and not z offsets
+ // Multiz is shitcode welcome home
+ var/turf/current_turf = (direction & (UP|DOWN)) ? \
+ (direction & UP) ? \
+ (z_traits["16"]) ? \
+ (get_step(locate(x, y, z + 1), NONE)) : \
+ (null) : \
+ (z_traits["32"]) ? \
+ (get_step(locate(x, y, z - 1), NONE)) : \
+ (null) : \
+ (get_step(src, direction))
+ if(!isopenturf(current_turf)) // not interested in you brother
+ continue
+ // The assumption is that ONLY DURING INIT if two tiles have the same cycle, there's no way canpass(a->b) will be different then canpass(b->a), so this is faster
+ // Saves like 1.2 seconds
+ if(current_turf.current_cycle >= current_cycle)
+ continue
+
+ //Can you and me form a deeper relationship, or is this just a passing wind
+ // (direction & (UP | DOWN)) is just "is this vertical" by the by
+ if(canpass && CANATMOSPASS(current_turf, src, (direction & (UP|DOWN))) && !(blocks_air || current_turf.blocks_air))
+ LAZYINITLIST(current_turf.atmos_adjacent_turfs)
+ atmos_adjacent_turfs[current_turf] = TRUE
+ current_turf.atmos_adjacent_turfs[src] = TRUE
+ else
+ atmos_adjacent_turfs -= current_turf
+ if (current_turf.atmos_adjacent_turfs)
+ current_turf.atmos_adjacent_turfs -= src
+ UNSETEMPTY(current_turf.atmos_adjacent_turfs)
+ SEND_SIGNAL(current_turf, COMSIG_TURF_CALCULATED_ADJACENT_ATMOS)
+
+ UNSETEMPTY(atmos_adjacent_turfs)
+ src.atmos_adjacent_turfs = atmos_adjacent_turfs
+ SEND_SIGNAL(src, COMSIG_TURF_CALCULATED_ADJACENT_ATMOS)
+
+/turf/proc/immediate_calculate_adjacent_turfs()
+ LAZYINITLIST(src.atmos_adjacent_turfs)
+ var/list/atmos_adjacent_turfs = src.atmos_adjacent_turfs
var/canpass = CANATMOSPASS(src, src, FALSE)
for(var/direction in GLOB.cardinals_multiz)
var/turf/current_turf = get_step_multiz(src, direction)
if(!isopenturf(current_turf)) // not interested in you brother
continue
+
//Can you and me form a deeper relationship, or is this just a passing wind
// (direction & (UP | DOWN)) is just "is this vertical" by the by
if(canpass && CANATMOSPASS(current_turf, src, (direction & (UP|DOWN))) && !(blocks_air || current_turf.blocks_air))
- LAZYINITLIST(atmos_adjacent_turfs)
LAZYINITLIST(current_turf.atmos_adjacent_turfs)
atmos_adjacent_turfs[current_turf] = TRUE
current_turf.atmos_adjacent_turfs[src] = TRUE
else
- if (atmos_adjacent_turfs)
- atmos_adjacent_turfs -= current_turf
+ atmos_adjacent_turfs -= current_turf
if (current_turf.atmos_adjacent_turfs)
current_turf.atmos_adjacent_turfs -= src
UNSETEMPTY(current_turf.atmos_adjacent_turfs)
+ SEND_SIGNAL(current_turf, COMSIG_TURF_CALCULATED_ADJACENT_ATMOS)
+
UNSETEMPTY(atmos_adjacent_turfs)
src.atmos_adjacent_turfs = atmos_adjacent_turfs
@@ -150,8 +205,7 @@
if(!text || !air)
return
- var/datum/gas_mixture/turf_mixture = new
- turf_mixture.parse_gas_string(text)
+ var/datum/gas_mixture/turf_mixture = SSair.parse_gas_string(text)
air.merge(turf_mixture)
archive()
diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
index 025dee1a2f277..d664bc2e1e977 100644
--- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
+++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
@@ -51,8 +51,7 @@
/turf/open/Initialize()
if(!blocks_air)
- air = new
- air.copy_from_turf(src)
+ air = create_gas_mixture()
if(planetary_atmos)
if(!SSair.planetary[initial_gas_mix])
var/datum/gas_mixture/immutable/planetary/mix = new
@@ -70,6 +69,18 @@
/////////////////GAS MIXTURE PROCS///////////////////
+///Copies all gas info from the turf into a new gas_mixture, along with our temperature
+///Returns the created gas_mixture
+/turf/proc/create_gas_mixture()
+ var/datum/gas_mixture/mix = SSair.parse_gas_string(initial_gas_mix)
+
+ //acounts for changes in temperature
+ var/turf/parent = parent_type
+ if(temperature != initial(temperature) || temperature != initial(parent.temperature))
+ mix.temperature = temperature
+
+ return mix
+
/turf/open/assume_air(datum/gas_mixture/giver) //use this for machines to adjust air
if(!giver)
return FALSE
@@ -93,8 +104,7 @@
/turf/return_air()
RETURN_TYPE(/datum/gas_mixture)
- var/datum/gas_mixture/copied_mixture = new
- copied_mixture.copy_from_turf(src)
+ var/datum/gas_mixture/copied_mixture = create_gas_mixture()
return copied_mixture
/turf/open/return_air()
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index 48e9457940aa8..46695df060045 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -262,8 +262,8 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
return copy
- ///Copies variables from sample, moles multiplicated by partial
- ///Returns: 1 if we are mutable, 0 otherwise
+///Copies variables from sample, moles multiplicated by partial
+///Returns: TRUE if we are mutable, FALSE otherwise
/datum/gas_mixture/proc/copy_from(datum/gas_mixture/sample, partial = 1)
var/list/cached_gases = gases //accessing datum vars is slower than proc vars
var/list/sample_gases = sample.gases
@@ -329,9 +329,11 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
gases[path][MOLES] = text2num(gas[id])
return 1
- ///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/share(datum/gas_mixture/sharer, atmos_adjacent_turfs = 4)
+/// Performs air sharing calculations between two gas_mixtures
+/// share() is communitive, which means A.share(B) needs to be the same as B.share(A)
+/// If we don't retain this, we will get negative moles. Don't do it
+/// Returns: amount of gas exchanged (+ if sharer received)
+/datum/gas_mixture/proc/share(datum/gas_mixture/sharer, our_coeff, sharer_coeff)
var/list/cached_gases = gases
var/list/sharer_gases = sharer.gases
@@ -430,25 +432,22 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
/datum/gas_mixture/proc/compare(datum/gas_mixture/sample)
var/list/sample_gases = sample.gases //accessing datum vars is slower than proc vars
var/list/cached_gases = gases
+ var/moles_sum = 0
for(var/id in cached_gases | sample_gases) // compare gases from either mixture
- var/gas_moles = cached_gases[id]
- gas_moles = gas_moles ? gas_moles[MOLES] : 0
- var/sample_moles = sample_gases[id]
- sample_moles = sample_moles ? sample_moles[MOLES] : 0
- var/delta = abs(gas_moles - sample_moles)
- if(delta > MINIMUM_MOLES_DELTA_TO_MOVE && \
- delta > gas_moles * MINIMUM_AIR_RATIO_TO_MOVE)
- return id
-
- var/our_moles
- TOTAL_MOLES(cached_gases, our_moles)
- if(our_moles > MINIMUM_MOLES_DELTA_TO_MOVE) //Don't consider temp if there's not enough mols
- var/temp = temperature
- var/sample_temp = sample.temperature
-
- var/temperature_delta = abs(temp - sample_temp)
- if(temperature_delta > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND)
+ // Yes this is actually fast. I too hate it here
+ var/gas_moles = cached_gases[id]?[MOLES] || 0
+ var/sample_moles = sample_gases[id]?[MOLES] || 0
+ // Brief explanation. We are much more likely to not pass this first check then pass the first and fail the second
+ // Because of this, double calculating the delta is FASTER then inserting it into a var
+ if(abs(gas_moles - sample_moles) > MINIMUM_MOLES_DELTA_TO_MOVE)
+ if(abs(gas_moles - sample_moles) > gas_moles * MINIMUM_AIR_RATIO_TO_MOVE)
+ return id
+ // similarly, we will rarely get cut off, so this is cheaper then doing it later
+ moles_sum += gas_moles
+
+ if(moles_sum > MINIMUM_MOLES_DELTA_TO_MOVE) //Don't consider temp if there's not enough mols
+ if(abs(temperature - sample.temperature) > MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND)
return "temp"
return ""
diff --git a/code/modules/procedural_mapping/mapGeneratorModules/helpers.dm b/code/modules/procedural_mapping/mapGeneratorModules/helpers.dm
index 08d5cb781b9c8..64279d6ddccc4 100644
--- a/code/modules/procedural_mapping/mapGeneratorModules/helpers.dm
+++ b/code/modules/procedural_mapping/mapGeneratorModules/helpers.dm
@@ -12,7 +12,7 @@
var/list/map = mother.map
for(var/turf/open/T in map)
if(T.air)
- T.air.copy_from_turf(T)
+ T.air = T.create_gas_mixture()
SSair.add_to_active(T, TRUE)
/datum/mapGeneratorModule/bottomLayer/massdelete
From 7caabd0461e940a51aa695fe28735e101e9c3c17 Mon Sep 17 00:00:00 2001
From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Date: Tue, 11 Jan 2022 15:16:15 -0800
Subject: [PATCH 064/114] Makes `share()` canonical. Saves cpu time, makes the
simulation proper (#63785)
---
code/game/objects/effects/portals.dm | 8 +-
code/modules/atmospherics/Atmospherics.md | 74 ++++++++++++++++++-
.../environmental/LINDA_turf_tile.dm | 35 +++++++--
.../atmospherics/gasmixtures/gas_mixture.dm | 35 +++++++--
code/modules/events/wormholes.dm | 2 +-
5 files changed, 132 insertions(+), 22 deletions(-)
diff --git a/code/game/objects/effects/portals.dm b/code/game/objects/effects/portals.dm
index 54b50fa7a7333..dea84b2fdad78 100644
--- a/code/game/objects/effects/portals.dm
+++ b/code/game/objects/effects/portals.dm
@@ -1,10 +1,9 @@
-
-/proc/create_portal_pair(turf/source, turf/destination, _creator = null, _lifespan = 300, accuracy = 0, newtype = /obj/effect/portal, atmos_link_override)
+/proc/create_portal_pair(turf/source, turf/destination, _lifespan = 300, accuracy = 0, newtype = /obj/effect/portal)
if(!istype(source) || !istype(destination))
return
var/turf/actual_destination = get_teleport_turf(destination, accuracy)
- var/obj/effect/portal/P1 = new newtype(source, _creator, _lifespan, null, FALSE, null, atmos_link_override)
- var/obj/effect/portal/P2 = new newtype(actual_destination, _creator, _lifespan, P1, TRUE, null, atmos_link_override)
+ var/obj/effect/portal/P1 = new newtype(source, _lifespan, null, FALSE, null)
+ var/obj/effect/portal/P2 = new newtype(actual_destination, _lifespan, P1, TRUE, null)
if(!istype(P1)||!istype(P2))
return
P1.link_portal(P2)
@@ -154,7 +153,6 @@
call(creator, "on_portal_destroy")(src, src.loc)
creator = null
GLOB.portals -= src
- unlink_atmos()
if(hardlinked && !QDELETED(linked))
QDEL_NULL(linked)
else
diff --git a/code/modules/atmospherics/Atmospherics.md b/code/modules/atmospherics/Atmospherics.md
index dd4454d51d725..f0ebe8ba0041c 100644
--- a/code/modules/atmospherics/Atmospherics.md
+++ b/code/modules/atmospherics/Atmospherics.md
@@ -157,6 +157,78 @@ As for react(), it is where all the behavior of the reaction is defined. The pro
This is a rather large subject, we will need to cover gas flow, turf sleeping, superconduction, and much more. Strap in and enjoy the ride!
+### A Word On `Share()`
+
+Each pair of turfs will only ever call `share()` on each other once. They use an archived cycle to keep track of
+this ordering
+
+That means turf A calling share on turf B should work the same as turf B calling share on turf A
+
+The key idea of FEA, the core sharing system we use is that neighboring cells should effectively equalize with each other.
+So taken on a line, you'd have two sharing partners, the cells to your left and right. The end goal of the simulation is for all the tiles on the line to have the same mix. But we can't just jump to that. So each "tick" we take our mix and average it with the mixes of the two tiles next to us.
+
+There's an equation for this that's considered standard in heat simulation. (Watch this video: https://www.youtube.com/watch?v=ly4S0oi3Yz8)
+We can't use it because means each pair of turfs needs to talk to each other twice, which is pain expensive. That and I'm pretty sure it would prevent us from yielding
+
+So instead of a complex form of averaging, we portion up tiles. So if you have two neighbors and you have something they don't, you can give them each a third. Have to keep one for ourselves mind, because otherwise we'll run out of gas. They can then act on this portion however they like, and we can likewise act on a portion of them to our liking.
+
+We know how much gas a tile had at the outset because of the archived moles list index. If we take more then we're owed in any shares before all other turfs have had their say, we could end up with negative moles. We expend a lot of effort to avoid this.
+
+The math for this looks like (totaldeltagas)/(neighborcount + 1)
+
+You may notice something like this in `process_cell()`. It's not quite the same though.
+
+Back in the old FEA days, neighbor count was hardcoded to 4 (Likely because this is what cell sharing on an infinite grid would look like). This means that turf A -> turf B is the same as turf B -> turf A, because they're each portioning up the gas in the same way.
+
+But when we moved to LINDA, we started using the length of our atmos_adjacent_turfs list (or an analog).
+We need this so things like multiz can work, and so tiles in a corner share in a way that makes sense.
+
+Because of this, turf A -> turf B was no longer the same as turf B -> turf A, assuming one of those turfs had a different neighbor count, from I DON'T KNOW WALLS?
+
+The fix for this was to use our neighbor count when moving gas from our tile to someone else's, and use the sharer's neighbor count when taking from it.
+
+This makes sense intuitively if you think of it like portioning up a tile, but I've included a rundown to make
+it a bit easier to prove to yourself.
+
+
+Take a look
+
+I have 10
+You have 20
+let's share
+I've got 2 partners
+you've got 3 partners
+so you want to give me 1/4th of your gas
+I want to give you 1/3rd of my gas
+
+the total gas diff between me and you is -10
+since it's negative you get to decide how to portion it
+so the total amount to share is -2.5
+I end up with 12.5
+you end up with 17.5
+
+again
+
+total diff is -5
+to share is 1.25
+I end up with 13.75
+you end up with 16.25
+
+again
+
+total diff is -2.5
+to share is 0.3125
+I end up with 14.0625
+you end up with 15.9375
+
+
+
+We need to do this because if the portions get mixed up, our archived gas list ends up lying about how much of each gas type we have available to share.
+This can lead to negative moles, which the system is not prepared for.
+
+This is also why we queue space's sucking till the end of a tile's `process_cell()` btw, by that point we can ensure that no other tile will need to check for our mix, so we can freely violate our portioning.
+
+
### Active Turfs
![](https://raw.githubusercontent.com/LemonInTheDark/documentation-assets/atmos-pics/atmos/FlowVisuals.png)
@@ -164,7 +236,7 @@ This is a rather large subject, we will need to cover gas flow, turf sleeping, s
Active turfs are the backbone of how gas moves from tile to tile. While most of `process_cell()` should be easy enough to understand, I am going to go into some detail about archiving, since I think it's a common source of hiccups.
-* *`archived_cycle`* this var stores the last cycle of the atmos loop that the turf processed on. The key point to notice here is that when processing a turf, we don't share with all its neighbors, we only talk to those who haven't processed yet. This is because the remainder of `process_cell()` and especially `share()` ought to be similar in form to addition. We can add in any order we like, and we only need to add once. This is what archived gases are for by the way, they store the state of the relevant tile before any processing occurs. This additive behavior isn't strictly the case unfortunately, but it's minor enough that we can ignore the effects.
+* *`archived_cycle`* this var stores the last cycle of the atmos loop that the turf processed on. The key point to notice here is that when processing a turf, we don't share with all its neighbors, we only talk to those who haven't processed yet. This is because the remainder of `process_cell()` and especially `share()` are like addition. We can add in any order we like, and we only need to add once. This is what archived gases are for by the way, they store the state of the relevant tile before any processing occurs.
Alright then, with that out of the way, what is an active turf.
diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
index d664bc2e1e977..0fea31422fb19 100644
--- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
+++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
@@ -39,8 +39,11 @@
///If there is an active hotspot on us store a reference to it here
var/obj/effect/hotspot/active_hotspot
- ///Whether or not we are a planetary turf
- var/planetary_atmos = FALSE //air will revert to initial_gas_mix
+ /// air will slowly revert to initial_gas_mix
+ var/planetary_atmos = FALSE
+ /// once our paired turfs are finished with all other shares, do one 100% share
+ /// exists so things like space can ask to take 100% of a tile's gas
+ var/run_later = FALSE
///gas IDs of current active gas overlays
var/list/atmos_overlay_types
@@ -268,16 +271,21 @@
//cache for sanic speed
var/list/adjacent_turfs = atmos_adjacent_turfs
var/datum/excited_group/our_excited_group = excited_group
- var/adjacent_turfs_length = LAZYLEN(adjacent_turfs)
+ var/our_share_coeff = 1/(LAZYLEN(adjacent_turfs) + 1)
var/datum/gas_mixture/our_air = air
+ var/list/share_end
+
#ifdef TRACK_MAX_SHARE
max_share = 0 //Gotta reset our tracker
#endif
- for(var/t in adjacent_turfs)
- var/turf/open/enemy_tile = t
+ for(var/turf/open/enemy_tile as anything in adjacent_turfs)
+ // This var is only rarely set, exists so turfs can request to share at the end of our sharing
+ // We need this so we can assume share is communative, which we need to do to avoid a hellish amount of garbage_collect()s
+ if(enemy_tile.run_later)
+ LAZYADD(share_end, enemy_tile)
if(fire_count <= enemy_tile.current_cycle)
continue
@@ -313,7 +321,7 @@
//air sharing
if(should_share_air)
- var/difference = our_air.share(enemy_air, adjacent_turfs_length)
+ var/difference = our_air.share(enemy_air, our_share_coeff, 1 / (LAZYLEN(enemy_tile.atmos_adjacent_turfs) + 1))
if(difference)
if(difference > 0)
consider_pressure_difference(enemy_tile, difference)
@@ -335,12 +343,25 @@
new_group.add_turf(src)
our_excited_group = excited_group
// shares 4/5 of our difference in moles with the atmosphere
- our_air.share(planetary_mix, 0.25)
+ our_air.share(planetary_mix, 0.8, 0.8)
// temperature share with the atmosphere with an inflated heat capacity to simulate faster sharing with a large atmosphere
our_air.temperature_share(planetary_mix, OPEN_HEAT_TRANSFER_COEFFICIENT, planetary_mix.temperature_archived, planetary_mix.heat_capacity() * 5)
planetary_mix.garbage_collect()
PLANET_SHARE_CHECK
+ for(var/turf/open/enemy_tile as anything in share_end)
+ var/datum/gas_mixture/enemy_mix = enemy_tile.air
+ archive()
+ // We share 100% of our mix in this step. Let's jive
+ var/difference = our_air.share(enemy_mix, 1, 1)
+ LAST_SHARE_CHECK
+ if(!difference)
+ continue
+ if(difference > 0)
+ consider_pressure_difference(enemy_tile, difference)
+ else
+ enemy_tile.consider_pressure_difference(src, difference)
+
our_air.react(src)
update_visuals()
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index 46695df060045..590cfa4a2c87e 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -337,6 +337,9 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
var/list/cached_gases = gases
var/list/sharer_gases = sharer.gases
+ var/list/only_in_sharer = sharer_gases - cached_gases
+ var/list/only_in_cached = cached_gases - sharer_gases
+
var/temperature_delta = temperature_archived - sharer.temperature_archived
var/abs_temperature_delta = abs(temperature_delta)
@@ -353,17 +356,29 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
var/abs_moved_moles = 0
//GAS TRANSFER
- for(var/id in sharer_gases - cached_gases) // create gases not in our cache
- ADD_GAS(id, gases)
- for(var/id in cached_gases) // transfer gases
- ASSERT_GAS(id, sharer)
+ //Prep
+ for(var/id in only_in_sharer) //create gases not in our cache
+ ADD_GAS(id, cached_gases)
+ for(var/id in only_in_cached) //create gases not in the sharing mix
+ ADD_GAS(id, sharer_gases)
+
+ for(var/id in cached_gases) //transfer gases
var/gas = cached_gases[id]
var/sharergas = sharer_gases[id]
+ var/delta = QUANTIZE(gas[ARCHIVE] - sharergas[ARCHIVE]) //the amount of gas that gets moved between the mixtures
- var/delta = QUANTIZE(gas[ARCHIVE] - sharergas[ARCHIVE])/(atmos_adjacent_turfs+1) //the amount of gas that gets moved between the mixtures
+ if(!delta)
+ continue
- if(delta && abs_temperature_delta > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
+ // If we have more gas then they do, gas is moving from us to them
+ // This means we want to scale it by our coeff. Vis versa for their case
+ if(delta > 0)
+ delta = delta * our_coeff
+ else
+ delta = delta * sharer_coeff
+
+ if(abs_temperature_delta > MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER)
var/gas_heat_capacity = delta * gas[GAS_META][META_GAS_SPECIFIC_HEAT]
if(delta > 0)
heat_capacity_self_to_sharer += gas_heat_capacity
@@ -394,8 +409,12 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
if(abs(new_sharer_heat_capacity/old_sharer_heat_capacity - 1) < 0.1) // <10% change in sharer heat capacity
temperature_share(sharer, OPEN_HEAT_TRANSFER_COEFFICIENT)
- garbage_collect()
- sharer.garbage_collect()
+ if(length(only_in_sharer + only_in_cached)) //if all gases were present in both mixtures, we know that no gases are 0
+ garbage_collect(only_in_cached) //any gases the sharer had, we are guaranteed to have. gases that it didn't have we are not.
+ sharer.garbage_collect(only_in_sharer) //the reverse is equally true
+ else if (initial(sharer.gc_share))
+ sharer.garbage_collect()
+
if(temperature_delta > MINIMUM_TEMPERATURE_TO_MOVE || abs(moved_moles) > MINIMUM_MOLES_DELTA_TO_MOVE)
var/our_moles
TOTAL_MOLES(cached_gases,our_moles)
diff --git a/code/modules/events/wormholes.dm b/code/modules/events/wormholes.dm
index 931b0ad57eaa1..c93e8a052c057 100644
--- a/code/modules/events/wormholes.dm
+++ b/code/modules/events/wormholes.dm
@@ -49,7 +49,7 @@ GLOBAL_LIST_EMPTY(all_wormholes) // So we can pick wormholes to teleport to
mech_sized = TRUE
-/obj/effect/portal/wormhole/Initialize(mapload, _creator, _lifespan = 0, obj/effect/portal/_linked, automatic_link = FALSE, turf/hard_target_override, atmos_link_override)
+/obj/effect/portal/wormhole/Initialize(mapload, _creator, _lifespan = 0, obj/effect/portal/_linked, automatic_link = FALSE, turf/hard_target_override)
. = ..()
GLOB.all_wormholes += src
From bc40a37ebd954e71c64759ee6ca5267b3459890e Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sat, 31 Aug 2024 15:22:24 +0200
Subject: [PATCH 065/114] Bullshit snuck in
---
code/__DEFINES/dcs/signals/signals_turf.dm | 2 ++
code/game/turfs/turf.dm | 4 +---
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/code/__DEFINES/dcs/signals/signals_turf.dm b/code/__DEFINES/dcs/signals/signals_turf.dm
index 80b5e534c2f43..4ae48a9008c62 100644
--- a/code/__DEFINES/dcs/signals/signals_turf.dm
+++ b/code/__DEFINES/dcs/signals/signals_turf.dm
@@ -17,3 +17,5 @@
#define COMSIG_TURF_RESERVATION_RELEASED "turf_reservation_released"
//from /turf/open/temperature_expose(datum/gas_mixture/air, exposed_temperature)
#define COMSIG_TURF_EXPOSE "turf_expose"
+///from /turf/proc/immediate_calculate_adjacent_turfs()
+#define COMSIG_TURF_CALCULATED_ADJACENT_ATMOS "turf_calculated_adjacent_atmos"
diff --git a/code/game/turfs/turf.dm b/code/game/turfs/turf.dm
index 24ca5fe6c4a09..80d4df1e03d84 100644
--- a/code/game/turfs/turf.dm
+++ b/code/game/turfs/turf.dm
@@ -35,9 +35,7 @@ GLOBAL_LIST_EMPTY(created_baseturf_lists)
/// Whether the turf blocks atmos from passing through it or not
var/blocks_air = FALSE
- // If this turf should initialize atmos adjacent turfs or not
- // Optimization, not for setting outside of initialize
- var/init_air = TRUE
+
flags_1 = CAN_BE_DIRTY_1
From 8985a7924c332af3cd9a297f0f041520a6fbc1ed Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sat, 31 Aug 2024 16:55:25 +0200
Subject: [PATCH 066/114] Conflict resolution kinda sucks sometimes huh
---
code/__DEFINES/atmospherics.dm | 404 ------------------------------
code/controllers/subsystem/air.dm | 10 -
2 files changed, 414 deletions(-)
delete mode 100644 code/__DEFINES/atmospherics.dm
diff --git a/code/__DEFINES/atmospherics.dm b/code/__DEFINES/atmospherics.dm
deleted file mode 100644
index c5caf46379798..0000000000000
--- a/code/__DEFINES/atmospherics.dm
+++ /dev/null
@@ -1,404 +0,0 @@
-//ATMOS
-//stuff you should probably leave well alone!
-/// kPa*L/(K*mol)
-#define R_IDEAL_GAS_EQUATION 8.31
-/// kPa
-#define ONE_ATMOSPHERE 101.325
-/// -270.3degC
-#define TCMB 2.7
-/// -48.15degC
-#define TCRYO 225
-/// 0degC
-#define T0C 273.15
-/// 20degC
-#define T20C 293.15
-/// -14C - Temperature used for kitchen cold room, medical freezer, etc.
-#define COLD_ROOM_TEMP 259.15
-
-///moles in a 2.5 m^3 cell at 101.325 Pa and 20 degC (103 or so)
-#define MOLES_CELLSTANDARD (ONE_ATMOSPHERE*CELL_VOLUME/(T20C*R_IDEAL_GAS_EQUATION))
-///compared against for superconductivity
-#define M_CELL_WITH_RATIO (MOLES_CELLSTANDARD * 0.005)
-/// percentage of oxygen in a normal mixture of air
-#define O2STANDARD 0.21
-/// same but for nitrogen
-#define N2STANDARD 0.79
-/// O2 standard value (21%)
-#define MOLES_O2STANDARD (MOLES_CELLSTANDARD*O2STANDARD)
-/// N2 standard value (79%)
-#define MOLES_N2STANDARD (MOLES_CELLSTANDARD*N2STANDARD)
-/// liters in a cell
-#define CELL_VOLUME 2500
-
-#define BREATH_VOLUME 0.5 //! liters in a normal breath
-#define BREATH_PERCENTAGE (BREATH_VOLUME/CELL_VOLUME) //! Amount of air to take a from a tile
-
-//EXCITED GROUPS
-#define EXCITED_GROUP_BREAKDOWN_CYCLES 3 //! number of FULL air controller ticks before an excited group breaks down (averages gas contents across turfs)
-#define EXCITED_GROUP_DISMANTLE_CYCLES 15 //! number of FULL air controller ticks before an excited group dismantles and removes its turfs from active
-#define MINIMUM_AIR_RATIO_TO_SUSPEND 0.1 //! Ratio of air that must move to/from a tile to reset group processing
-#define MINIMUM_AIR_RATIO_TO_MOVE 0.05 //! Minimum ratio of air that must move to/from a tile
-#define MINIMUM_AIR_TO_SUSPEND (MOLES_CELLSTANDARD*MINIMUM_AIR_RATIO_TO_SUSPEND) //! Minimum amount of air that has to move before a group processing can be suspended
-#define MINIMUM_MOLES_DELTA_TO_MOVE (MOLES_CELLSTANDARD*MINIMUM_AIR_RATIO_TO_MOVE) //! Either this must be active or MINIMUM_TEMPERATURE_TO_MOVE
-#define MINIMUM_TEMPERATURE_TO_MOVE (T20C+100) //! Either this must be active or MINIMUM_MOLES_DELTA_TO_MOVE
-#define MINIMUM_TEMPERATURE_DELTA_TO_SUSPEND 4 //! Minimum temperature difference before group processing is suspended
-#define MINIMUM_TEMPERATURE_DELTA_TO_CONSIDER 1 //! Minimum temperature difference before the gas temperatures are just set to be equal
-#define MINIMUM_TEMPERATURE_FOR_SUPERCONDUCTION (T20C+10)
-#define MINIMUM_TEMPERATURE_START_SUPERCONDUCTION (T20C+200)
-
-//HEAT TRANSFER COEFFICIENTS
-//Must be between 0 and 1. Values closer to 1 equalize temperature faster
-//Should not exceed 0.4 else strange heat flow occur
-#define WALL_HEAT_TRANSFER_COEFFICIENT 0.0
-#define OPEN_HEAT_TRANSFER_COEFFICIENT 0.4
-#define WINDOW_HEAT_TRANSFER_COEFFICIENT 0.1 //a hack for now
-#define HEAT_CAPACITY_VACUUM 7000 //a hack to help make vacuums "cold", sacrificing realism for gameplay
-
-//FIRE
-#define FIRE_MINIMUM_TEMPERATURE_TO_SPREAD (150+T0C)
-#define FIRE_MINIMUM_TEMPERATURE_TO_EXIST (100+T0C)
-#define FIRE_SPREAD_RADIOSITY_SCALE 0.85
-#define FIRE_GROWTH_RATE 40000 //For small fires
-#define PLASMA_MINIMUM_BURN_TEMPERATURE (100+T0C)
-#define PLASMA_UPPER_TEMPERATURE (1370+T0C)
-#define PLASMA_OXYGEN_FULLBURN 10
-
-//GASES
-#define MIN_TOXIC_GAS_DAMAGE 1
-#define MAX_TOXIC_GAS_DAMAGE 10
-#define MOLES_GAS_VISIBLE 0.25 //! Moles in a standard cell after which gases are visible
-
-#define FACTOR_GAS_VISIBLE_MAX 20 //! moles_visible * FACTOR_GAS_VISIBLE_MAX = Moles after which gas is at maximum visibility
-#define MOLES_GAS_VISIBLE_STEP 0.25 //! Mole step for alpha updates. This means alpha can update at 0.25, 0.5, 0.75 and so on
-
-//REACTIONS
-//return values for reactions (bitflags)
-#define NO_REACTION 0
-#define REACTING 1
-#define STOP_REACTIONS 2
-
-// Pressure limits.
-/// This determins at what pressure the ultra-high pressure red icon is displayed. (This one is set as a constant)
-#define HAZARD_HIGH_PRESSURE 550
-/// This determins when the orange pressure icon is displayed (it is 0.7 * HAZARD_HIGH_PRESSURE)
-#define WARNING_HIGH_PRESSURE 325
-/// This is when the gray low pressure icon is displayed. (it is 2.5 * HAZARD_LOW_PRESSURE)
-#define WARNING_LOW_PRESSURE 50
-/// This is when the black ultra-low pressure icon is displayed. (This one is set as a constant)
-#define HAZARD_LOW_PRESSURE 20
-
-/// This is used in handle_temperature_damage() for humans, and in reagents that affect body temperature. Temperature damage is multiplied by this amount.
-#define TEMPERATURE_DAMAGE_COEFFICIENT 1.5
-
-/// The natural temperature for a body
-#define BODYTEMP_NORMAL 310.15
-/// This is the divisor which handles how much of the temperature difference between the current body temperature and 310.15K (optimal temperature) humans auto-regenerate each tick. The higher the number, the slower the recovery. This is applied each tick, so long as the mob is alive.
-#define BODYTEMP_AUTORECOVERY_DIVISOR 14
-/// Minimum amount of kelvin moved toward 310K per tick. So long as abs(310.15 - bodytemp) is more than 50.
-#define BODYTEMP_AUTORECOVERY_MINIMUM 6
-///Similar to the BODYTEMP_AUTORECOVERY_DIVISOR, but this is the divisor which is applied at the stage that follows autorecovery. This is the divisor which comes into play when the human's loc temperature is lower than their body temperature. Make it lower to lose bodytemp faster.
-#define BODYTEMP_COLD_DIVISOR 15
-/// Similar to the BODYTEMP_AUTORECOVERY_DIVISOR, but this is the divisor which is applied at the stage that follows autorecovery. This is the divisor which comes into play when the human's loc temperature is higher than their body temperature. Make it lower to gain bodytemp faster.
-#define BODYTEMP_HEAT_DIVISOR 15
-/// The maximum number of degrees that your body can cool in 1 tick, due to the environment, when in a cold area.
-#define BODYTEMP_COOLING_MAX -30
-/// The maximum number of degrees that your body can heat up in 1 tick, due to the environment, when in a hot area.
-#define BODYTEMP_HEATING_MAX 30
-
-/// The body temperature limit the human body can take before it starts taking damage from heat.
-/// This also affects how fast the body normalises it's temperature when hot.
-/// 340k is about 66c, and rather high for a human.
-#define BODYTEMP_HEAT_DAMAGE_LIMIT (BODYTEMP_NORMAL + 30)
-/// The body temperature limit the human body can take before it starts taking damage from cold.
-/// This also affects how fast the body normalises it's temperature when cold.
-/// 270k is about -3c, that is below freezing and would hurt over time.
-#define BODYTEMP_COLD_DAMAGE_LIMIT (BODYTEMP_NORMAL - 40)
-/// The body temperature limit the human body can take before it will take wound damage.
-#define BODYTEMP_HEAT_WOUND_LIMIT (BODYTEMP_NORMAL + 90) // 400.5 k
-
-// Body temperature warning icons
-/// The temperature the red icon is displayed.
-#define BODYTEMP_HEAT_WARNING_3 (BODYTEMP_HEAT_DAMAGE_LIMIT + 360) //+700k
-/// The temperature the orange icon is displayed.
-#define BODYTEMP_HEAT_WARNING_2 (BODYTEMP_HEAT_DAMAGE_LIMIT + 120) //460K
-/// The temperature the yellow icon is displayed.
-#define BODYTEMP_HEAT_WARNING_1 (BODYTEMP_HEAT_DAMAGE_LIMIT) //340K
-/// The temperature the light green icon is displayed.
-#define BODYTEMP_COLD_WARNING_1 (BODYTEMP_COLD_DAMAGE_LIMIT) //270k
-/// The temperature the cyan icon is displayed.
-#define BODYTEMP_COLD_WARNING_2 (BODYTEMP_COLD_DAMAGE_LIMIT - 70) //200k
-/// The temperature the blue icon is displayed.
-#define BODYTEMP_COLD_WARNING_3 (BODYTEMP_COLD_DAMAGE_LIMIT - 150) //120k
-
-/// what min_cold_protection_temperature is set to for space-helmet quality headwear. MUST NOT BE 0.
-#define SPACE_HELM_MIN_TEMP_PROTECT 2.0
-/// Thermal insulation works both ways /Malkevin
-#define SPACE_HELM_MAX_TEMP_PROTECT 1500
-/// what min_cold_protection_temperature is set to for space-suit quality jumpsuits or suits. MUST NOT BE 0.
-#define SPACE_SUIT_MIN_TEMP_PROTECT 2.0
-/// The min cold protection of a space suit without the heater active
-#define SPACE_SUIT_MIN_TEMP_PROTECT_OFF 72
-#define SPACE_SUIT_MAX_TEMP_PROTECT 1500
-
-#define FIRE_SUIT_MIN_TEMP_PROTECT 60 //! Cold protection for firesuits
-#define FIRE_SUIT_MAX_TEMP_PROTECT 30000 //! what max_heat_protection_temperature is set to for firesuit quality suits. MUST NOT BE 0.
-#define FIRE_HELM_MIN_TEMP_PROTECT 60 //! Cold protection for fire helmets
-#define FIRE_HELM_MAX_TEMP_PROTECT 30000 //! for fire helmet quality items (red and white hardhats)
-
-#define FIRE_IMMUNITY_MAX_TEMP_PROTECT 35000 //! what max_heat_protection_temperature is set to for firesuit quality suits and helmets. MUST NOT BE 0.
-
-//Emergency skinsuits
-#define EMERGENCY_HELM_MIN_TEMP_PROTECT 2.0 //The helmet is pressurized with air from the oxygen tank. If they don't take damage from that they won't take damage here
-#define EMERGENCY_SUIT_MIN_TEMP_PROTECT 237 //This is the approximate average temperature of Mt. Everest in the winter
-
-#define HELMET_MIN_TEMP_PROTECT 160 //For normal helmets
-#define HELMET_MAX_TEMP_PROTECT 600 //For normal helmets
-#define ARMOR_MIN_TEMP_PROTECT 160 //For armor
-#define ARMOR_MAX_TEMP_PROTECT 600 //For armor
-
-#define GLOVES_MIN_TEMP_PROTECT 2.0 //For some gloves (black and)
-#define GLOVES_MAX_TEMP_PROTECT 1500 //For some gloves
-#define SHOES_MIN_TEMP_PROTECT 2.0 //For gloves
-#define SHOES_MAX_TEMP_PROTECT 1500 //For gloves
-
-#define PRESSURE_DAMAGE_COEFFICIENT 4 //! The amount of pressure damage someone takes is equal to (pressure / HAZARD_HIGH_PRESSURE)*PRESSURE_DAMAGE_COEFFICIENT, with the maximum of MAX_PRESSURE_DAMAGE
-#define MAX_HIGH_PRESSURE_DAMAGE 4
-#define LOW_PRESSURE_DAMAGE 4 //! The amount of damage someone takes when in a low pressure area (The pressure threshold is so low that it doesn't make sense to do any calculations, so it just applies this flat value).
-
-#define COLD_SLOWDOWN_FACTOR 20 //! Humans are slowed by the difference between bodytemp and BODYTEMP_COLD_DAMAGE_LIMIT divided by this
-
-//PIPES
-//Atmos pipe limits
-/// (kPa) What pressure pumps and powered equipment max out at.
-#define MAX_OUTPUT_PRESSURE 4500
-/// (L/s) Maximum speed powered equipment can work at.
-#define MAX_TRANSFER_RATE 200
-/// How many percent of the contents that an overclocked volume pumps leak into the air
-#define VOLUME_PUMP_LEAK_AMOUNT 0.1
-
-//used for device_type vars
-#define UNARY 1
-#define BINARY 2
-#define TRINARY 3
-#define QUATERNARY 4
-
-//TANKS
-#define TANK_MELT_TEMPERATURE 1000000 //! temperature in kelvins at which a tank will start to melt
-#define TANK_LEAK_PRESSURE (30.*ONE_ATMOSPHERE) //! temperature in kelvins at which a tank starts leaking
-#define TANK_RUPTURE_PRESSURE (35.*ONE_ATMOSPHERE) //! temperature in kelvins at which a tank spills all contents into atmosphere
-#define TANK_FRAGMENT_PRESSURE (40.*ONE_ATMOSPHERE) //! temperature in kelvins at which a tank creates a boom 3x3 base explosion
-#define TANK_FRAGMENT_SCALE (6.*ONE_ATMOSPHERE) //! +1 for each SCALE kPa aboe threshold
-#define TANK_MAX_RELEASE_PRESSURE (ONE_ATMOSPHERE*3)
-#define TANK_MIN_RELEASE_PRESSURE 0
-#define TANK_DEFAULT_RELEASE_PRESSURE 17
-
-//CANATMOSPASS
-#define ATMOS_PASS_YES 1
-#define ATMOS_PASS_NO 0
-#define ATMOS_PASS_PROC -1 //ask CanAtmosPass()
-#define ATMOS_PASS_DENSITY -2 //just check density
-
-#define CANATMOSPASS(A, O) ( A.CanAtmosPass == ATMOS_PASS_PROC ? A.CanAtmosPass(O) : ( A.CanAtmosPass == ATMOS_PASS_DENSITY ? !A.density : A.CanAtmosPass ) )
-#define CANVERTICALATMOSPASS(A, O) ( A.CanAtmosPassVertical == ATMOS_PASS_PROC ? A.CanAtmosPass(O, TRUE) : ( A.CanAtmosPassVertical == ATMOS_PASS_DENSITY ? !A.density : A.CanAtmosPassVertical ) )
-
-//OPEN TURF ATMOS
-/// the default air mix that open turfs spawn
-#define OPENTURF_DEFAULT_ATMOS "o2=22;n2=82;TEMP=293.15"
-#define OPENTURF_LOW_PRESSURE "o2=14;n2=30;TEMP=293.15"
-/// -193,15°C telecommunications. also used for xenobiology slime killrooms
-#define TCOMMS_ATMOS "n2=100;TEMP=80"
-/// space
-#define AIRLESS_ATMOS "TEMP=2.7"
-/// -93.15°C snow and ice turfs
-#define FROZEN_ATMOS "o2=22;n2=82;TEMP=180"
-/// -14°C kitchen coldroom, just might lose your tail; higher amount of mol to reach about 101.3 kpA
-#define KITCHEN_COLDROOM_ATMOS "o2=26;n2=97;TEMP=[COLD_ROOM_TEMP]"
-/// used in the holodeck burn test program
-#define BURNMIX_ATMOS "o2=100;plasma=200;TEMP=370" //used in the holodeck burn test program
-
-//ATMOSPHERICS DEPARTMENT GAS TANK TURFS
-#define ATMOS_TANK_N2O "n2o=6000;TEMP=293.15"
-#define ATMOS_TANK_CO2 "co2=50000;TEMP=293.15"
-#define ATMOS_TANK_PLASMA "plasma=70000;TEMP=293.15"
-#define ATMOS_TANK_O2 "o2=100000;TEMP=293.15"
-#define ATMOS_TANK_N2 "n2=100000;TEMP=293.15"
-#define ATMOS_TANK_AIRMIX "o2=2644;n2=10580;TEMP=293.15"
-
-//LAVALAND
-#define MAXIMUM_LAVALAND_EQUIPMENT_EFFECT_PRESSURE 90 //! what pressure you have to be under to increase the effect of equipment meant for lavaland
-#define LAVALAND_DEFAULT_ATMOS "o2=14;n2=5;co2=13;TEMP=300"
-
-//ATMOS MIX IDS
-//Lavaland used to live here. That was a mistake.
-
-//ATMOSIA GAS MONITOR TAGS
-#define ATMOS_GAS_MONITOR_INPUT_O2 "o2_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_O2 "o2_out"
-#define ATMOS_GAS_MONITOR_SENSOR_O2 "o2_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_PLASMA "plasma_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_PLASMA "plasma_out"
-#define ATMOS_GAS_MONITOR_SENSOR_PLASMA "plasma_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_AIR "air_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_AIR "air_out"
-#define ATMOS_GAS_MONITOR_SENSOR_AIR "air_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_MIX "mix_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_MIX "mix_out"
-#define ATMOS_GAS_MONITOR_SENSOR_MIX "mix_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_N2O "n2o_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_N2O "n2o_out"
-#define ATMOS_GAS_MONITOR_SENSOR_N2O "n2o_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_N2 "n2_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_N2 "n2_out"
-#define ATMOS_GAS_MONITOR_SENSOR_N2 "n2_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_CO2 "co2_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_CO2 "co2_out"
-#define ATMOS_GAS_MONITOR_SENSOR_CO2 "co2_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_INCINERATOR "incinerator_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_INCINERATOR "incinerator_out"
-#define ATMOS_GAS_MONITOR_SENSOR_INCINERATOR "incinerator_sensor"
-
-#define ATMOS_GAS_MONITOR_INPUT_TOXINS_LAB "toxinslab_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_TOXINS_LAB "toxinslab_out"
-#define ATMOS_GAS_MONITOR_SENSOR_TOXINS_LAB "toxinslab_sensor"
-
-#define ATMOS_GAS_MONITOR_LOOP_DISTRIBUTION "distro-loop_meter"
-#define ATMOS_GAS_MONITOR_LOOP_ATMOS_WASTE "atmos-waste_loop_meter"
-
-#define ATMOS_GAS_MONITOR_WASTE_ENGINE "engine-waste_out"
-#define ATMOS_GAS_MONITOR_WASTE_ATMOS "atmos-waste_out"
-
-#define ATMOS_GAS_MONITOR_INPUT_SM "sm_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_SM "sm_out"
-#define ATMOS_GAS_MONITOR_SENSOR_SM "sm_sense"
-
-#define ATMOS_GAS_MONITOR_INPUT_SM_WASTE "sm_waste_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_SM_WASTE "sm_waste_out"
-#define ATMOS_GAS_MONITOR_SENSOR_SM_WASTE "sm_waste_sense"
-
-#define ATMOS_GAS_MONITOR_INPUT_TOXINS_WASTE "toxins_waste_in"
-#define ATMOS_GAS_MONITOR_OUTPUT_TOXINS_WASTE "toxins_waste_out"
-#define ATMOS_GAS_MONITOR_SENSOR_TOXINS_WASTE "toxins_waste_sense"
-
-//AIRLOCK CONTROLLER TAGS
-
-//RnD toxins burn chamber
-#define INCINERATOR_TOXMIX_IGNITER "toxmix_igniter"
-#define INCINERATOR_TOXMIX_VENT "toxmix_vent"
-#define INCINERATOR_TOXMIX_DP_VENTPUMP "toxmix_airlock_pump"
-#define INCINERATOR_TOXMIX_AIRLOCK_SENSOR "toxmix_airlock_sensor"
-#define INCINERATOR_TOXMIX_AIRLOCK_CONTROLLER "toxmix_airlock_controller"
-#define INCINERATOR_TOXMIX_AIRLOCK_INTERIOR "toxmix_airlock_interior"
-#define INCINERATOR_TOXMIX_AIRLOCK_EXTERIOR "toxmix_airlock_exterior"
-
-//Atmospherics/maintenance incinerator
-#define INCINERATOR_ATMOS_IGNITER "atmos_incinerator_igniter"
-#define INCINERATOR_ATMOS_MAINVENT "atmos_incinerator_mainvent"
-#define INCINERATOR_ATMOS_AUXVENT "atmos_incinerator_auxvent"
-#define INCINERATOR_ATMOS_DP_VENTPUMP "atmos_incinerator_airlock_pump"
-#define INCINERATOR_ATMOS_AIRLOCK_SENSOR "atmos_incinerator_airlock_sensor"
-#define INCINERATOR_ATMOS_AIRLOCK_CONTROLLER "atmos_incinerator_airlock_controller"
-#define INCINERATOR_ATMOS_AIRLOCK_INTERIOR "atmos_incinerator_airlock_interior"
-#define INCINERATOR_ATMOS_AIRLOCK_EXTERIOR "atmos_incinerator_airlock_exterior"
-
-//Syndicate lavaland base incinerator (lavaland_surface_syndicate_base1.dmm)
-#define INCINERATOR_SYNDICATELAVA_IGNITER "syndicatelava_igniter"
-#define INCINERATOR_SYNDICATELAVA_MAINVENT "syndicatelava_mainvent"
-#define INCINERATOR_SYNDICATELAVA_AUXVENT "syndicatelava_auxvent"
-#define INCINERATOR_SYNDICATELAVA_DP_VENTPUMP "syndicatelava_airlock_pump"
-#define INCINERATOR_SYNDICATELAVA_AIRLOCK_SENSOR "syndicatelava_airlock_sensor"
-#define INCINERATOR_SYNDICATELAVA_AIRLOCK_CONTROLLER "syndicatelava_airlock_controller"
-#define INCINERATOR_SYNDICATELAVA_AIRLOCK_INTERIOR "syndicatelava_airlock_interior"
-#define INCINERATOR_SYNDICATELAVA_AIRLOCK_EXTERIOR "syndicatelava_airlock_exterior"
-
-//MULTIPIPES
-//IF YOU EVER CHANGE THESE CHANGE SPRITES TO MATCH.
-#define PIPING_LAYER_MIN 1
-#define PIPING_LAYER_MAX 5
-#define PIPING_LAYER_DEFAULT 3
-#define PIPING_LAYER_P_X 5
-#define PIPING_LAYER_P_Y 5
-#define PIPING_LAYER_LCHANGE 0.05
-
-#define PIPING_ALL_LAYER (1<<0) //! intended to connect with all layers, check for all instead of just one.
-#define PIPING_ONE_PER_TURF (1<<1) //! can only be built if nothing else with this flag is on the tile already.
-#define PIPING_DEFAULT_LAYER_ONLY (1<<2) //! can only exist at PIPING_LAYER_DEFAULT
-#define PIPING_CARDINAL_AUTONORMALIZE (1<<3) //! north/south east/west doesn't matter, auto normalize on build.
-
-// 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 "nob"
-#define GAS_NITROUS "n2o"
-#define GAS_NITRYL "no2"
-#define GAS_TRITIUM "tritium"
-#define GAS_BZ "bz"
-#define GAS_STIMULUM "stim"
-#define GAS_PLUOXIUM "pluox"
-
-#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)) { \
- T.pixel_x = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_X;\
- } \
- if(T.dir & (EAST|WEST)) { \
- T.pixel_y = (PipingLayer - PIPING_LAYER_DEFAULT) * PIPING_LAYER_P_Y;\
- }
-
-#define PIPING_FORWARD_SHIFT(T, PipingLayer, more_shift) \
- if(T.dir & (NORTH|SOUTH)) { \
- T.pixel_y += more_shift * (PipingLayer - PIPING_LAYER_DEFAULT);\
- } \
- if(T.dir & (EAST|WEST)) { \
- T.pixel_x += more_shift * (PipingLayer - PIPING_LAYER_DEFAULT);\
- }
-
-#define PIPING_LAYER_DOUBLE_SHIFT(T, PipingLayer) \
- 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_LIST_INIT(pipe_paint_colors, sort_list(list(
- "amethyst" = rgb(130,43,255),
- "blue" = rgb(0,0,255),
- "brown" = rgb(178,100,56),
- "cyan" = rgb(0,255,249),
- "dark" = rgb(69,69,69),
- "green" = rgb(30,255,0),
- "grey" = rgb(255,255,255),
- "orange" = rgb(255,129,25),
- "purple" = rgb(128,0,182),
- "red" = rgb(255,0,0),
- "violet" = rgb(64,0,128),
- "yellow" = rgb(255,198,0)
-)))
-
-//PIPENET UPDATE STATUS
-#define PIPENET_UPDATE_STATUS_DORMANT 0
-#define PIPENET_UPDATE_STATUS_REACT_NEEDED 1
-#define PIPENET_UPDATE_STATUS_RECONCILE_NEEDED 2
-
-// GAS MIXTURE STUFF (used to be in code/modules/atmospherics/gasmixtures/gas_mixture.dm)
-#define MINIMUM_HEAT_CAPACITY 0.0003
-#define MINIMUM_MOLE_COUNT 0.01
-/*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 */
-#define QUANTIZE(variable) (round(variable,0.0000001))
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index 03265873a7e36..ff50dda2142b8 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -87,25 +87,15 @@ SUBSYSTEM_DEF(air)
msg += "AT/MS:[round((cost ? active_turfs.len/cost : 0),0.1)]"
return ..()
-<<<<<<< HEAD
/datum/controller/subsystem/air/Initialize(timeofday)
-=======
-/datum/controller/subsystem/air/Initialize()
->>>>>>> fd55feafac6ca89c963096d2b2cd9129d5d27d0b
map_loading = FALSE
gas_reactions = init_gas_reactions()
setup_allturfs()
setup_atmos_machinery()
setup_pipenets()
-<<<<<<< HEAD
setup_turf_visuals()
return ..()
-=======
- gas_reactions = init_gas_reactions()
- auxtools_update_reactions()
- return SS_INIT_SUCCESS
->>>>>>> fd55feafac6ca89c963096d2b2cd9129d5d27d0b
/datum/controller/subsystem/air/fire(resumed = FALSE)
From afe780e3386de6256cb2f30dc56a455877c953c6 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sat, 31 Aug 2024 17:07:17 +0200
Subject: [PATCH 067/114] Compiles again
---
code/game/atoms_movable.dm | 4 ++--
code/game/machinery/doors/door.dm | 2 +-
code/game/machinery/firealarm.dm | 2 +-
code/game/objects/items/devices/forcefieldprojector.dm | 2 +-
code/game/objects/structures/mineral_doors.dm | 2 +-
code/game/objects/structures/window.dm | 2 +-
code/modules/events/mimite_infestation.dm | 2 +-
code/modules/mapping/mapping_helpers.dm | 6 +++---
code/modules/mob/living/carbon/life.dm | 2 +-
code/modules/mob/living/simple_animal/hostile/mimite.dm | 2 +-
code/modules/surgery/organs/lungs.dm | 2 +-
11 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/code/game/atoms_movable.dm b/code/game/atoms_movable.dm
index 2236975564f41..82f990dc38a25 100644
--- a/code/game/atoms_movable.dm
+++ b/code/game/atoms_movable.dm
@@ -110,8 +110,8 @@
if(loc)
//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
+ if(((can_atmos_pass == ATMOS_PASS_DENSITY && density) || can_atmos_pass == ATMOS_PASS_NO) && isturf(loc))
+ can_atmos_pass = ATMOS_PASS_YES
air_update_turf(TRUE, FALSE)
loc.handle_atom_del(src)
diff --git a/code/game/machinery/doors/door.dm b/code/game/machinery/doors/door.dm
index 0360c6ef7cf85..bff717e4bf737 100644
--- a/code/game/machinery/doors/door.dm
+++ b/code/game/machinery/doors/door.dm
@@ -13,7 +13,7 @@
z_flags = Z_BLOCK_IN_DOWN | Z_BLOCK_IN_UP
max_integrity = 350
armor = list(MELEE = 30, BULLET = 30, LASER = 20, ENERGY = 20, BOMB = 10, BIO = 100, RAD = 100, FIRE = 80, ACID = 70, STAMINA = 0, BLEED = 0)
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
flags_1 = PREVENT_CLICK_UNDER_1
ricochet_chance_mod = 0.8
damage_deflection = 10
diff --git a/code/game/machinery/firealarm.dm b/code/game/machinery/firealarm.dm
index 65483798f2c77..a368697825089 100644
--- a/code/game/machinery/firealarm.dm
+++ b/code/game/machinery/firealarm.dm
@@ -50,7 +50,7 @@
update_appearance()
myarea = get_area(src)
LAZYADD(myarea.firealarms, src)
- RegisterSignal(SSdcs, COMSIG_GLOB_SECURITY_ALERT_CHANGE, PROC_REF(handle_alert))
+ RegisterSignal(SSsecurity_level, COMSIG_SECURITY_LEVEL_CHANGED, PROC_REF(check_security_level))
/obj/machinery/firealarm/ComponentInitialize()
. = ..()
diff --git a/code/game/objects/items/devices/forcefieldprojector.dm b/code/game/objects/items/devices/forcefieldprojector.dm
index 7c6d8c1798069..811a0603e5c1e 100644
--- a/code/game/objects/items/devices/forcefieldprojector.dm
+++ b/code/game/objects/items/devices/forcefieldprojector.dm
@@ -86,7 +86,7 @@
z_flags = Z_BLOCK_IN_DOWN | Z_BLOCK_IN_UP
mouse_opacity = MOUSE_OPACITY_OPAQUE
resistance_flags = INDESTRUCTIBLE
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
armor = list(MELEE = 0, BULLET = 25, LASER = 50, ENERGY = 50, BOMB = 25, BIO = 100, RAD = 100, FIRE = 100, ACID = 100, STAMINA = 0, BLEED = 0)
var/obj/item/forcefield_projector/generator
diff --git a/code/game/objects/structures/mineral_doors.dm b/code/game/objects/structures/mineral_doors.dm
index b03feeca49386..4fc1430cb6ec4 100644
--- a/code/game/objects/structures/mineral_doors.dm
+++ b/code/game/objects/structures/mineral_doors.dm
@@ -12,7 +12,7 @@
icon_state = "metal"
max_integrity = 200
armor = list(MELEE = 10, BULLET = 0, LASER = 0, ENERGY = 100, BOMB = 10, BIO = 100, RAD = 100, FIRE = 50, ACID = 50, STAMINA = 0, BLEED = 0)
- CanAtmosPass = ATMOS_PASS_DENSITY
+ can_atmos_pass = ATMOS_PASS_DENSITY
rad_flags = RAD_PROTECT_CONTENTS | RAD_NO_CONTAMINATE
rad_insulation = RAD_MEDIUM_INSULATION
diff --git a/code/game/objects/structures/window.dm b/code/game/objects/structures/window.dm
index 3966ed0a78569..57463e7c95970 100644
--- a/code/game/objects/structures/window.dm
+++ b/code/game/objects/structures/window.dm
@@ -11,7 +11,7 @@
can_be_unanchored = TRUE
resistance_flags = ACID_PROOF
armor = list(MELEE = 0, BULLET = 0, LASER = 0, ENERGY = 0, BOMB = 0, BIO = 0, RAD = 0, FIRE = 80, ACID = 100, STAMINA = 0, BLEED = 0)
- CanAtmosPass = ATMOS_PASS_PROC
+ can_atmos_pass = ATMOS_PASS_PROC
rad_insulation = RAD_VERY_LIGHT_INSULATION
rad_flags = RAD_PROTECT_CONTENTS
pass_flags_self = PASSTRANSPARENT
diff --git a/code/modules/events/mimite_infestation.dm b/code/modules/events/mimite_infestation.dm
index dd99e6047d6c0..d04c1618a1856 100644
--- a/code/modules/events/mimite_infestation.dm
+++ b/code/modules/events/mimite_infestation.dm
@@ -35,7 +35,7 @@
if(!temp_vent_parent)
continue//no parent vent
//Stops mimites getting stuck in small networks.
- if(temp_vent_parent.other_atmosmch.len > 20)
+ if(temp_vent_parent.other_atmos_machines.len > 20)
vents += temp_vent
if(!vents.len)
message_admins("An event attempted to spawn mimites but no suitable vents were found. Shutting down.")
diff --git a/code/modules/mapping/mapping_helpers.dm b/code/modules/mapping/mapping_helpers.dm
index b5c3d7ae0534f..cbff00b64b740 100644
--- a/code/modules/mapping/mapping_helpers.dm
+++ b/code/modules/mapping/mapping_helpers.dm
@@ -539,7 +539,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava)
/** internal code variables - not for mappers **/
/// used to skip a direction on a turf
var/skip_direction
- /// there are a few stuff that "CanAtmosPass()" is not reliable
+ /// there are a few stuff that "can_atmos_pass()" is not reliable
var/static/list/unliable_atmos_blockers
@@ -563,7 +563,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava)
if(isspaceturf(each_turf) || isopenspace(each_turf))
continue
- if(!each_turf.CanAtmosPass(my_turf))
+ if(!each_turf.can_atmos_pass(my_turf))
for(var/atom/movable/movable_content as anything in each_turf.contents)
if(is_type_in_typecache(movable_content, unliable_atmos_blockers))
unliable_atmos_blocking = TRUE
@@ -600,7 +600,7 @@ INITIALIZE_IMMEDIATE(/obj/effect/mapping_helpers/no_lava)
// puts a directional window for each direction.
for(var/turf/each_turf in nearby_turfs)
- if(!each_turf.CanAtmosPass(my_turf) || isspaceturf(each_turf) || isopenspace(each_turf))
+ if(!each_turf.can_atmos_pass(my_turf) || isspaceturf(each_turf) || isopenspace(each_turf))
continue
var/obj/d_glass = new window_type(each_turf)
diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm
index 60dd7d6b35383..01153394d1e8a 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -275,7 +275,7 @@
//Fourth and final link in a breath chain
/mob/living/carbon/proc/handle_breath_temperature(datum/gas_mixture/breath)
// The air you breathe out should match your body temperature
- breath.set_temperature(bodytemperature)
+ breath.temperature = bodytemperature
/// Attempts to take a breath from the external or internal air tank.
/mob/living/carbon/proc/get_breath_from_internal(volume_needed)
diff --git a/code/modules/mob/living/simple_animal/hostile/mimite.dm b/code/modules/mob/living/simple_animal/hostile/mimite.dm
index 0989261f6412f..a4ffde2faf7a1 100644
--- a/code/modules/mob/living/simple_animal/hostile/mimite.dm
+++ b/code/modules/mob/living/simple_animal/hostile/mimite.dm
@@ -253,7 +253,7 @@
if(get_dist(src, entry_vent) <= 3)
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/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index 81c0797ed5a09..76c5dcc892c70 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -346,7 +346,7 @@
to_chat(H, "You feel [hot_message] in your [name]!")
// The air you breathe out should match your body temperature
- breath.set_temperature(H.bodytemperature)
+ breath.temperature = H.bodytemperature
/obj/item/organ/lungs/on_life()
..()
From b1fcec60f3b87acafc6283ffa2db868580dd8ece Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sat, 31 Aug 2024 17:13:15 +0200
Subject: [PATCH 068/114] Fixed wrong proc ref syntax
---
code/datums/elements/atmos_sensitive.dm | 2 +-
code/game/turfs/closed/minerals.dm | 2 +-
.../atmospherics/machinery/components/components_base.dm | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/code/datums/elements/atmos_sensitive.dm b/code/datums/elements/atmos_sensitive.dm
index 601c50e2cdd40..07187f9f57da9 100644
--- a/code/datums/elements/atmos_sensitive.dm
+++ b/code/datums/elements/atmos_sensitive.dm
@@ -11,7 +11,7 @@
var/atom/to_track = target
if(isopenturf(to_track.loc))
to_track.RegisterSignal(to_track.loc, COMSIG_TURF_EXPOSE, /atom/proc/check_atmos_process)
- RegisterSignal(to_track, COMSIG_MOVABLE_MOVED, .proc/handle_move)
+ RegisterSignal(to_track, COMSIG_MOVABLE_MOVED, PROC_REF(handle_move))
return ..()
/datum/element/atmos_sensitive/Detach(datum/source, force)
diff --git a/code/game/turfs/closed/minerals.dm b/code/game/turfs/closed/minerals.dm
index ba034d7375b2e..cf284792f17bb 100644
--- a/code/game/turfs/closed/minerals.dm
+++ b/code/game/turfs/closed/minerals.dm
@@ -95,7 +95,7 @@
if(defer_change) // TODO: make the defer change var a var for any changeturf flag
flags = CHANGETURF_DEFER_CHANGE
var/turf/open/mined = ScrapeAway(null, flags)
- addtimer(CALLBACK(src, .proc/AfterChange, old_type), 1, TIMER_UNIQUE)
+ addtimer(CALLBACK(src, PROC_REF(AfterChange), old_type), 1, TIMER_UNIQUE)
playsound(src, 'sound/effects/break_stone.ogg', 50, TRUE) //beautiful destruction
mined.update_visuals()
diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm
index 3bbfa787aada9..95c81d87da7fd 100644
--- a/code/modules/atmospherics/machinery/components/components_base.dm
+++ b/code/modules/atmospherics/machinery/components/components_base.dm
@@ -31,7 +31,7 @@
. = ..()
if(hide)
- RegisterSignal(src, COMSIG_OBJ_HIDE, .proc/hide_pipe)
+ RegisterSignal(src, COMSIG_OBJ_HIDE, PROC_REF(hide_pipe))
// Iconnery
From edb1686a0586ac539d9fb4da6cccec0b2bc9edab Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sat, 31 Aug 2024 17:40:12 +0200
Subject: [PATCH 069/114] This should fix at least one runtime I guess
---
code/datums/elements/atmos_requirements.dm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/code/datums/elements/atmos_requirements.dm b/code/datums/elements/atmos_requirements.dm
index 2c2eabd0d84c6..cb1886d2375ae 100644
--- a/code/datums/elements/atmos_requirements.dm
+++ b/code/datums/elements/atmos_requirements.dm
@@ -45,6 +45,8 @@
if(!ST.air && (atmos_requirements["min_oxy"] || atmos_requirements["min_tox"] || atmos_requirements["min_n2"] || atmos_requirements["min_co2"]))
return FALSE
+ ST.air.assert_gases(/datum/gas/plasma, /datum/gas/oxygen, /datum/gas/nitrogen, /datum/gas/carbon_dioxide)
+
var/plas = ST.air.gases[/datum/gas/plasma][MOLES]
var/oxy = ST.air.gases[/datum/gas/oxygen][MOLES]
var/n2 = ST.air.gases[/datum/gas/nitrogen][MOLES]
From 0914191b1ed066a9bc416168d534bd8c9aeaf097 Mon Sep 17 00:00:00 2001
From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Date: Sun, 12 Mar 2023 16:15:26 -0700
Subject: [PATCH 070/114] Optimizes atmos init by 20% (#73926)
Each time we intialized a turf's atmos, we checked all the turfs around
it to see if they were different. This meant each pair of turfs talked
to each other twice.
If we instead do the comparing in a second loop, we can use
current_cycle to ensure we only compare a pair once. This saves 0.5
seconds of atmos init.
Speed
---
code/controllers/subsystem/air.dm | 26 +++++++++++++++++++++++---
code/game/turfs/open/_open.dm | 8 --------
2 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index ff50dda2142b8..943cacb949931 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -521,15 +521,35 @@ SUBSYSTEM_DEF(air)
active_turfs.Cut()
var/time = 0
- for(var/turf/T as anything in turfs_to_init)
- if (!T.init_air)
+ var/list/turf/open/difference_check = list()
+ for(var/turf/setup as anything in ALL_TURFS())
+ if (!setup.init_air)
continue
// We pass the tick as the current step so if we sleep the step changes
// This way we can make setting up adjacent turfs O(n) rather then O(n^2)
- T.Initalize_Atmos(time)
+ setup.Initalize_Atmos(time)
+ // We assert that we'll only get open turfs here
+ difference_check += setup
if(CHECK_TICK)
time++
+ // Now we're gonna compare for differences
+ // Taking advantage of current cycle being set to negative before this run to do A->B B->A prevention
+ for(var/turf/open/potential_diff as anything in difference_check)
+ potential_diff.current_cycle = 0
+ for(var/turf/open/enemy_tile as anything in potential_diff.atmos_adjacent_turfs)
+ // If it's already been processed, then it's already talked to us
+ if(enemy_tile.current_cycle == 0)
+ continue
+ // .air instead of .return_air() because we can guarentee that the proc won't do anything
+ if(potential_diff.air.compare(enemy_tile.air))
+ //testing("Active turf found. Return value of compare(): [T.air.compare(enemy_tile.air)]")
+ potential_diff.excited = TRUE
+ SSair.active_turfs += potential_diff
+ // No sense continuing to iterate
+ break
+ CHECK_TICK
+
if(active_turfs.len)
var/starting_ats = active_turfs.len
sleep(world.tick_lag)
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index 20873df2f5079..15cd8b643edff 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -184,15 +184,7 @@
air.copy_from_turf(src)
current_cycle = time
-
init_immediate_calculate_adjacent_turfs()
- for(var/turf/open/enemy_tile as anything in atmos_adjacent_turfs)
- if(air.compare(enemy_tile.return_air()))
- //testing("Active turf found. Return value of compare(): [is_active]")
- excited = TRUE
- SSair.active_turfs += src
- // No sense continuing to iterate
- return
/turf/open/proc/GetHeatCapacity()
. = air.heat_capacity()
From caf809a670dce7476869025477772d4eac8b6ba1 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sat, 31 Aug 2024 17:50:56 +0200
Subject: [PATCH 071/114] Well now ssair won't error on init
---
code/controllers/subsystem/air.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index 943cacb949931..bb8ce6dd506ab 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -95,7 +95,7 @@ SUBSYSTEM_DEF(air)
setup_atmos_machinery()
setup_pipenets()
setup_turf_visuals()
- return ..()
+ return SS_INIT_SUCCESS
/datum/controller/subsystem/air/fire(resumed = FALSE)
From 297742ff8ee11dbe7ba9c6615c009ef346b7bb67 Mon Sep 17 00:00:00 2001
From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Date: Thu, 3 Feb 2022 07:58:36 -0800
Subject: [PATCH 072/114] Moves adjacent air into the main atmos subsystem
(#64559)
We should just straight up not be processing turfs if the adjacent turf
isn't correctly setup
It used to be on a seperate subsystem with a second wait with the idea
of reducing the cost of explosions, but since they're instant now
there's no reason to not just have it on SSair. Gets rid of my excuse
for process_cell runtimes too
---
beestation.dme | 5 ++
code/__DEFINES/atmospherics/atmos_helpers.dm | 4 +-
code/__DEFINES/subsystems.dm | 1 -
code/controllers/subsystem/adjacent_air.dm | 41 --------------
code/controllers/subsystem/air.dm | 56 +++++++++++++++++++-
5 files changed, 62 insertions(+), 45 deletions(-)
delete mode 100644 code/controllers/subsystem/adjacent_air.dm
diff --git a/beestation.dme b/beestation.dme
index 177ba80f7916e..c1327e310d9de 100644
--- a/beestation.dme
+++ b/beestation.dme
@@ -407,8 +407,13 @@
#include "code\controllers\configuration\entries\policies.dm"
#include "code\controllers\configuration\entries\resources.dm"
#include "code\controllers\subsystem\achievements.dm"
+<<<<<<< HEAD:beestation.dme
#include "code\controllers\subsystem\acid.dm"
#include "code\controllers\subsystem\adjacent_air.dm"
+=======
+#include "code\controllers\subsystem\addiction.dm"
+#include "code\controllers\subsystem\ai_controllers.dm"
+>>>>>>> 597902f7452 (Moves adjacent air into the main atmos subsystem (#64559)):tgstation.dme
#include "code\controllers\subsystem\air.dm"
#include "code\controllers\subsystem\ambience.dm"
#include "code\controllers\subsystem\area_contents.dm"
diff --git a/code/__DEFINES/atmospherics/atmos_helpers.dm b/code/__DEFINES/atmospherics/atmos_helpers.dm
index fb8cec5119b62..92fc3025575cb 100644
--- a/code/__DEFINES/atmospherics/atmos_helpers.dm
+++ b/code/__DEFINES/atmospherics/atmos_helpers.dm
@@ -63,9 +63,9 @@ GLOBAL_LIST_INIT(nonoverlaying_gases, typecache_of_gases_with_no_overlays())
#ifdef TESTING
GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
-#define CALCULATE_ADJACENT_TURFS(T, state) if (SSadjacent_air.queue[T]) { GLOB.atmos_adjacent_savings[1] += 1 } else { GLOB.atmos_adjacent_savings[2] += 1; SSadjacent_air.queue[T] = state}
+#define CALCULATE_ADJACENT_TURFS(T, state) if (SSair.adjacent_rebuild[T]) { GLOB.atmos_adjacent_savings[1] += 1 } else { GLOB.atmos_adjacent_savings[2] += 1; SSair.adjacent_rebuild[T] = state}
#else
-#define CALCULATE_ADJACENT_TURFS(T, state) SSadjacent_air.queue[T] = state
+#define CALCULATE_ADJACENT_TURFS(T, state) SSair.adjacent_rebuild[T] = state
#endif
//If you're doing spreading things related to atmos, DO NOT USE CANATMOSPASS, IT IS NOT CHEAP. use this instead, the info is cached after all. it's tweaked just a bit to allow for circular checks
diff --git a/code/__DEFINES/subsystems.dm b/code/__DEFINES/subsystems.dm
index 3642fe00003d8..a2053fa5eafac 100644
--- a/code/__DEFINES/subsystems.dm
+++ b/code/__DEFINES/subsystems.dm
@@ -216,7 +216,6 @@
#define FIRE_PRIORITY_ASSETS 105
#define FIRE_PRIORITY_TGUI 110
#define FIRE_PRIORITY_TICKER 200
-#define FIRE_PRIORITY_ATMOS_ADJACENCY 300
#define FIRE_PRIORITY_CHAT 400
#define FIRE_PRIORITY_RUNECHAT 410
#define FIRE_PRIORITY_OVERLAYS 500
diff --git a/code/controllers/subsystem/adjacent_air.dm b/code/controllers/subsystem/adjacent_air.dm
deleted file mode 100644
index dace8860ad817..0000000000000
--- a/code/controllers/subsystem/adjacent_air.dm
+++ /dev/null
@@ -1,41 +0,0 @@
-SUBSYSTEM_DEF(adjacent_air)
- name = "Atmos Adjacency"
- flags = SS_BACKGROUND
- runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
- wait = 10
- priority = FIRE_PRIORITY_ATMOS_ADJACENCY
- 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/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]
- var/goal = queue[currT]
- queue.Cut(1,2)
-
- currT.immediate_calculate_adjacent_turfs()
- if(goal == MAKE_ACTIVE)
- SSair.add_to_active(currT)
- else if(goal == KILL_EXCITED)
- SSair.add_to_active(currT, TRUE)
-
- 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 bb8ce6dd506ab..c3894183793fd 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -17,6 +17,7 @@ SUBSYSTEM_DEF(air)
var/cost_pipenets = 0
var/cost_atmos_machinery = 0
var/cost_rebuilds = 0
+ var/cost_adjacent = 0
var/list/excited_groups = list()
var/list/active_turfs = list()
@@ -25,10 +26,12 @@ SUBSYSTEM_DEF(air)
var/list/rebuild_queue = list()
//Subservient to rebuild queue
var/list/expansion_queue = list()
+ /// List of turfs to recalculate adjacent turfs on before processing
+ var/list/adjacent_rebuild = list()
/// A list of machines that will be processed when currentpart == SSAIR_ATMOSMACHINERY. Use SSair.begin_processing_machine and SSair.stop_processing_machine to add and remove machines.
var/list/obj/machinery/atmos_machinery = list()
- var/list/pipe_init_dirs_cache = list()
+ var/list/pipe_init_dirs_cache = list()
//atmos singletons
var/list/gas_reactions = list()
var/list/atmos_gen
@@ -73,6 +76,7 @@ SUBSYSTEM_DEF(air)
msg += "AM:[round(cost_atmos_machinery,1)]|"
msg += "AO:[round(cost_atoms, 1)]|"
msg += "RB:[round(cost_rebuilds,1)]|"
+ msg += "AJ:[round(cost_adjacent,1)]|"
msg += "} "
msg += "AT:[active_turfs.len]|"
msg += "HS:[hotspots.len]|"
@@ -84,6 +88,7 @@ SUBSYSTEM_DEF(air)
msg += "AO:[atom_process.len]|"
msg += "RB:[rebuild_queue.len]|"
msg += "EP:[expansion_queue.len]|"
+ msg += "AJ:[adjacent_rebuild.len]|"
msg += "AT/MS:[round((cost ? active_turfs.len/cost : 0),0.1)]"
return ..()
@@ -95,6 +100,7 @@ SUBSYSTEM_DEF(air)
setup_atmos_machinery()
setup_pipenets()
setup_turf_visuals()
+ process_adjacent_rebuild()
return SS_INIT_SUCCESS
@@ -138,6 +144,16 @@ SUBSYSTEM_DEF(air)
//Rebuilds can happen at any time, so this needs to be done outside of the normal system
cost_rebuilds = 0
+ cost_adjacent = 0
+
+ // We need to have a solid setup for turfs before fire, otherwise we'll get massive runtimes and strange behavior
+ if(length(adjacent_rebuild))
+ timer = TICK_USAGE_REAL
+ process_adjacent_rebuild()
+ //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_adjacent = TICK_USAGE_REAL - timer
+ if(state != SS_RUNNING)
+ return
// Every time we fire, we want to make sure pipenets are rebuilt. The game state could have changed between each fire() proc call
// and anything missing a pipenet can lead to unintended behaviour at worse and various runtimes at best.
@@ -248,6 +264,44 @@ SUBSYSTEM_DEF(air)
last_complete_process = world.time
SStgui.update_uis(SSair) //Lightning fast debugging motherfucker
+/datum/controller/subsystem/air/Recover()
+ excited_groups = SSair.excited_groups
+ active_turfs = SSair.active_turfs
+ hotspots = SSair.hotspots
+ networks = SSair.networks
+ rebuild_queue = SSair.rebuild_queue
+ expansion_queue = SSair.expansion_queue
+ adjacent_rebuild = SSair.adjacent_rebuild
+ atmos_machinery = SSair.atmos_machinery
+ pipe_init_dirs_cache = SSair.pipe_init_dirs_cache
+ gas_reactions = SSair.gas_reactions
+ atmos_gen = SSair.atmos_gen
+ planetary = SSair.planetary
+ active_super_conductivity = SSair.active_super_conductivity
+ high_pressure_delta = SSair.high_pressure_delta
+ atom_process = SSair.atom_process
+ currentrun = SSair.currentrun
+ queued_for_activation = SSair.queued_for_activation
+
+/datum/controller/subsystem/air/proc/process_adjacent_rebuild(init = FALSE)
+ var/list/queue = adjacent_rebuild
+
+ while (length(queue))
+ var/turf/currT = queue[1]
+ var/goal = queue[currT]
+ queue.Cut(1,2)
+
+ currT.immediate_calculate_adjacent_turfs()
+ if(goal == MAKE_ACTIVE)
+ add_to_active(currT)
+ else if(goal == KILL_EXCITED)
+ add_to_active(currT, TRUE)
+
+ if(init)
+ CHECK_TICK
+ else
+ if(MC_TICK_CHECK)
+ break
/datum/controller/subsystem/air/proc/process_pipenets(resumed = FALSE)
if (!resumed)
From 62b38ad01711b0f16fdd5eae9fb89ac9cd568022 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sat, 31 Aug 2024 17:53:06 +0200
Subject: [PATCH 073/114] updates DME
---
beestation.dme | 1 -
1 file changed, 1 deletion(-)
diff --git a/beestation.dme b/beestation.dme
index c1327e310d9de..1d94e09124367 100644
--- a/beestation.dme
+++ b/beestation.dme
@@ -408,7 +408,6 @@
#include "code\controllers\configuration\entries\resources.dm"
#include "code\controllers\subsystem\achievements.dm"
<<<<<<< HEAD:beestation.dme
-#include "code\controllers\subsystem\acid.dm"
#include "code\controllers\subsystem\adjacent_air.dm"
=======
#include "code\controllers\subsystem\addiction.dm"
From 38d7a4637669263d27f26857d50a26dbda83c093 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sat, 31 Aug 2024 17:54:38 +0200
Subject: [PATCH 074/114] DME got fucked up somehow
---
beestation.dme | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/beestation.dme b/beestation.dme
index 1d94e09124367..c64b3c1388008 100644
--- a/beestation.dme
+++ b/beestation.dme
@@ -407,13 +407,8 @@
#include "code\controllers\configuration\entries\policies.dm"
#include "code\controllers\configuration\entries\resources.dm"
#include "code\controllers\subsystem\achievements.dm"
-<<<<<<< HEAD:beestation.dme
-#include "code\controllers\subsystem\adjacent_air.dm"
-=======
-#include "code\controllers\subsystem\addiction.dm"
-#include "code\controllers\subsystem\ai_controllers.dm"
->>>>>>> 597902f7452 (Moves adjacent air into the main atmos subsystem (#64559)):tgstation.dme
#include "code\controllers\subsystem\air.dm"
+#include "code\controllers\subsystem\acid.dm"
#include "code\controllers\subsystem\ambience.dm"
#include "code\controllers\subsystem\area_contents.dm"
#include "code\controllers\subsystem\asset_loading.dm"
From 46db89636756ead5b818f5ad478fc6713f124e85 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sat, 31 Aug 2024 18:37:29 +0200
Subject: [PATCH 075/114] More stuff, don't forget to remove lowmemmode before
setting to open
---
_maps/_basemap.dm | 2 +-
code/controllers/subsystem/air.dm | 1 -
code/game/turfs/open/_open.dm | 1 +
code/modules/surgery/organs/lungs.dm | 2 ++
4 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/_maps/_basemap.dm b/_maps/_basemap.dm
index f56eb5147fb1d..fc57006ca2192 100644
--- a/_maps/_basemap.dm
+++ b/_maps/_basemap.dm
@@ -1,4 +1,4 @@
-//#define LOWMEMORYMODE //uncomment this to load centcom and runtime station and thats it.
+#define LOWMEMORYMODE //uncomment this to load centcom and runtime station and thats it.
// uncomment this for a map you need to use
// #define FORCE_MAP "corgstation"
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index c3894183793fd..d30d3f76e520e 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -561,7 +561,6 @@ SUBSYSTEM_DEF(air)
queued_for_activation.Cut()
/datum/controller/subsystem/air/proc/setup_allturfs()
- var/list/turfs_to_init = block(locate(1, 1, 1), locate(world.maxx, world.maxy, world.maxz))
var/list/active_turfs = src.active_turfs
times_fired++
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index 15cd8b643edff..a97d1d5fa9199 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -286,6 +286,7 @@
pulse_strength = min(pulse_strength,air.gases[/datum/gas/carbon_dioxide][MOLES]*1000,air.gases[/datum/gas/oxygen][MOLES]*2000) //Ensures matter is conserved properly
air.gases[/datum/gas/carbon_dioxide][MOLES] = max(air.gases[/datum/gas/carbon_dioxide][MOLES]-(pulse_strength/1000),0)
air.gases[/datum/gas/oxygen][MOLES] = max(air.gases[/datum/gas/oxygen][MOLES]-(pulse_strength/2000),0)
+ ASSERT_GAS(/datum/gas/pluoxium, air)
air.gases[/datum/gas/pluoxium][MOLES] += pulse_strength/4000
/turf/open/proc/break_tile(force, allow_base)
diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index 76c5dcc892c70..b15c46ce68954 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -177,6 +177,8 @@
alert_category = class.low_alert_category
alert_type = class.low_alert_datum
for(var/gas in gases)
+ if (!(gas in breath.gases))
+ continue
var/moles = breath.gases[gas][MOLES]
var/multiplier = gases[gas]
mole_adjustments[gas] = (gas in mole_adjustments) ? mole_adjustments[gas] - moles : -moles
From cf29d59a02abe9aaab24da3199de158261954881 Mon Sep 17 00:00:00 2001
From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Date: Mon, 13 Mar 2023 21:42:39 -0700
Subject: [PATCH 076/114] Fixes ignoring space turfs in difference checks
(#73962)
## About The Pull Request
I done fucked it lads. Space turfs are never initialized, so asserting
all shareable turfs have a cycle below 0 is not safe. instead we'll use
-infinity. if that ever breaks I'll eat my shoe
Closes #73961
---
code/controllers/subsystem/air.dm | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index d30d3f76e520e..94a307b3fe80a 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -589,16 +589,21 @@ SUBSYSTEM_DEF(air)
// Now we're gonna compare for differences
// Taking advantage of current cycle being set to negative before this run to do A->B B->A prevention
for(var/turf/open/potential_diff as anything in difference_check)
- potential_diff.current_cycle = 0
+ // I can't use 0 here, so we're gonna do this instead. If it ever breaks I'll eat my shoe
+ potential_diff.current_cycle = -INFINITE
for(var/turf/open/enemy_tile as anything in potential_diff.atmos_adjacent_turfs)
// If it's already been processed, then it's already talked to us
- if(enemy_tile.current_cycle == 0)
+ if(enemy_tile.current_cycle == -INFINITE)
continue
// .air instead of .return_air() because we can guarentee that the proc won't do anything
if(potential_diff.air.compare(enemy_tile.air))
//testing("Active turf found. Return value of compare(): [T.air.compare(enemy_tile.air)]")
- potential_diff.excited = TRUE
- SSair.active_turfs += potential_diff
+ if(!potential_diff.excited)
+ potential_diff.excited = TRUE
+ SSair.active_turfs += potential_diff
+ if(!enemy_tile.excited)
+ enemy_tile.excited = TRUE
+ SSair.active_turfs += enemy_tile
// No sense continuing to iterate
break
CHECK_TICK
From 3754526d8bc95fd131d57b2bf5c65adf36342165 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sat, 31 Aug 2024 18:40:32 +0200
Subject: [PATCH 077/114] did a silly
---
code/controllers/subsystem/air.dm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index 94a307b3fe80a..2db1fc3896d4f 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -590,10 +590,10 @@ SUBSYSTEM_DEF(air)
// Taking advantage of current cycle being set to negative before this run to do A->B B->A prevention
for(var/turf/open/potential_diff as anything in difference_check)
// I can't use 0 here, so we're gonna do this instead. If it ever breaks I'll eat my shoe
- potential_diff.current_cycle = -INFINITE
+ potential_diff.current_cycle = -INFINITY
for(var/turf/open/enemy_tile as anything in potential_diff.atmos_adjacent_turfs)
// If it's already been processed, then it's already talked to us
- if(enemy_tile.current_cycle == -INFINITE)
+ if(enemy_tile.current_cycle == -INFINITY)
continue
// .air instead of .return_air() because we can guarentee that the proc won't do anything
if(potential_diff.air.compare(enemy_tile.air))
From 2ce2fc16e3096f9d46180a99439f55302b2128d8 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sat, 31 Aug 2024 22:44:36 +0200
Subject: [PATCH 078/114] GET MOLES??? IS THAT YOU???
---
code/__DEFINES/atmospherics/atmos_helpers.dm | 14 +++++
code/__HELPERS/turfs.dm | 6 +-
code/controllers/subsystem/air.dm | 3 +-
code/datums/atmosphere/_atmosphere.dm | 14 ++---
code/datums/elements/atmos_requirements.dm | 10 ++--
code/game/atoms.dm | 2 +-
code/game/gamemodes/objective_items.dm | 2 +-
code/game/machinery/shuttle/shuttle_heater.dm | 2 +-
.../effects/effect_system/effects_foam.dm | 8 +--
.../effects/effect_system/effects_smoke.dm | 2 +-
.../objects/effects/spawners/bombspawner.dm | 6 +-
code/game/objects/items/chrono_eraser.dm | 6 +-
code/game/objects/items/devices/scanners.dm | 34 +++++------
code/game/objects/items/tanks/jetpack.dm | 22 +++----
code/game/objects/items/tanks/tank_types.dm | 35 +++++------
.../transit_tubes/transit_tube_pod.dm | 6 +-
code/game/turfs/open/_open.dm | 7 +--
code/modules/admin/verbs/debug.dm | 4 +-
.../gasmixtures/breathing_classes.dm | 2 +-
.../atmospherics/gasmixtures/reactions.dm | 58 ++++++++-----------
.../components/trinary_devices/filter.dm | 3 +-
.../components/unary_devices/cryo.dm | 4 +-
.../components/unary_devices/tank.dm | 8 +--
.../atmospherics/machinery/datum_pipeline.dm | 3 +-
.../atmospherics/machinery/other/miner.dm | 2 +-
.../atmospherics/machinery/portable/pump.dm | 4 +-
.../mob/living/simple_animal/simple_animal.dm | 9 ++-
code/modules/surgery/organs/lungs.dm | 2 +-
code/modules/unit_tests/gas_transfer.dm | 13 ++---
code/modules/vehicles/mecha/_mecha.dm | 6 +-
30 files changed, 134 insertions(+), 163 deletions(-)
diff --git a/code/__DEFINES/atmospherics/atmos_helpers.dm b/code/__DEFINES/atmospherics/atmos_helpers.dm
index 92fc3025575cb..0fb823a192e30 100644
--- a/code/__DEFINES/atmospherics/atmos_helpers.dm
+++ b/code/__DEFINES/atmospherics/atmos_helpers.dm
@@ -74,3 +74,17 @@ GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
#define TURF_SHARES(T) (LAZYLEN(T.atmos_adjacent_turfs))
/// Rounding
#define QUANTIZE(variable) (round((variable), (MOLAR_ACCURACY)))
+
+// Macros to access moles. Used instead of listmos only when nullchecking is necessary.
+
+///Gets the moles of a specific gas in a gas mixture.
+#define GET_MOLES(gas, gas_mixture) (gas_mixture.gases[gas] ? gas_mixture.gases[gas][MOLES] : 0)
+
+///Adds moles to a specific gas in a gas mixture, asserts the gas is present.
+#define ADD_MOLES(gas, gas_mixture, moles) (ASSERT_GAS(gas, gas_mixture); gas_mixture.gases[gas][MOLES] += moles)
+
+///Removes moles from a specific gas in a gas mixture, asserts the gas is present.
+#define REMOVE_MOLES(gas, gas_mixture, moles) (ASSERT_GAS(gas, gas_mixture); max(gas_mixture.gases[gas][MOLES] -= moles, 0))
+
+///Sets the moles of a specific gas in a gas mixture, asserts the gas is present.
+#define SET_MOLES(gas, gas_mixture, moles) (ASSERT_GAS(gas, gas_mixture); gas_mixture.gases[gas][MOLES] = moles)
diff --git a/code/__HELPERS/turfs.dm b/code/__HELPERS/turfs.dm
index 877988ba28247..04b13155f90d3 100644
--- a/code/__HELPERS/turfs.dm
+++ b/code/__HELPERS/turfs.dm
@@ -404,12 +404,12 @@ Turf and target are separate in case you want to teleport some distance from a t
if(id in GLOB.hardcoded_gases)
continue
return FALSE
- if(air.gases[/datum/gas/oxygen][MOLES] < 16 || air.gases[/datum/gas/plasma][MOLES] || air.gases[/datum/gas/carbon_dioxide][MOLES] >= 10)
+ if(GET_MOLES(/datum/gas/oxygen, air) < 16 || air.gases[/datum/gas/plasma][MOLES] || GET_MOLES(/datum/gas/carbon_dioxide, air) >= 10)
return FALSE
- var/temperature = air.return_temperature()
+ var/temperature = air.temperature
if(temperature <= 270 || temperature >= 360)
return FALSE
- var/pressure = air.return_pressure()
+ var/pressure = air.pressure
if(pressure <= 20 || pressure >= 550)
return FALSE
return TRUE
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index 2db1fc3896d4f..b2e68c635b18c 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -749,8 +749,7 @@ GLOBAL_LIST_EMPTY(colored_images)
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
- ADD_GAS(path, gases)
- gases[path][MOLES] = text2num(gas[id])
+ SET_MOLES(path, gases, text2num(gas[id]))
if(istype(canonical_mix, /datum/gas_mixture/immutable))
return canonical_mix
diff --git a/code/datums/atmosphere/_atmosphere.dm b/code/datums/atmosphere/_atmosphere.dm
index 7747391caeaa8..00c9976d5dd59 100644
--- a/code/datums/atmosphere/_atmosphere.dm
+++ b/code/datums/atmosphere/_atmosphere.dm
@@ -25,13 +25,13 @@
var/datum/gas_mixture/gasmix = new
gasmix.temperature = rand(minimum_temp, maximum_temp)
for(var/i in base_gases)
- gasmix.gases[i][MOLES] = base_gases[i]
+ SET_MOLES(gasmix, i, base_gases[i])
// Now let the random choices begin
var/datum/gas/gastype
var/amount
- while(gasmix.return_pressure() < target_pressure)
+ while(gasmix.pressure < target_pressure)
if(!prob(restricted_chance))
gastype = pick(normal_gases)
amount = normal_gases[gastype]
@@ -45,16 +45,16 @@
amount *= pressure_scalar // If we pick a really small target pressure we want roughly the same mix but less of it all
amount = CEILING(amount, 0.1)
- gasmix.gases[gastype][MOLES] = gasmix.gases[gastype][MOLES] + amount
+ ADD_MOLES(gastype, gasmix, amount)
// That last one put us over the limit, remove some of it
- while(gasmix.return_pressure() > target_pressure)
- gasmix.gases[gastype][MOLES] = gasmix.gases[gastype][MOLES] - (gasmix.gases[gastype][MOLES] * 0.1)
- gasmix.gases[gastype][MOLES] = FLOOR(gasmix.gases[gastype][MOLES], 0.1)
+ while(gasmix.pressure > target_pressure)
+ SET_MOLES(gastype, gasmix, GET_MOLES(gastype, gasmix) * 0.9)
+ SET_MOLES(gastype, gasmix, FLOOR(GET_MOLES(gastype,gasmix), 0.1))
// Now finally lets make that string
var/list/gas_string_builder = list()
for(var/i in gasmix.gases)
- gas_string_builder += "[gasmix.gases[i][GAS_META][META_GAS_ID]]=[gasmix.gases[i][MOLES]]"
+ gas_string_builder += "[gasmix.gases[i][GAS_META][META_GAS_ID]]=[GET_MOLES(i, gasmix)]"
gas_string_builder += "TEMP=[gasmix.return_temperature()]"
gas_string = gas_string_builder.Join(";")
diff --git a/code/datums/elements/atmos_requirements.dm b/code/datums/elements/atmos_requirements.dm
index cb1886d2375ae..ddffd374ba120 100644
--- a/code/datums/elements/atmos_requirements.dm
+++ b/code/datums/elements/atmos_requirements.dm
@@ -45,12 +45,10 @@
if(!ST.air && (atmos_requirements["min_oxy"] || atmos_requirements["min_tox"] || atmos_requirements["min_n2"] || atmos_requirements["min_co2"]))
return FALSE
- ST.air.assert_gases(/datum/gas/plasma, /datum/gas/oxygen, /datum/gas/nitrogen, /datum/gas/carbon_dioxide)
-
- var/plas = ST.air.gases[/datum/gas/plasma][MOLES]
- var/oxy = ST.air.gases[/datum/gas/oxygen][MOLES]
- var/n2 = ST.air.gases[/datum/gas/nitrogen][MOLES]
- var/co2 = ST.air.gases[/datum/gas/carbon_dioxide][MOLES]
+ var/plas = GET_MOLES(/datum/gas/plasma, ST.air)
+ var/oxy = GET_MOLES(/datum/gas/oxygen, ST.air)
+ var/n2 = GET_MOLES(/datum/gas/nitrogen, ST.air)
+ var/co2 = GET_MOLES(/datum/gas/carbon_dioxide, ST.air)
. = TRUE
if(atmos_requirements["min_oxy"] && oxy < atmos_requirements["min_oxy"])
diff --git a/code/game/atoms.dm b/code/game/atoms.dm
index c1a7cb3344f66..1fec06a3022f1 100644
--- a/code/game/atoms.dm
+++ b/code/game/atoms.dm
@@ -1888,7 +1888,7 @@
/atom/proc/plasma_ignition(strength, mob/user, reagent_reaction)
var/turf/T = get_turf(src)
var/datum/gas_mixture/environment = T.return_air()
- if(environment.gases[/datum/gas/oxygen][MOLES] >= PLASMA_MINIMUM_OXYGEN_NEEDED) //Flashpoint ignition can only occur with at least this much oxygen present
+ if(GET_MOLES(/datum/gas/oxygen, environment) >= PLASMA_MINIMUM_OXYGEN_NEEDED) //Flashpoint ignition can only occur with at least this much oxygen present
//no reason to alert admins or create an explosion if there's not enough power to actually make an explosion
if(strength > 1)
if(user)
diff --git a/code/game/gamemodes/objective_items.dm b/code/game/gamemodes/objective_items.dm
index ce1fa7fcc47bd..28f9b58003668 100644
--- a/code/game/gamemodes/objective_items.dm
+++ b/code/game/gamemodes/objective_items.dm
@@ -144,7 +144,7 @@
var/target_amount = text2num(name)
var/found_amount = 0
var/datum/gas_mixture/mix = T.return_air()
- found_amount += mix.gases[/datum/gas/plasma] ? mix.gases[/datum/gas/plasma][MOLES] : 0
+ found_amount += GET_MOLES(/datum/gas/plasma, mix)
return found_amount>=target_amount
/datum/objective_item/steal/functionalai
diff --git a/code/game/machinery/shuttle/shuttle_heater.dm b/code/game/machinery/shuttle/shuttle_heater.dm
index 179c7fd32784a..05901c3b57fd0 100644
--- a/code/game/machinery/shuttle/shuttle_heater.dm
+++ b/code/game/machinery/shuttle/shuttle_heater.dm
@@ -83,7 +83,7 @@
/obj/machinery/atmospherics/components/unary/shuttle/heater/examine(mob/user)
. = ..()
var/datum/gas_mixture/air_contents = airs[1]
- . += "The engine heater's gas dial reads [air_contents.gases[gas_type][MOLES]] moles of gas. "
+ . += "The engine heater's gas dial reads [GET_MOLES(gas_type, air_contents)] moles of gas. "
/obj/machinery/atmospherics/components/unary/shuttle/heater/proc/updateGasStats()
var/datum/gas_mixture/air_contents = airs[1]
diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm
index 8f55cf1023ce3..58cfb9ad0ddb8 100644
--- a/code/game/objects/effects/effect_system/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/effects_foam.dm
@@ -44,10 +44,10 @@
if(hotspot && istype(T) && T.air)
qdel(hotspot)
var/datum/gas_mixture/G = T.air
- var/plas_amt = min(30,G.gases[/datum/gas/plasma][MOLES]) //Absorb some plasma
- G.gases[/datum/gas/plasma][MOLES] += -plas_amt
+ var/plas_amt = min(30,GET_MOLES(/datum/gas/plasma, G)) //Absorb some plasma
+ REMOVE_MOLES(/datum/gas/plasma, G, plas_amt)
absorbed_plasma += plas_amt
- if(G.return_temperature() > T20C)
+ if(G.temperature > T20C)
G.temperature = max(G.return_temperature()/2,T20C)
T.air_update_turf(FALSE, FALSE)
@@ -342,7 +342,7 @@
for(var/I in G.gases)
if(I == /datum/gas/oxygen || I == /datum/gas/nitrogen)
continue
- G.gases[I][MOLES] = 0
+ SET_MOLES(I , G, 0)
for(var/obj/machinery/atmospherics/components/unary/U in O)
if(!U.welded)
diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm
index 97192a395a6e2..bef1f6710853c 100644
--- a/code/game/objects/effects/effect_system/effects_smoke.dm
+++ b/code/game/objects/effects/effect_system/effects_smoke.dm
@@ -180,7 +180,7 @@
for(var/obj/effect/hotspot/H in T)
qdel(H)
if(G.gases[/datum/gas/plasma][MOLES])
- G.gases[/datum/gas/nitrogen][MOLES] += G.gases[/datum/gas/plasma][MOLES]
+ ADD_MOLES(/datum/gas/nitrogen, G, G.gases[/datum/gas/plasma][MOLES])
G.gases[/datum/gas/plasma][MOLES] = 0
if (weldvents)
diff --git a/code/game/objects/effects/spawners/bombspawner.dm b/code/game/objects/effects/spawners/bombspawner.dm
index 63dbe14b0e027..36b3caea0e8dc 100644
--- a/code/game/objects/effects/spawners/bombspawner.dm
+++ b/code/game/objects/effects/spawners/bombspawner.dm
@@ -22,12 +22,10 @@
var/datum/gas_mixture/plasma_mix = plasma_tank.return_air()
var/datum/gas_mixture/oxygen_mix = oxygen_tank.return_air()
- plasma_mix.assert_gas(/datum/gas/plasma)
- plasma_mix.gases[/datum/gas/plasma][MOLES] = pressure_p*plasma_mix.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_p))
+ SET_MOLES(plasma_mix, /datum/gas/plasma, pressure_p*plasma_mix.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_p)))
plasma_mix.temperature = CELSIUS_TO_KELVIN(temp_p)
- oxygen_mix.assert_gas(/datum/gas/oxygen)
- oxygen_mix.gases[/datum/gas/oxygen][MOLES] = pressure_o*oxygen_mix.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o))
+ SET_MOLES(oxygen_mix, /datum/gas/oxygen, pressure_o*oxygen_mix.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o)))
oxygen_mix.temperature = CELSIUS_TO_KELVIN(temp_o)
V.tank_one = plasma_tank
diff --git a/code/game/objects/items/chrono_eraser.dm b/code/game/objects/items/chrono_eraser.dm
index f500a0a24984c..df105473321af 100644
--- a/code/game/objects/items/chrono_eraser.dm
+++ b/code/game/objects/items/chrono_eraser.dm
@@ -264,10 +264,8 @@
/obj/structure/chrono_field/return_air() //we always have nominal air and temperature
var/datum/gas_mixture/GM = new
- GM.gases[/datum/gas/oxygen][MOLES] = MOLES_O2STANDARD
-
- GM.gases[/datum/gas/nitrogen][MOLES] = MOLES_N2STANDARD
-
+ SET_MOLES(GM, /datum/gas/oxygen, MOLES_O2STANDARD)
+ SET_MOLES(GM, /datum/gas/nitrogen, MOLES_N2STANDARD)
GM.temperature = T20C
return GM
diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm
index e1c7ac818dbc4..b346f41fd129d 100644
--- a/code/game/objects/items/devices/scanners.dm
+++ b/code/game/objects/items/devices/scanners.dm
@@ -667,8 +667,8 @@ GENE SCANNER
message += "Pressure: [round(pressure,0.01)] kPa"
for(var/id in air_contents.gases)
- var/gas_concentration = air_contents.gases[id][MOLES]/total_moles
- message += "[air_contents.gases[id][GAS_META][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] % ([round(air_contents.gases[id][MOLES], 0.01)] mol)"
+ var/gas_concentration = GET_MOLES(id,air_contents)/total_moles
+ message += "[air_contents.gases[id][GAS_META][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] % ([round(GET_MOLES(id, air_contents), 0.01)] mol)"
message += "Temperature: [round(temperature - T0C,0.01)] °C ([round(temperature, 0.01)] K)"
else
@@ -702,37 +702,37 @@ GENE SCANNER
else
message += "Pressure: [round(pressure, 0.01)] kPa"
if(total_moles)
- var/o2_concentration = environment.gases[/datum/gas/oxygen][MOLES]/total_moles
- var/n2_concentration = environment.gases[/datum/gas/nitrogen][MOLES]/total_moles
- var/co2_concentration = environment.gases[/datum/gas/carbon_dioxide][MOLES]/total_moles
- var/plasma_concentration = environment.gases[/datum/gas/plasma][MOLES]/total_moles
+ var/o2_concentration = GET_MOLES(/datum/gas/oxygen, environment)/total_moles
+ var/n2_concentration = GET_MOLES(/datum/gas/nitrogen, environment)/total_moles
+ var/co2_concentration = GET_MOLES(/datum/gas/carbon_dioxide, environment)/total_moles
+ var/plasma_concentration =
if(abs(n2_concentration - N2STANDARD) < 20)
- message += "Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/nitrogen][MOLES], 0.01)] mol)"
+ message += "Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(n2_concentration*total_moles, 0.01)] mol)"
else
- message += "Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/nitrogen][MOLES], 0.01)] mol)"
+ message += "Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(n2_concentration*total_moles, 0.01)] mol)"
if(abs(o2_concentration - O2STANDARD) < 2)
- message += "Oxygen: [round(o2_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/oxygen][MOLES], 0.01)] mol)"
+ message += "Oxygen: [round(o2_concentration*100, 0.01)] % ([round(o2_concentration*total_moles, 0.01)] mol)"
else
- message += "Oxygen: [round(o2_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/oxygen][MOLES], 0.01)] mol)"
+ message += "Oxygen: [round(o2_concentration*100, 0.01)] % ([round(o2_concentration*total_moles, 0.01)] mol)"
if(co2_concentration > 0.01)
- message += "CO2: [round(co2_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/carbon_dioxide][MOLES], 0.01)] mol)"
+ message += "CO2: [round(co2_concentration*100, 0.01)] % ([round(co2_concentration*total_moles, 0.01)] mol)"
else
- message += "CO2: [round(co2_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/carbon_dioxide][MOLES], 0.01)] mol)"
+ message += "CO2: [round(co2_concentration*100, 0.01)] % ([round(co2_concentration*total_moles, 0.01)] mol)"
if(plasma_concentration > 0.005)
- message += "Plasma: [round(plasma_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/plasma][MOLES], 0.01)] mol)"
+ message += "Plasma: [round(plasma_concentration*100, 0.01)] % ([round(plasma_concentration*total_moles, 0.01)] mol)"
else
- message += "Plasma: [round(plasma_concentration*100, 0.01)] % ([round(environment.gases[/datum/gas/plasma][MOLES], 0.01)] mol)"
+ message += "Plasma: [round(plasma_concentration*100, 0.01)] % ([round(plasma_concentration*total_moles, 0.01)] mol)"
for(var/id in environment.gases)
if(id in GLOB.hardcoded_gases)
continue
- var/gas_concentration = environment.gases[id][MOLES]/total_moles
- message += "[environment.gases[id][GAS_META][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] % ([round(environment.gases[id][MOLES], 0.01)] mol)"
- message += "Temperature: [round(environment.return_temperature()-T0C, 0.01)] °C ([round(environment.return_temperature(), 0.01)] K)"
+ var/gas_concentration = GET_MOLES(id, environment)/total_moles
+ message += "[environment.gases[id][GAS_META][META_GAS_NAME]]: [round(gas_concentration*100, 0.01)] % ([round(gas_concentration*total_moles, 0.01)] mol)"
+ message += "Temperature: [round(environment.temperature-T0C, 0.01)] °C ([round(environment.temperature, 0.01)] K)"
to_chat(user, EXAMINE_BLOCK(jointext(message, "\n")))
/obj/item/analyzer/ranged
diff --git a/code/game/objects/items/tanks/jetpack.dm b/code/game/objects/items/tanks/jetpack.dm
index 6dfcead56cf89..b4eb91883bf8b 100644
--- a/code/game/objects/items/tanks/jetpack.dm
+++ b/code/game/objects/items/tanks/jetpack.dm
@@ -29,8 +29,7 @@
/obj/item/tank/jetpack/populate_gas()
if(gas_type)
- air_contents.assert_gas(gas_type)
- air_contents.gases[gas_type][MOLES] = ((6 * ONE_ATMOSPHERE * volume / (R_IDEAL_GAS_EQUATION * T20C)))
+ SET_MOLES(air_contents, gas_type, ((6 * ONE_ATMOSPHERE * volume / (R_IDEAL_GAS_EQUATION * T20C))))
/obj/item/tank/jetpack/ui_action_click(mob/user, action)
if(istype(action, /datum/action/item_action/toggle_jetpack))
@@ -338,11 +337,8 @@
var/ideal_o2_percent = (1 / PLASMA_OXYGEN_FULLBURN) * 2
var/datum/gas_mixture/temp_air_contents = return_air()
- temp_air_contents.assert_gas(/datum/gas/plasma)
- temp_air_contents.gases[/datum/gas/plasma][MOLES] = moles_full * (1 - ideal_o2_percent)
-
- temp_air_contents.assert_gas(/datum/gas/oxygen)
- temp_air_contents.gases[/datum/gas/oxygen][MOLES] = moles_full * ideal_o2_percent
+ SET_MOLES(temp_air_contents, /datum/gas/plasma, moles_full*(1-ideal_o2_percent))
+ SET_MOLES(temp_air_contents, /datum/gas/oxygen, moles_full*ideal_o2_percent)
/obj/item/tank/jetpack/combustion/allow_thrust(num, mob/living/user, use_fuel = TRUE)
@@ -358,12 +354,12 @@
// Also produces no waste products (CO2/Trit)
var/oxygen_burn_rate = (OXYGEN_BURN_RATE_BASE - 1)
var/plasma_burn_rate = 0
- if(our_mix.gases[/datum/gas/oxygen][MOLES] > our_mix.gases[/datum/gas/plasma][MOLES]*PLASMA_OXYGEN_FULLBURN)
- plasma_burn_rate = our_mix.gases[/datum/gas/plasma][MOLES]/PLASMA_BURN_RATE_DELTA
+ if(GET_MOLES(/datum/gas/oxygen, our_mix) > GET_MOLES(/datum/gas/plasma, our_mix) * PLASMA_OXYGEN_FULLBURN)
+ plasma_burn_rate = GET_MOLES(/datum/gas/plasma, our_mix)/PLASMA_BURN_RATE_DELTA
else
- plasma_burn_rate = (our_mix.gases[/datum/gas/oxygen][MOLES]/PLASMA_OXYGEN_FULLBURN)/PLASMA_BURN_RATE_DELTA
+ plasma_burn_rate = (GET_MOLES(/datum/gas/plasma, our_mix)/PLASMA_OXYGEN_FULLBURN)/PLASMA_BURN_RATE_DELTA
if(plasma_burn_rate > MINIMUM_HEAT_CAPACITY)
- plasma_burn_rate = min(plasma_burn_rate,our_mix.gases[/datum/gas/plasma][MOLES],our_mix.gases[/datum/gas/oxygen][MOLES]/oxygen_burn_rate) //Ensures matter is conserved properly
+ plasma_burn_rate = min(plasma_burn_rate,GET_MOLES(/datum/gas/plasma, our_mix),GET_MOLES(/datum/gas/oxygen, our_mix)/oxygen_burn_rate) //Ensures matter is conserved properly
potential_energy = FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate)
// Normalize thrust volume to joules
@@ -377,8 +373,8 @@
// Consume
if(use_fuel)
- our_mix.gases[/datum/gas/plasma][MOLES] = QUANTIZE(our_mix.gases[/datum/gas/plasma][MOLES] - plasma_burn_rate)
- our_mix.gases[/datum/gas/oxygen][MOLES] = QUANTIZE(our_mix.gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate))
+ SET_MOLES(/datum/gas/plasma, our_mix, QUANTIZE(GET_MOLES(/datum/gas/plasma, our_mix) - plasma_burn_rate))
+ SET_MOLES(/datum/gas/oxygen, our_mix, QUANTIZE(GET_MOLES(/datum/gas/oxygen, our_mix) - (plasma_burn_rate * oxygen_burn_rate)))
update_fade(15)
update_lifespan(4)
diff --git a/code/game/objects/items/tanks/tank_types.dm b/code/game/objects/items/tanks/tank_types.dm
index 36241e36a6ff5..9b3a7c38ead1b 100644
--- a/code/game/objects/items/tanks/tank_types.dm
+++ b/code/game/objects/items/tanks/tank_types.dm
@@ -30,8 +30,7 @@
/obj/item/tank/internals/oxygen/populate_gas()
- air_contents.assert_gas(/datum/gas/oxygen)
- air_contents.gases[/datum/gas/oxygen][MOLES] = (6*ONE_ATMOSPHERE *volume/(R_IDEAL_GAS_EQUATION*T20C))
+ SET_MOLES(air_contents, /datum/gas/oxygen, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
/obj/item/tank/internals/oxygen/yellow
desc = "A tank of oxygen, this one is yellow."
@@ -57,10 +56,8 @@
force = 10
/obj/item/tank/internals/anesthetic/populate_gas()
- air_contents.assert_gas(/datum/gas/oxygen)
- air_contents.assert_gas(/datum/gas/nitrous_oxide)
- air_contents.gases[/datum/gas/oxygen][MOLES] = (3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
- air_contents.gases[/datum/gas/nitrous_oxide][MOLES] = (3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
+ SET_MOLES(air_contents, /datum/gas/oxygen, 3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
+ SET_MOLES(air_contents, /datum/gas/nitrous_oxide, 3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
/*
* Air
@@ -74,10 +71,8 @@
dog_fashion = /datum/dog_fashion/back
/obj/item/tank/internals/air/populate_gas()
- air_contents.assert_gas(/datum/gas/oxygen)
- air_contents.assert_gas(/datum/gas/nitrogen)
- air_contents.gases[/datum/gas/oxygen][MOLES] = (6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
- air_contents.gases[/datum/gas/nitrogen][MOLES] = (6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
+ SET_MOLES(air_contents, /datum/gas/oxygen, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
+ SET_MOLES(air_contents, /datum/gas/nitrogen, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
/*
* Plasma
@@ -92,8 +87,7 @@
/obj/item/tank/internals/plasma/populate_gas()
- air_contents.assert_gas(/datum/gas/plasma)
- air_contents.gases[/datum/gas/plasma][MOLES] = (3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ SET_MOLES(air_contents, /datum/gas/plasma, 10*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))
@@ -109,8 +103,7 @@
return ..()
/obj/item/tank/internals/plasma/full/populate_gas()
- air_contents.assert_gas(/datum/gas/plasma)
- air_contents.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ SET_MOLES(air_contents, /datum/gas/plasma, 10*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasma/empty/populate_gas()
return
@@ -129,10 +122,10 @@
distribute_pressure = TANK_DEFAULT_RELEASE_PRESSURE
/obj/item/tank/internals/plasmaman/populate_gas()
- air_contents.gases[/datum/gas/plasma][MOLES] = (3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ SET_MOLES(/datum/gas/plasma, air_contents, (3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C)))
/obj/item/tank/internals/plasmaman/full/populate_gas()
- air_contents.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ SET_MOLES(/datum/gas/plasma, air_contents, (10*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C)))
/obj/item/tank/internals/plasmaman/empty/populate_gas()
return
@@ -150,8 +143,7 @@
w_class = WEIGHT_CLASS_SMALL //thanks i forgot this
/obj/item/tank/internals/plasmaman/belt/full/populate_gas()
- air_contents.assert_gas(/datum/gas/plasma)
- air_contents.gases[/datum/gas/plasma][MOLES] = (10*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ SET_MOLES(air_contents, /datum/gas/plasma, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasmaman/belt/empty/populate_gas()
return
@@ -178,8 +170,7 @@
/obj/item/tank/internals/emergency_oxygen/populate_gas()
- air_contents.assert_gas(/datum/gas/oxygen)
- air_contents.gases[/datum/gas/oxygen][MOLES] = (10*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ SET_MOLES(air_contents, /datum/gas/oxygen, 0.5*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/emergency_oxygen/empty/populate_gas()
return
@@ -223,5 +214,5 @@
volume = 1
/obj/item/tank/internals/emergency_oxygen/clown/populate_gas()
- air_contents.gases[/datum/gas/oxygen][MOLES] = (9.99*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
- air_contents.gases[/datum/gas/nitrous_oxide][MOLES] = (0.01*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ SET_MOLES(/datum/gas/oxygen, air_contents, 9.99*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ SET_MOLES(/datum/gas/nitrous_oxide, air_contents, 0.01*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
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 176616c7d759d..9f6f299c017e9 100644
--- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
+++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
@@ -13,10 +13,8 @@
/obj/structure/transit_tube_pod/Initialize(mapload)
. = ..()
- air_contents.assert_gas(/datum/gas/oxygen)
- air_contents.gases[/datum/gas/oxygen][MOLES] = MOLES_O2STANDARD
- air_contents.assert_gas(/datum/gas/nitrogen)
- air_contents.gases[/datum/gas/nitrogen][MOLES] = MOLES_N2STANDARD
+ SET_MOLES(air_contents, /datum/gas/oxygen, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
+ SET_MOLES(air_contents, /datum/gas/nitrogen, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
air_contents.temperature = T20C
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index a97d1d5fa9199..ae2f653052bd9 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -284,10 +284,9 @@
. = ..()
if (air.gases[/datum/gas/carbon_dioxide] && air.gases[/datum/gas/oxygen])
pulse_strength = min(pulse_strength,air.gases[/datum/gas/carbon_dioxide][MOLES]*1000,air.gases[/datum/gas/oxygen][MOLES]*2000) //Ensures matter is conserved properly
- air.gases[/datum/gas/carbon_dioxide][MOLES] = max(air.gases[/datum/gas/carbon_dioxide][MOLES]-(pulse_strength/1000),0)
- air.gases[/datum/gas/oxygen][MOLES] = max(air.gases[/datum/gas/oxygen][MOLES]-(pulse_strength/2000),0)
- ASSERT_GAS(/datum/gas/pluoxium, air)
- air.gases[/datum/gas/pluoxium][MOLES] += pulse_strength/4000
+ REMOVE_MOLES(/datum/gas/carbon_dioxide, air, air.gases[/datum/gas/carbon_dioxide][MOLES]-(pulse_strength/1000))
+ REMOVE_MOLES(/datum/gas/oxygen, air, air.gases[/datum/gas/oxygen][MOLES]-(pulse_strength/2000))
+ ADD_MOLES(/datum/gas/pluoxium, air, pulse_strength/4000)
/turf/open/proc/break_tile(force, allow_base)
LAZYINITLIST(damage_overlays)
diff --git a/code/modules/admin/verbs/debug.dm b/code/modules/admin/verbs/debug.dm
index 2d1c691db4f5f..b42bf93316bb3 100644
--- a/code/modules/admin/verbs/debug.dm
+++ b/code/modules/admin/verbs/debug.dm
@@ -625,7 +625,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
if(!Rad.loaded_tank)
var/obj/item/tank/internals/plasma/Plasma = new/obj/item/tank/internals/plasma(Rad)
var/datum/gas_mixture/plasma_air = Plasma.return_air()
- plasma_air.gases[/datum/gas/plasma][MOLES] = 70
+ SET_MOLES(/datum/gas/plasma, plasma_air, 70)
Rad.drainratio = 0
Rad.loaded_tank = Plasma
@@ -957,7 +957,7 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
var/datum/gas_mixture/C_air = C.return_air()
- C_air.gases[gas_to_add][MOLES] = amount
+ SET_MOLES(gas_to_add, C_air, amount)
C_air.temperature = (temp)
C.update_icon()
diff --git a/code/modules/atmospherics/gasmixtures/breathing_classes.dm b/code/modules/atmospherics/gasmixtures/breathing_classes.dm
index a42d016d35326..57d557a89612c 100644
--- a/code/modules/atmospherics/gasmixtures/breathing_classes.dm
+++ b/code/modules/atmospherics/gasmixtures/breathing_classes.dm
@@ -17,7 +17,7 @@
/datum/breathing_class/proc/get_effective_pp(datum/gas_mixture/breath)
var/mol = 0
for(var/gas in gases)
- mol += breath.gases[gas][MOLES] * gases[gas]
+ mol += GET_MOLES(gas,breath) * gases[gas]
return (mol/breath.total_moles()) * breath.return_pressure()
/datum/breathing_class/oxygen
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index 52e540be3f4c7..a66c408f5b493 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -125,10 +125,8 @@
if(burned_fuel)
energy_released += (N2O_DECOMPOSITION_ENERGY_RELEASED * burned_fuel)
- ASSERT_GAS(/datum/gas/oxygen, air)
- cached_gases[/datum/gas/oxygen][MOLES] += burned_fuel * 0.5
- ASSERT_GAS(/datum/gas/nitrogen, air)
- cached_gases[/datum/gas/nitrogen][MOLES] += burned_fuel
+ ADD_MOLES(/datum/gas/oxygen, burned_fuel * 0.5)
+ ADD_MOLES(/datum/gas/nitrogen, burned_fuel)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
@@ -164,8 +162,7 @@
burned_fuel = cached_gases[/datum/gas/oxygen][MOLES] / TRITIUM_BURN_OXY_FACTOR
cached_gases[/datum/gas/tritium][MOLES] -= burned_fuel
- ASSERT_GAS(/datum/gas/water_vapor, air) //oxygen+more-or-less hydrogen=H2O
- cached_gases[/datum/gas/water_vapor][MOLES] += burned_fuel / TRITIUM_BURN_OXY_FACTOR
+ ADD_MOLES(/datum/gas/water_vapor, air, burned_fuel/TRITIUM_BURN_OXY_FACTOR)
energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel)
cached_results["fire"] += burned_fuel
@@ -176,8 +173,7 @@
cached_gases[/datum/gas/tritium][MOLES] -= burned_fuel / TRITIUM_BURN_TRIT_FACTOR
cached_gases[/datum/gas/oxygen][MOLES] -= burned_fuel
- ASSERT_GAS(/datum/gas/water_vapor, air) //oxygen+more-or-less hydrogen=H2O
- cached_gases[/datum/gas/water_vapor][MOLES] += burned_fuel / TRITIUM_BURN_TRIT_FACTOR
+ ADD_MOLES(/datum/gas/water_vapor, air, burned_fuel/TRITIUM_BURN_OXY_FACTOR)
energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel)
cached_results["fire"] += burned_fuel * 10
@@ -257,13 +253,10 @@
cached_gases[/datum/gas/plasma][MOLES] = QUANTIZE(cached_gases[/datum/gas/plasma][MOLES] - plasma_burn_rate)
cached_gases[/datum/gas/oxygen][MOLES] = QUANTIZE(cached_gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate))
if (super_saturation)
- ASSERT_GAS(/datum/gas/tritium, air)
- cached_gases[/datum/gas/tritium][MOLES] += plasma_burn_rate
+ ADD_MOLES(/datum/gas/tritium, air, plasma_burn_rate)
else
- ASSERT_GAS(/datum/gas/carbon_dioxide,air)
- ASSERT_GAS(/datum/gas/water_vapor,air)
- cached_gases[/datum/gas/carbon_dioxide][MOLES] += plasma_burn_rate * 0.75
- cached_gases[/datum/gas/water_vapor][MOLES] += plasma_burn_rate * 0.25
+ ADD_MOLES(/datum/gas/carbon_dioxide, air, plasma_burn_rate*0.75)
+ ADD_MOLES(/datum/gas/water_vapor, air, plasma_burn_rate*0.25)
energy_released += FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate)
@@ -311,10 +304,10 @@
var/list/cached_scan_results = air.analyzer_results
var/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.gases[/datum/gas/plasma][MOLES]
- var/initial_carbon = air.gases[/datum/gas/carbon_dioxide][MOLES]
- var/scale_factor = max(air.return_volume() / FUSION_SCALE_DIVISOR, FUSION_MINIMAL_SCALE)
- var/temperature_scale = log(10, air.return_temperature())
+ var/initial_plasma = GET_MOLES(/datum/gas/plasma, air)
+ var/initial_carbon = GET_MOLES(/datum/gas/carbon_dioxide, air)
+ var/scale_factor = max(air.volume / FUSION_SCALE_DIVISOR, FUSION_MINIMAL_SCALE)
+ var/temperature_scale = log(10, air.temperature)
//The size of the phase space hypertorus
var/toroidal_size = TOROID_CALCULATED_THRESHOLD \
+ (temperature_scale <= FUSION_BASE_TEMPSCALE ? \
@@ -322,7 +315,7 @@
: 4 ** (temperature_scale-FUSION_BASE_TEMPSCALE) / FUSION_SLOPE_DIVISOR)
var/gas_power = 0
for (var/gas_id in air.gases)
- gas_power += (GLOB.meta_gas_info[gas_id][META_GAS_FUSION_POWER]*air.gases[gas_id][MOLES])
+ gas_power += (GLOB.meta_gas_info[gas_id][META_GAS_FUSION_POWER]*GET_MOLES(gas_id, air))
var/instability = MODULUS((gas_power*INSTABILITY_GAS_POWER_FACTOR),toroidal_size) //Instability effects how chaotic the behavior of the reaction is
cached_scan_results[id] = instability//used for analyzer feedback
@@ -333,9 +326,9 @@
plasma = MODULUS(plasma - (instability*sin(TODEGREES(carbon))), toroidal_size)
carbon = MODULUS(carbon - plasma, toroidal_size)
- air.gases[/datum/gas/plasma][MOLES] = plasma*scale_factor + FUSION_MOLE_THRESHOLD
+ SET_MOLES(/datum/gas/plasma, air, plasma*scale_factor + FUSION_MOLE_THRESHOLD)
//Scales the gases back up
- air.gases[/datum/gas/carbon_dioxide][MOLES] = carbon*scale_factor + FUSION_MOLE_THRESHOLD
+ SET_MOLES(/datum/gas/carbon_dioxide, air, carbon*scale_factor + FUSION_MOLE_THRESHOLD)
var/delta_plasma = min(initial_plasma - air.gases[/datum/gas/plasma][MOLES], toroidal_size * scale_factor * 1.5)
@@ -357,19 +350,19 @@
thermal_energy = middle_energy * 10 ** log(FUSION_ENERGY_TRANSLATION_EXPONENT, (thermal_energy + bowdlerized_reaction_energy) / middle_energy)
//The reason why you should set up a tritium production line.
- air.gases[/datum/gas/tritium][MOLES] += -FUSION_TRITIUM_MOLES_USED
+ REMOVE_MOLES(/datum/gas/tritium, air, 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
var/standard_waste_gas_output = scale_factor * (FUSION_TRITIUM_CONVERSION_COEFFICIENT*FUSION_TRITIUM_MOLES_USED)
if(delta_plasma > 0)
- air.gases[/datum/gas/water_vapor][MOLES] += standard_waste_gas_output
+ ADD_MOLES(/datum/gas/water_vapor, air, standard_waste_gas_output)
else
- air.gases[/datum/gas/bz][MOLES] += standard_waste_gas_output
- air.gases[/datum/gas/oxygen][MOLES] += standard_waste_gas_output //Oxygen is a bit touchy subject
+ ADD_MOLES(/datum/gas/bz, air, standard_waste_gas_output)
+ ADD_MOLES(/datum/gas/oxygen, air, standard_waste_gas_output) //Oxygen is a bit touchy subject
if(reaction_energy)
if(location)
- var/standard_energy = 400 * air.gases[/datum/gas/plasma][MOLES] * air.return_temperature() //Prevents putting meaningless waste gases to achieve high rads.
+ var/standard_energy = 400 * GET_MOLES(/datum/gas/plasma, air) * air.temperature //Prevents putting meaningless waste gases to achieve high rads.
if(prob(PERCENT(((PARTICLE_CHANCE_CONSTANT)/(reaction_energy-PARTICLE_CHANCE_CONSTANT)) + 1))) //Asymptopically approaches 100% as the energy of the reaction goes up.
location.fire_nuclear_particle(customize = TRUE, custompower = standard_energy)
radiation_pulse(location, max(2000 * 3 ** (log(10,standard_energy) - FUSION_RAD_MIDPOINT), 0))
@@ -405,15 +398,13 @@
var/old_heat_capacity = air.heat_capacity()
var/heat_efficency = min(temperature / (FIRE_MINIMUM_TEMPERATURE_TO_EXIST * 8), cached_gases[/datum/gas/oxygen][MOLES], cached_gases[/datum/gas/nitrogen][MOLES], cached_gases[/datum/gas/bz][MOLES] * INVERSE(0.05))
var/energy_used = heat_efficency * NITRYL_FORMATION_ENERGY
- ASSERT_GAS(/datum/gas/nitryl, air)
if ((cached_gases[/datum/gas/oxygen][MOLES] - heat_efficency < 0 ) || (cached_gases[/datum/gas/nitrogen][MOLES] - heat_efficency < 0) || (cached_gases[/datum/gas/bz][MOLES] - heat_efficency * 0.05 < 0)) //Shouldn't produce gas from nothing.
return NO_REACTION
- ASSERT_GAS(/datum/gas/nitryl, air)
cached_gases[/datum/gas/oxygen][MOLES] -= heat_efficency
cached_gases[/datum/gas/nitrogen][MOLES] -= heat_efficency
cached_gases[/datum/gas/bz][MOLES] -= heat_efficency * 0.05 //bz gets consumed to balance the nitryl production and not make it too common and/or easy
- cached_gases[/datum/gas/nitryl][MOLES] += heat_efficency
+ ADD_MOLES(/datum/gas/nitryl, air, heat_efficiency)
if(energy_used > 0)
var/new_heat_capacity = air.heat_capacity()
@@ -442,12 +433,10 @@
if ((cached_gases[/datum/gas/nitrous_oxide][MOLES] - reaction_efficency < 0 )|| (cached_gases[/datum/gas/plasma][MOLES] - (2 * reaction_efficency) < 0) || energy_released <= 0) //Shouldn't produce gas from nothing.
return NO_REACTION
- ASSERT_GAS(/datum/gas/bz, air)
- cached_gases[/datum/gas/bz][MOLES] += reaction_efficency * 2.5
+ ADD_MOLES(/datum/gas/bz, air, reaction_efficency * 2.5)
if(reaction_efficency == cached_gases[/datum/gas/nitrous_oxide][MOLES])
- ASSERT_GAS(/datum/gas/oxygen, air)
cached_gases[/datum/gas/bz][MOLES] -= min(pressure, 0.5)
- cached_gases[/datum/gas/oxygen][MOLES] += min(pressure, 0.5)
+ ADD_MOLES(/datum/gas/oxygen, air, min(pressure, 0.5))
cached_gases[/datum/gas/nitrous_oxide][MOLES] -= reaction_efficency
cached_gases[/datum/gas/plasma][MOLES] -= 2 * reaction_efficency
@@ -475,12 +464,11 @@
var/old_heat_capacity = air.heat_capacity()
var/heat_scale = min(air.temperature/STIMULUM_HEAT_SCALE, cached_gases[/datum/gas/tritium][MOLES], cached_gases[/datum/gas/plasma][MOLES], cached_gases[/datum/gas/nitryl][MOLES])
var/stim_energy_change = heat_scale + STIMULUM_FIRST_RISE * (heat_scale ** 2) - STIMULUM_FIRST_DROP * (heat_scale ** 3) + STIMULUM_SECOND_RISE * (heat_scale ** 4) - STIMULUM_ABSOLUTE_DROP * (heat_scale ** 5)
- ASSERT_GAS(/datum/gas/stimulum, air)
if ((cached_gases[/datum/gas/tritium][MOLES] - heat_scale < 0 ) || (cached_gases[/datum/gas/nitryl][MOLES] - heat_scale < 0)) //Shouldn't produce gas from nothing.
return NO_REACTION
cached_gases[/datum/gas/tritium][MOLES] -= heat_scale
cached_gases[/datum/gas/nitryl][MOLES] -= heat_scale
- cached_gases[/datum/gas/stimulum][MOLES] += heat_scale * 0.75
+ ADD_GAS(/datum/gas/stimulum, air, heat_scale*0.75)
if(stim_energy_change)
var/new_heat_capacity = air.heat_capacity()
diff --git a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
index f703a90024ddd..f299954e149f0 100644
--- a/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
+++ b/code/modules/atmospherics/machinery/components/trinary_devices/filter.dm
@@ -103,8 +103,7 @@
var/datum/gas_mixture/filtered_out = new
filtered_out.temperature = removed.temperature
- filtered_out.add_gas(filter_type)
- filtered_out.gases[filter_type][MOLES] = removed.gases[filter_type][MOLES]
+ SET_MOLES(filter_type, filtered_out, removed.gases[filter_type][MOLES])
removed.gases[filter_type][MOLES] = 0
removed.garbage_collect()
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
index 0cd9a73d4a56a..4154d0214abfc 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/cryo.dm
@@ -236,7 +236,7 @@
var/datum/gas_mixture/air1 = airs[1]
- if(!nodes[1] || !airs[1] || air1.gases[/datum/gas/oxygen][MOLES] < 5) // Turn off if the machine won't work due to not having enough moles to operate.
+ if(!nodes[1] || !airs[1] || GET_MOLES(/datum/gas/oxygen, air1) < 5) // Turn off if the machine won't work due to not having enough moles to operate.
on = FALSE
update_icon()
var/msg = "Aborting. Not enough gas present to operate."
@@ -260,7 +260,7 @@
air1.temperature = max(air1.return_temperature() - heat / air_heat_capacity, TCMB)
mob_occupant.adjust_bodytemperature(heat / heat_capacity, TCMB)
- air1.gases[/datum/gas/oxygen][MOLES] = max(0,air1.gases[/datum/gas/oxygen][MOLES] - 0.5 / efficiency) // Magically consume gas? Why not, we run on cryo magic.
+ SET_MOLES(/datum/gas/oxygen, air1, max(0,GET_MOLES(/datum/gas/oxygen, air1) - 0.5 / efficiency)) // Magically consume gas? Why not, we run on cryo magic.
update_parents()
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
index 67d863384f7bd..f8b2b437992d0 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
@@ -20,7 +20,7 @@
air_contents.volume = volume
air_contents.temperature = (T20C)
if(gas_type)
- air_contents.gases[gas_type][MOLES] = AIR_CONTENTS
+ SET_MOLES(gas_type, air_contents, AIR_CONTENTS)
name = "[name] ([GLOB.meta_gas_info[gas_type][META_GAS_NAME]])"
set_piping_layer(piping_layer)
@@ -33,10 +33,8 @@
/obj/machinery/atmospherics/components/unary/tank/air/New()
..()
var/datum/gas_mixture/air_contents = airs[1]
- air_contents.assert_gas(/datum/gas/oxygen)
- air_contents.gases[/datum/gas/oxygen][MOLES] = AIR_CONTENTS * 0.2
- air_contents.assert_gas(/datum/gas/nitrogen)
- air_contents.gases[/datum/gas/nitrogen][MOLES] = AIR_CONTENTS * 0.8
+ SET_MOLES(air_contents, /datum/gas/oxygen, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
+ SET_MOLES(air_contents, /datum/gas/nitrogen, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide
diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm
index 669a412d3fee5..c1306149d6410 100644
--- a/code/modules/atmospherics/machinery/datum_pipeline.dm
+++ b/code/modules/atmospherics/machinery/datum_pipeline.dm
@@ -282,8 +282,7 @@
//gas transfer
for(var/giver_id in giver_gases)
var/giver_gas_data = giver_gases[giver_id]
- ASSERT_GAS(giver_id, total_gas_mixture)
- total_gases[giver_id][MOLES] += giver_gas_data[MOLES]
+ ADD_MOLES(total_gases, giver_id, giver_gas_data[MOLES])
total_heat_capacity += giver_gas_data[MOLES] * giver_gas_data[GAS_META][META_GAS_SPECIFIC_HEAT]
total_thermal_energy += THERMAL_ENERGY(gas_mixture)
diff --git a/code/modules/atmospherics/machinery/other/miner.dm b/code/modules/atmospherics/machinery/other/miner.dm
index b470238c7e7e7..ff97cb2c1a05e 100644
--- a/code/modules/atmospherics/machinery/other/miner.dm
+++ b/code/modules/atmospherics/machinery/other/miner.dm
@@ -134,7 +134,7 @@
if(!isopenturf(O))
return FALSE
var/datum/gas_mixture/merger = new
- merger.gases[spawn_id][MOLES] = spawn_mol * delta_time
+ SET_MOLES(spawn_id, merger, spawn_mol * delta_time)
merger.temperature = (spawn_temp)
O.assume_air(merger)
diff --git a/code/modules/atmospherics/machinery/portable/pump.dm b/code/modules/atmospherics/machinery/portable/pump.dm
index c8bb89f4baece..d4dd7d010f099 100644
--- a/code/modules/atmospherics/machinery/portable/pump.dm
+++ b/code/modules/atmospherics/machinery/portable/pump.dm
@@ -187,8 +187,8 @@
if(on)
SSair.start_processing_machine(src)
if(on && !holding)
- var/plasma = air_contents.gases[/datum/gas/plasma][MOLES]
- var/n2o = air_contents.gases[/datum/gas/nitrous_oxide][MOLES]
+ var/plasma = GET_MOLES(/datum/gas/plasma, air_contents)
+ var/n2o = GET_MOLES(/datum/gas/nitrous_oxide, air_contents)
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/mob/living/simple_animal/simple_animal.dm b/code/modules/mob/living/simple_animal/simple_animal.dm
index 78af6f8b578c2..61295833e0807 100644
--- a/code/modules/mob/living/simple_animal/simple_animal.dm
+++ b/code/modules/mob/living/simple_animal/simple_animal.dm
@@ -279,11 +279,10 @@
if(isturf(loc) && isopenturf(loc))
var/turf/open/ST = loc
if(ST.air)
- ST.air.assert_gases(/datum/gas/plasma,/datum/gas/nitrogen, /datum/gas/oxygen, /datum/gas/carbon_dioxide)
- var/tox = ST.air.gases[/datum/gas/plasma][MOLES]
- var/oxy = ST.air.gases[/datum/gas/oxygen]?[MOLES]
- var/n2 = ST.air.gases[/datum/gas/nitrogen]?[MOLES]
- var/co2 = ST.air.gases[/datum/gas/carbon_dioxide]?[MOLES]
+ var/tox = GET_MOLES(/datum/gas/plasma, ST.air)
+ var/oxy = GET_MOLES(/datum/gas/oxygen, ST.air)
+ var/n2 = GET_MOLES(/datum/gas/nitrogen, ST.air)
+ var/co2 = GET_MOLES(/datum/gas/carbon_dioxide, ST.air)
if(atmos_requirements["min_oxy"] && oxy < atmos_requirements["min_oxy"])
. = FALSE
diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index b15c46ce68954..100778067fe19 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -245,7 +245,7 @@
mole_adjustments[gas] = (gas in mole_adjustments) ? mole_adjustments[gas] - breath.gases[gas][MOLES] : -breath.gases[gas][MOLES]
for(var/gas in mole_adjustments)
- breath.gases[gas][MOLES] += mole_adjustments[gas]
+ ADD_MOLES(breath, gas, mole_adjustments[gas])
if(breath) // If there's some other shit in the air lets deal with it here.
diff --git a/code/modules/unit_tests/gas_transfer.dm b/code/modules/unit_tests/gas_transfer.dm
index 32f973d72444a..bf8159ac789dc 100644
--- a/code/modules/unit_tests/gas_transfer.dm
+++ b/code/modules/unit_tests/gas_transfer.dm
@@ -9,23 +9,22 @@
first_mix.volume = 200
second_mix.volume = 200
- ASSERT_GAS(/datum/gas/hypernoblium, first_mix)
- ASSERT_GAS(/datum/gas/tritium, second_mix)
- first_mix.gases[/datum/gas/hypernoblium][MOLES] = tempNmoles
- second_mix.gases[/datum/gas/tritium][MOLES] = 200
+ SET_MOLES(first_mix, /datum/gas/hypernoblium, tempNmoles)
+ SET_MOLES(second_mix, /datum/gas/tritium, 200)
+
first_mix.temperature = tempNmoles
second_mix.temperature = T20C
var/initial_pressure = second_mix.return_pressure()
// A constant value would be nicer but there will be cases when even MOLAR_ACCURACY amounts would far exceed the pressure so we need to scale it somewhat.
var/additional_pressure = (tempNmoles / 1000) + 500
-
+
/* ERROR MARGIN CALCULATION
* We calculate how much would the pressure change if MOLAR_ACCURACY amount of hothotgas is imparted on the cold mix.
* This number gets really big for very high temperatures so it's somewhat meaningless, but our main goal is to ensure the code doesn't break.
- */
+ */
var/error_margin = first_mix.gas_pressure_minimum_transfer(second_mix) - initial_pressure
-
+
first_mix.pump_gas_to(second_mix, (initial_pressure + additional_pressure))
var/margin = abs(second_mix.return_pressure() - (initial_pressure+additional_pressure))
diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm
index e21c0fbfba20f..5dfdeeb1fac8f 100644
--- a/code/modules/vehicles/mecha/_mecha.dm
+++ b/code/modules/vehicles/mecha/_mecha.dm
@@ -338,10 +338,8 @@
cabin_air = new
cabin_air.temperature = (T20C)
cabin_air.volume = 200
- cabin_air.assert_gas(/datum/gas/oxygen)
- cabin_air.gases[/datum/gas/oxygen][MOLES] = O2STANDARD*cabin_air.return_volume()/(R_IDEAL_GAS_EQUATION*cabin_air.return_temperature())
- cabin_air.assert_gas(/datum/gas/nitrogen)
- cabin_air.gases[/datum/gas/nitrogen][MOLES] = N2STANDARD*cabin_air.return_volume()/(R_IDEAL_GAS_EQUATION*cabin_air.return_temperature())
+ SET_MOLES(cabin_air, /datum/gas/oxygen, O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature))
+ SET_MOLES(cabin_air, /datum/gas/nitrogen, N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature))
return cabin_air
/obj/vehicle/sealed/mecha/proc/add_radio()
From a10ffb4b450c318ae9e5d884a123967b00da26da Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sat, 31 Aug 2024 22:57:48 +0200
Subject: [PATCH 079/114] Welcome back get_moles
This reverts commit 497928838e6060464bbe0f3caf705e7a58f616a3.
---
code/datums/atmosphere/_atmosphere.dm | 2 +-
.../atmospherics/gasmixtures/reactions.dm | 16 +++++------
.../atmospherics/machinery/airalarm.dm | 6 ++--
code/modules/events/spacevine.dm | 12 +++-----
code/modules/hydroponics/grown/towercap.dm | 2 +-
code/modules/mob/living/carbon/alien/life.dm | 6 ++--
.../carbon/human/species_types/oozelings.dm | 4 +--
.../carbon/human/species_types/plasmamen.dm | 2 +-
code/modules/mob/living/carbon/life.dm | 28 +++++++++----------
code/modules/mob/living/life.dm | 2 +-
.../mob/living/simple_animal/bot/atmosbot.dm | 8 +++---
.../mob/living/simple_animal/hostile/tree.dm | 2 +-
.../mob/living/simple_animal/slime/life.dm | 10 +++----
.../file_system/programs/atmosscan.dm | 4 +--
code/modules/power/singularity/collector.dm | 12 ++++----
code/modules/power/supermatter/supermatter.dm | 22 +++++++--------
.../xenobiology/crossbreeding/_structures.dm | 4 +--
.../loot/alien_artifact.dm | 2 +-
.../shuttle_components/plasma_refiner.dm | 2 +-
code/modules/surgery/organs/lungs.dm | 4 +--
.../traits/xenoartifact_majors.dm | 2 +-
21 files changed, 74 insertions(+), 78 deletions(-)
diff --git a/code/datums/atmosphere/_atmosphere.dm b/code/datums/atmosphere/_atmosphere.dm
index 00c9976d5dd59..330d665d77e57 100644
--- a/code/datums/atmosphere/_atmosphere.dm
+++ b/code/datums/atmosphere/_atmosphere.dm
@@ -38,7 +38,7 @@
else
gastype = pick(restricted_gases)
amount = restricted_gases[gastype]
- if(gasmix.gases[gastype][MOLES])
+ if(GET_MOLES(gastype, gasmix))
continue
amount *= rand(50, 200) / 100 // Randomly modifes the amount from half to double the base for some variety
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index a66c408f5b493..2e47b90475674 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -530,16 +530,16 @@
location = get_turf(pick(pipenet.members))
else
location = get_turf(holder)
- var/ball_shot_angle = 180*cos(air.gases[/datum/gas/water_vapor][MOLES]/air.gases[/datum/gas/nitryl][MOLES])+180
- var/stim_used = min(STIM_BALL_GAS_AMOUNT/air.gases[/datum/gas/plasma][MOLES],air.gases[/datum/gas/stimulum][MOLES])
- var/pluox_used = min(STIM_BALL_GAS_AMOUNT/air.gases[/datum/gas/plasma][MOLES],air.gases[/datum/gas/pluoxium][MOLES])
+ var/ball_shot_angle = 180*cos(GET_MOLES(/datum/gas/water_vapor, air)/GET_MOLES(/datum/gas/nitryl, air))+180
+ var/stim_used = min(STIM_BALL_GAS_AMOUNT/GET_MOLES(/datum/gas/plasma, air),GET_MOLES(/datum/gas/stimulum, air))
+ var/pluox_used = min(STIM_BALL_GAS_AMOUNT/GET_MOLES(/datum/gas/plasma, air),GET_MOLES(/datum/gas/pluoxium, air))
var/energy_released = stim_used*STIMULUM_HEAT_SCALE//Stimulum has a lot of stored energy, and breaking it up releases some of it
location.fire_nuclear_particle(ball_shot_angle)
- air.gases[/datum/gas/carbon_dioxide][MOLES] += 4*pluox_used
- air.gases[/datum/gas/nitrogen][MOLES] += 8*stim_used
- air.gases[/datum/gas/pluoxium][MOLES] += -pluox_used
- air.gases[/datum/gas/stimulum][MOLES] += -stim_used
- air.gases[/datum/gas/plasma][MOLES] += max(-air.gases[/datum/gas/plasma][MOLES]/2,-30)
+ ADD_MOLES(/datum/gas/carbon_dioxide, air, 4*pluox_used)
+ ADD_MOLES(/datum/gas/nitrogen, air, 8*stim_used)
+ REMOVE_MOLES(/datum/gas/pluoxium, air, pluox_used)
+ REMOVE_MOLES(/datum/gas/stimulum, air, stim_used)
+ REMOVE_MOLES(/datum/gas/plasma], air, min(GET_MOLES(/datum/gas/plasma, air)/2,30))
if(energy_released)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
diff --git a/code/modules/atmospherics/machinery/airalarm.dm b/code/modules/atmospherics/machinery/airalarm.dm
index 9ceaa3bea54f7..18122683094d8 100644
--- a/code/modules/atmospherics/machinery/airalarm.dm
+++ b/code/modules/atmospherics/machinery/airalarm.dm
@@ -281,7 +281,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 24)
"name" = GLOB.meta_gas_info[gas_id][META_GAS_NAME],
"value" = environment.gases[gas_id][MOLES] / total_moles * 100,
"unit" = "%",
- "danger_level" = cur_tlv.get_danger_level(environment.gases[gas_id][MOLES] * partial_pressure)
+ "danger_level" = cur_tlv.get_danger_level(GET_MOLES(gas_id, environment) * partial_pressure)
))
if(!locked || user.has_unlimited_silicon_privilege)
@@ -681,7 +681,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 24)
if(!(gas_id in TLV)) // We're not interested in this gas, it seems.
continue
cur_tlv = TLV[gas_id]
- gas_dangerlevel = max(gas_dangerlevel, cur_tlv.get_danger_level(environment.gases[gas_id][MOLES] * partial_pressure))
+ gas_dangerlevel = max(gas_dangerlevel, cur_tlv.get_danger_level(GET_MOLES(gas_id, environment) * partial_pressure))
var/old_danger_level = danger_level
danger_level = max(pressure_dangerlevel, temperature_dangerlevel, gas_dangerlevel)
@@ -936,7 +936,7 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/airalarm, 24)
pressure.set_output(round(environment.return_pressure()))
temperature.set_output(round(environment.return_temperature()))
if(ispath(options_map[current_option]))
- gas_amount.set_output(round(environment.gases[current_option][MOLES]))
+ gas_amount.set_output(round(GET_MOLES(current_option, environment)))
return
var/datum/tlv/settings = connected_alarm.TLV[options_map[current_option]]
diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm
index 29689c49e7335..b5114abf42844 100644
--- a/code/modules/events/spacevine.dm
+++ b/code/modules/events/spacevine.dm
@@ -217,8 +217,7 @@
var/turf/open/floor/T = holder.loc
if(istype(T))
var/datum/gas_mixture/GM = T.air
- GM.gases[/datum/gas/oxygen][MOLES] = max(GM.gases[/datum/gas/oxygen][MOLES] - severity * holder.energy, 0
-)
+ GM.set_moles(/datum/gas/oxygen, max(GET_MOLES(/datum/gas/oxygen, GM) - severity * holder.energy, 0))
/datum/spacevine_mutation/nitro_eater
name = "nitrogen consuming"
@@ -230,8 +229,7 @@
var/turf/open/floor/T = holder.loc
if(istype(T))
var/datum/gas_mixture/GM = T.air
- GM.gases[/datum/gas/nitrogen][MOLES] = max(GM.gases[/datum/gas/nitrogen][MOLES] - severity * holder.energy, 0
-)
+ GM.set_moles(/datum/gas/nitrogen, max(GET_MOLES(/datum/gas/nitrogen, GM) - severity * holder.energy, 0))
/datum/spacevine_mutation/carbondioxide_eater
name = "CO2 consuming"
@@ -243,8 +241,7 @@
var/turf/open/floor/T = holder.loc
if(istype(T))
var/datum/gas_mixture/GM = T.air
- GM.gases[/datum/gas/carbon_dioxide][MOLES] = max(GM.gases[/datum/gas/carbon_dioxide][MOLES] - severity * holder.energy, 0
-)
+ GM.set_moles(/datum/gas/carbon_dioxide, max(GET_MOLES(/datum/gas/carbon_dioxide, GM) - severity * holder.energy, 0))
/datum/spacevine_mutation/plasma_eater
name = "toxins consuming"
@@ -256,8 +253,7 @@
var/turf/open/floor/T = holder.loc
if(istype(T))
var/datum/gas_mixture/GM = T.air
- GM.gases[/datum/gas/plasma][MOLES] = max(GM.gases[/datum/gas/plasma][MOLES] - severity * holder.energy, 0
-)
+ GM.set_moles(/datum/gas/plasma, max(GET_MOLES(/datum/gas/plasma, GM) - severity * holder.energy, 0))
/datum/spacevine_mutation/thorns
name = "thorny"
diff --git a/code/modules/hydroponics/grown/towercap.dm b/code/modules/hydroponics/grown/towercap.dm
index e04a1772acb08..51b55084f9421 100644
--- a/code/modules/hydroponics/grown/towercap.dm
+++ b/code/modules/hydroponics/grown/towercap.dm
@@ -246,7 +246,7 @@
if(isopenturf(loc))
var/turf/open/O = loc
if(O.air)
- if(O.air.gases[/datum/gas/oxygen][MOLES] > 13)
+ if(O.GET_MOLES(/datum/gas/oxygen, air) > 13)
return TRUE
return FALSE
diff --git a/code/modules/mob/living/carbon/alien/life.dm b/code/modules/mob/living/carbon/alien/life.dm
index 9c99be1edd409..29465cdfc405a 100644
--- a/code/modules/mob/living/carbon/alien/life.dm
+++ b/code/modules/mob/living/carbon/alien/life.dm
@@ -15,13 +15,13 @@
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.gases[/datum/gas/plasma][MOLES]/breath.total_moles())*breath_pressure
+ var/toxins_pp = (GET_MOLES(/datum/gas/plasma, breath)/breath.total_moles())*breath_pressure
if(toxins_pp > tox_detect_threshold) // Detect toxins in air
- adjustPlasma(breath.gases[/datum/gas/plasma][MOLES]*250)
+ adjustPlasma(GET_MOLES(/datum/gas/plasma, breath)*250)
throw_alert("alien_tox", /atom/movable/screen/alert/alien_tox)
- toxins_used = breath.gases[/datum/gas/plasma][MOLES]
+ toxins_used = GET_MOLES(/datum/gas/plasma, breath)
else
clear_alert("alien_tox")
diff --git a/code/modules/mob/living/carbon/human/species_types/oozelings.dm b/code/modules/mob/living/carbon/human/species_types/oozelings.dm
index 267355dfa1c90..7af8e26a67f8f 100644
--- a/code/modules/mob/living/carbon/human/species_types/oozelings.dm
+++ b/code/modules/mob/living/carbon/human/species_types/oozelings.dm
@@ -88,11 +88,11 @@
if(!atmos_sealed)
var/datum/gas_mixture/environment = H.loc.return_air()
if(environment?.total_moles())
- if(environment.gases[/datum/gas/water_vapor][MOLES] >= 1)
+ if(GET_MOLES(/datum/gas/water_vapor, environment) >= 1)
H.blood_volume -= 15
if(prob(50))
to_chat(H, "Your ooze melts away rapidly in the water vapor!")
- if(H.blood_volume <= 672 && environment.gases[/datum/gas/plasma][MOLES] >= 1)
+ if(H.blood_volume <= 672 && GET_MOLES(/datum/gas/plasma, environment) >= 1)
H.blood_volume += 15
if(H.blood_volume < BLOOD_VOLUME_OKAY && prob(5))
to_chat(H, "You feel drained!")
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 f2ebbb4d9511d..240c98f239200 100644
--- a/code/modules/mob/living/carbon/human/species_types/plasmamen.dm
+++ b/code/modules/mob/living/carbon/human/species_types/plasmamen.dm
@@ -54,7 +54,7 @@
var/datum/gas_mixture/environment = H.loc.return_air()
if(environment)
if(environment.total_moles())
- if(environment.gases[/datum/gas/oxygen][MOLES] >= 1) //Same threshold that extinguishes fire
+ if(GET_MOLES(/datum/gas/oxygen, environment) >= 1) //Same threshold that extinguishes fire
H.adjust_fire_stacks(0.5)
if(!H.on_fire && H.fire_stacks > 0)
H.visible_message("[H]'s body reacts with the atmosphere and bursts into flames!","Your body reacts with the atmosphere and bursts into flame!")
diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm
index 01153394d1e8a..51798f72fa609 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -183,9 +183,9 @@
var/oxygen_used = 0
var/moles = breath.total_moles()
var/breath_pressure = (moles*R_IDEAL_GAS_EQUATION*breath.return_temperature())/BREATH_VOLUME
- var/O2_partialpressure = ((breath.gases[/datum/gas/oxygen][MOLES]/moles)*breath_pressure) + (((breath.gases[/datum/gas/pluoxium][MOLES]*8)/moles)*breath_pressure)
- var/Toxins_partialpressure = (breath.gases[/datum/gas/plasma][MOLES]/moles)*breath_pressure
- var/CO2_partialpressure = (breath.gases[/datum/gas/carbon_dioxide][MOLES]/moles)*breath_pressure
+ var/O2_partialpressure = ((GET_MOLES(/datum/gas/oxygen, breath)/moles)*breath_pressure) + (((GET_MOLES(GAS_PLUOXIUM, breath)*8)/moles)*breath_pressure)
+ var/Toxins_partialpressure = (GET_MOLES(/datum/gas/plasma, breath)/moles)*breath_pressure
+ var/CO2_partialpressure = (GET_MOLES(/datum/gas/carbon_dioxide, breath)/moles)*breath_pressure
//OXYGEN
@@ -196,7 +196,7 @@
var/ratio = 1 - O2_partialpressure/safe_oxy_min
adjustOxyLoss(min(5*ratio, 3))
failed_last_breath = 1
- oxygen_used = breath.gases[/datum/gas/oxygen][MOLES]*ratio
+ oxygen_used = GET_MOLES(/datum/gas/oxygen, breath)*ratio
else
adjustOxyLoss(3)
failed_last_breath = 1
@@ -206,7 +206,7 @@
failed_last_breath = 0
if(health >= crit_threshold)
adjustOxyLoss(-5)
- oxygen_used = breath.gases[/datum/gas/oxygen][MOLES]
+ oxygen_used = GET_MOLES(/datum/gas/oxygen, breath)
clear_alert("not_enough_oxy")
breath.gases[/datum/gas/oxygen][MOLES] += -oxygen_used
@@ -229,15 +229,15 @@
//TOXINS/PLASMA
if(Toxins_partialpressure > safe_tox_max)
- var/ratio = (breath.gases[/datum/gas/plasma][MOLES]/safe_tox_max) * 10
+ var/ratio = (GET_MOLES(/datum/gas/plasma, breath)/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.gases[/datum/gas/nitrous_oxide][MOLES])
- var/SA_partialpressure = (breath.gases[/datum/gas/nitrous_oxide][MOLES]/breath.total_moles())*breath_pressure
+ if(GET_MOLES(/datum/gas/nitrous_oxide, breath))
+ var/SA_partialpressure = (GET_MOLES(/datum/gas/nitrous_oxide, breath)/breath.total_moles())*breath_pressure
if(SA_partialpressure > SA_para_min)
Unconscious(60)
if(SA_partialpressure > SA_sleep_min)
@@ -250,21 +250,21 @@
SEND_SIGNAL(src, COMSIG_CLEAR_MOOD_EVENT, "chemical_euphoria")
//BZ (Facepunch port of their Agent B)
- if(breath.gases[/datum/gas/bz][MOLES])
- var/bz_partialpressure = (breath.gases[/datum/gas/bz][MOLES]/breath.total_moles())*breath_pressure
+ if(GET_MOLES(/datum/gas/bz, breath))
+ var/bz_partialpressure = (GET_MOLES(/datum/gas/bz, breath)/breath.total_moles())*breath_pressure
if(bz_partialpressure > 1)
hallucination += 10
else if(bz_partialpressure > 0.01)
hallucination += 5
//TRITIUM
- if(breath.gases[/datum/gas/tritium][MOLES])
- var/tritium_partialpressure = (breath.gases[/datum/gas/tritium][MOLES]/breath.total_moles())*breath_pressure
+ if(GET_MOLES(/datum/gas/tritium, breath))
+ var/tritium_partialpressure = (GET_MOLES(/datum/gas/tritium, breath)/breath.total_moles())*breath_pressure
radiation += tritium_partialpressure/10
//NITRYL
- if(breath.gases[/datum/gas/nitryl][MOLES])
- var/nitryl_partialpressure = (breath.gases[/datum/gas/nitryl][MOLES]/breath.total_moles())*breath_pressure
+ if(GET_MOLES(/datum/gas/nitryl, breath))
+ var/nitryl_partialpressure = (GET_MOLES(/datum/gas/nitryl, breath)/breath.total_moles())*breath_pressure
adjustFireLoss(nitryl_partialpressure/4)
//BREATH TEMPERATURE
diff --git a/code/modules/mob/living/life.dm b/code/modules/mob/living/life.dm
index 8830f788925ec..d21f0ad94481e 100644
--- a/code/modules/mob/living/life.dm
+++ b/code/modules/mob/living/life.dm
@@ -93,7 +93,7 @@
ExtinguishMob()
return TRUE //mob was put out, on_fire = FALSE via ExtinguishMob(), no need to update everything down the chain.
var/datum/gas_mixture/G = loc.return_air() // Check if we're standing in an oxygenless environment
- if(G.gases[/datum/gas/oxygen][MOLES] < 1)
+ if(GET_MOLES(/datum/gas/oxygen, G) < 1)
ExtinguishMob() //If there's no oxygen in the tile we're on, put out the fire
return TRUE
var/turf/location = get_turf(src)
diff --git a/code/modules/mob/living/simple_animal/bot/atmosbot.dm b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
index db4dfbad014f3..a1c7d64752c4c 100644
--- a/code/modules/mob/living/simple_animal/bot/atmosbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
@@ -229,8 +229,8 @@
var/datum/gas_mixture/environment = T.return_air()
for(var/G in gasses)
if(gasses[G])
- var/moles_in_atmos = environment.gases[G][MOLES]
- environment.gases[G][MOLES] += -min(moles_in_atmos, ATMOSBOT_MAX_SCRUB_CHANGE)
+ var/moles_in_atmos = GET_MOLES(G, environment)
+ environment.adjust_moles(G, -min(moles_in_atmos, ATMOSBOT_MAX_SCRUB_CHANGE))
/mob/living/simple_animal/bot/atmosbot/proc/deploy_holobarrier()
if(deployed_holobarrier)
@@ -247,11 +247,11 @@
//Toxins in the air
if(emagged != 2)
for(var/G in gasses)
- if(gasses[G] && gas_mix.gases[G][MOLES] > 0.2)
+ if(gasses[G] && GET_MOLES(G, gas_mix) > 0.2)
return ATMOSBOT_HIGH_TOXINS
//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.gases[/datum/gas/oxygen][MOLES] * partial_pressure
+ var/oxygen_moles = GET_MOLES(/datum/gas/oxygen, gas_mix) * partial_pressure
if(oxygen_moles < 20 || gas_mix.return_pressure() < WARNING_LOW_PRESSURE)
return ATMOSBOT_LOW_OXYGEN
//Check temperature
diff --git a/code/modules/mob/living/simple_animal/hostile/tree.dm b/code/modules/mob/living/simple_animal/hostile/tree.dm
index d73250d29d525..6c8d517a94d12 100644
--- a/code/modules/mob/living/simple_animal/hostile/tree.dm
+++ b/code/modules/mob/living/simple_animal/hostile/tree.dm
@@ -49,7 +49,7 @@
if(isopenturf(loc))
var/turf/open/T = src.loc
if(T.air)
- var/co2 = T.air.gases[/datum/gas/carbon_dioxide][MOLES]
+ var/co2 = T.GET_MOLES(/datum/gas/carbon_dioxide, air)
if(co2 > 0)
if(prob(25))
var/amt = min(co2, 9)
diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm
index 08d85c5b9a7fd..2209b06f17e17 100644
--- a/code/modules/mob/living/simple_animal/slime/life.dm
+++ b/code/modules/mob/living/simple_animal/slime/life.dm
@@ -94,14 +94,14 @@
else
adjustBruteLoss(round(sqrt(bodytemperature)) * 2)
- if(stat != DEAD && environment.gases[/datum/gas/bz])
- var/bz_percentage = environment.total_moles() ? (environment.gases[/datum/gas/bz][MOLES] / environment.total_moles()) : 0
+ if(stat != DEAD)
+ var/bz_percentage = environment.total_moles() ? (GET_MOLES(/datum/gas/bz, environment) / environment.total_moles()) : 0
var/stasis = (bz_percentage >= 0.05 && bodytemperature < (T0C + 100)) || force_stasis
if(transformeffects & SLIME_EFFECT_DARK_PURPLE)
var/amt = is_adult ? 30 : 15
- var/plas_amt = min(amt,environment.gases[/datum/gas/plasma][MOLES])
- environment.gases[/datum/gas/plasma][MOLES] += -plas_amt
- environment.gases[/datum/gas/oxygen][MOLES] += plas_amt
+ var/plas_amt = min(amt,GET_MOLES(/datum/gas/plasma, environment))
+ environment.adjust_moles(/datum/gas/plasma, -plas_amt)
+ environment.adjust_moles(/datum/gas/oxygen, plas_amt)
adjustBruteLoss(plas_amt ? -2 : 0)
switch(stat)
diff --git a/code/modules/modular_computers/file_system/programs/atmosscan.dm b/code/modules/modular_computers/file_system/programs/atmosscan.dm
index 99c55919cbf73..bf7e1e29ced89 100644
--- a/code/modules/modular_computers/file_system/programs/atmosscan.dm
+++ b/code/modules/modular_computers/file_system/programs/atmosscan.dm
@@ -30,8 +30,8 @@
data["AirTempC"] = round(environment.return_temperature() - T0C)
data["AirTempK"] = round(environment.return_temperature())
if (total_moles)
- for(var/id in environment.gases)
- var/gas_level = environment.gases[id][MOLES]/total_moles
+ for(var/id in environment.get_gases())
+ var/gas_level = GET_MOLES(id, environment)/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)))
data["AirData"] = airlist
diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm
index 031009d60dd43..4fe88c07dc723 100644
--- a/code/modules/power/singularity/collector.dm
+++ b/code/modules/power/singularity/collector.dm
@@ -51,21 +51,21 @@
return
var/datum/gas_mixture/loaded_tank_air = loaded_tank.return_air()
if(!bitcoinmining)
- if(loaded_tank_air.gases[/datum/gas/plasma][MOLES] < 0.0001)
+ if(loaded_tank.GET_MOLES(/datum/gas/plasma, air_contents) < 0.0001)
investigate_log("out of fuel.", INVESTIGATE_ENGINES)
playsound(src, 'sound/machines/ding.ogg', 50, 1)
var/msg = "Plasma depleted, recommend replacing tank."
radio.talk_into(src, msg, RADIO_CHANNEL_ENGINEERING)
eject()
else
- var/gasdrained = min(powerproduction_drain*drainratio*delta_time,loaded_tank_air.gases[/datum/gas/plasma][MOLES])
- loaded_tank_air.gases[/datum/gas/plasma][MOLES] += -gasdrained
- loaded_tank_air.gases[/datum/gas/tritium][MOLES] += gasdrained
+ var/gasdrained = min(powerproduction_drain*drainratio*delta_time,loaded_tank.GET_MOLES(/datum/gas/plasma, air_contents))
+ loaded_tank.air_contents.adjust_moles(/datum/gas/plasma, -gasdrained)
+ loaded_tank.air_contents.adjust_moles(/datum/gas/tritium, gasdrained)
var/power_produced = RAD_COLLECTOR_OUTPUT
add_avail(power_produced)
stored_energy-=power_produced
else if(is_station_level(z) && SSresearch.science_tech)
- if(!loaded_tank_air.gases[/datum/gas/tritium][MOLES] || !loaded_tank_air.gases[/datum/gas/oxygen][MOLES])
+ if(!loaded_tank.GET_MOLES(/datum/gas/tritium, air_contents) || !loaded_tank.GET_MOLES(/datum/gas/oxygen, air_contents))
playsound(src, 'sound/machines/ding.ogg', 50, 1)
eject()
else
@@ -87,7 +87,7 @@
toggle_power()
user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \
"You turn the [src.name] [active? "on":"off"].")
- var/fuel = loaded_tank.air_contents.gases[/datum/gas/plasma][MOLES]
+ var/fuel = loaded_tank?.GET_MOLES(/datum/gas/plasma, air_contents)
investigate_log("turned [active?"on":"off"] by [key_name(user)]. [loaded_tank?"Fuel: [round(fuel/0.29)]%":"It is empty"].", INVESTIGATE_ENGINES)
return
else
diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm
index ffc3b7f61a327..96d1215b3e41f 100644
--- a/code/modules/power/supermatter/supermatter.dm
+++ b/code/modules/power/supermatter/supermatter.dm
@@ -224,8 +224,8 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
data["SM_moles"] = air.total_moles()
for(var/gasid in air.gases)
gasdata.Add(list(list(
- "name"= air.gases[gasid][GAS_META][META_GAS_NAME],
- "amount" = round(100*air.gases[gasid][MOLES]/air.total_moles(),0.01))))
+ "name"= GLOB.gas_data.names[gasid],
+ "amount" = round(100*GET_MOLES(gasid, air)/air.total_moles(),0.01))))
else
for(var/gasid in air.gases)
gasdata.Add(list(list(
@@ -457,15 +457,15 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
//Can cause an overestimation of mol count, should stabalize things though.
//Prevents huge bursts of gas/heat when a large amount of something is introduced
//They range between 0 and 1
- plasmacomp += clamp(max(removed.gases[/datum/gas/plasma][MOLES]/combined_gas, 0) - plasmacomp, -1, gas_change_rate)
- o2comp += clamp(max(removed.gases[/datum/gas/oxygen][MOLES]/combined_gas, 0) - o2comp, -1, gas_change_rate)
- co2comp += clamp(max(removed.gases[/datum/gas/carbon_dioxide][MOLES]/combined_gas, 0) - co2comp, -1, gas_change_rate)
- pluoxiumcomp += clamp(max(removed.gases[/datum/gas/pluoxium][MOLES]/combined_gas, 0) - pluoxiumcomp, -1, gas_change_rate)
- tritiumcomp += clamp(max(removed.gases[/datum/gas/tritium][MOLES]/combined_gas, 0) - tritiumcomp, -1, gas_change_rate)
- bzcomp += clamp(max(removed.gases[/datum/gas/bz][MOLES]/combined_gas, 0) - bzcomp, -1, gas_change_rate)
-
- n2ocomp += clamp(max(removed.gases[/datum/gas/nitrous_oxide][MOLES]/combined_gas, 0) - n2ocomp, -1, gas_change_rate)
- n2comp += clamp(max(removed.gases[/datum/gas/nitrogen][MOLES]/combined_gas, 0) - n2comp, -1, gas_change_rate)
+ plasmacomp += clamp(max(GET_MOLES(/datum/gas/plasma, removed)/combined_gas, 0) - plasmacomp, -1, gas_change_rate)
+ o2comp += clamp(max(GET_MOLES(/datum/gas/oxygen, removed)/combined_gas, 0) - o2comp, -1, gas_change_rate)
+ co2comp += clamp(max(GET_MOLES(/datum/gas/carbon_dioxide, removed)/combined_gas, 0) - co2comp, -1, gas_change_rate)
+ pluoxiumcomp += clamp(max(GET_MOLES(GAS_PLUOXIUM, removed)/combined_gas, 0) - pluoxiumcomp, -1, gas_change_rate)
+ tritiumcomp += clamp(max(GET_MOLES(/datum/gas/tritium, removed)/combined_gas, 0) - tritiumcomp, -1, gas_change_rate)
+ bzcomp += clamp(max(GET_MOLES(/datum/gas/bz, removed)/combined_gas, 0) - bzcomp, -1, gas_change_rate)
+
+ n2ocomp += clamp(max(GET_MOLES(/datum/gas/nitrous_oxide, removed)/combined_gas, 0) - n2ocomp, -1, gas_change_rate)
+ n2comp += clamp(max(GET_MOLES(/datum/gas/nitrogen, removed)/combined_gas, 0) - n2comp, -1, gas_change_rate)
gasmix_power_ratio = min(max(plasmacomp + o2comp + co2comp + tritiumcomp + bzcomp - pluoxiumcomp - n2comp, 0), 1)
diff --git a/code/modules/research/xenobiology/crossbreeding/_structures.dm b/code/modules/research/xenobiology/crossbreeding/_structures.dm
index ba8488c46b179..95ccf3d9b58ab 100644
--- a/code/modules/research/xenobiology/crossbreeding/_structures.dm
+++ b/code/modules/research/xenobiology/crossbreeding/_structures.dm
@@ -236,8 +236,8 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals)
var/turf/open/open_turf = T
var/datum/gas_mixture/air = open_turf.return_air()
- if(air.gases[/datum/gas/plasma][MOLES] > 15)
- air.gases[/datum/gas/plasma][MOLES] += -15
+ if(GET_MOLES(/datum/gas/plasma, air) > 15)
+ air.adjust_moles(/datum/gas/plasma, -15)
new /obj/item/stack/sheet/mineral/plasma(open_turf)
/obj/structure/slime_crystal/darkpurple/Destroy()
diff --git a/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm b/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm
index 78f5491e79e37..8783006d11b6b 100644
--- a/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm
+++ b/code/modules/shuttle/super_cruise/orbital_poi_generator/loot/alien_artifact.dm
@@ -416,7 +416,7 @@ GLOBAL_LIST_EMPTY(destabliization_exits)
var/datum/gas_mixture/air = T.return_air()
var/input_id = initial(input.id)
var/output_id = initial(output.id)
- var/moles = min(air.gases[input_id][MOLES], 5)
+ var/moles = min(GET_MOLES(input_id, air), 5)
if(moles)
air.gases[input_id][MOLES] += -moles
air.gases[output_id][MOLES] += moles
diff --git a/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm b/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm
index b9114ac85d4b6..2f82e12346140 100644
--- a/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm
+++ b/code/modules/shuttle/super_cruise/shuttle_components/plasma_refiner.dm
@@ -35,7 +35,7 @@
/obj/machinery/atmospherics/components/unary/plasma_refiner/AltClick(mob/living/user)
var/datum/gas_mixture/air_contents = airs[1]
- var/plasmoles = air_contents.gases[/datum/gas/plasma][MOLES]
+ var/plasmoles = GET_MOLES(/datum/gas/plasma, air_contents)
if(!air_contents)
return
if(plasmoles >= 100)
diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index 100778067fe19..3c8f6b6a7e106 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -156,7 +156,7 @@
#define PP_MOLES(X) ((X / total_moles) * pressure)
- #define PP(air, gas) PP_MOLES(air.gases[gas][MOLES])
+ #define PP(air, gas) PP_MOLES(GET_MOLES(gas, air))
var/gas_breathed = 0
@@ -189,7 +189,7 @@
for(var/product in products)
mole_adjustments[product] = (product in mole_adjustments) ? mole_adjustments[product] + to_add : to_add
else
- required_moles = breath.gases[entry][MOLES]
+ required_moles = GET_MOLES(entry, breath)
required_pp = PP_MOLES(required_moles)
var/list/alert = GLOB.meta_gas_info[entry][META_GAS_BREATH_ALERT_INFO]?["not_enough_alert"]
if(alert)
diff --git a/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm b/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm
index 2911ca4813d31..b71dba7108501 100644
--- a/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm
+++ b/code/modules/xenoarchaeology/traits/xenoartifact_majors.dm
@@ -448,7 +448,7 @@
var/datum/gas_mixture/air = T.return_air()
var/input_id = initial(input.id)
var/output_id = initial(output.id)
- var/moles = min(air.gases[input_id][MOLES], 5)
+ var/moles = min(GET_MOLES(input_id, air), 5)
if(moles)
air.gases[input_id][MOLES] += -moles
air.gases[output_id][MOLES] += moles
From 1754d73d1187682fec2fb9770aa5130f1fff72be Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sat, 31 Aug 2024 23:40:55 +0200
Subject: [PATCH 080/114] Shitcode 2
---
code/__DEFINES/atmospherics/atmos_helpers.dm | 16 ++++--
code/__HELPERS/turfs.dm | 2 +-
code/controllers/subsystem/air.dm | 3 +-
code/datums/atmosphere/_atmosphere.dm | 8 +--
.../effects/effect_system/effects_foam.dm | 2 +-
.../effects/effect_system/effects_smoke.dm | 2 +-
.../objects/effects/spawners/bombspawner.dm | 4 +-
code/game/objects/items/chrono_eraser.dm | 4 +-
code/game/objects/items/devices/scanners.dm | 2 +-
code/game/objects/items/tanks/jetpack.dm | 6 +--
code/game/objects/items/tanks/tank_types.dm | 18 +++----
.../transit_tubes/transit_tube_pod.dm | 4 +-
code/game/turfs/open/_open.dm | 6 +--
.../atmospherics/gasmixtures/reactions.dm | 52 +++++++++----------
.../components/unary_devices/tank.dm | 4 +-
.../atmospherics/machinery/datum_pipeline.dm | 2 +-
code/modules/events/spacevine.dm | 8 +--
code/modules/hydroponics/grown/towercap.dm | 2 +-
code/modules/mob/living/carbon/life.dm | 2 +-
.../mob/living/simple_animal/bot/atmosbot.dm | 2 +-
.../mob/living/simple_animal/hostile/tree.dm | 2 +-
.../mob/living/simple_animal/slime/life.dm | 4 +-
.../file_system/programs/atmosscan.dm | 2 +-
code/modules/power/singularity/collector.dm | 14 ++---
code/modules/power/supermatter/supermatter.dm | 4 +-
.../xenobiology/crossbreeding/_structures.dm | 2 +-
code/modules/surgery/organs/lungs.dm | 2 +-
code/modules/unit_tests/gas_transfer.dm | 4 +-
code/modules/vehicles/mecha/_mecha.dm | 4 +-
29 files changed, 97 insertions(+), 90 deletions(-)
diff --git a/code/__DEFINES/atmospherics/atmos_helpers.dm b/code/__DEFINES/atmospherics/atmos_helpers.dm
index 0fb823a192e30..79775134aca37 100644
--- a/code/__DEFINES/atmospherics/atmos_helpers.dm
+++ b/code/__DEFINES/atmospherics/atmos_helpers.dm
@@ -80,11 +80,17 @@ GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
///Gets the moles of a specific gas in a gas mixture.
#define GET_MOLES(gas, gas_mixture) (gas_mixture.gases[gas] ? gas_mixture.gases[gas][MOLES] : 0)
-///Adds moles to a specific gas in a gas mixture, asserts the gas is present.
-#define ADD_MOLES(gas, gas_mixture, moles) (ASSERT_GAS(gas, gas_mixture); gas_mixture.gases[gas][MOLES] += moles)
+///Adjusts the moles of a specific gas in the mixture. Doesn't check if it goes under 0.
+#define ADJUST_MOLES(gas, gas_mixture, moles)\
+ ASSERT_GAS(gas, gas_mixture);\
+ gas_mixture.gases[gas][MOLES] += moles;
-///Removes moles from a specific gas in a gas mixture, asserts the gas is present.
-#define REMOVE_MOLES(gas, gas_mixture, moles) (ASSERT_GAS(gas, gas_mixture); max(gas_mixture.gases[gas][MOLES] -= moles, 0))
+///Removes moles while making sure it doesn't go under 0.
+#define SAFE_REMOVE_MOLES(gas, gas_mixture, moles)\
+ ASSERT_GAS(gas, gas_mixture);\
+ max(gas_mixture.gases[gas][MOLES] -= moles, 0);
///Sets the moles of a specific gas in a gas mixture, asserts the gas is present.
-#define SET_MOLES(gas, gas_mixture, moles) (ASSERT_GAS(gas, gas_mixture); gas_mixture.gases[gas][MOLES] = moles)
+#define SET_MOLES(gas, gas_mixture, moles)\
+ ASSERT_GAS(gas, gas_mixture);\
+ gas_mixture.gases[gas][MOLES] = moles;
diff --git a/code/__HELPERS/turfs.dm b/code/__HELPERS/turfs.dm
index 04b13155f90d3..a1445211416b1 100644
--- a/code/__HELPERS/turfs.dm
+++ b/code/__HELPERS/turfs.dm
@@ -409,7 +409,7 @@ Turf and target are separate in case you want to teleport some distance from a t
var/temperature = air.temperature
if(temperature <= 270 || temperature >= 360)
return FALSE
- var/pressure = air.pressure
+ var/pressure = air.return_pressure()
if(pressure <= 20 || pressure >= 550)
return FALSE
return TRUE
diff --git a/code/controllers/subsystem/air.dm b/code/controllers/subsystem/air.dm
index b2e68c635b18c..a065e2458cf6e 100644
--- a/code/controllers/subsystem/air.dm
+++ b/code/controllers/subsystem/air.dm
@@ -737,7 +737,6 @@ GLOBAL_LIST_EMPTY(colored_images)
strings_to_mix[gas_string] = canonical_mix
gas_string = preprocess_gas_string(gas_string)
- var/list/gases = canonical_mix.gases
var/list/gas = params2list(gas_string)
if(gas["TEMP"])
canonical_mix.temperature = text2num(gas["TEMP"])
@@ -749,7 +748,7 @@ GLOBAL_LIST_EMPTY(colored_images)
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, gases, text2num(gas[id]))
+ SET_MOLES(path, canonical_mix, text2num(gas[id]))
if(istype(canonical_mix, /datum/gas_mixture/immutable))
return canonical_mix
diff --git a/code/datums/atmosphere/_atmosphere.dm b/code/datums/atmosphere/_atmosphere.dm
index 330d665d77e57..754e13507887d 100644
--- a/code/datums/atmosphere/_atmosphere.dm
+++ b/code/datums/atmosphere/_atmosphere.dm
@@ -25,13 +25,13 @@
var/datum/gas_mixture/gasmix = new
gasmix.temperature = rand(minimum_temp, maximum_temp)
for(var/i in base_gases)
- SET_MOLES(gasmix, i, base_gases[i])
+ SET_MOLES(i, gasmix, base_gases[i])
// Now let the random choices begin
var/datum/gas/gastype
var/amount
- while(gasmix.pressure < target_pressure)
+ while(gasmix.return_pressure() < target_pressure)
if(!prob(restricted_chance))
gastype = pick(normal_gases)
amount = normal_gases[gastype]
@@ -45,10 +45,10 @@
amount *= pressure_scalar // If we pick a really small target pressure we want roughly the same mix but less of it all
amount = CEILING(amount, 0.1)
- ADD_MOLES(gastype, gasmix, amount)
+ ADJUST_MOLES(gastype, gasmix, amount)
// That last one put us over the limit, remove some of it
- while(gasmix.pressure > target_pressure)
+ while(gasmix.return_pressure() > target_pressure)
SET_MOLES(gastype, gasmix, GET_MOLES(gastype, gasmix) * 0.9)
SET_MOLES(gastype, gasmix, FLOOR(GET_MOLES(gastype,gasmix), 0.1))
diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm
index 58cfb9ad0ddb8..94c4d5c3b71bd 100644
--- a/code/game/objects/effects/effect_system/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/effects_foam.dm
@@ -45,7 +45,7 @@
qdel(hotspot)
var/datum/gas_mixture/G = T.air
var/plas_amt = min(30,GET_MOLES(/datum/gas/plasma, G)) //Absorb some plasma
- REMOVE_MOLES(/datum/gas/plasma, G, plas_amt)
+ ADJUST_MOLES(/datum/gas/plasma, G, -plas_amt)
absorbed_plasma += plas_amt
if(G.temperature > T20C)
G.temperature = max(G.return_temperature()/2,T20C)
diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm
index bef1f6710853c..4aaa1fc31b6e5 100644
--- a/code/game/objects/effects/effect_system/effects_smoke.dm
+++ b/code/game/objects/effects/effect_system/effects_smoke.dm
@@ -180,7 +180,7 @@
for(var/obj/effect/hotspot/H in T)
qdel(H)
if(G.gases[/datum/gas/plasma][MOLES])
- ADD_MOLES(/datum/gas/nitrogen, G, G.gases[/datum/gas/plasma][MOLES])
+ ADJUST_MOLES(/datum/gas/nitrogen, G, G.gases[/datum/gas/plasma][MOLES])
G.gases[/datum/gas/plasma][MOLES] = 0
if (weldvents)
diff --git a/code/game/objects/effects/spawners/bombspawner.dm b/code/game/objects/effects/spawners/bombspawner.dm
index 36b3caea0e8dc..24fbdcf5de846 100644
--- a/code/game/objects/effects/spawners/bombspawner.dm
+++ b/code/game/objects/effects/spawners/bombspawner.dm
@@ -22,10 +22,10 @@
var/datum/gas_mixture/plasma_mix = plasma_tank.return_air()
var/datum/gas_mixture/oxygen_mix = oxygen_tank.return_air()
- SET_MOLES(plasma_mix, /datum/gas/plasma, pressure_p*plasma_mix.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_p)))
+ SET_MOLES(/datum/gas/plasma, plasma_mix, pressure_p*plasma_mix.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_p)))
plasma_mix.temperature = CELSIUS_TO_KELVIN(temp_p)
- SET_MOLES(oxygen_mix, /datum/gas/oxygen, pressure_o*oxygen_mix.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o)))
+ SET_MOLES(/datum/gas/oxygen, oxygen_mix, pressure_o*oxygen_mix.volume/(R_IDEAL_GAS_EQUATION*CELSIUS_TO_KELVIN(temp_o)))
oxygen_mix.temperature = CELSIUS_TO_KELVIN(temp_o)
V.tank_one = plasma_tank
diff --git a/code/game/objects/items/chrono_eraser.dm b/code/game/objects/items/chrono_eraser.dm
index df105473321af..ae3593ebd5137 100644
--- a/code/game/objects/items/chrono_eraser.dm
+++ b/code/game/objects/items/chrono_eraser.dm
@@ -264,8 +264,8 @@
/obj/structure/chrono_field/return_air() //we always have nominal air and temperature
var/datum/gas_mixture/GM = new
- SET_MOLES(GM, /datum/gas/oxygen, MOLES_O2STANDARD)
- SET_MOLES(GM, /datum/gas/nitrogen, MOLES_N2STANDARD)
+ SET_MOLES(/datum/gas/oxygen, GM, MOLES_O2STANDARD)
+ SET_MOLES(/datum/gas/nitrogen, GM, MOLES_N2STANDARD)
GM.temperature = T20C
return GM
diff --git a/code/game/objects/items/devices/scanners.dm b/code/game/objects/items/devices/scanners.dm
index b346f41fd129d..eb4ae4e6227d4 100644
--- a/code/game/objects/items/devices/scanners.dm
+++ b/code/game/objects/items/devices/scanners.dm
@@ -705,7 +705,7 @@ GENE SCANNER
var/o2_concentration = GET_MOLES(/datum/gas/oxygen, environment)/total_moles
var/n2_concentration = GET_MOLES(/datum/gas/nitrogen, environment)/total_moles
var/co2_concentration = GET_MOLES(/datum/gas/carbon_dioxide, environment)/total_moles
- var/plasma_concentration =
+ var/plasma_concentration = GET_MOLES(/datum/gas/plasma, environment)/total_moles
if(abs(n2_concentration - N2STANDARD) < 20)
message += "Nitrogen: [round(n2_concentration*100, 0.01)] % ([round(n2_concentration*total_moles, 0.01)] mol)"
diff --git a/code/game/objects/items/tanks/jetpack.dm b/code/game/objects/items/tanks/jetpack.dm
index b4eb91883bf8b..6b16d97ab3f59 100644
--- a/code/game/objects/items/tanks/jetpack.dm
+++ b/code/game/objects/items/tanks/jetpack.dm
@@ -29,7 +29,7 @@
/obj/item/tank/jetpack/populate_gas()
if(gas_type)
- SET_MOLES(air_contents, gas_type, ((6 * ONE_ATMOSPHERE * volume / (R_IDEAL_GAS_EQUATION * T20C))))
+ SET_MOLES(gas_type, air_contents, ((6 * ONE_ATMOSPHERE * volume / (R_IDEAL_GAS_EQUATION * T20C))))
/obj/item/tank/jetpack/ui_action_click(mob/user, action)
if(istype(action, /datum/action/item_action/toggle_jetpack))
@@ -337,8 +337,8 @@
var/ideal_o2_percent = (1 / PLASMA_OXYGEN_FULLBURN) * 2
var/datum/gas_mixture/temp_air_contents = return_air()
- SET_MOLES(temp_air_contents, /datum/gas/plasma, moles_full*(1-ideal_o2_percent))
- SET_MOLES(temp_air_contents, /datum/gas/oxygen, moles_full*ideal_o2_percent)
+ SET_MOLES(/datum/gas/plasma, temp_air_contents, moles_full*(1-ideal_o2_percent))
+ SET_MOLES(/datum/gas/oxygen, temp_air_contents, moles_full*ideal_o2_percent)
/obj/item/tank/jetpack/combustion/allow_thrust(num, mob/living/user, use_fuel = TRUE)
diff --git a/code/game/objects/items/tanks/tank_types.dm b/code/game/objects/items/tanks/tank_types.dm
index 9b3a7c38ead1b..0ff3a83c01fdb 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()
- SET_MOLES(air_contents, /datum/gas/oxygen, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
+ SET_MOLES(/datum/gas/oxygen, air_contents, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
/obj/item/tank/internals/oxygen/yellow
desc = "A tank of oxygen, this one is yellow."
@@ -56,8 +56,8 @@
force = 10
/obj/item/tank/internals/anesthetic/populate_gas()
- SET_MOLES(air_contents, /datum/gas/oxygen, 3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
- SET_MOLES(air_contents, /datum/gas/nitrous_oxide, 3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
+ SET_MOLES(/datum/gas/oxygen, air_contents, 3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
+ SET_MOLES(/datum/gas/nitrous_oxide, air_contents, 3*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
/*
* Air
@@ -71,8 +71,8 @@
dog_fashion = /datum/dog_fashion/back
/obj/item/tank/internals/air/populate_gas()
- SET_MOLES(air_contents, /datum/gas/oxygen, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
- SET_MOLES(air_contents, /datum/gas/nitrogen, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
+ SET_MOLES(/datum/gas/oxygen, air_contents, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
+ SET_MOLES(/datum/gas/nitrogen, air_contents, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
/*
* Plasma
@@ -87,7 +87,7 @@
/obj/item/tank/internals/plasma/populate_gas()
- SET_MOLES(air_contents, /datum/gas/plasma, 10*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ SET_MOLES(/datum/gas/plasma, air_contents, 10*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))
@@ -103,7 +103,7 @@
return ..()
/obj/item/tank/internals/plasma/full/populate_gas()
- SET_MOLES(air_contents, /datum/gas/plasma, 10*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ SET_MOLES(/datum/gas/plasma, air_contents, 10*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasma/empty/populate_gas()
return
@@ -143,7 +143,7 @@
w_class = WEIGHT_CLASS_SMALL //thanks i forgot this
/obj/item/tank/internals/plasmaman/belt/full/populate_gas()
- SET_MOLES(air_contents, /datum/gas/plasma, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ SET_MOLES(/datum/gas/plasma, air_contents, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/plasmaman/belt/empty/populate_gas()
return
@@ -170,7 +170,7 @@
/obj/item/tank/internals/emergency_oxygen/populate_gas()
- SET_MOLES(air_contents, /datum/gas/oxygen, 0.5*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
+ SET_MOLES(/datum/gas/oxygen, air_contents, 0.5*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C))
/obj/item/tank/internals/emergency_oxygen/empty/populate_gas()
return
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 9f6f299c017e9..9513de4580f99 100644
--- a/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
+++ b/code/game/objects/structures/transit_tubes/transit_tube_pod.dm
@@ -13,8 +13,8 @@
/obj/structure/transit_tube_pod/Initialize(mapload)
. = ..()
- SET_MOLES(air_contents, /datum/gas/oxygen, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
- SET_MOLES(air_contents, /datum/gas/nitrogen, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
+ SET_MOLES(/datum/gas/oxygen, air_contents, 6*ONE_ATMOSPHERE*air_contents.volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
+ SET_MOLES(/datum/gas/nitrogen, air_contents, 6*ONE_ATMOSPHERE*air_contents.volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
air_contents.temperature = T20C
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index ae2f653052bd9..185c61dea24f5 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -284,9 +284,9 @@
. = ..()
if (air.gases[/datum/gas/carbon_dioxide] && air.gases[/datum/gas/oxygen])
pulse_strength = min(pulse_strength,air.gases[/datum/gas/carbon_dioxide][MOLES]*1000,air.gases[/datum/gas/oxygen][MOLES]*2000) //Ensures matter is conserved properly
- REMOVE_MOLES(/datum/gas/carbon_dioxide, air, air.gases[/datum/gas/carbon_dioxide][MOLES]-(pulse_strength/1000))
- REMOVE_MOLES(/datum/gas/oxygen, air, air.gases[/datum/gas/oxygen][MOLES]-(pulse_strength/2000))
- ADD_MOLES(/datum/gas/pluoxium, air, pulse_strength/4000)
+ ADJUST_MOLES(/datum/gas/carbon_dioxide, air, (pulse_strength/1000)-air.gases[/datum/gas/carbon_dioxide][MOLES])
+ ADJUST_MOLES(/datum/gas/oxygen, air, (pulse_strength/2000)-air.gases[/datum/gas/oxygen][MOLES])
+ ADJUST_MOLES(/datum/gas/pluoxium, air, pulse_strength/4000)
/turf/open/proc/break_tile(force, allow_base)
LAZYINITLIST(damage_overlays)
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index 2e47b90475674..f5420d91e8436 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -125,8 +125,8 @@
if(burned_fuel)
energy_released += (N2O_DECOMPOSITION_ENERGY_RELEASED * burned_fuel)
- ADD_MOLES(/datum/gas/oxygen, burned_fuel * 0.5)
- ADD_MOLES(/datum/gas/nitrogen, burned_fuel)
+ ADJUST_MOLES(/datum/gas/oxygen, air, burned_fuel * 0.5)
+ ADJUST_MOLES(/datum/gas/nitrogen, air, burned_fuel)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
@@ -162,7 +162,7 @@
burned_fuel = cached_gases[/datum/gas/oxygen][MOLES] / TRITIUM_BURN_OXY_FACTOR
cached_gases[/datum/gas/tritium][MOLES] -= burned_fuel
- ADD_MOLES(/datum/gas/water_vapor, air, burned_fuel/TRITIUM_BURN_OXY_FACTOR)
+ ADJUST_MOLES(/datum/gas/water_vapor, air, burned_fuel/TRITIUM_BURN_OXY_FACTOR)
energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel)
cached_results["fire"] += burned_fuel
@@ -173,7 +173,7 @@
cached_gases[/datum/gas/tritium][MOLES] -= burned_fuel / TRITIUM_BURN_TRIT_FACTOR
cached_gases[/datum/gas/oxygen][MOLES] -= burned_fuel
- ADD_MOLES(/datum/gas/water_vapor, air, burned_fuel/TRITIUM_BURN_OXY_FACTOR)
+ ADJUST_MOLES(/datum/gas/water_vapor, air, burned_fuel/TRITIUM_BURN_OXY_FACTOR)
energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel)
cached_results["fire"] += burned_fuel * 10
@@ -253,10 +253,10 @@
cached_gases[/datum/gas/plasma][MOLES] = QUANTIZE(cached_gases[/datum/gas/plasma][MOLES] - plasma_burn_rate)
cached_gases[/datum/gas/oxygen][MOLES] = QUANTIZE(cached_gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate))
if (super_saturation)
- ADD_MOLES(/datum/gas/tritium, air, plasma_burn_rate)
+ ADJUST_MOLES(/datum/gas/tritium, air, plasma_burn_rate)
else
- ADD_MOLES(/datum/gas/carbon_dioxide, air, plasma_burn_rate*0.75)
- ADD_MOLES(/datum/gas/water_vapor, air, plasma_burn_rate*0.25)
+ ADJUST_MOLES(/datum/gas/carbon_dioxide, air, plasma_burn_rate*0.75)
+ ADJUST_MOLES(/datum/gas/water_vapor, air, plasma_burn_rate*0.25)
energy_released += FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate)
@@ -350,15 +350,15 @@
thermal_energy = middle_energy * 10 ** log(FUSION_ENERGY_TRANSLATION_EXPONENT, (thermal_energy + bowdlerized_reaction_energy) / middle_energy)
//The reason why you should set up a tritium production line.
- REMOVE_MOLES(/datum/gas/tritium, air, FUSION_TRITIUM_MOLES_USED)
+ ADJUST_MOLES(/datum/gas/tritium, air, -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
var/standard_waste_gas_output = scale_factor * (FUSION_TRITIUM_CONVERSION_COEFFICIENT*FUSION_TRITIUM_MOLES_USED)
if(delta_plasma > 0)
- ADD_MOLES(/datum/gas/water_vapor, air, standard_waste_gas_output)
+ ADJUST_MOLES(/datum/gas/water_vapor, air, standard_waste_gas_output)
else
- ADD_MOLES(/datum/gas/bz, air, standard_waste_gas_output)
- ADD_MOLES(/datum/gas/oxygen, air, standard_waste_gas_output) //Oxygen is a bit touchy subject
+ ADJUST_MOLES(/datum/gas/bz, air, standard_waste_gas_output)
+ ADJUST_MOLES(/datum/gas/oxygen, air, standard_waste_gas_output) //Oxygen is a bit touchy subject
if(reaction_energy)
if(location)
@@ -396,15 +396,15 @@
var/temperature = air.temperature
var/old_heat_capacity = air.heat_capacity()
- var/heat_efficency = min(temperature / (FIRE_MINIMUM_TEMPERATURE_TO_EXIST * 8), cached_gases[/datum/gas/oxygen][MOLES], cached_gases[/datum/gas/nitrogen][MOLES], cached_gases[/datum/gas/bz][MOLES] * INVERSE(0.05))
- var/energy_used = heat_efficency * NITRYL_FORMATION_ENERGY
- if ((cached_gases[/datum/gas/oxygen][MOLES] - heat_efficency < 0 ) || (cached_gases[/datum/gas/nitrogen][MOLES] - heat_efficency < 0) || (cached_gases[/datum/gas/bz][MOLES] - heat_efficency * 0.05 < 0)) //Shouldn't produce gas from nothing.
+ var/heat_efficiency = min(temperature / (FIRE_MINIMUM_TEMPERATURE_TO_EXIST * 8), cached_gases[/datum/gas/oxygen][MOLES], cached_gases[/datum/gas/nitrogen][MOLES], cached_gases[/datum/gas/bz][MOLES] * INVERSE(0.05))
+ var/energy_used = heat_efficiency * NITRYL_FORMATION_ENERGY
+ if ((cached_gases[/datum/gas/oxygen][MOLES] - heat_efficiency < 0 ) || (cached_gases[/datum/gas/nitrogen][MOLES] - heat_efficiency < 0) || (cached_gases[/datum/gas/bz][MOLES] - heat_efficiency * 0.05 < 0)) //Shouldn't produce gas from nothing.
return NO_REACTION
- cached_gases[/datum/gas/oxygen][MOLES] -= heat_efficency
- cached_gases[/datum/gas/nitrogen][MOLES] -= heat_efficency
- cached_gases[/datum/gas/bz][MOLES] -= heat_efficency * 0.05 //bz gets consumed to balance the nitryl production and not make it too common and/or easy
- ADD_MOLES(/datum/gas/nitryl, air, heat_efficiency)
+ cached_gases[/datum/gas/oxygen][MOLES] -= heat_efficiency
+ cached_gases[/datum/gas/nitrogen][MOLES] -= heat_efficiency
+ cached_gases[/datum/gas/bz][MOLES] -= heat_efficiency * 0.05 //bz gets consumed to balance the nitryl production and not make it too common and/or easy
+ ADJUST_MOLES(/datum/gas/nitryl, air, heat_efficiency)
if(energy_used > 0)
var/new_heat_capacity = air.heat_capacity()
@@ -433,10 +433,10 @@
if ((cached_gases[/datum/gas/nitrous_oxide][MOLES] - reaction_efficency < 0 )|| (cached_gases[/datum/gas/plasma][MOLES] - (2 * reaction_efficency) < 0) || energy_released <= 0) //Shouldn't produce gas from nothing.
return NO_REACTION
- ADD_MOLES(/datum/gas/bz, air, reaction_efficency * 2.5)
+ ADJUST_MOLES(/datum/gas/bz, air, reaction_efficency * 2.5)
if(reaction_efficency == cached_gases[/datum/gas/nitrous_oxide][MOLES])
cached_gases[/datum/gas/bz][MOLES] -= min(pressure, 0.5)
- ADD_MOLES(/datum/gas/oxygen, air, min(pressure, 0.5))
+ ADJUST_MOLES(/datum/gas/oxygen, air, min(pressure, 0.5))
cached_gases[/datum/gas/nitrous_oxide][MOLES] -= reaction_efficency
cached_gases[/datum/gas/plasma][MOLES] -= 2 * reaction_efficency
@@ -468,7 +468,7 @@
return NO_REACTION
cached_gases[/datum/gas/tritium][MOLES] -= heat_scale
cached_gases[/datum/gas/nitryl][MOLES] -= heat_scale
- ADD_GAS(/datum/gas/stimulum, air, heat_scale*0.75)
+ ADJUST_MOLES(/datum/gas/stimulum, air, heat_scale*0.75)
if(stim_energy_change)
var/new_heat_capacity = air.heat_capacity()
@@ -535,11 +535,11 @@
var/pluox_used = min(STIM_BALL_GAS_AMOUNT/GET_MOLES(/datum/gas/plasma, air),GET_MOLES(/datum/gas/pluoxium, air))
var/energy_released = stim_used*STIMULUM_HEAT_SCALE//Stimulum has a lot of stored energy, and breaking it up releases some of it
location.fire_nuclear_particle(ball_shot_angle)
- ADD_MOLES(/datum/gas/carbon_dioxide, air, 4*pluox_used)
- ADD_MOLES(/datum/gas/nitrogen, air, 8*stim_used)
- REMOVE_MOLES(/datum/gas/pluoxium, air, pluox_used)
- REMOVE_MOLES(/datum/gas/stimulum, air, stim_used)
- REMOVE_MOLES(/datum/gas/plasma], air, min(GET_MOLES(/datum/gas/plasma, air)/2,30))
+ ADJUST_MOLES(/datum/gas/carbon_dioxide, air, 4*pluox_used)
+ ADJUST_MOLES(/datum/gas/nitrogen, air, 8*stim_used)
+ ADJUST_MOLES(/datum/gas/pluoxium, air, -pluox_used)
+ ADJUST_MOLES(/datum/gas/stimulum, air, -stim_used)
+ ADJUST_MOLES(/datum/gas/plasma, air, -min(GET_MOLES(/datum/gas/plasma, air)/2,30))
if(energy_released)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
diff --git a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
index f8b2b437992d0..2771c55095bf3 100644
--- a/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
+++ b/code/modules/atmospherics/machinery/components/unary_devices/tank.dm
@@ -33,8 +33,8 @@
/obj/machinery/atmospherics/components/unary/tank/air/New()
..()
var/datum/gas_mixture/air_contents = airs[1]
- SET_MOLES(air_contents, /datum/gas/oxygen, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
- SET_MOLES(air_contents, /datum/gas/nitrogen, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
+ SET_MOLES(/datum/gas/oxygen, air_contents, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * O2STANDARD)
+ SET_MOLES(/datum/gas/nitrogen, air_contents, 6*ONE_ATMOSPHERE*volume/(R_IDEAL_GAS_EQUATION*T20C) * N2STANDARD)
/obj/machinery/atmospherics/components/unary/tank/carbon_dioxide
diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm
index c1306149d6410..3c8eb37b46b72 100644
--- a/code/modules/atmospherics/machinery/datum_pipeline.dm
+++ b/code/modules/atmospherics/machinery/datum_pipeline.dm
@@ -282,7 +282,7 @@
//gas transfer
for(var/giver_id in giver_gases)
var/giver_gas_data = giver_gases[giver_id]
- ADD_MOLES(total_gases, giver_id, giver_gas_data[MOLES])
+ ADJUST_MOLES(giver_id, gas_mixture, giver_gas_data[MOLES])
total_heat_capacity += giver_gas_data[MOLES] * giver_gas_data[GAS_META][META_GAS_SPECIFIC_HEAT]
total_thermal_energy += THERMAL_ENERGY(gas_mixture)
diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm
index b5114abf42844..4db4dd687ac2c 100644
--- a/code/modules/events/spacevine.dm
+++ b/code/modules/events/spacevine.dm
@@ -217,7 +217,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(GET_MOLES(/datum/gas/oxygen, GM) - severity * holder.energy, 0))
+ SET_MOLES(/datum/gas/oxygen, GM, max(GET_MOLES(/datum/gas/oxygen, GM) - severity * holder.energy, 0))
/datum/spacevine_mutation/nitro_eater
name = "nitrogen consuming"
@@ -229,7 +229,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(GET_MOLES(/datum/gas/nitrogen, GM) - severity * holder.energy, 0))
+ SET_MOLES(/datum/gas/nitrogen, GM, max(GET_MOLES(/datum/gas/nitrogen, GM) - severity * holder.energy, 0))
/datum/spacevine_mutation/carbondioxide_eater
name = "CO2 consuming"
@@ -241,7 +241,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(GET_MOLES(/datum/gas/carbon_dioxide, GM) - severity * holder.energy, 0))
+ ADJUST_MOLES(/datum/gas/carbon_dioxide, GM, GET_MOLES(/datum/gas/carbon_dioxide, GM) - severity * holder.energy)
/datum/spacevine_mutation/plasma_eater
name = "toxins consuming"
@@ -253,7 +253,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(GET_MOLES(/datum/gas/plasma, GM) - severity * holder.energy, 0))
+ SET_MOLES(/datum/gas/plasma, GM, max(GET_MOLES(/datum/gas/plasma, GM) - severity * holder.energy, 0))
/datum/spacevine_mutation/thorns
name = "thorny"
diff --git a/code/modules/hydroponics/grown/towercap.dm b/code/modules/hydroponics/grown/towercap.dm
index 51b55084f9421..736244a1018ee 100644
--- a/code/modules/hydroponics/grown/towercap.dm
+++ b/code/modules/hydroponics/grown/towercap.dm
@@ -246,7 +246,7 @@
if(isopenturf(loc))
var/turf/open/O = loc
if(O.air)
- if(O.GET_MOLES(/datum/gas/oxygen, air) > 13)
+ if(GET_MOLES(/datum/gas/oxygen, O.air) > 13)
return TRUE
return FALSE
diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm
index 51798f72fa609..0339143d3efab 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -183,7 +183,7 @@
var/oxygen_used = 0
var/moles = breath.total_moles()
var/breath_pressure = (moles*R_IDEAL_GAS_EQUATION*breath.return_temperature())/BREATH_VOLUME
- var/O2_partialpressure = ((GET_MOLES(/datum/gas/oxygen, breath)/moles)*breath_pressure) + (((GET_MOLES(GAS_PLUOXIUM, breath)*8)/moles)*breath_pressure)
+ var/O2_partialpressure = ((GET_MOLES(/datum/gas/oxygen, breath)/moles)*breath_pressure) + (((GET_MOLES(/datum/gas/pluoxium, breath)*8)/moles)*breath_pressure)
var/Toxins_partialpressure = (GET_MOLES(/datum/gas/plasma, breath)/moles)*breath_pressure
var/CO2_partialpressure = (GET_MOLES(/datum/gas/carbon_dioxide, breath)/moles)*breath_pressure
diff --git a/code/modules/mob/living/simple_animal/bot/atmosbot.dm b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
index a1c7d64752c4c..7b5e4529bf5c5 100644
--- a/code/modules/mob/living/simple_animal/bot/atmosbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
@@ -230,7 +230,7 @@
for(var/G in gasses)
if(gasses[G])
var/moles_in_atmos = GET_MOLES(G, environment)
- environment.adjust_moles(G, -min(moles_in_atmos, ATMOSBOT_MAX_SCRUB_CHANGE))
+ ADJUST_MOLES(G, environment, -min(moles_in_atmos, ATMOSBOT_MAX_SCRUB_CHANGE))
/mob/living/simple_animal/bot/atmosbot/proc/deploy_holobarrier()
if(deployed_holobarrier)
diff --git a/code/modules/mob/living/simple_animal/hostile/tree.dm b/code/modules/mob/living/simple_animal/hostile/tree.dm
index 6c8d517a94d12..f70c499368058 100644
--- a/code/modules/mob/living/simple_animal/hostile/tree.dm
+++ b/code/modules/mob/living/simple_animal/hostile/tree.dm
@@ -49,7 +49,7 @@
if(isopenturf(loc))
var/turf/open/T = src.loc
if(T.air)
- var/co2 = T.GET_MOLES(/datum/gas/carbon_dioxide, air)
+ var/co2 = GET_MOLES(/datum/gas/carbon_dioxide, T.air)
if(co2 > 0)
if(prob(25))
var/amt = min(co2, 9)
diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm
index 2209b06f17e17..ee9e1e35d71b5 100644
--- a/code/modules/mob/living/simple_animal/slime/life.dm
+++ b/code/modules/mob/living/simple_animal/slime/life.dm
@@ -100,8 +100,8 @@
if(transformeffects & SLIME_EFFECT_DARK_PURPLE)
var/amt = is_adult ? 30 : 15
var/plas_amt = min(amt,GET_MOLES(/datum/gas/plasma, environment))
- environment.adjust_moles(/datum/gas/plasma, -plas_amt)
- environment.adjust_moles(/datum/gas/oxygen, plas_amt)
+ ADJUST_MOLES(/datum/gas/plasma, environment, -plas_amt)
+ ADJUST_MOLES(/datum/gas/oxygen, environment, plas_amt)
adjustBruteLoss(plas_amt ? -2 : 0)
switch(stat)
diff --git a/code/modules/modular_computers/file_system/programs/atmosscan.dm b/code/modules/modular_computers/file_system/programs/atmosscan.dm
index bf7e1e29ced89..23d8a53028585 100644
--- a/code/modules/modular_computers/file_system/programs/atmosscan.dm
+++ b/code/modules/modular_computers/file_system/programs/atmosscan.dm
@@ -30,7 +30,7 @@
data["AirTempC"] = round(environment.return_temperature() - T0C)
data["AirTempK"] = round(environment.return_temperature())
if (total_moles)
- for(var/id in environment.get_gases())
+ for(var/id in environment.gases)
var/gas_level = GET_MOLES(id, environment)/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)))
diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm
index 4fe88c07dc723..3d1324670f89e 100644
--- a/code/modules/power/singularity/collector.dm
+++ b/code/modules/power/singularity/collector.dm
@@ -51,21 +51,21 @@
return
var/datum/gas_mixture/loaded_tank_air = loaded_tank.return_air()
if(!bitcoinmining)
- if(loaded_tank.GET_MOLES(/datum/gas/plasma, air_contents) < 0.0001)
+ if(GET_MOLES(/datum/gas/plasma, loaded_tank.air_contents) < 0.0001)
investigate_log("out of fuel.", INVESTIGATE_ENGINES)
playsound(src, 'sound/machines/ding.ogg', 50, 1)
var/msg = "Plasma depleted, recommend replacing tank."
radio.talk_into(src, msg, RADIO_CHANNEL_ENGINEERING)
eject()
else
- var/gasdrained = min(powerproduction_drain*drainratio*delta_time,loaded_tank.GET_MOLES(/datum/gas/plasma, air_contents))
- loaded_tank.air_contents.adjust_moles(/datum/gas/plasma, -gasdrained)
- loaded_tank.air_contents.adjust_moles(/datum/gas/tritium, gasdrained)
+ var/gasdrained = min(powerproduction_drain*drainratio*delta_time,GET_MOLES(/datum/gas/plasma, loaded_tank.air_contents))
+ ADJUST_MOLES(/datum/gas/plasma, loaded_tank.air_contents, -gasdrained)
+ ADJUST_MOLES(/datum/gas/tritium, loaded_tank.air_contents, gasdrained)
var/power_produced = RAD_COLLECTOR_OUTPUT
add_avail(power_produced)
stored_energy-=power_produced
else if(is_station_level(z) && SSresearch.science_tech)
- if(!loaded_tank.GET_MOLES(/datum/gas/tritium, air_contents) || !loaded_tank.GET_MOLES(/datum/gas/oxygen, air_contents))
+ if(!GET_MOLES(/datum/gas/tritium, loaded_tank.air_contents) || !GET_MOLES(/datum/gas/oxygen, loaded_tank.air_contents))
playsound(src, 'sound/machines/ding.ogg', 50, 1)
eject()
else
@@ -87,7 +87,9 @@
toggle_power()
user.visible_message("[user.name] turns the [src.name] [active? "on":"off"].", \
"You turn the [src.name] [active? "on":"off"].")
- var/fuel = loaded_tank?.GET_MOLES(/datum/gas/plasma, air_contents)
+ var/fuel = 0
+ if(loaded_tank)
+ fuel = GET_MOLES(/datum/gas/plasma, loaded_tank.air_contents)
investigate_log("turned [active?"on":"off"] by [key_name(user)]. [loaded_tank?"Fuel: [round(fuel/0.29)]%":"It is empty"].", INVESTIGATE_ENGINES)
return
else
diff --git a/code/modules/power/supermatter/supermatter.dm b/code/modules/power/supermatter/supermatter.dm
index 96d1215b3e41f..d14d847705869 100644
--- a/code/modules/power/supermatter/supermatter.dm
+++ b/code/modules/power/supermatter/supermatter.dm
@@ -224,7 +224,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
data["SM_moles"] = air.total_moles()
for(var/gasid in air.gases)
gasdata.Add(list(list(
- "name"= GLOB.gas_data.names[gasid],
+ "name"= GLOB.meta_gas_info[gasid][META_GAS_NAME],
"amount" = round(100*GET_MOLES(gasid, air)/air.total_moles(),0.01))))
else
for(var/gasid in air.gases)
@@ -460,7 +460,7 @@ GLOBAL_DATUM(main_supermatter_engine, /obj/machinery/power/supermatter_crystal)
plasmacomp += clamp(max(GET_MOLES(/datum/gas/plasma, removed)/combined_gas, 0) - plasmacomp, -1, gas_change_rate)
o2comp += clamp(max(GET_MOLES(/datum/gas/oxygen, removed)/combined_gas, 0) - o2comp, -1, gas_change_rate)
co2comp += clamp(max(GET_MOLES(/datum/gas/carbon_dioxide, removed)/combined_gas, 0) - co2comp, -1, gas_change_rate)
- pluoxiumcomp += clamp(max(GET_MOLES(GAS_PLUOXIUM, removed)/combined_gas, 0) - pluoxiumcomp, -1, gas_change_rate)
+ pluoxiumcomp += clamp(max(GET_MOLES(/datum/gas/pluoxium, removed)/combined_gas, 0) - pluoxiumcomp, -1, gas_change_rate)
tritiumcomp += clamp(max(GET_MOLES(/datum/gas/tritium, removed)/combined_gas, 0) - tritiumcomp, -1, gas_change_rate)
bzcomp += clamp(max(GET_MOLES(/datum/gas/bz, removed)/combined_gas, 0) - bzcomp, -1, gas_change_rate)
diff --git a/code/modules/research/xenobiology/crossbreeding/_structures.dm b/code/modules/research/xenobiology/crossbreeding/_structures.dm
index 95ccf3d9b58ab..1e02629c418aa 100644
--- a/code/modules/research/xenobiology/crossbreeding/_structures.dm
+++ b/code/modules/research/xenobiology/crossbreeding/_structures.dm
@@ -237,7 +237,7 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals)
var/datum/gas_mixture/air = open_turf.return_air()
if(GET_MOLES(/datum/gas/plasma, air) > 15)
- air.adjust_moles(/datum/gas/plasma, -15)
+ ADJUST_MOLES(/datum/gas/plasma, air, -15)
new /obj/item/stack/sheet/mineral/plasma(open_turf)
/obj/structure/slime_crystal/darkpurple/Destroy()
diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index 3c8f6b6a7e106..3035ffe83b216 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -245,7 +245,7 @@
mole_adjustments[gas] = (gas in mole_adjustments) ? mole_adjustments[gas] - breath.gases[gas][MOLES] : -breath.gases[gas][MOLES]
for(var/gas in mole_adjustments)
- ADD_MOLES(breath, gas, mole_adjustments[gas])
+ ADJUST_MOLES(gas, breath, mole_adjustments[gas])
if(breath) // If there's some other shit in the air lets deal with it here.
diff --git a/code/modules/unit_tests/gas_transfer.dm b/code/modules/unit_tests/gas_transfer.dm
index bf8159ac789dc..565fd62a79bd7 100644
--- a/code/modules/unit_tests/gas_transfer.dm
+++ b/code/modules/unit_tests/gas_transfer.dm
@@ -9,8 +9,8 @@
first_mix.volume = 200
second_mix.volume = 200
- SET_MOLES(first_mix, /datum/gas/hypernoblium, tempNmoles)
- SET_MOLES(second_mix, /datum/gas/tritium, 200)
+ SET_MOLES(/datum/gas/hypernoblium, first_mix, tempNmoles)
+ SET_MOLES(/datum/gas/tritium, second_mix, 200)
first_mix.temperature = tempNmoles
second_mix.temperature = T20C
diff --git a/code/modules/vehicles/mecha/_mecha.dm b/code/modules/vehicles/mecha/_mecha.dm
index 5dfdeeb1fac8f..396d77f238892 100644
--- a/code/modules/vehicles/mecha/_mecha.dm
+++ b/code/modules/vehicles/mecha/_mecha.dm
@@ -338,8 +338,8 @@
cabin_air = new
cabin_air.temperature = (T20C)
cabin_air.volume = 200
- SET_MOLES(cabin_air, /datum/gas/oxygen, O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature))
- SET_MOLES(cabin_air, /datum/gas/nitrogen, N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature))
+ SET_MOLES(/datum/gas/oxygen, cabin_air, O2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature))
+ SET_MOLES(/datum/gas/nitrogen, cabin_air, N2STANDARD*cabin_air.volume/(R_IDEAL_GAS_EQUATION*cabin_air.temperature))
return cabin_air
/obj/vehicle/sealed/mecha/proc/add_radio()
From 997880ae0b82324ade7e6b5207baa5f759e808c3 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sat, 31 Aug 2024 23:45:05 +0200
Subject: [PATCH 081/114] Less warnings more gooder
---
code/modules/atmospherics/machinery/datum_pipeline.dm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm
index 3c8eb37b46b72..c6691a56f9cb8 100644
--- a/code/modules/atmospherics/machinery/datum_pipeline.dm
+++ b/code/modules/atmospherics/machinery/datum_pipeline.dm
@@ -270,7 +270,6 @@
var/total_heat_capacity = 0
var/datum/gas_mixture/total_gas_mixture = new(0)
- var/list/total_gases = total_gas_mixture.gases
for(var/mixture in gas_mixture_list)
var/datum/gas_mixture/gas_mixture = mixture
@@ -282,7 +281,7 @@
//gas transfer
for(var/giver_id in giver_gases)
var/giver_gas_data = giver_gases[giver_id]
- ADJUST_MOLES(giver_id, gas_mixture, giver_gas_data[MOLES])
+ ADJUST_MOLES(giver_id, total_gas_mixture, giver_gas_data[MOLES])
total_heat_capacity += giver_gas_data[MOLES] * giver_gas_data[GAS_META][META_GAS_SPECIFIC_HEAT]
total_thermal_energy += THERMAL_ENERGY(gas_mixture)
From eacd0126689f8a2e37a9964f6f60e6202eee11e7 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sun, 1 Sep 2024 00:36:42 +0200
Subject: [PATCH 082/114] Fixes broken breathing. Too much alerts still broken
for some reason
---
code/modules/mob/living/carbon/life.dm | 8 ++++----
code/modules/surgery/organs/lungs.dm | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm
index 0339143d3efab..aadbd883f7ce2 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -130,13 +130,13 @@
breath = loc_as_obj.handle_internal_lifeform(src, BREATH_VOLUME)
else if(isturf(loc)) //Breathe from loc as turf
- var/breath_ratio = 0
+ var/breath_moles = 0
if(environment)
- breath_ratio = BREATH_VOLUME/environment.return_volume()
+ breath_moles = environment.total_moles()*BREATH_PERCENTAGE
- breath = loc.remove_air_ratio(breath_ratio)
+ breath = loc.remove_air(breath_moles)
else //Breathe from loc as obj again
- if(istype(loc, /obj/))
+ if(isobj(loc))
var/obj/loc_as_obj = loc
loc_as_obj.handle_internal_lifeform(src,0)
diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index 3035ffe83b216..94ce531a73d49 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -215,15 +215,15 @@
var/datum/reagent/danger_reagent = null
var/alert_category = null
var/alert_type = null
- if(ispath(breathing_class))
+ if(istype(breathing_class, /datum/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
- danger_reagent = GLOB.meta_gas_info[entry][META_GAS_BREATH_REAGENT_DANGEROUS]
- var/list/alert = GLOB.meta_gas_info[entry][META_GAS_BREATH_ALERT_INFO]?["too_much_alert"]
+ danger_reagent = GLOB.meta_gas_info[breathing_class][META_GAS_BREATH_REAGENT_DANGEROUS]
+ var/list/alert = GLOB.meta_gas_info[breathing_class][META_GAS_BREATH_ALERT_INFO]?["too_much_alert"]
if(alert)
alert_category = alert["alert_category"]
alert_type = alert["alert_type"]
From d21e4ab001640d53e3f215232f82b7b927b6a17a Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 2 Sep 2024 10:09:51 +0200
Subject: [PATCH 083/114] Kills atmos callbacks
---
code/controllers/subsystem/callback.dm | 14 --------------
1 file changed, 14 deletions(-)
delete mode 100644 code/controllers/subsystem/callback.dm
diff --git a/code/controllers/subsystem/callback.dm b/code/controllers/subsystem/callback.dm
deleted file mode 100644
index ecc65760f4e80..0000000000000
--- a/code/controllers/subsystem/callback.dm
+++ /dev/null
@@ -1,14 +0,0 @@
-SUBSYSTEM_DEF(callbacks)
- name = "Auxtools Callbacks"
- flags = SS_TICKER | SS_NO_INIT
- wait = 1
- priority = FIRE_PRIORITY_CALLBACKS
-
-/proc/process_atmos_callbacks()
- SScallbacks.can_fire = 0
- SScallbacks.flags |= SS_NO_FIRE
- CRASH("Auxtools not found! Callback subsystem shutting itself off.")
-
-/datum/controller/subsystem/callbacks/fire()
- if(process_atmos_callbacks(MC_TICK_REMAINING_MS))
- pause()
From dabd6e3716f10d8716447cea654744ac02e762f0 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 2 Sep 2024 10:13:26 +0200
Subject: [PATCH 084/114] Update beestation.dme
---
beestation.dme | 2 --
1 file changed, 2 deletions(-)
diff --git a/beestation.dme b/beestation.dme
index c64b3c1388008..dc676584bb920 100644
--- a/beestation.dme
+++ b/beestation.dme
@@ -419,7 +419,6 @@
#include "code\controllers\subsystem\autotransfer.dm"
#include "code\controllers\subsystem\ban_cache.dm"
#include "code\controllers\subsystem\blackbox.dm"
-#include "code\controllers\subsystem\callback.dm"
#include "code\controllers\subsystem\chat.dm"
#include "code\controllers\subsystem\circuit_component.dm"
#include "code\controllers\subsystem\combat_logging.dm"
@@ -524,7 +523,6 @@
#include "code\datums\armor.dm"
#include "code\datums\beam.dm"
#include "code\datums\browser.dm"
-#include "code\datums\callback.dm"
#include "code\datums\chat_payload.dm"
#include "code\datums\chatmessage.dm"
#include "code\datums\cinematic.dm"
From 00ecc2bd70b268294d2b932869fdf1ae3958917c Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 2 Sep 2024 10:18:25 +0200
Subject: [PATCH 085/114] Revert "Kills atmos callbacks"
This reverts commit d21e4ab001640d53e3f215232f82b7b927b6a17a.
---
code/controllers/subsystem/callback.dm | 14 ++++++++++++++
1 file changed, 14 insertions(+)
create mode 100644 code/controllers/subsystem/callback.dm
diff --git a/code/controllers/subsystem/callback.dm b/code/controllers/subsystem/callback.dm
new file mode 100644
index 0000000000000..ecc65760f4e80
--- /dev/null
+++ b/code/controllers/subsystem/callback.dm
@@ -0,0 +1,14 @@
+SUBSYSTEM_DEF(callbacks)
+ name = "Auxtools Callbacks"
+ flags = SS_TICKER | SS_NO_INIT
+ wait = 1
+ priority = FIRE_PRIORITY_CALLBACKS
+
+/proc/process_atmos_callbacks()
+ SScallbacks.can_fire = 0
+ SScallbacks.flags |= SS_NO_FIRE
+ CRASH("Auxtools not found! Callback subsystem shutting itself off.")
+
+/datum/controller/subsystem/callbacks/fire()
+ if(process_atmos_callbacks(MC_TICK_REMAINING_MS))
+ pause()
From 4e8037e4da69843e590b798be358e755ab1a37c1 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 2 Sep 2024 10:18:31 +0200
Subject: [PATCH 086/114] Revert "Update beestation.dme"
This reverts commit dabd6e3716f10d8716447cea654744ac02e762f0.
---
beestation.dme | 2 ++
1 file changed, 2 insertions(+)
diff --git a/beestation.dme b/beestation.dme
index dc676584bb920..c64b3c1388008 100644
--- a/beestation.dme
+++ b/beestation.dme
@@ -419,6 +419,7 @@
#include "code\controllers\subsystem\autotransfer.dm"
#include "code\controllers\subsystem\ban_cache.dm"
#include "code\controllers\subsystem\blackbox.dm"
+#include "code\controllers\subsystem\callback.dm"
#include "code\controllers\subsystem\chat.dm"
#include "code\controllers\subsystem\circuit_component.dm"
#include "code\controllers\subsystem\combat_logging.dm"
@@ -523,6 +524,7 @@
#include "code\datums\armor.dm"
#include "code\datums\beam.dm"
#include "code\datums\browser.dm"
+#include "code\datums\callback.dm"
#include "code\datums\chat_payload.dm"
#include "code\datums\chatmessage.dm"
#include "code\datums\cinematic.dm"
From b5abcb0c2b7564cbeb61c937eb4ab60ff6a00d4d Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 2 Sep 2024 10:52:31 +0200
Subject: [PATCH 087/114] Silly me
---
code/modules/atmospherics/gasmixtures/gas_types.dm | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/code/modules/atmospherics/gasmixtures/gas_types.dm b/code/modules/atmospherics/gasmixtures/gas_types.dm
index 6cf7d2a595dda..e20e1b487b395 100644
--- a/code/modules/atmospherics/gasmixtures/gas_types.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_types.dm
@@ -7,6 +7,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
for(var/gas_path in .)
var/list/gas_info = new(11)
var/datum/gas/gas = gas_path
+ var/datum/gas/instance = new(gas_path)
gas_info[META_GAS_SPECIFIC_HEAT] = initial(gas.specific_heat)
gas_info[META_GAS_NAME] = initial(gas.name)
@@ -20,7 +21,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
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_info[META_GAS_BREATH_ALERT_INFO] = initial(gas.breath_alert_info)
+ gas_info[META_GAS_BREATH_ALERT_INFO] = instance.breath_alert_info.Copy()
gas_info[META_GAS_BREATH_REAGENT] = initial(gas.breath_reagent)
gas_info[META_GAS_BREATH_RESULTS] = initial(gas.breath_results)
gas_info[META_GAS_BREATH_REAGENT_DANGEROUS] = initial(gas.breath_reagent_dangerous)
@@ -54,7 +55,7 @@ GLOBAL_LIST_INIT(nonreactive_gases, typecacheof(list(/datum/gas/oxygen, /datum/g
var/dangerous = FALSE //currently used by canisters
var/fusion_power = 0 //How much the gas accelerates a fusion reaction
var/rarity = 0 // relative rarity compared to other gases, used when setting up the reactions list.
- var/list/breath_alert_info = null
+ var/list/breath_alert_info = list()
var/breath_reagent = null
var/breath_results = null
var/breath_reagent_dangerous = null
From 8c77d0a2cec8dc9d51306545ab5a16af3d2fe862 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 2 Sep 2024 11:18:28 +0200
Subject: [PATCH 088/114] Makes breath considerably less fucked!
---
code/__DEFINES/atmospherics/atmos_helpers.dm | 2 +-
.../effects/effect_system/effects_foam.dm | 2 +-
code/modules/surgery/organs/lungs.dm | 21 +++++++++----------
3 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/code/__DEFINES/atmospherics/atmos_helpers.dm b/code/__DEFINES/atmospherics/atmos_helpers.dm
index 79775134aca37..480dcbf5ee200 100644
--- a/code/__DEFINES/atmospherics/atmos_helpers.dm
+++ b/code/__DEFINES/atmospherics/atmos_helpers.dm
@@ -88,7 +88,7 @@ GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
///Removes moles while making sure it doesn't go under 0.
#define SAFE_REMOVE_MOLES(gas, gas_mixture, moles)\
ASSERT_GAS(gas, gas_mixture);\
- max(gas_mixture.gases[gas][MOLES] -= moles, 0);
+ gas_mixture.gases[gas][MOLES] -= max(moles, 0);
///Sets the moles of a specific gas in a gas mixture, asserts the gas is present.
#define SET_MOLES(gas, gas_mixture, moles)\
diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm
index 94c4d5c3b71bd..223b5219b7cf6 100644
--- a/code/game/objects/effects/effect_system/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/effects_foam.dm
@@ -45,7 +45,7 @@
qdel(hotspot)
var/datum/gas_mixture/G = T.air
var/plas_amt = min(30,GET_MOLES(/datum/gas/plasma, G)) //Absorb some plasma
- ADJUST_MOLES(/datum/gas/plasma, G, -plas_amt)
+ SAFE_REMOVE_MOLES(/datum/gas/plasma, G, plas_amt)
absorbed_plasma += plas_amt
if(G.temperature > T20C)
G.temperature = max(G.return_temperature()/2,T20C)
diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index 94ce531a73d49..c5d09c8a8e11b 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -30,7 +30,7 @@
var/list/gas_min = list()
var/list/gas_max = list(
/datum/gas/carbon_dioxide = 30, // Yes it's an arbitrary value who cares?
- /datum/gas/plasma = MOLES_GAS_VISIBLE
+ /datum/breathing_class/plasma = MOLES_GAS_VISIBLE
)
var/list/gas_damage = list(
"default" = list(
@@ -170,8 +170,8 @@
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/datum/breathing_class/class = breathing_classes[entry]
+ if(class)
var/list/gases = class.gases
var/list/products = class.products
alert_category = class.low_alert_category
@@ -211,19 +211,18 @@
clear_alert_for(H, alert_category)
for(var/entry in gas_max)
var/found_pp = 0
- var/datum/breathing_class/breathing_class = entry
+ var/datum/breathing_class/breathing_class = breathing_classes[entry]
var/datum/reagent/danger_reagent = null
var/alert_category = null
var/alert_type = null
- if(istype(breathing_class, /datum/breathing_class))
- breathing_class = breathing_classes[breathing_class]
+ if(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
- danger_reagent = GLOB.meta_gas_info[breathing_class][META_GAS_BREATH_REAGENT_DANGEROUS]
- var/list/alert = GLOB.meta_gas_info[breathing_class][META_GAS_BREATH_ALERT_INFO]?["too_much_alert"]
+ danger_reagent = GLOB.meta_gas_info[entry][META_GAS_BREATH_REAGENT_DANGEROUS]
+ var/list/alert = GLOB.meta_gas_info[entry][META_GAS_BREATH_ALERT_INFO]?["too_much_alert"]
if(alert)
alert_category = alert["alert_category"]
alert_type = alert["alert_type"]
@@ -292,14 +291,14 @@
if (gas_breathed > gas_stimulation_min)
H.reagents.add_reagent(/datum/reagent/nitryl,1)
- breath.gases[/datum/gas/nitryl][MOLES] += -gas_breathed
+ SAFE_REMOVE_MOLES(/datum/gas/nitryl, breath, gas_breathed)
// Stimulum
gas_breathed = PP(breath,/datum/gas/stimulum)
if (gas_breathed > gas_stimulation_min)
var/existing = H.reagents.get_reagent_amount(/datum/reagent/stimulum)
H.reagents.add_reagent(/datum/reagent/stimulum, max(0, 5 - existing))
- breath.gases[/datum/gas/stimulum][MOLES] += -gas_breathed
+ SAFE_REMOVE_MOLES(/datum/gas/stimulum, breath, gas_breathed)
handle_breath_temperature(breath, H)
return TRUE
@@ -370,7 +369,7 @@
/obj/item/organ/lungs/plasmaman/populate_gas_info()
..()
- gas_max -= /datum/gas/plasma
+ gas_max -= /datum/breathing_class/plasma
/obj/item/organ/lungs/slime
name = "vacuole"
From 5faa2ae7db23fcce3269aa4ee969435eeba0966e Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 2 Sep 2024 11:29:49 +0200
Subject: [PATCH 089/114] Nicer defines
---
code/__DEFINES/atmospherics/atmos_helpers.dm | 11 +++--
code/datums/atmosphere/_atmosphere.dm | 2 +-
.../effects/effect_system/effects_foam.dm | 2 +-
.../effects/effect_system/effects_smoke.dm | 2 +-
code/game/turfs/open/_open.dm | 6 +--
.../atmospherics/gasmixtures/reactions.dm | 42 +++++++++----------
.../atmospherics/machinery/datum_pipeline.dm | 2 +-
code/modules/events/spacevine.dm | 2 +-
.../mob/living/simple_animal/bot/atmosbot.dm | 2 +-
.../mob/living/simple_animal/slime/life.dm | 4 +-
code/modules/power/singularity/collector.dm | 4 +-
.../xenobiology/crossbreeding/_structures.dm | 2 +-
code/modules/surgery/organs/lungs.dm | 4 +-
13 files changed, 45 insertions(+), 40 deletions(-)
diff --git a/code/__DEFINES/atmospherics/atmos_helpers.dm b/code/__DEFINES/atmospherics/atmos_helpers.dm
index 480dcbf5ee200..0eddefe55fd5e 100644
--- a/code/__DEFINES/atmospherics/atmos_helpers.dm
+++ b/code/__DEFINES/atmospherics/atmos_helpers.dm
@@ -80,16 +80,21 @@ GLOBAL_LIST_INIT(atmos_adjacent_savings, list(0,0))
///Gets the moles of a specific gas in a gas mixture.
#define GET_MOLES(gas, gas_mixture) (gas_mixture.gases[gas] ? gas_mixture.gases[gas][MOLES] : 0)
-///Adjusts the moles of a specific gas in the mixture. Doesn't check if it goes under 0.
-#define ADJUST_MOLES(gas, gas_mixture, moles)\
+///Adds moles to a specific gas in a gas mixture.
+#define ADD_MOLES(gas, gas_mixture, moles)\
ASSERT_GAS(gas, gas_mixture);\
gas_mixture.gases[gas][MOLES] += moles;
///Removes moles while making sure it doesn't go under 0.
-#define SAFE_REMOVE_MOLES(gas, gas_mixture, moles)\
+#define REMOVE_MOLES(gas, gas_mixture, moles)\
ASSERT_GAS(gas, gas_mixture);\
gas_mixture.gases[gas][MOLES] -= max(moles, 0);
+/// Basically REMOVE_MOLES but with the thing sign flipped. Use this when sign is unknown
+#define ADJUST_MOLES(gas, gas_mixture, moles)\
+ ASSERT_GAS(gas, gas_mixture);\
+ gas_mixture.gases[gas][MOLES] += max(moles, 0);
+
///Sets the moles of a specific gas in a gas mixture, asserts the gas is present.
#define SET_MOLES(gas, gas_mixture, moles)\
ASSERT_GAS(gas, gas_mixture);\
diff --git a/code/datums/atmosphere/_atmosphere.dm b/code/datums/atmosphere/_atmosphere.dm
index 754e13507887d..521e5a74ff2c3 100644
--- a/code/datums/atmosphere/_atmosphere.dm
+++ b/code/datums/atmosphere/_atmosphere.dm
@@ -45,7 +45,7 @@
amount *= pressure_scalar // If we pick a really small target pressure we want roughly the same mix but less of it all
amount = CEILING(amount, 0.1)
- ADJUST_MOLES(gastype, gasmix, amount)
+ ADD_MOLES(gastype, gasmix, amount)
// That last one put us over the limit, remove some of it
while(gasmix.return_pressure() > target_pressure)
diff --git a/code/game/objects/effects/effect_system/effects_foam.dm b/code/game/objects/effects/effect_system/effects_foam.dm
index 223b5219b7cf6..58cfb9ad0ddb8 100644
--- a/code/game/objects/effects/effect_system/effects_foam.dm
+++ b/code/game/objects/effects/effect_system/effects_foam.dm
@@ -45,7 +45,7 @@
qdel(hotspot)
var/datum/gas_mixture/G = T.air
var/plas_amt = min(30,GET_MOLES(/datum/gas/plasma, G)) //Absorb some plasma
- SAFE_REMOVE_MOLES(/datum/gas/plasma, G, plas_amt)
+ REMOVE_MOLES(/datum/gas/plasma, G, plas_amt)
absorbed_plasma += plas_amt
if(G.temperature > T20C)
G.temperature = max(G.return_temperature()/2,T20C)
diff --git a/code/game/objects/effects/effect_system/effects_smoke.dm b/code/game/objects/effects/effect_system/effects_smoke.dm
index 4aaa1fc31b6e5..bef1f6710853c 100644
--- a/code/game/objects/effects/effect_system/effects_smoke.dm
+++ b/code/game/objects/effects/effect_system/effects_smoke.dm
@@ -180,7 +180,7 @@
for(var/obj/effect/hotspot/H in T)
qdel(H)
if(G.gases[/datum/gas/plasma][MOLES])
- ADJUST_MOLES(/datum/gas/nitrogen, G, G.gases[/datum/gas/plasma][MOLES])
+ ADD_MOLES(/datum/gas/nitrogen, G, G.gases[/datum/gas/plasma][MOLES])
G.gases[/datum/gas/plasma][MOLES] = 0
if (weldvents)
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index 185c61dea24f5..338a421a1bcf7 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -284,9 +284,9 @@
. = ..()
if (air.gases[/datum/gas/carbon_dioxide] && air.gases[/datum/gas/oxygen])
pulse_strength = min(pulse_strength,air.gases[/datum/gas/carbon_dioxide][MOLES]*1000,air.gases[/datum/gas/oxygen][MOLES]*2000) //Ensures matter is conserved properly
- ADJUST_MOLES(/datum/gas/carbon_dioxide, air, (pulse_strength/1000)-air.gases[/datum/gas/carbon_dioxide][MOLES])
- ADJUST_MOLES(/datum/gas/oxygen, air, (pulse_strength/2000)-air.gases[/datum/gas/oxygen][MOLES])
- ADJUST_MOLES(/datum/gas/pluoxium, air, pulse_strength/4000)
+ ADD_MOLES(/datum/gas/carbon_dioxide, air, (pulse_strength/1000)-air.gases[/datum/gas/carbon_dioxide][MOLES])
+ ADD_MOLES(/datum/gas/oxygen, air, (pulse_strength/2000)-air.gases[/datum/gas/oxygen][MOLES])
+ ADD_MOLES(/datum/gas/pluoxium, air, pulse_strength/4000)
/turf/open/proc/break_tile(force, allow_base)
LAZYINITLIST(damage_overlays)
diff --git a/code/modules/atmospherics/gasmixtures/reactions.dm b/code/modules/atmospherics/gasmixtures/reactions.dm
index f5420d91e8436..48736e346cf10 100644
--- a/code/modules/atmospherics/gasmixtures/reactions.dm
+++ b/code/modules/atmospherics/gasmixtures/reactions.dm
@@ -125,8 +125,8 @@
if(burned_fuel)
energy_released += (N2O_DECOMPOSITION_ENERGY_RELEASED * burned_fuel)
- ADJUST_MOLES(/datum/gas/oxygen, air, burned_fuel * 0.5)
- ADJUST_MOLES(/datum/gas/nitrogen, air, burned_fuel)
+ ADD_MOLES(/datum/gas/oxygen, air, burned_fuel * 0.5)
+ ADD_MOLES(/datum/gas/nitrogen, air, burned_fuel)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
@@ -162,7 +162,7 @@
burned_fuel = cached_gases[/datum/gas/oxygen][MOLES] / TRITIUM_BURN_OXY_FACTOR
cached_gases[/datum/gas/tritium][MOLES] -= burned_fuel
- ADJUST_MOLES(/datum/gas/water_vapor, air, burned_fuel/TRITIUM_BURN_OXY_FACTOR)
+ ADD_MOLES(/datum/gas/water_vapor, air, burned_fuel/TRITIUM_BURN_OXY_FACTOR)
energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel)
cached_results["fire"] += burned_fuel
@@ -173,7 +173,7 @@
cached_gases[/datum/gas/tritium][MOLES] -= burned_fuel / TRITIUM_BURN_TRIT_FACTOR
cached_gases[/datum/gas/oxygen][MOLES] -= burned_fuel
- ADJUST_MOLES(/datum/gas/water_vapor, air, burned_fuel/TRITIUM_BURN_OXY_FACTOR)
+ ADD_MOLES(/datum/gas/water_vapor, air, burned_fuel/TRITIUM_BURN_OXY_FACTOR)
energy_released += (FIRE_HYDROGEN_ENERGY_RELEASED * burned_fuel)
cached_results["fire"] += burned_fuel * 10
@@ -253,10 +253,10 @@
cached_gases[/datum/gas/plasma][MOLES] = QUANTIZE(cached_gases[/datum/gas/plasma][MOLES] - plasma_burn_rate)
cached_gases[/datum/gas/oxygen][MOLES] = QUANTIZE(cached_gases[/datum/gas/oxygen][MOLES] - (plasma_burn_rate * oxygen_burn_rate))
if (super_saturation)
- ADJUST_MOLES(/datum/gas/tritium, air, plasma_burn_rate)
+ ADD_MOLES(/datum/gas/tritium, air, plasma_burn_rate)
else
- ADJUST_MOLES(/datum/gas/carbon_dioxide, air, plasma_burn_rate*0.75)
- ADJUST_MOLES(/datum/gas/water_vapor, air, plasma_burn_rate*0.25)
+ ADD_MOLES(/datum/gas/carbon_dioxide, air, plasma_burn_rate*0.75)
+ ADD_MOLES(/datum/gas/water_vapor, air, plasma_burn_rate*0.25)
energy_released += FIRE_PLASMA_ENERGY_RELEASED * (plasma_burn_rate)
@@ -350,15 +350,15 @@
thermal_energy = middle_energy * 10 ** log(FUSION_ENERGY_TRANSLATION_EXPONENT, (thermal_energy + bowdlerized_reaction_energy) / middle_energy)
//The reason why you should set up a tritium production line.
- ADJUST_MOLES(/datum/gas/tritium, air, -FUSION_TRITIUM_MOLES_USED)
+ REMOVE_MOLES(/datum/gas/tritium, air, 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
var/standard_waste_gas_output = scale_factor * (FUSION_TRITIUM_CONVERSION_COEFFICIENT*FUSION_TRITIUM_MOLES_USED)
if(delta_plasma > 0)
- ADJUST_MOLES(/datum/gas/water_vapor, air, standard_waste_gas_output)
+ ADD_MOLES(/datum/gas/water_vapor, air, standard_waste_gas_output)
else
- ADJUST_MOLES(/datum/gas/bz, air, standard_waste_gas_output)
- ADJUST_MOLES(/datum/gas/oxygen, air, standard_waste_gas_output) //Oxygen is a bit touchy subject
+ ADD_MOLES(/datum/gas/bz, air, standard_waste_gas_output)
+ ADD_MOLES(/datum/gas/oxygen, air, standard_waste_gas_output) //Oxygen is a bit touchy subject
if(reaction_energy)
if(location)
@@ -404,7 +404,7 @@
cached_gases[/datum/gas/oxygen][MOLES] -= heat_efficiency
cached_gases[/datum/gas/nitrogen][MOLES] -= heat_efficiency
cached_gases[/datum/gas/bz][MOLES] -= heat_efficiency * 0.05 //bz gets consumed to balance the nitryl production and not make it too common and/or easy
- ADJUST_MOLES(/datum/gas/nitryl, air, heat_efficiency)
+ ADD_MOLES(/datum/gas/nitryl, air, heat_efficiency)
if(energy_used > 0)
var/new_heat_capacity = air.heat_capacity()
@@ -433,10 +433,10 @@
if ((cached_gases[/datum/gas/nitrous_oxide][MOLES] - reaction_efficency < 0 )|| (cached_gases[/datum/gas/plasma][MOLES] - (2 * reaction_efficency) < 0) || energy_released <= 0) //Shouldn't produce gas from nothing.
return NO_REACTION
- ADJUST_MOLES(/datum/gas/bz, air, reaction_efficency * 2.5)
+ ADD_MOLES(/datum/gas/bz, air, reaction_efficency * 2.5)
if(reaction_efficency == cached_gases[/datum/gas/nitrous_oxide][MOLES])
- cached_gases[/datum/gas/bz][MOLES] -= min(pressure, 0.5)
- ADJUST_MOLES(/datum/gas/oxygen, air, min(pressure, 0.5))
+ REMOVE_MOLES(/datum/gas/bz, air, min(pressure, 0.5))
+ ADD_MOLES(/datum/gas/oxygen, air, min(pressure, 0.5))
cached_gases[/datum/gas/nitrous_oxide][MOLES] -= reaction_efficency
cached_gases[/datum/gas/plasma][MOLES] -= 2 * reaction_efficency
@@ -468,7 +468,7 @@
return NO_REACTION
cached_gases[/datum/gas/tritium][MOLES] -= heat_scale
cached_gases[/datum/gas/nitryl][MOLES] -= heat_scale
- ADJUST_MOLES(/datum/gas/stimulum, air, heat_scale*0.75)
+ ADD_MOLES(/datum/gas/stimulum, air, heat_scale*0.75)
if(stim_energy_change)
var/new_heat_capacity = air.heat_capacity()
@@ -535,11 +535,11 @@
var/pluox_used = min(STIM_BALL_GAS_AMOUNT/GET_MOLES(/datum/gas/plasma, air),GET_MOLES(/datum/gas/pluoxium, air))
var/energy_released = stim_used*STIMULUM_HEAT_SCALE//Stimulum has a lot of stored energy, and breaking it up releases some of it
location.fire_nuclear_particle(ball_shot_angle)
- ADJUST_MOLES(/datum/gas/carbon_dioxide, air, 4*pluox_used)
- ADJUST_MOLES(/datum/gas/nitrogen, air, 8*stim_used)
- ADJUST_MOLES(/datum/gas/pluoxium, air, -pluox_used)
- ADJUST_MOLES(/datum/gas/stimulum, air, -stim_used)
- ADJUST_MOLES(/datum/gas/plasma, air, -min(GET_MOLES(/datum/gas/plasma, air)/2,30))
+ ADD_MOLES(/datum/gas/carbon_dioxide, air, 4*pluox_used)
+ ADD_MOLES(/datum/gas/nitrogen, air, 8*stim_used)
+ REMOVE_MOLES(/datum/gas/pluoxium, air, pluox_used)
+ REMOVE_MOLES(/datum/gas/stimulum, air, stim_used)
+ REMOVE_MOLES(/datum/gas/plasma, air, min(GET_MOLES(/datum/gas/plasma, air)/2,30))
if(energy_released)
var/new_heat_capacity = air.heat_capacity()
if(new_heat_capacity > MINIMUM_HEAT_CAPACITY)
diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm
index c6691a56f9cb8..6a287b3ab859b 100644
--- a/code/modules/atmospherics/machinery/datum_pipeline.dm
+++ b/code/modules/atmospherics/machinery/datum_pipeline.dm
@@ -281,7 +281,7 @@
//gas transfer
for(var/giver_id in giver_gases)
var/giver_gas_data = giver_gases[giver_id]
- ADJUST_MOLES(giver_id, total_gas_mixture, giver_gas_data[MOLES])
+ ADD_MOLES(giver_id, total_gas_mixture, giver_gas_data[MOLES])
total_heat_capacity += giver_gas_data[MOLES] * giver_gas_data[GAS_META][META_GAS_SPECIFIC_HEAT]
total_thermal_energy += THERMAL_ENERGY(gas_mixture)
diff --git a/code/modules/events/spacevine.dm b/code/modules/events/spacevine.dm
index 4db4dd687ac2c..0f0f0e18fc1b9 100644
--- a/code/modules/events/spacevine.dm
+++ b/code/modules/events/spacevine.dm
@@ -241,7 +241,7 @@
var/turf/open/floor/T = holder.loc
if(istype(T))
var/datum/gas_mixture/GM = T.air
- ADJUST_MOLES(/datum/gas/carbon_dioxide, GM, GET_MOLES(/datum/gas/carbon_dioxide, GM) - severity * holder.energy)
+ REMOVE_MOLES(/datum/gas/carbon_dioxide, GM, severity * holder.energy - GET_MOLES(/datum/gas/carbon_dioxide, GM))
/datum/spacevine_mutation/plasma_eater
name = "toxins consuming"
diff --git a/code/modules/mob/living/simple_animal/bot/atmosbot.dm b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
index 7b5e4529bf5c5..6afcf1fb5cd0b 100644
--- a/code/modules/mob/living/simple_animal/bot/atmosbot.dm
+++ b/code/modules/mob/living/simple_animal/bot/atmosbot.dm
@@ -230,7 +230,7 @@
for(var/G in gasses)
if(gasses[G])
var/moles_in_atmos = GET_MOLES(G, environment)
- ADJUST_MOLES(G, environment, -min(moles_in_atmos, ATMOSBOT_MAX_SCRUB_CHANGE))
+ REMOVE_MOLES(G, environment, min(moles_in_atmos, ATMOSBOT_MAX_SCRUB_CHANGE))
/mob/living/simple_animal/bot/atmosbot/proc/deploy_holobarrier()
if(deployed_holobarrier)
diff --git a/code/modules/mob/living/simple_animal/slime/life.dm b/code/modules/mob/living/simple_animal/slime/life.dm
index ee9e1e35d71b5..80599f13d597d 100644
--- a/code/modules/mob/living/simple_animal/slime/life.dm
+++ b/code/modules/mob/living/simple_animal/slime/life.dm
@@ -100,8 +100,8 @@
if(transformeffects & SLIME_EFFECT_DARK_PURPLE)
var/amt = is_adult ? 30 : 15
var/plas_amt = min(amt,GET_MOLES(/datum/gas/plasma, environment))
- ADJUST_MOLES(/datum/gas/plasma, environment, -plas_amt)
- ADJUST_MOLES(/datum/gas/oxygen, environment, plas_amt)
+ REMOVE_MOLES(/datum/gas/plasma, environment, plas_amt)
+ ADD_MOLES(/datum/gas/oxygen, environment, plas_amt)
adjustBruteLoss(plas_amt ? -2 : 0)
switch(stat)
diff --git a/code/modules/power/singularity/collector.dm b/code/modules/power/singularity/collector.dm
index 3d1324670f89e..b483f923b6897 100644
--- a/code/modules/power/singularity/collector.dm
+++ b/code/modules/power/singularity/collector.dm
@@ -59,8 +59,8 @@
eject()
else
var/gasdrained = min(powerproduction_drain*drainratio*delta_time,GET_MOLES(/datum/gas/plasma, loaded_tank.air_contents))
- ADJUST_MOLES(/datum/gas/plasma, loaded_tank.air_contents, -gasdrained)
- ADJUST_MOLES(/datum/gas/tritium, loaded_tank.air_contents, gasdrained)
+ REMOVE_MOLES(/datum/gas/plasma, loaded_tank.air_contents, gasdrained)
+ ADD_MOLES(/datum/gas/tritium, loaded_tank.air_contents, gasdrained)
var/power_produced = RAD_COLLECTOR_OUTPUT
add_avail(power_produced)
stored_energy-=power_produced
diff --git a/code/modules/research/xenobiology/crossbreeding/_structures.dm b/code/modules/research/xenobiology/crossbreeding/_structures.dm
index 1e02629c418aa..2ddb3e7931dc7 100644
--- a/code/modules/research/xenobiology/crossbreeding/_structures.dm
+++ b/code/modules/research/xenobiology/crossbreeding/_structures.dm
@@ -237,7 +237,7 @@ GLOBAL_LIST_EMPTY(bluespace_slime_crystals)
var/datum/gas_mixture/air = open_turf.return_air()
if(GET_MOLES(/datum/gas/plasma, air) > 15)
- ADJUST_MOLES(/datum/gas/plasma, air, -15)
+ REMOVE_MOLES(/datum/gas/plasma, air, 15)
new /obj/item/stack/sheet/mineral/plasma(open_turf)
/obj/structure/slime_crystal/darkpurple/Destroy()
diff --git a/code/modules/surgery/organs/lungs.dm b/code/modules/surgery/organs/lungs.dm
index c5d09c8a8e11b..2a4c4c2e118d5 100644
--- a/code/modules/surgery/organs/lungs.dm
+++ b/code/modules/surgery/organs/lungs.dm
@@ -291,14 +291,14 @@
if (gas_breathed > gas_stimulation_min)
H.reagents.add_reagent(/datum/reagent/nitryl,1)
- SAFE_REMOVE_MOLES(/datum/gas/nitryl, breath, gas_breathed)
+ REMOVE_MOLES(/datum/gas/nitryl, breath, gas_breathed)
// Stimulum
gas_breathed = PP(breath,/datum/gas/stimulum)
if (gas_breathed > gas_stimulation_min)
var/existing = H.reagents.get_reagent_amount(/datum/reagent/stimulum)
H.reagents.add_reagent(/datum/reagent/stimulum, max(0, 5 - existing))
- SAFE_REMOVE_MOLES(/datum/gas/stimulum, breath, gas_breathed)
+ REMOVE_MOLES(/datum/gas/stimulum, breath, gas_breathed)
handle_breath_temperature(breath, H)
return TRUE
From ee2a41af522a1af69d609a075463829734541846 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 2 Sep 2024 15:07:30 +0200
Subject: [PATCH 090/114] joelogbybolb special
---
_maps/_basemap.dm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/_maps/_basemap.dm b/_maps/_basemap.dm
index fc57006ca2192..f56eb5147fb1d 100644
--- a/_maps/_basemap.dm
+++ b/_maps/_basemap.dm
@@ -1,4 +1,4 @@
-#define LOWMEMORYMODE //uncomment this to load centcom and runtime station and thats it.
+//#define LOWMEMORYMODE //uncomment this to load centcom and runtime station and thats it.
// uncomment this for a map you need to use
// #define FORCE_MAP "corgstation"
From 289ac180f9c18233b50f5001ae795533d342d728 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 2 Sep 2024 15:12:16 +0200
Subject: [PATCH 091/114] deltastation being silly
---
_maps/map_files/Deltastation/DeltaStation2.dmm | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/_maps/map_files/Deltastation/DeltaStation2.dmm b/_maps/map_files/Deltastation/DeltaStation2.dmm
index e783827adc2a4..192905d0a4518 100644
--- a/_maps/map_files/Deltastation/DeltaStation2.dmm
+++ b/_maps/map_files/Deltastation/DeltaStation2.dmm
@@ -41647,7 +41647,7 @@
},
/turf/open/floor/plating{
initial_gas_mix = "o2=0.01;n2=0.01;TEMP=2.7";
- initial_temperature = 2.7;
+ temperature = 2.7;
luminosity = 2
},
/area/security/main)
@@ -78888,7 +78888,7 @@
},
/turf/open/floor/plating{
initial_gas_mix = "o2=0.01;n2=0.01;TEMP=2.7";
- initial_temperature = 2.7;
+ temperature = 2.7;
luminosity = 2
},
/area/security/brig)
@@ -92798,7 +92798,7 @@
},
/turf/open/floor/plating{
initial_gas_mix = "o2=0.01;n2=0.01;TEMP=2.7";
- initial_temperature = 2.7;
+ temperature = 2.7;
luminosity = 2
},
/area/security/main)
@@ -94187,7 +94187,7 @@
},
/turf/open/floor/plating{
initial_gas_mix = "o2=0.01;n2=0.01;TEMP=2.7";
- initial_temperature = 2.7;
+ temperature = 2.7;
luminosity = 2
},
/area/security/brig)
From d67a07b22f379e3443d0b806e2847d57421cbeb7 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 2 Sep 2024 16:18:09 +0200
Subject: [PATCH 092/114] Skibidi toilet is real. It appeared in my room one
day.
---
code/modules/mob/living/carbon/life.dm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm
index aadbd883f7ce2..2247d1a84d456 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -209,8 +209,8 @@
oxygen_used = GET_MOLES(/datum/gas/oxygen, breath)
clear_alert("not_enough_oxy")
- breath.gases[/datum/gas/oxygen][MOLES] += -oxygen_used
- breath.gases[/datum/gas/carbon_dioxide][MOLES] += oxygen_used
+ ADD_MOLES(breath, /datum/gas/carbon_dioxide, oxygen_used)
+ REMOVE_MOLES(breath, /datum/gas/oxygen, oxygen_used)
//CARBON DIOXIDE
if(CO2_partialpressure > safe_co2_max)
From bcdc28dd817de19f1ab9a9738ee1565248bed53c Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 2 Sep 2024 16:19:11 +0200
Subject: [PATCH 093/114] mesa very stupid
---
code/modules/mob/living/carbon/life.dm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/code/modules/mob/living/carbon/life.dm b/code/modules/mob/living/carbon/life.dm
index 2247d1a84d456..4c11bb73f04f1 100644
--- a/code/modules/mob/living/carbon/life.dm
+++ b/code/modules/mob/living/carbon/life.dm
@@ -209,8 +209,8 @@
oxygen_used = GET_MOLES(/datum/gas/oxygen, breath)
clear_alert("not_enough_oxy")
- ADD_MOLES(breath, /datum/gas/carbon_dioxide, oxygen_used)
- REMOVE_MOLES(breath, /datum/gas/oxygen, oxygen_used)
+ ADD_MOLES(/datum/gas/carbon_dioxide, breath, oxygen_used)
+ REMOVE_MOLES(/datum/gas/oxygen, breath, oxygen_used)
//CARBON DIOXIDE
if(CO2_partialpressure > safe_co2_max)
From 907c1f4bf5308b5bbe42bcc8904d75050b4b32f9 Mon Sep 17 00:00:00 2001
From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
Date: Mon, 27 Mar 2023 11:24:49 -0700
Subject: [PATCH 094/114] Optimizes some gas_mixture procs, Optimizes pipeline
processing significantly by 33% (#74233)
It is faster to operate on a gas list, especially if cached, then it is
to operate on a datum.
Doing this cause I'm seeing cost in merge() post #74230
Hits on a few other important places too. self_breakdown and such. Worth
it IMO
Could in theory go further by caching the global list. I'm tempted I
admit but it needs profiling first and it's late
EDIT: I have not slept, and have gone tooo far
[Micros /gas_mixture/copy and copy_from, adds a new proc to handle
copying with a ratio,
copy_from_ratio](https://github.com/tgstation/tgstation/pull/74233/commits/91da0003daa9485962525d3e6bc9170a4c09876b)
[91da000](https://github.com/tgstation/tgstation/pull/74233/commits/91da0003daa9485962525d3e6bc9170a4c09876b)
The ADD_GAS sidestep saves us 0.1 seconds of init (used to at least.
Ensuring we don't break archive is gonna have a cost. I don't want to
profile this so I'll estimate maybe 0.05 seconds). The faster version of
copy_from is just well, better, and helps to avoid stupid
[Optimizes pipeline
processing](https://github.com/tgstation/tgstation/pull/74233/commits/bf5a2d2d60554da2ce5fa1ac5f6c4179f6208cb2)
[bf5a2d2](https://github.com/tgstation/tgstation/pull/74233/commits/bf5a2d2d60554da2ce5fa1ac5f6c4179f6208cb2)
I haven't slept in 36 hours. Have some atmos optimizations
Pipelines now keep track of components that require custom
reconciliation as a seperate list.
This avoids the overhead of filtering all connected atmos machinery.
Rather then relying on |= to avoid duplicate gas_mixtures, we instead
use a cycle var stored on the mix itself, which is compared with a
static unique id from reconcile_air()
This fully prevents double processing of gas, and should (hopefully)
prevent stupid dupe issues in future
Rather then summing volume on the gas mixture itself, we sum it in a
local var.
This avoids datum var accesses, and saves a slight bit of time
Instead of running THERMAL_ENERGY() (and thus heat_capacity(), which
iterates all gases in the mix AGAIN) when processing gas, we instead
just hook into the existing heat capacity calculation done inside the
giver gases loop
This saves a significant amount of time, somewhere around 30% of the
proc, I think?
This doesn't tackle the big headache here, which is the copy_from loop
at the base of the proc.
I think the solution is to convert pipelines to a sort of polling model.
Atmos components don't "own" their mix, they instead have to request a
copy of it from the pipeline datum.
This would work based off a mutually agreed upon volume amount for that
component in that process cycle.
We'd use an archived system to figure out what gases to give to
components, while removing from the real MOLES list.
We could then push gas consumption requests to the pipeline, which would
handle them, alongside volume changes, on the next process.
Not sure how I'd handle connected pipelines... Merging post reconcile
maybe?
This is a problem for tomorrow though, I need to go to bed.
Saves about 30% of pipeline costs.
Profiles taken on kilo, until each reconcile_air hits 5000 calls
[old.txt](https://github.com/tgstation/tgstation/files/11075118/Profile.results.total.time.txt)
[new.txt](https://github.com/tgstation/tgstation/files/11075133/profiler.txt)
---
code/__DEFINES/atmospherics/atmos_helpers.dm | 5 +-
code/game/turfs/change_turf.dm | 2 +-
.../environmental/LINDA_turf_tile.dm | 2 +-
.../atmospherics/gasmixtures/gas_mixture.dm | 36 ++++++++++---
.../machinery/components/components_base.dm | 2 +
.../atmospherics/machinery/datum_pipeline.dm | 54 ++++++++++++-------
6 files changed, 72 insertions(+), 29 deletions(-)
diff --git a/code/__DEFINES/atmospherics/atmos_helpers.dm b/code/__DEFINES/atmospherics/atmos_helpers.dm
index 0eddefe55fd5e..0e789557c5a72 100644
--- a/code/__DEFINES/atmospherics/atmos_helpers.dm
+++ b/code/__DEFINES/atmospherics/atmos_helpers.dm
@@ -35,7 +35,10 @@
var/list/tmp_gaslist = GLOB.gaslist_cache[gas_id]; out_list[gas_id] = tmp_gaslist.Copy();
///Adds a gas to a gas mixture but checks if is already present, faster than the same proc
-#define ASSERT_GAS(gas_id, gas_mixture) if (!gas_mixture.gases[gas_id]) { ADD_GAS(gas_id, gas_mixture.gases) };
+#define ASSERT_GAS(gas_id, gas_mixture) ASSERT_GAS_IN_LIST(gas_id, gas_mixture.gases)
+
+///Adds a gas to a gas LIST but checks if is already present, accepts a list instead of a datum, so faster if the list is locally cached
+#define ASSERT_GAS_IN_LIST(gas_id, gases) if (!gases[gas_id]) { ADD_GAS(gas_id, gases) };
///Adds a gas to a gas LIST but checks if is already present, accepts a list instead of a datum, so faster if the list is locally cached
#define ASSERT_GAS_IN_LIST(gas_id, gases) if (!gases[gas_id]) { ADD_GAS(gas_id, gases) };
diff --git a/code/game/turfs/change_turf.dm b/code/game/turfs/change_turf.dm
index 2fa10eac34d11..8a09a5c6661ef 100644
--- a/code/game/turfs/change_turf.dm
+++ b/code/game/turfs/change_turf.dm
@@ -369,7 +369,7 @@ GLOBAL_LIST_INIT(blacklisted_automated_baseturfs, typecacheof(list(
var/list/giver_gases = mix.gases
for(var/giver_id in giver_gases)
- ASSERT_GAS(giver_id, total)
+ ASSERT_GAS_IN_LIST(giver_id, total_gases)
total_gases[giver_id][MOLES] += giver_gases[giver_id][MOLES]
total.temperature = energy / heat_cap
diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
index 0fea31422fb19..05fab4f6f36f4 100644
--- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
+++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
@@ -499,7 +499,7 @@
var/list/giver_gases = mix.gases
for(var/giver_id in giver_gases)
- ASSERT_GAS(giver_id, shared_mix)
+ ASSERT_GAS_IN_LIST(giver_id, shared_gases)
shared_gases[giver_id][MOLES] += giver_gases[giver_id][MOLES]
if(!imumutable_in_group)
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index 590cfa4a2c87e..444fdd8bb71db 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -34,6 +34,9 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
var/list/analyzer_results
/// Whether to call garbage_collect() on the sharer during shares, used for immutable mixtures
var/gc_share = FALSE
+ /// When this gas mixture was last touched by pipeline processing
+ /// I am sorry
+ var/pipeline_cycle = -1
/datum/gas_mixture/New(volume)
gases = new
@@ -158,7 +161,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
var/list/giver_gases = giver.gases
//gas transfer
for(var/giver_id in giver_gases)
- ASSERT_GAS(giver_id, src)
+ ASSERT_GAS_IN_LIST(giver_id, cached_gases)
cached_gases[giver_id][MOLES] += giver_gases[giver_id][MOLES]
return TRUE
@@ -251,20 +254,41 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
///Creates new, identical gas mixture
///Returns: duplicate gas mixture
/datum/gas_mixture/proc/copy()
- var/list/cached_gases = gases
+ // Type as /list/list to make spacemandmm happy with the inlined access we do down there
+ var/list/list/cached_gases = gases
var/datum/gas_mixture/copy = new type
var/list/copy_gases = copy.gases
copy.temperature = temperature
for(var/id in cached_gases)
- ADD_GAS(id, copy.gases)
- copy_gases[id][MOLES] = cached_gases[id][MOLES]
+ // Sort of a sideways way of doing ADD_GAS()
+ // Faster tho, gotta save those cpu cycles
+ copy_gases[id] = cached_gases[id].Copy()
+ copy_gases[id][ARCHIVE] = 0
return copy
+
+///Copies variables from sample
+///Returns: TRUE if we are mutable, FALSE otherwise
+/datum/gas_mixture/proc/copy_from(datum/gas_mixture/sample)
+ var/list/cached_gases = gases //accessing datum vars is slower than proc vars
+ // Type as /list/list to make spacemandmm happy with the inlined access we do down there
+ var/list/list/sample_gases = sample.gases
+
+ //remove all gases
+ cached_gases.Cut()
+
+ temperature = sample.temperature
+ for(var/id in sample_gases)
+ cached_gases[id] = sample_gases[id].Copy()
+ cached_gases[id][ARCHIVE] = 0
+
+ return TRUE
+
///Copies variables from sample, moles multiplicated by partial
///Returns: TRUE if we are mutable, FALSE otherwise
-/datum/gas_mixture/proc/copy_from(datum/gas_mixture/sample, partial = 1)
+/datum/gas_mixture/proc/copy_from_ratio(datum/gas_mixture/sample, partial = 1)
var/list/cached_gases = gases //accessing datum vars is slower than proc vars
var/list/sample_gases = sample.gases
@@ -273,7 +297,7 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
temperature = sample.temperature
for(var/id in sample_gases)
- ASSERT_GAS(id,src)
+ ASSERT_GAS_IN_LIST(id, cached_gases)
cached_gases[id][MOLES] = sample_gases[id][MOLES] * partial
return 1
diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm
index 95c81d87da7fd..c363a8a6df8e2 100644
--- a/code/modules/atmospherics/machinery/components/components_base.dm
+++ b/code/modules/atmospherics/machinery/components/components_base.dm
@@ -130,6 +130,8 @@
parents[i] = null // Disconnects from the machinery side.
reference.other_atmos_machines -= src
+ if(custom_reconcilation)
+ reference.require_custom_reconcilation -= src
/**
* We explicitly qdel pipeline when this particular pipeline
diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm
index 6a287b3ab859b..95370c67cbb31 100644
--- a/code/modules/atmospherics/machinery/datum_pipeline.dm
+++ b/code/modules/atmospherics/machinery/datum_pipeline.dm
@@ -4,6 +4,10 @@
var/list/obj/machinery/atmospherics/pipe/members
var/list/obj/machinery/atmospherics/components/other_atmos_machines
+ /// List of other_atmos_machines that have custom_reconcilation set
+ /// We're essentially caching this to avoid needing to filter over it when processing our machines
+ var/list/obj/machinery/atmospherics/components/require_custom_reconcilation
+
///Should we equalize air amoung all our members?
var/update = TRUE
@@ -14,6 +18,7 @@
other_airs = list()
members = list()
other_atmos_machines = list()
+ require_custom_reconcilation = list()
SSair.networks += src
/datum/pipeline/Destroy()
@@ -121,6 +126,8 @@
/datum/pipeline/proc/add_machinery_member(obj/machinery/atmospherics/components/considered_component)
other_atmos_machines |= considered_component
+ if(considered_component.custom_reconcilation)
+ require_custom_reconcilation |= considered_component
var/list/returned_airs = considered_component.return_pipenet_airs(src)
if (!length(returned_airs) || (null in returned_airs))
stack_trace("add_machinery_member: Nonexistent (empty list) or null machinery gasmix added to pipeline datum from [considered_component] \
@@ -156,10 +163,13 @@
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)
+ if(reference_component.custom_reconcilation)
+ require_custom_reconcilation |= reference_component
other_atmos_machines |= parent_pipeline.other_atmos_machines
other_airs |= parent_pipeline.other_airs
parent_pipeline.members.Cut()
parent_pipeline.other_atmos_machines.Cut()
+ parent_pipeline.require_custom_reconcilation.Cut()
update = TRUE
qdel(parent_pipeline)
@@ -182,7 +192,7 @@
for(var/obj/machinery/atmospherics/pipe/member in members)
member.air_temporary = new
member.air_temporary.volume = member.volume
- member.air_temporary.copy_from(air, member.volume / air.volume)
+ member.air_temporary.copy_from_ratio(air, member.volume / air.volume)
member.air_temporary.temperature = air.temperature
@@ -255,43 +265,47 @@
continue
gas_mixture_list += pipeline.other_airs
gas_mixture_list += pipeline.air
- for(var/atmosmch in pipeline.other_atmos_machines)
- if (istype(atmosmch, /obj/machinery/atmospherics/components/binary/valve))
- var/obj/machinery/atmospherics/components/binary/valve/considered_valve = atmosmch
- if(considered_valve.on)
- pipeline_list |= considered_valve.parents[1]
- pipeline_list |= considered_valve.parents[2]
- else if (istype(atmosmch, /obj/machinery/atmospherics/components/unary/portables_connector))
- var/obj/machinery/atmospherics/components/unary/portables_connector/considered_connector = atmosmch
- if(considered_connector.connected_device)
- gas_mixture_list += considered_connector.connected_device.return_air()
+ for(var/obj/machinery/atmospherics/components/atmos_machine as anything in pipeline.require_custom_reconcilation)
+ pipeline_list |= atmos_machine.return_pipenets_for_reconcilation(src)
+ gas_mixture_list += atmos_machine.return_airs_for_reconcilation(src)
var/total_thermal_energy = 0
var/total_heat_capacity = 0
var/datum/gas_mixture/total_gas_mixture = new(0)
- for(var/mixture in gas_mixture_list)
- var/datum/gas_mixture/gas_mixture = mixture
- total_gas_mixture.volume += gas_mixture.volume
+ var/volume_sum = 0
+
+ var/static/process_id = 0
+ process_id = (process_id + 1) % (SHORT_REAL_LIMIT - 1)
+
+ for(var/datum/gas_mixture/gas_mixture as anything in gas_mixture_list)
+ // Ensure we never walk the same mix twice
+ if(gas_mixture.pipeline_cycle == process_id)
+ gas_mixture_list -= gas_mixture
+ continue
+ gas_mixture.pipeline_cycle = process_id
+ volume_sum += gas_mixture.volume
// This is sort of a combined merge + heat_capacity calculation
var/list/giver_gases = gas_mixture.gases
+ var/heat_capacity = 0
//gas transfer
for(var/giver_id in giver_gases)
var/giver_gas_data = giver_gases[giver_id]
+
ADD_MOLES(giver_id, total_gas_mixture, giver_gas_data[MOLES])
- total_heat_capacity += giver_gas_data[MOLES] * giver_gas_data[GAS_META][META_GAS_SPECIFIC_HEAT]
+ heat_capacity += giver_gas_data[MOLES] * giver_gas_data[GAS_META][META_GAS_SPECIFIC_HEAT]
- total_thermal_energy += THERMAL_ENERGY(gas_mixture)
+ total_heat_capacity += heat_capacity
+ total_thermal_energy += gas_mixture.temperature * heat_capacity
total_gas_mixture.temperature = total_heat_capacity ? (total_thermal_energy / total_heat_capacity) : 0
-
+ total_gas_mixture.volume = volume_sum
total_gas_mixture.garbage_collect()
if(total_gas_mixture.volume > 0)
//Update individual gas_mixtures by volume ratio
- for(var/mixture in gas_mixture_list)
- var/datum/gas_mixture/gas_mixture = mixture
- gas_mixture.copy_from(total_gas_mixture, gas_mixture.volume / total_gas_mixture.volume)
+ for(var/datum/gas_mixture/gas_mixture as anything in gas_mixture_list)
+ gas_mixture.copy_from_ratio(total_gas_mixture, gas_mixture.volume / volume_sum)
From 7955990e4a792a70dfbb41a5f4b69cafeaa62d81 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Mon, 2 Sep 2024 17:01:59 +0200
Subject: [PATCH 095/114] fixes, still compiles
---
.../atmospherics/gasmixtures/gas_mixture.dm | 17 -----------------
.../machinery/components/components_base.dm | 2 --
.../atmospherics/machinery/datum_pipeline.dm | 13 -------------
3 files changed, 32 deletions(-)
diff --git a/code/modules/atmospherics/gasmixtures/gas_mixture.dm b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
index 444fdd8bb71db..89f0f69ec635d 100644
--- a/code/modules/atmospherics/gasmixtures/gas_mixture.dm
+++ b/code/modules/atmospherics/gasmixtures/gas_mixture.dm
@@ -286,23 +286,6 @@ GLOBAL_LIST_INIT(gaslist_cache, init_gaslist_cache())
return TRUE
-///Copies variables from sample, moles multiplicated by partial
-///Returns: TRUE if we are mutable, FALSE otherwise
-/datum/gas_mixture/proc/copy_from_ratio(datum/gas_mixture/sample, partial = 1)
- var/list/cached_gases = gases //accessing datum vars is slower than proc vars
- var/list/sample_gases = sample.gases
-
- //remove all gases not in the sample
- cached_gases &= sample_gases
-
- temperature = sample.temperature
- for(var/id in sample_gases)
- ASSERT_GAS_IN_LIST(id, cached_gases)
- cached_gases[id][MOLES] = sample_gases[id][MOLES] * partial
-
- return 1
-
-
///Copies variables from sample, moles multiplicated by partial
///Returns: TRUE if we are mutable, FALSE otherwise
/datum/gas_mixture/proc/copy_from_ratio(datum/gas_mixture/sample, partial = 1)
diff --git a/code/modules/atmospherics/machinery/components/components_base.dm b/code/modules/atmospherics/machinery/components/components_base.dm
index c363a8a6df8e2..95c81d87da7fd 100644
--- a/code/modules/atmospherics/machinery/components/components_base.dm
+++ b/code/modules/atmospherics/machinery/components/components_base.dm
@@ -130,8 +130,6 @@
parents[i] = null // Disconnects from the machinery side.
reference.other_atmos_machines -= src
- if(custom_reconcilation)
- reference.require_custom_reconcilation -= src
/**
* We explicitly qdel pipeline when this particular pipeline
diff --git a/code/modules/atmospherics/machinery/datum_pipeline.dm b/code/modules/atmospherics/machinery/datum_pipeline.dm
index 95370c67cbb31..0a94e55813383 100644
--- a/code/modules/atmospherics/machinery/datum_pipeline.dm
+++ b/code/modules/atmospherics/machinery/datum_pipeline.dm
@@ -4,9 +4,6 @@
var/list/obj/machinery/atmospherics/pipe/members
var/list/obj/machinery/atmospherics/components/other_atmos_machines
- /// List of other_atmos_machines that have custom_reconcilation set
- /// We're essentially caching this to avoid needing to filter over it when processing our machines
- var/list/obj/machinery/atmospherics/components/require_custom_reconcilation
///Should we equalize air amoung all our members?
@@ -18,7 +15,6 @@
other_airs = list()
members = list()
other_atmos_machines = list()
- require_custom_reconcilation = list()
SSair.networks += src
/datum/pipeline/Destroy()
@@ -126,8 +122,6 @@
/datum/pipeline/proc/add_machinery_member(obj/machinery/atmospherics/components/considered_component)
other_atmos_machines |= considered_component
- if(considered_component.custom_reconcilation)
- require_custom_reconcilation |= considered_component
var/list/returned_airs = considered_component.return_pipenet_airs(src)
if (!length(returned_airs) || (null in returned_airs))
stack_trace("add_machinery_member: Nonexistent (empty list) or null machinery gasmix added to pipeline datum from [considered_component] \
@@ -163,13 +157,10 @@
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)
- if(reference_component.custom_reconcilation)
- require_custom_reconcilation |= reference_component
other_atmos_machines |= parent_pipeline.other_atmos_machines
other_airs |= parent_pipeline.other_airs
parent_pipeline.members.Cut()
parent_pipeline.other_atmos_machines.Cut()
- parent_pipeline.require_custom_reconcilation.Cut()
update = TRUE
qdel(parent_pipeline)
@@ -265,10 +256,6 @@
continue
gas_mixture_list += pipeline.other_airs
gas_mixture_list += pipeline.air
- for(var/obj/machinery/atmospherics/components/atmos_machine as anything in pipeline.require_custom_reconcilation)
- pipeline_list |= atmos_machine.return_pipenets_for_reconcilation(src)
- gas_mixture_list += atmos_machine.return_airs_for_reconcilation(src)
-
var/total_thermal_energy = 0
var/total_heat_capacity = 0
var/datum/gas_mixture/total_gas_mixture = new(0)
From 2187181b2d6199c1d17233d75dce0886e0f16996 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Tue, 3 Sep 2024 17:58:54 +0200
Subject: [PATCH 096/114] no dilly-dallying
---
code/__DEFINES/atmospherics/atmos_helpers.dm | 3 ---
1 file changed, 3 deletions(-)
diff --git a/code/__DEFINES/atmospherics/atmos_helpers.dm b/code/__DEFINES/atmospherics/atmos_helpers.dm
index 0e789557c5a72..ba94118304a22 100644
--- a/code/__DEFINES/atmospherics/atmos_helpers.dm
+++ b/code/__DEFINES/atmospherics/atmos_helpers.dm
@@ -40,9 +40,6 @@
///Adds a gas to a gas LIST but checks if is already present, accepts a list instead of a datum, so faster if the list is locally cached
#define ASSERT_GAS_IN_LIST(gas_id, gases) if (!gases[gas_id]) { ADD_GAS(gas_id, gases) };
-///Adds a gas to a gas LIST but checks if is already present, accepts a list instead of a datum, so faster if the list is locally cached
-#define ASSERT_GAS_IN_LIST(gas_id, gases) if (!gases[gas_id]) { ADD_GAS(gas_id, gases) };
-
//prefer this to gas_mixture/total_moles in performance critical areas
///Calculate the total moles of the gas mixture, faster than the proc, good for performance critical areas
#define TOTAL_MOLES(cached_gases, out_var)\
From ada712f8524d95e3429ee1bc562e84d80a0a36b4 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sun, 8 Sep 2024 13:31:09 +0200
Subject: [PATCH 097/114] A slight dilly dally, a silly even
---
code/__byond_version_compat.dm | 4 ++--
code/modules/unit_tests/_unit_tests.dm | 5 -----
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/code/__byond_version_compat.dm b/code/__byond_version_compat.dm
index fc667f8b9dd82..bb355bba6e201 100644
--- a/code/__byond_version_compat.dm
+++ b/code/__byond_version_compat.dm
@@ -20,9 +20,9 @@
/savefile/byond_version = MIN_COMPILER_VERSION
#endif
-#if defined(FASTDMM) || defined(CIBUILDING)
+// #if defined(FASTDMM) || defined(CIBUILDING)
#define YES_I_WANT_515
-#endif
+// #endif
// Temporary 515 block until it is completely compatible.
// AnturK says there are issues with savefiles that would make it dangerous to test merge,
// and so this check is in place to stop serious damage.
diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm
index 6774dc923745b..6abd9ac55fb68 100644
--- a/code/modules/unit_tests/_unit_tests.dm
+++ b/code/modules/unit_tests/_unit_tests.dm
@@ -23,10 +23,6 @@
#include "crafting_tests.dm"
#include "breath.dm"
-// Del the World.
-// This unit test creates and qdels almost every atom in the code, checking for errors with initialization and harddels on deletion.
-// It is disabled by default for now due to the large amount of consistent errors it produces. Run the "dm: find hard deletes" task to enable it.
-#ifdef REFERENCE_TRACKING_FAST
/*
#include "create_and_destroy.dm"
*/
@@ -39,7 +35,6 @@
#endif
#include "food_edibility_check.dm"
-#include "gas_transfer.dm"
#include "gamemode_sanity.dm"
#include "greyscale_config.dm"
#include "heretic_knowledge.dm"
From 2a9dbc3e7d4d01e470c58f801156ec7932fad71a Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sun, 8 Sep 2024 13:39:11 +0200
Subject: [PATCH 098/114] Delete .github/workflows/continuous_integration.yml
---
.github/workflows/continuous_integration.yml | 136 -------------------
1 file changed, 136 deletions(-)
delete mode 100644 .github/workflows/continuous_integration.yml
diff --git a/.github/workflows/continuous_integration.yml b/.github/workflows/continuous_integration.yml
deleted file mode 100644
index 43d94ece5f6d5..0000000000000
--- a/.github/workflows/continuous_integration.yml
+++ /dev/null
@@ -1,136 +0,0 @@
-name: Run tests
-
-on:
- workflow_dispatch:
-# push:
-# paths-ignore:
-# - "html/changelogs/**"
-# - "html/changelog.html"
- pull_request:
- branches:
- - master
- merge_group:
- branches:
- - master
-
-jobs:
- run_linters:
- runs-on: ubuntu-20.04
- steps:
- - uses: actions/checkout@v3
- - name: Python setup
- uses: actions/setup-python@v4
- with:
- python-version: "3.11"
- cache: 'pip'
- - uses: actions/setup-node@v3
- with:
- node-version: 18
- cache: yarn
- cache-dependency-path: tgui/yarn.lock
- - name: Cache SpacemanDMM
- id: cache-spacemandmm
- uses: actions/cache@v3
- with:
- path: ~/dreamchecker
- key: ${{ runner.os }}-spacemandmm-cache-${{ hashFiles('dependencies.sh') }}
- - name: Install SpacemanDMM
- if: steps.cache-spacemandmm.outputs.cache-hit != 'true'
- run: bash tools/ci/install_spaceman_dmm.sh dreamchecker
- - name: Install Tools
- run: |
- pip install setuptools
- pip install -r tools/requirements.txt
- - name: Run Linters
- run: |
- bash tools/ci/check_filedirs.sh beestation.dme
- bash tools/ci/check_changelogs.sh
- find . -name "*.php" -print0 | xargs -0 -n1 php -l
- find . -name "*.json" -not -path "*/node_modules/*" -print0 | xargs -0 python ./tools/json_verifier.py
- bash tools/ci/check_grep.sh
- tools/build/build --ci lint tgui-test
- tools/bootstrap/python -m dmi.test
- tools/bootstrap/python -m mapmerge2.dmm_test
- ~/dreamchecker
- compile_all_maps:
- runs-on: ubuntu-20.04
- steps:
- - uses: actions/checkout@v3
- - name: Setup cache
- id: cache-byond
- uses: actions/cache@v3
- with:
- path: ~/BYOND
- key: ${{ runner.os }}-byond-cache-${{ hashFiles('Dockerfile') }}
- - name: Install BYOND
- if: steps.cache-byond.outputs.cache-hit != 'true'
- run: bash tools/ci/install_byond.sh
- - name: Compile All Maps
- run: |
- source $HOME/BYOND/byond/bin/byondsetup
- python3 tools/ci/template_dm_generator.py
- tools/build/build --ci dm -DCIBUILDING -DCITESTING -DALL_MAPS
- run_all_tests:
- runs-on: ubuntu-20.04
- services:
- mariadb:
- image: mariadb:latest
- env:
- MYSQL_ROOT_PASSWORD: root
- ports:
- - 3306
- options: --health-cmd="mariadb-admin ping" --health-interval=10s --health-timeout=5s --health-retries=3
- steps:
- - uses: actions/checkout@v3
- - uses: actions/setup-node@v3
- with:
- node-version: 18
- cache: yarn
- cache-dependency-path: tgui/yarn.lock
- - name: Cache BYOND
- id: cache-byond
- uses: actions/cache@v3
- with:
- path: ~/BYOND
- key: ${{ runner.os }}-byond-cache-${{ hashFiles('Dockerfile') }}
- - name: Install BYOND
- if: steps.cache-byond.outputs.cache-hit != 'true'
- run: bash tools/ci/install_byond.sh
- - name: Setup database
- run: |
- sudo systemctl start mysql
- mysql -u root -proot -e 'CREATE DATABASE bee_ci;'
- mysql -u root -proot bee_ci < SQL/beestation_schema.sql
- - name: Install rust-g
- run: |
- sudo dpkg --add-architecture i386
- sudo apt update || true
- sudo apt install libssl1.1:i386
- bash tools/ci/install_rust_g.sh
- - name: Compile Tests
- run: |
- source $HOME/BYOND/byond/bin/byondsetup
- tools/build/build --ci dm -DCIBUILDING -DANSICOLORS
- - name: Run Tests
- run: |
- source $HOME/BYOND/byond/bin/byondsetup
- bash tools/ci/run_server.sh
- test_windows:
- runs-on: windows-latest
- steps:
- - uses: actions/checkout@v3
- - uses: actions/setup-node@v3
- with:
- node-version: 18
- cache: yarn
- cache-dependency-path: tgui/yarn.lock
- - name: Cache BYOND
- id: cache-byond
- uses: actions/cache@v3
- with:
- path: C:/byond
- key: ${{ runner.os }}-byond-cache-${{ hashFiles('dependencies.sh') }}
- - name: Compile
- run: pwsh tools/ci/build.ps1
- env:
- DM_EXE: "C:\\byond\\bin\\dm.exe"
From fafaba6d5ae33af58277e1be3e13d86df4f5385f Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sun, 8 Sep 2024 13:45:27 +0200
Subject: [PATCH 099/114] Arlongus
---
_maps/RandomZLevels/moonoutpost19.dmm | 3 +--
_maps/RandomZLevels/undergroundoutpost45.dmm | 1 -
2 files changed, 1 insertion(+), 3 deletions(-)
diff --git a/_maps/RandomZLevels/moonoutpost19.dmm b/_maps/RandomZLevels/moonoutpost19.dmm
index 928e786852ca7..45e6c481d0991 100644
--- a/_maps/RandomZLevels/moonoutpost19.dmm
+++ b/_maps/RandomZLevels/moonoutpost19.dmm
@@ -4243,10 +4243,9 @@
/turf/open/floor/iron/showroomfloor{
heat_capacity = 1e+006;
temperature = 273.15
- },
locked = 0;
name = "meat fridge";
- req_access_txt = "201"
+ req_access_txt = "201";
},
/obj/item/food/meat/slab/monkey,
/obj/item/food/meat/slab/monkey,
diff --git a/_maps/RandomZLevels/undergroundoutpost45.dmm b/_maps/RandomZLevels/undergroundoutpost45.dmm
index 112fd75ebd95a..5e647d302c4ad 100644
--- a/_maps/RandomZLevels/undergroundoutpost45.dmm
+++ b/_maps/RandomZLevels/undergroundoutpost45.dmm
@@ -1929,7 +1929,6 @@
"hU" = (
/obj/machinery/atmospherics/pipe/simple/supply/hidden{
dir = 4;
-
},
/obj/structure/table,
/obj/item/book/manual/chef_recipes,
From ed06a40a4255645d2872f6f7d559b4f26143c7cb Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sun, 8 Sep 2024 13:48:00 +0200
Subject: [PATCH 100/114] beince
---
_maps/RandomZLevels/moonoutpost19.dmm | 1 +
1 file changed, 1 insertion(+)
diff --git a/_maps/RandomZLevels/moonoutpost19.dmm b/_maps/RandomZLevels/moonoutpost19.dmm
index 45e6c481d0991..f2c629941e3a1 100644
--- a/_maps/RandomZLevels/moonoutpost19.dmm
+++ b/_maps/RandomZLevels/moonoutpost19.dmm
@@ -4236,6 +4236,7 @@
name = "kitchen Cabinet";
req_access_txt = "201"
},
+/area/awaymission/moonoutpost19/arrivals)
/obj/item/reagent_containers/food/condiment/flour,
/obj/item/reagent_containers/food/condiment/flour,
/obj/item/reagent_containers/food/condiment/sugar,
From 54f3a00219ce9516a7019f678eeb04dccb017ca6 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sun, 8 Sep 2024 13:51:29 +0200
Subject: [PATCH 101/114] Revert moonoutpost changes
---
_maps/RandomZLevels/moonoutpost19.dmm | 209 +++++++++++++-------------
1 file changed, 104 insertions(+), 105 deletions(-)
diff --git a/_maps/RandomZLevels/moonoutpost19.dmm b/_maps/RandomZLevels/moonoutpost19.dmm
index f2c629941e3a1..2cef09ba236cf 100644
--- a/_maps/RandomZLevels/moonoutpost19.dmm
+++ b/_maps/RandomZLevels/moonoutpost19.dmm
@@ -478,7 +478,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/syndicate)
"bY" = (
@@ -503,14 +503,14 @@
/obj/structure/alien/weeds,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"ca" = (
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cd" = (
@@ -524,7 +524,7 @@
dir = 8;
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" = (
@@ -537,7 +537,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cf" = (
@@ -550,7 +550,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cg" = (
@@ -562,7 +562,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"ci" = (
@@ -622,7 +622,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cp" = (
@@ -664,7 +664,7 @@
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cw" = (
@@ -719,7 +719,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/syndicate)
"cD" = (
@@ -735,7 +735,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cG" = (
@@ -790,7 +790,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cR" = (
@@ -798,7 +798,7 @@
dir = 8;
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)
"cT" = (
@@ -830,7 +830,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cW" = (
@@ -838,7 +838,7 @@
dir = 8;
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" = (
@@ -846,7 +846,7 @@
dir = 8;
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" = (
@@ -862,7 +862,7 @@
/turf/open/floor/iron{
dir = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cZ" = (
@@ -920,7 +920,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/syndicate)
"df" = (
@@ -941,7 +941,7 @@
/turf/open/floor/iron{
dir = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dh" = (
@@ -984,7 +984,7 @@
/obj/structure/alien/weeds,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dm" = (
@@ -994,7 +994,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dn" = (
@@ -1003,7 +1003,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"do" = (
@@ -1011,7 +1011,7 @@
dir = 8;
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)
"dq" = (
@@ -1090,7 +1090,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/syndicate)
"dx" = (
@@ -1110,7 +1110,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/syndicate)
"dz" = (
@@ -1137,7 +1137,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/syndicate)
"dD" = (
@@ -1148,7 +1148,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/syndicate)
"dE" = (
@@ -1207,7 +1207,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" = (
@@ -1230,7 +1230,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" = (
@@ -1238,7 +1238,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" = (
@@ -3534,7 +3534,7 @@
dir = 8;
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" = (
@@ -3545,7 +3545,7 @@
dir = 8;
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" = (
@@ -3556,7 +3556,7 @@
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kf" = (
@@ -3569,7 +3569,7 @@
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kg" = (
@@ -3580,7 +3580,7 @@
dir = 8;
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)
"ki" = (
@@ -3591,7 +3591,7 @@
dir = 8;
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" = (
@@ -3751,7 +3751,7 @@
dir = 8;
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" = (
@@ -3768,14 +3768,14 @@
dir = 8;
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" = (
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kF" = (
@@ -3783,7 +3783,7 @@
dir = 8;
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" = (
@@ -3791,7 +3791,7 @@
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kH" = (
@@ -3943,7 +3943,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"lm" = (
@@ -3988,8 +3988,7 @@
/area/awaymission/moonoutpost19/arrivals)
"lv" = (
/turf/open/floor/iron/showroomfloor{
- heat_capacity = 1e+006;
- temperature = 273.15
+ initial_temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"lw" = (
@@ -3999,8 +3998,7 @@
pixel_y = 28
},
/turf/open/floor/iron/showroomfloor{
- heat_capacity = 1e+006;
- temperature = 273.15
+ initial_temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"lx" = (
@@ -4011,8 +4009,7 @@
/obj/item/storage/box/mousetraps,
/obj/item/clothing/under/suit/waiter,
/turf/open/floor/iron/showroomfloor{
- heat_capacity = 1e+006;
- temperature = 273.15
+ initial_temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"ly" = (
@@ -4037,7 +4034,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" = (
@@ -4072,7 +4069,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"lJ" = (
@@ -4081,7 +4078,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"lK" = (
@@ -4138,8 +4135,7 @@
},
/obj/item/gun/ballistic/shotgun/sc_pump,
/turf/open/floor/iron/showroomfloor{
- heat_capacity = 1e+006;
- temperature = 273.15
+ initial_temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"lV" = (
@@ -4214,7 +4210,7 @@
/obj/effect/turf_decal/tile/neutral,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"mi" = (
@@ -4236,25 +4232,29 @@
name = "kitchen Cabinet";
req_access_txt = "201"
},
-/area/awaymission/moonoutpost19/arrivals)
/obj/item/reagent_containers/food/condiment/flour,
/obj/item/reagent_containers/food/condiment/flour,
/obj/item/reagent_containers/food/condiment/sugar,
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron/showroomfloor{
- heat_capacity = 1e+006;
- temperature = 273.15
+ initial_temperature = 273.15
+ },
+/area/awaymission/moonoutpost19/arrivals)
+"mn" = (
+/obj/structure/closet/secure_closet/freezer{
locked = 0;
name = "meat fridge";
- req_access_txt = "201";
+ req_access_txt = "201"
},
/obj/item/food/meat/slab/monkey,
/obj/item/food/meat/slab/monkey,
/obj/item/food/meat/slab/monkey,
/obj/item/food/meat/slab/monkey,
/turf/open/floor/iron/showroomfloor{
- heat_capacity = 1e+006;
- temperature = 273.15
+ initial_temperature = 273.15
+ },
+/area/awaymission/moonoutpost19/arrivals)
+"mo" = (
/obj/structure/closet/secure_closet/freezer{
locked = 0;
name = "refrigerator";
@@ -4265,8 +4265,7 @@
/obj/item/reagent_containers/food/condiment/milk,
/obj/item/storage/fancy/egg_box,
/turf/open/floor/iron/showroomfloor{
- heat_capacity = 1e+006;
- temperature = 273.15
+ initial_temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"mp" = (
@@ -4326,7 +4325,7 @@
/obj/effect/turf_decal/tile/neutral,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"my" = (
@@ -4479,7 +4478,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"mQ" = (
@@ -4492,7 +4491,7 @@
dir = 8;
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" = (
@@ -4560,7 +4559,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"na" = (
@@ -4606,7 +4605,7 @@
dir = 8;
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" = (
@@ -4618,7 +4617,7 @@
dir = 8;
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" = (
@@ -4666,7 +4665,7 @@
dir = 8;
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)
"ns" = (
@@ -4686,7 +4685,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)
"ny" = (
@@ -4698,7 +4697,7 @@
/obj/effect/turf_decal/tile/neutral,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nz" = (
@@ -4740,7 +4739,7 @@
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nG" = (
@@ -4752,7 +4751,7 @@
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nH" = (
@@ -4798,7 +4797,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nO" = (
@@ -4833,7 +4832,7 @@
dir = 8;
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" = (
@@ -4863,7 +4862,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" = (
@@ -4875,7 +4874,7 @@
dir = 8;
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" = (
@@ -4886,7 +4885,7 @@
/obj/effect/turf_decal/tile/neutral,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nZ" = (
@@ -4895,7 +4894,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" = (
@@ -4915,7 +4914,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" = (
@@ -4985,7 +4984,7 @@
/obj/effect/turf_decal/tile/red/half/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"ql" = (
@@ -5106,7 +5105,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"vq" = (
@@ -5114,7 +5113,7 @@
/obj/effect/turf_decal/tile/red/half/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"vM" = (
@@ -5136,7 +5135,7 @@
/turf/open/floor/plating{
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"vV" = (
@@ -5163,7 +5162,7 @@
/turf/open/floor/plating{
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"xg" = (
@@ -5252,7 +5251,7 @@
/obj/effect/turf_decal/tile/red/half/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"zZ" = (
@@ -5293,7 +5292,7 @@
/turf/open/floor/plating{
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"CF" = (
@@ -5333,7 +5332,7 @@
/turf/open/floor/plating{
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"DR" = (
@@ -5344,7 +5343,7 @@
/obj/effect/turf_decal/tile/red/half/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"DU" = (
@@ -5439,7 +5438,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"GN" = (
@@ -5447,7 +5446,7 @@
/obj/effect/turf_decal/tile/neutral/half/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"Hc" = (
@@ -5511,7 +5510,7 @@
/turf/open/floor/plating{
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"In" = (
@@ -5535,7 +5534,7 @@
/turf/open/floor/plating{
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"II" = (
@@ -5549,7 +5548,7 @@
/obj/effect/turf_decal/tile/neutral/half/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"Jk" = (
@@ -5558,7 +5557,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"JH" = (
@@ -5582,7 +5581,7 @@
},
/turf/open/floor/iron/cafeteria{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"LE" = (
@@ -5635,7 +5634,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"NJ" = (
@@ -5643,7 +5642,7 @@
/obj/effect/turf_decal/tile/red/anticorner/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"Ot" = (
@@ -5653,7 +5652,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"Oy" = (
@@ -5685,7 +5684,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"QP" = (
@@ -5702,14 +5701,14 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"RA" = (
/obj/effect/turf_decal/tile/red/half/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"RD" = (
@@ -5753,7 +5752,7 @@
/turf/open/floor/plating{
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"Ul" = (
@@ -5768,7 +5767,7 @@
/obj/effect/turf_decal/tile/red/half/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"Uo" = (
@@ -5819,7 +5818,7 @@
},
/turf/open/floor/iron/cafeteria{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- temperature = 251
+ initial_temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"Xd" = (
From 781fe42dc67f1c195e21e1024236388003e45f99 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sun, 8 Sep 2024 13:54:03 +0200
Subject: [PATCH 102/114] Tests
From 295015d3558a91d87a201079ba7864c0b67fb276 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sun, 8 Sep 2024 13:55:28 +0200
Subject: [PATCH 103/114] amog us
---
_maps/RandomZLevels/undergroundoutpost45.dmm | 107 +++++++++----------
1 file changed, 49 insertions(+), 58 deletions(-)
diff --git a/_maps/RandomZLevels/undergroundoutpost45.dmm b/_maps/RandomZLevels/undergroundoutpost45.dmm
index 5e647d302c4ad..b07ed2c46f8bb 100644
--- a/_maps/RandomZLevels/undergroundoutpost45.dmm
+++ b/_maps/RandomZLevels/undergroundoutpost45.dmm
@@ -419,14 +419,14 @@
/obj/structure/glowshroom/single,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 351.9;
+ initial_temperature = 351.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
"bX" = (
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 351.9;
+ initial_temperature = 351.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -637,10 +637,6 @@
/area/awaymission/undergroundoutpost45/central)
"cM" = (
/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden{
- dir = 5;
- },
-/turf/open/floor/plating{
- heat_capacity = 1e+006
dir = 5
},
/turf/open/floor/plating,
@@ -1009,7 +1005,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" = (
@@ -1077,7 +1073,7 @@
"eJ" = (
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -1169,7 +1165,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/central)
@@ -1313,7 +1309,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/central)
@@ -1449,7 +1445,7 @@
/obj/structure/glowshroom/single,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -1558,7 +1554,7 @@
/obj/machinery/light/small,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/crew_quarters)
@@ -1729,7 +1725,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/research)
@@ -1739,7 +1735,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/crew_quarters)
@@ -1766,7 +1762,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/crew_quarters)
@@ -1928,7 +1924,7 @@
/area/awaymission/undergroundoutpost45/crew_quarters)
"hU" = (
/obj/machinery/atmospherics/pipe/simple/supply/hidden{
- dir = 4;
+ dir = 4
},
/obj/structure/table,
/obj/item/book/manual/chef_recipes,
@@ -1939,11 +1935,7 @@
"hV" = (
/obj/effect/spawner/structure/window/reinforced,
/obj/machinery/atmospherics/pipe/simple/supply/hidden{
- dir = 4;
-
- },
-/turf/open/floor/plating{
- heat_capacity = 1e+006
+ dir = 4
},
/turf/open/floor/plating,
/area/awaymission/undergroundoutpost45/crew_quarters)
@@ -2504,7 +2496,7 @@
/obj/machinery/light/small,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/gateway)
@@ -2531,7 +2523,7 @@
/obj/machinery/light/small,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/research)
@@ -3664,7 +3656,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/gateway)
@@ -4673,7 +4665,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -4683,7 +4675,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -4694,7 +4686,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/engineering)
@@ -4904,7 +4896,7 @@
/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -5085,7 +5077,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -5095,7 +5087,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -5105,7 +5097,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -5480,8 +5472,7 @@
dir = 4
},
/obj/machinery/atmospherics/pipe/simple/supply/hidden{
- dir = 4;
-
+ dir = 4
},
/obj/machinery/door/airlock/maintenance{
name = "Research Maintenance";
@@ -6448,7 +6439,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/crew_quarters)
@@ -6843,7 +6834,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7006,7 +6997,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/research)
@@ -7229,7 +7220,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/mining)
@@ -7862,7 +7853,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/mining)
@@ -7870,7 +7861,7 @@
/obj/structure/ore_box,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7878,7 +7869,7 @@
/obj/structure/closet/crate,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7888,7 +7879,7 @@
/obj/effect/mob_spawn/human,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7897,7 +7888,7 @@
/obj/structure/bed/nest,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7907,7 +7898,7 @@
/obj/effect/decal/cleanable/blood/gibs/down,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7916,7 +7907,7 @@
/obj/effect/decal/cleanable/blood/gibs/core,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7924,7 +7915,7 @@
/obj/structure/alien/weeds,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7933,7 +7924,7 @@
/obj/structure/alien/resin/wall,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7942,7 +7933,7 @@
/obj/effect/mob_spawn/human,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7950,7 +7941,7 @@
/obj/effect/decal/cleanable/blood/splatter,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7958,7 +7949,7 @@
/obj/effect/decal/cleanable/blood/gibs/up,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7967,7 +7958,7 @@
/obj/structure/glowshroom/single,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7976,7 +7967,7 @@
/obj/structure/alien/weeds,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7985,7 +7976,7 @@
/obj/effect/decal/cleanable/blood/splatter,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7993,7 +7984,7 @@
/obj/structure/alien/resin/membrane,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -8002,7 +7993,7 @@
/obj/effect/decal/cleanable/blood/gibs/down,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -8010,7 +8001,7 @@
/obj/effect/decal/cleanable/blood/gibs/limb,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -8019,7 +8010,7 @@
/obj/effect/mob_spawn/human,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -8029,7 +8020,7 @@
/obj/effect/mob_spawn/human,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -8049,7 +8040,7 @@
/obj/effect/mob_spawn/human,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- temperature = 363.9;
+ initial_temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
From 12aea5303269df44e9631e57cbf23d51b3651fd9 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sun, 8 Sep 2024 14:03:38 +0200
Subject: [PATCH 104/114] Rerun test
From 676c4ed35a6601e462d6db04eeb01fa5dd235715 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sun, 8 Sep 2024 14:27:35 +0200
Subject: [PATCH 105/114] bingul
---
_maps/RandomZLevels/moonoutpost19.dmm | 192 +++++++++----------
_maps/RandomZLevels/undergroundoutpost45.dmm | 92 ++++-----
2 files changed, 142 insertions(+), 142 deletions(-)
diff --git a/_maps/RandomZLevels/moonoutpost19.dmm b/_maps/RandomZLevels/moonoutpost19.dmm
index 2cef09ba236cf..361f1f2a3f38f 100644
--- a/_maps/RandomZLevels/moonoutpost19.dmm
+++ b/_maps/RandomZLevels/moonoutpost19.dmm
@@ -478,7 +478,7 @@
},
/turf/open/floor/plating{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"bY" = (
@@ -503,14 +503,14 @@
/obj/structure/alien/weeds,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"ca" = (
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cd" = (
@@ -524,7 +524,7 @@
dir = 8;
icon_state = "floorscorched2";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"ce" = (
@@ -537,7 +537,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cf" = (
@@ -550,7 +550,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cg" = (
@@ -562,7 +562,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"ci" = (
@@ -622,7 +622,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cp" = (
@@ -664,7 +664,7 @@
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cw" = (
@@ -719,7 +719,7 @@
},
/turf/open/floor/plating{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cD" = (
@@ -735,7 +735,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cG" = (
@@ -790,7 +790,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cR" = (
@@ -798,7 +798,7 @@
dir = 8;
icon_state = "damaged4";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cT" = (
@@ -830,7 +830,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cW" = (
@@ -838,7 +838,7 @@
dir = 8;
icon_state = "damaged2";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cX" = (
@@ -846,7 +846,7 @@
dir = 8;
icon_state = "damaged3";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cY" = (
@@ -862,7 +862,7 @@
/turf/open/floor/iron{
dir = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"cZ" = (
@@ -920,7 +920,7 @@
},
/turf/open/floor/plating{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"df" = (
@@ -941,7 +941,7 @@
/turf/open/floor/iron{
dir = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dh" = (
@@ -984,7 +984,7 @@
/obj/structure/alien/weeds,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dm" = (
@@ -994,7 +994,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dn" = (
@@ -1003,7 +1003,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"do" = (
@@ -1011,7 +1011,7 @@
dir = 8;
icon_state = "damaged1";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dq" = (
@@ -1090,7 +1090,7 @@
},
/turf/open/floor/plating{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dx" = (
@@ -1110,7 +1110,7 @@
},
/turf/open/floor/plating{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dz" = (
@@ -1137,7 +1137,7 @@
},
/turf/open/floor/plating{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dD" = (
@@ -1148,7 +1148,7 @@
},
/turf/open/floor/plating{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dE" = (
@@ -1207,7 +1207,7 @@
icon_plating = "asteroidplating";
icon_state = "asteroidplating";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dJ" = (
@@ -1230,7 +1230,7 @@
icon_plating = "asteroidplating";
icon_state = "asteroidplating";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"dM" = (
@@ -1238,7 +1238,7 @@
icon_plating = "asteroidplating";
icon_state = "asteroidplating";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/main)
"dN" = (
@@ -3534,7 +3534,7 @@
dir = 8;
icon_state = "floorscorched2";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kd" = (
@@ -3545,7 +3545,7 @@
dir = 8;
icon_state = "damaged1";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"ke" = (
@@ -3556,7 +3556,7 @@
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kf" = (
@@ -3569,7 +3569,7 @@
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kg" = (
@@ -3580,7 +3580,7 @@
dir = 8;
icon_state = "floorscorched1";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"ki" = (
@@ -3591,7 +3591,7 @@
dir = 8;
icon_state = "damaged3";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kj" = (
@@ -3751,7 +3751,7 @@
dir = 8;
icon_state = "damaged2";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kC" = (
@@ -3768,14 +3768,14 @@
dir = 8;
icon_state = "damaged4";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kE" = (
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kF" = (
@@ -3783,7 +3783,7 @@
dir = 8;
icon_state = "damaged5";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kG" = (
@@ -3791,7 +3791,7 @@
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"kH" = (
@@ -3943,7 +3943,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"lm" = (
@@ -3988,7 +3988,7 @@
/area/awaymission/moonoutpost19/arrivals)
"lv" = (
/turf/open/floor/iron/showroomfloor{
- initial_temperature = 273.15
+ temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"lw" = (
@@ -3998,7 +3998,7 @@
pixel_y = 28
},
/turf/open/floor/iron/showroomfloor{
- initial_temperature = 273.15
+ temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"lx" = (
@@ -4009,7 +4009,7 @@
/obj/item/storage/box/mousetraps,
/obj/item/clothing/under/suit/waiter,
/turf/open/floor/iron/showroomfloor{
- initial_temperature = 273.15
+ temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"ly" = (
@@ -4034,7 +4034,7 @@
},
/turf/open/floor/plating{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"lE" = (
@@ -4069,7 +4069,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"lJ" = (
@@ -4078,7 +4078,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"lK" = (
@@ -4135,7 +4135,7 @@
},
/obj/item/gun/ballistic/shotgun/sc_pump,
/turf/open/floor/iron/showroomfloor{
- initial_temperature = 273.15
+ temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"lV" = (
@@ -4210,7 +4210,7 @@
/obj/effect/turf_decal/tile/neutral,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"mi" = (
@@ -4237,7 +4237,7 @@
/obj/item/reagent_containers/food/condiment/sugar,
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron/showroomfloor{
- initial_temperature = 273.15
+ temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"mn" = (
@@ -4251,7 +4251,7 @@
/obj/item/food/meat/slab/monkey,
/obj/item/food/meat/slab/monkey,
/turf/open/floor/iron/showroomfloor{
- initial_temperature = 273.15
+ temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"mo" = (
@@ -4265,7 +4265,7 @@
/obj/item/reagent_containers/food/condiment/milk,
/obj/item/storage/fancy/egg_box,
/turf/open/floor/iron/showroomfloor{
- initial_temperature = 273.15
+ temperature = 273.15
},
/area/awaymission/moonoutpost19/arrivals)
"mp" = (
@@ -4325,7 +4325,7 @@
/obj/effect/turf_decal/tile/neutral,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"my" = (
@@ -4478,7 +4478,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"mQ" = (
@@ -4491,7 +4491,7 @@
dir = 8;
icon_state = "floorscorched2";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"mR" = (
@@ -4559,7 +4559,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"na" = (
@@ -4605,7 +4605,7 @@
dir = 8;
icon_state = "floorscorched2";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nj" = (
@@ -4617,7 +4617,7 @@
dir = 8;
icon_state = "damaged2";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nk" = (
@@ -4665,7 +4665,7 @@
dir = 8;
icon_state = "damaged1";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"ns" = (
@@ -4685,7 +4685,7 @@
icon_plating = "asteroidplating";
icon_state = "asteroidplating";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"ny" = (
@@ -4697,7 +4697,7 @@
/obj/effect/turf_decal/tile/neutral,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nz" = (
@@ -4739,7 +4739,7 @@
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nG" = (
@@ -4751,7 +4751,7 @@
/obj/effect/decal/cleanable/dirt,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nH" = (
@@ -4797,7 +4797,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nO" = (
@@ -4832,7 +4832,7 @@
dir = 8;
icon_state = "damaged1";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nT" = (
@@ -4862,7 +4862,7 @@
icon_plating = "asteroidplating";
icon_state = "asteroidplating";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nX" = (
@@ -4874,7 +4874,7 @@
dir = 8;
icon_state = "floorscorched2";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nY" = (
@@ -4885,7 +4885,7 @@
/obj/effect/turf_decal/tile/neutral,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"nZ" = (
@@ -4894,7 +4894,7 @@
icon_plating = "asteroidplating";
icon_state = "asteroidplating";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/main)
"oa" = (
@@ -4914,7 +4914,7 @@
icon_plating = "asteroidplating";
icon_state = "asteroidplating";
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/main)
"od" = (
@@ -4984,7 +4984,7 @@
/obj/effect/turf_decal/tile/red/half/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"ql" = (
@@ -5105,7 +5105,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"vq" = (
@@ -5113,7 +5113,7 @@
/obj/effect/turf_decal/tile/red/half/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"vM" = (
@@ -5135,7 +5135,7 @@
/turf/open/floor/plating{
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"vV" = (
@@ -5162,7 +5162,7 @@
/turf/open/floor/plating{
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"xg" = (
@@ -5251,7 +5251,7 @@
/obj/effect/turf_decal/tile/red/half/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"zZ" = (
@@ -5292,7 +5292,7 @@
/turf/open/floor/plating{
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"CF" = (
@@ -5332,7 +5332,7 @@
/turf/open/floor/plating{
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"DR" = (
@@ -5343,7 +5343,7 @@
/obj/effect/turf_decal/tile/red/half/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"DU" = (
@@ -5438,7 +5438,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"GN" = (
@@ -5446,7 +5446,7 @@
/obj/effect/turf_decal/tile/neutral/half/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"Hc" = (
@@ -5510,7 +5510,7 @@
/turf/open/floor/plating{
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"In" = (
@@ -5534,7 +5534,7 @@
/turf/open/floor/plating{
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"II" = (
@@ -5548,7 +5548,7 @@
/obj/effect/turf_decal/tile/neutral/half/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"Jk" = (
@@ -5557,7 +5557,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"JH" = (
@@ -5581,7 +5581,7 @@
},
/turf/open/floor/iron/cafeteria{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"LE" = (
@@ -5634,7 +5634,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"NJ" = (
@@ -5642,7 +5642,7 @@
/obj/effect/turf_decal/tile/red/anticorner/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"Ot" = (
@@ -5652,7 +5652,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"Oy" = (
@@ -5684,7 +5684,7 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"QP" = (
@@ -5701,14 +5701,14 @@
},
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"RA" = (
/obj/effect/turf_decal/tile/red/half/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"RD" = (
@@ -5752,7 +5752,7 @@
/turf/open/floor/plating{
broken = 1;
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"Ul" = (
@@ -5767,7 +5767,7 @@
/obj/effect/turf_decal/tile/red/half/contrasted,
/turf/open/floor/iron{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/syndicate)
"Uo" = (
@@ -5818,7 +5818,7 @@
},
/turf/open/floor/iron/cafeteria{
initial_gas_mix = "co2=48.7;n2=13.2;o2=32.4;TEMP=251";
- initial_temperature = 251
+ temperature = 251
},
/area/awaymission/moonoutpost19/arrivals)
"Xd" = (
diff --git a/_maps/RandomZLevels/undergroundoutpost45.dmm b/_maps/RandomZLevels/undergroundoutpost45.dmm
index b07ed2c46f8bb..1b30c6b540581 100644
--- a/_maps/RandomZLevels/undergroundoutpost45.dmm
+++ b/_maps/RandomZLevels/undergroundoutpost45.dmm
@@ -419,14 +419,14 @@
/obj/structure/glowshroom/single,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 351.9;
+ temperature = 351.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
"bX" = (
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 351.9;
+ temperature = 351.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -1005,7 +1005,7 @@
icon_plating = "asteroidplating";
icon_state = "asteroidplating";
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9
+ temperature = 363.9
},
/area/awaymission/undergroundoutpost45/caves)
"ev" = (
@@ -1073,7 +1073,7 @@
"eJ" = (
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -1165,7 +1165,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/central)
@@ -1309,7 +1309,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/central)
@@ -1445,7 +1445,7 @@
/obj/structure/glowshroom/single,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -1554,7 +1554,7 @@
/obj/machinery/light/small,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/crew_quarters)
@@ -1725,7 +1725,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/research)
@@ -1735,7 +1735,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/crew_quarters)
@@ -1762,7 +1762,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/crew_quarters)
@@ -2496,7 +2496,7 @@
/obj/machinery/light/small,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/gateway)
@@ -2523,7 +2523,7 @@
/obj/machinery/light/small,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/research)
@@ -3656,7 +3656,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/gateway)
@@ -4665,7 +4665,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -4675,7 +4675,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -4686,7 +4686,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/engineering)
@@ -4896,7 +4896,7 @@
/obj/machinery/atmospherics/pipe/simple/scrubbers/hidden,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -5077,7 +5077,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -5087,7 +5087,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -5097,7 +5097,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -6439,7 +6439,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/crew_quarters)
@@ -6834,7 +6834,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -6997,7 +6997,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/research)
@@ -7220,7 +7220,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/mining)
@@ -7853,7 +7853,7 @@
},
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/mining)
@@ -7861,7 +7861,7 @@
/obj/structure/ore_box,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7869,7 +7869,7 @@
/obj/structure/closet/crate,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7879,7 +7879,7 @@
/obj/effect/mob_spawn/human,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7888,7 +7888,7 @@
/obj/structure/bed/nest,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7898,7 +7898,7 @@
/obj/effect/decal/cleanable/blood/gibs/down,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7907,7 +7907,7 @@
/obj/effect/decal/cleanable/blood/gibs/core,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7915,7 +7915,7 @@
/obj/structure/alien/weeds,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7924,7 +7924,7 @@
/obj/structure/alien/resin/wall,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7933,7 +7933,7 @@
/obj/effect/mob_spawn/human,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7941,7 +7941,7 @@
/obj/effect/decal/cleanable/blood/splatter,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7949,7 +7949,7 @@
/obj/effect/decal/cleanable/blood/gibs/up,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7958,7 +7958,7 @@
/obj/structure/glowshroom/single,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7967,7 +7967,7 @@
/obj/structure/alien/weeds,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7976,7 +7976,7 @@
/obj/effect/decal/cleanable/blood/splatter,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7984,7 +7984,7 @@
/obj/structure/alien/resin/membrane,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -7993,7 +7993,7 @@
/obj/effect/decal/cleanable/blood/gibs/down,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -8001,7 +8001,7 @@
/obj/effect/decal/cleanable/blood/gibs/limb,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -8010,7 +8010,7 @@
/obj/effect/mob_spawn/human,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -8020,7 +8020,7 @@
/obj/effect/mob_spawn/human,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
@@ -8040,7 +8040,7 @@
/obj/effect/mob_spawn/human,
/turf/open/floor/plating/asteroid{
initial_gas_mix = "co2=173.4;n2=135.1;plasma=229.8;TEMP=351.9";
- initial_temperature = 363.9;
+ temperature = 363.9;
name = "Cave Floor"
},
/area/awaymission/undergroundoutpost45/caves)
From a4b3eb7c460c9bdc41fbbd5402c6b1227b08a8af Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sun, 8 Sep 2024 14:29:07 +0200
Subject: [PATCH 106/114] mogus
---
.github/workflows/run_integration_tests.yml | 3 ---
1 file changed, 3 deletions(-)
diff --git a/.github/workflows/run_integration_tests.yml b/.github/workflows/run_integration_tests.yml
index 43eeda344d694..d628c813e36b9 100644
--- a/.github/workflows/run_integration_tests.yml
+++ b/.github/workflows/run_integration_tests.yml
@@ -48,9 +48,6 @@ jobs:
# - name: Install dreamluau
# run: |
# bash tools/ci/install_dreamluau.sh
- - name: Install auxmos
- run: |
- bash tools/ci/install_auxmos.sh
- name: Configure version
run: |
echo "BYOND_MAJOR=${{ inputs.major }}" >> $GITHUB_ENV
From ea78aa27b001ba492674f04e982330f7c944d94f Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sun, 8 Sep 2024 14:29:54 +0200
Subject: [PATCH 107/114] Fix
---
code/controllers/subsystem/explosion.dm | 2 --
1 file changed, 2 deletions(-)
diff --git a/code/controllers/subsystem/explosion.dm b/code/controllers/subsystem/explosion.dm
index f4637725c5121..d74e8910d94bb 100644
--- a/code/controllers/subsystem/explosion.dm
+++ b/code/controllers/subsystem/explosion.dm
@@ -625,8 +625,6 @@ SUBSYSTEM_DEF(explosions)
currentpart = SSEXPLOSIONS_TURFS
-#undef SSAIR_REBUILD_PIPENETS
-
#undef EXPLOSION_THROW_SPEED
#undef SSEX_TURF
#undef SSEX_OBJ
From 8b822a6332aa0453bb5dd6f832e97c310a6ab6c1 Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sun, 8 Sep 2024 14:42:46 +0200
Subject: [PATCH 108/114] cancel culture
From 2fee225f1cedfb32544da758854664f3f1d6072e Mon Sep 17 00:00:00 2001
From: JixS4v <61665800+JixS4v@users.noreply.github.com>
Date: Sun, 8 Sep 2024 17:20:24 +0200
Subject: [PATCH 109/114] Linter pleasing
---
beestation.dme | 1 +
code/game/objects/items/tanks/tanks.dm | 1 +
code/game/turfs/open/_open.dm | 7 -
.../environmental/LINDA_turf_tile.dm | 9 +-
code/modules/research/experimentor.dm | 672 ------------------
code/modules/unit_tests/breath.dm | 2 +-
6 files changed, 11 insertions(+), 681 deletions(-)
delete mode 100644 code/modules/research/experimentor.dm
diff --git a/beestation.dme b/beestation.dme
index 2fbb574d47056..0c211ef4656f9 100644
--- a/beestation.dme
+++ b/beestation.dme
@@ -1808,6 +1808,7 @@
#include "code\modules\admin\verbs\deadsay.dm"
#include "code\modules\admin\verbs\debug.dm"
#include "code\modules\admin\verbs\diagnostics.dm"
+#include "code\modules\admin\verbs\fix_air.dm"
#include "code\modules\admin\verbs\forcecryo.dm"
#include "code\modules\admin\verbs\fps.dm"
#include "code\modules\admin\verbs\getlogs.dm"
diff --git a/code/game/objects/items/tanks/tanks.dm b/code/game/objects/items/tanks/tanks.dm
index c2889becf5aa4..6c2085185fe8c 100644
--- a/code/game/objects/items/tanks/tanks.dm
+++ b/code/game/objects/items/tanks/tanks.dm
@@ -348,3 +348,4 @@
#undef TTV_NO_CASING_MOD
#undef REACTIONS_BEFORE_EXPLOSION
+#undef ASSUME_AIR_DT_FACTOR
diff --git a/code/game/turfs/open/_open.dm b/code/game/turfs/open/_open.dm
index 30466013fd9b5..f45a33f5e74cd 100644
--- a/code/game/turfs/open/_open.dm
+++ b/code/game/turfs/open/_open.dm
@@ -35,13 +35,6 @@ CREATION_TEST_IGNORE_SELF(/turf/open)
///Is this floor no-slip?
var/traction = FALSE
-/turf/open/Initialize(mapload)
- . = ..()
- if(broken)
- break_tile(TRUE)
- if(burnt)
- burn_tile(TRUE)
-
/turf/open/ComponentInitialize()
. = ..()
if(wet)
diff --git a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
index 05fab4f6f36f4..925a0e9dfe3b8 100644
--- a/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
+++ b/code/modules/atmospherics/environmental/LINDA_turf_tile.dm
@@ -52,7 +52,7 @@
var/max_share = 0
#endif
-/turf/open/Initialize()
+/turf/open/Initialize(mapload)
if(!blocks_air)
air = create_gas_mixture()
if(planetary_atmos)
@@ -60,6 +60,10 @@
var/datum/gas_mixture/immutable/planetary/mix = new
mix.parse_string_immutable(initial_gas_mix)
SSair.planetary[initial_gas_mix] = mix
+ if(broken)
+ break_tile(TRUE)
+ if(burnt)
+ burn_tile(TRUE)
. = ..()
/turf/open/Destroy()
@@ -689,3 +693,6 @@ Then we space some of our heat, and think about if we should stop conducting.
(heat_capacity * sharer.heat_capacity / (heat_capacity + sharer.heat_capacity)) //The larger the combined capacity the less is shared
temperature -= heat / heat_capacity //The higher your own heat cap the less heat you get from this arrangement
sharer.temperature += heat / sharer.heat_capacity
+
+#undef LAST_SHARE_CHECK
+#undef PLANET_SHARE_CHECK
diff --git a/code/modules/research/experimentor.dm b/code/modules/research/experimentor.dm
deleted file mode 100644
index 4e22c5ac4e5ac..0000000000000
--- a/code/modules/research/experimentor.dm
+++ /dev/null
@@ -1,672 +0,0 @@
-//this is designed to replace the destructive analyzer
-
-//NEEDS MAJOR CODE CLEANUP
-
-#define SCANTYPE_POKE 1
-#define SCANTYPE_IRRADIATE 2
-#define SCANTYPE_GAS 3
-#define SCANTYPE_HEAT 4
-#define SCANTYPE_COLD 5
-#define SCANTYPE_OBLITERATE 6
-#define SCANTYPE_DISCOVER 7
-
-#define EFFECT_PROB_VERYLOW 20
-#define EFFECT_PROB_LOW 35
-#define EFFECT_PROB_MEDIUM 50
-#define EFFECT_PROB_HIGH 75
-#define EFFECT_PROB_VERYHIGH 95
-
-#define FAIL 8
-/obj/machinery/rnd/experimentor
- name = "\improper E.X.P.E.R.I-MENTOR"
- desc = "A \"replacement\" for the destructive analyzer with a slight tendency to catastrophically fail."
- icon = 'icons/obj/machines/heavy_lathe.dmi'
- icon_state = "h_lathe"
- density = TRUE
- use_power = IDLE_POWER_USE
- circuit = /obj/item/circuitboard/machine/experimentor
- var/recentlyExperimented = 0
- var/mob/trackedIan
- var/mob/trackedRuntime
- var/badThingCoeff = 0
- var/resetTime = 15
- var/cloneMode = FALSE
- var/list/item_reactions = list()
- var/static/list/valid_items = list() //valid items for special reactions like transforming
- var/list/critical_items_typecache //items that can cause critical reactions
- var/banned_typecache // items that won't be produced
-
-/obj/machinery/rnd/experimentor/proc/ConvertReqString2List(list/source_list)
- var/list/temp_list = params2list(source_list)
- for(var/O in temp_list)
- temp_list[O] = text2num(temp_list[O])
- return temp_list
-
-/obj/machinery/rnd/experimentor/proc/valid_items()
- if (!isnull(valid_items))
- return valid_items
- var/static/list/banned_typecache = typecacheof(list(
- /obj/item/stock_parts/cell/infinite,
- /obj/item/grenade/chem_grenade/tuberculosis
- ))
-
- valid_items = list()
-
- for(var/I in typesof(/obj/item))
- if(ispath(I, /obj/item/relic))
- item_reactions["[I]"] = SCANTYPE_DISCOVER
- else
- item_reactions["[I]"] = pick(SCANTYPE_POKE,SCANTYPE_IRRADIATE,SCANTYPE_GAS,SCANTYPE_HEAT,SCANTYPE_COLD,SCANTYPE_OBLITERATE)
-
- if(is_type_in_typecache(I, banned_typecache))
- continue
-
- if(ispath(I, /obj/item/stock_parts) || ispath(I, /obj/item/grenade/chem_grenade) || ispath(I, /obj/item/kitchen))
- var/obj/item/tempCheck = I
- if(initial(tempCheck.icon_state) != null) //check it's an actual usable item, in a hacky way
- valid_items["[I]"] += 15
-
- if(ispath(I, /obj/item/reagent_containers/food))
- var/obj/item/tempCheck = I
- if(initial(tempCheck.icon_state) != null) //check it's an actual usable item, in a hacky way
- valid_items["[I]"] += rand(1,4)
- return valid_items
-
-/obj/machinery/rnd/experimentor/Initialize(mapload)
- . = ..()
-
- trackedIan = locate(/mob/living/simple_animal/pet/dog/corgi/Ian) in GLOB.mob_living_list
- trackedRuntime = locate(/mob/living/simple_animal/pet/cat/Runtime) in GLOB.mob_living_list
-
- critical_items_typecache = typecacheof(list(
- /obj/item/construction/rcd,
- /obj/item/grenade,
- /obj/item/aicard,
- /obj/item/storage/backpack/holding,
- /obj/item/slime_extract,
- /obj/item/transfer_valve))
-
-/obj/machinery/rnd/experimentor/RefreshParts()
- for(var/obj/item/stock_parts/manipulator/M in component_parts)
- if(resetTime > 0 && (resetTime - M.rating) >= 1)
- resetTime -= M.rating
- for(var/obj/item/stock_parts/scanning_module/M in component_parts)
- badThingCoeff += M.rating*2
- for(var/obj/item/stock_parts/micro_laser/M in component_parts)
- badThingCoeff += M.rating
-
-/obj/machinery/rnd/experimentor/examine(mob/user)
- . = ..()
- if(in_range(user, src) || isobserver(user))
- . += "The status display reads: Malfunction probability reduced by [badThingCoeff]%. Cooldown interval between experiments at [resetTime*0.1] seconds."
-
-/obj/machinery/rnd/experimentor/proc/checkCircumstances(obj/item/O)
- //snowflake check to only take "made" bombs
- if(istype(O, /obj/item/transfer_valve))
- var/obj/item/transfer_valve/T = O
- if(!T.tank_one || !T.tank_two || !T.attached_device)
- return FALSE
- return TRUE
-
-/obj/machinery/rnd/experimentor/Insert_Item(obj/item/O, mob/user)
- if(user.a_intent != INTENT_HARM)
- . = 1
- if(!is_insertion_ready(user))
- return
- if(!user.transferItemToLoc(O, src))
- return
- loaded_item = O
- to_chat(user, "You add [O] to the machine.")
- flick("h_lathe_load", src)
-
-/obj/machinery/rnd/experimentor/default_deconstruction_crowbar(obj/item/O)
- ejectItem()
- . = ..(O)
-
-/obj/machinery/rnd/experimentor/ui_interact(mob/user)
- var/list/dat = list("
")
- if(!linked_console)
- dat += "Scan for R&D Console"
- if(loaded_item)
- dat += "Loaded Item: [loaded_item]"
-
- dat += "