From 733d4794255bda0695a7fcd5c66e2d6072fb821f Mon Sep 17 00:00:00 2001
From: Princess Cheeseballs
<66055347+Princess-Cheeseballs@users.noreply.github.com>
Date: Sat, 14 Mar 2026 01:53:49 -0700
Subject: [PATCH] Move a metric fuckton of AtmosphereSystem to Shared. (#42989)
* AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
* fix the tests I broke
* Remove methods that the client shouldn't be calling. Hamburger.
* light cleanup for now
* review
* whoop
* docs updates and misc changes
---------
Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com>
Co-authored-by: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com>
---
Content.Benchmarks/DeltaPressureBenchmark.cs | 3 +-
.../Components/MapAtmosphereComponent.cs | 9 -
.../EntitySystems/AtmosphereSystem.Gases.cs | 10 +
.../Tests/Atmos/GridJoinTest.cs | 3 +-
.../Tests/Respirator/LungTest.cs | 2 +-
.../Atmos/Commands/AddAtmosCommand.cs | 2 +-
.../Atmos/Commands/PauseAtmosCommand.cs | 2 +-
.../Atmos/Commands/SetMapAtmosCommand.cs | 2 +-
.../Components/GridAtmosphereComponent.cs | 135 --------------
.../Atmos/EntitySystems/AirFilterSystem.cs | 3 +-
.../EntitySystems/AtmosDebugOverlaySystem.cs | 2 +-
.../Atmos/EntitySystems/AtmosExposedSystem.cs | 61 ------
.../EntitySystems/AtmosphereSystem.API.cs | 176 +++++++++---------
.../AtmosphereSystem.BenchmarkHelpers.cs | 1 +
.../AtmosphereSystem.DeltaPressure.cs | 18 +-
.../EntitySystems/AtmosphereSystem.Gases.cs | 44 +----
.../AtmosphereSystem.HighPressureDelta.cs | 5 +-
.../AtmosphereSystem.Processing.cs | 18 +-
.../AtmosphereSystem.Superconductivity.cs | 2 +-
.../EntitySystems/AtmosphereSystem.Utils.cs | 20 +-
.../Atmos/EntitySystems/AtmosphereSystem.cs | 9 +-
.../EntitySystems/AutomaticAtmosSystem.cs | 2 +-
.../Atmos/EntitySystems/GasMinerSystem.cs | 2 +-
.../EntitySystems/HeatExchangerSystem.cs | 9 +-
.../Atmos/Monitor/Systems/AirAlarmSystem.cs | 2 +-
.../Monitor/Systems/AtmosMonitoringSystem.cs | 4 +-
.../EntitySystems/GasPassiveGateSystem.cs | 3 +-
.../EntitySystems/GasPressurePumpSystem.cs | 3 +-
.../GasPressureRegulatorSystem.cs | 2 +-
.../Binary/EntitySystems/GasRecyclerSystem.cs | 3 +-
.../EntitySystems/GasVolumePumpSystem.cs | 2 +-
.../Piping/EntitySystems/AtmosDeviceSystem.cs | 3 +-
.../Trinary/EntitySystems/GasFilterSystem.cs | 3 +-
.../Trinary/EntitySystems/GasMixerSystem.cs | 3 +-
.../PressureControlledValveSystem.cs | 3 +-
.../Unary/EntitySystems/GasCanisterSystem.cs | 2 +-
.../Unary/EntitySystems/GasCondenserSystem.cs | 3 +-
.../EntitySystems/GasOutletInjectorSystem.cs | 3 +-
.../EntitySystems/GasPassiveVentSystem.cs | 3 +-
.../EntitySystems/GasThermoMachineSystem.cs | 4 +-
.../Unary/EntitySystems/GasVentPumpSystem.cs | 2 +-
.../EntitySystems/GasVentScrubberSystem.cs | 2 +-
.../Atmos/Portable/PortableScrubberSystem.cs | 4 +-
.../Atmos/Portable/SpaceHeaterSystem.cs | 3 +-
Content.Server/Atmos/Rotting/RottingSystem.cs | 4 +-
.../Disposal/Unit/BeingDisposedSystem.cs | 1 +
.../Doors/Systems/FirelockSystem.cs | 1 +
Content.Server/Mech/Systems/MechSystem.cs | 1 +
Content.Server/Medical/CryoPodSystem.cs | 3 +-
Content.Server/Medical/InsideCryoPodSystem.cs | 4 +-
.../EntitySystems/NodeGroupSystem.cs | 1 -
.../NodeContainer/NodeGroups/PipeNet.cs | 141 +++++++-------
.../NodeContainer/Nodes/PipeNode.cs | 1 +
.../Power/Generation/Teg/TegSystem.cs | 8 +-
.../Power/Generator/GasPowerReceiverSystem.cs | 4 +-
.../Salvage/SpawnSalvageMissionJob.cs | 11 +-
.../SensorMonitoringConsoleSystem.cs | 3 +-
.../EntitySystems/EntityStorageSystem.cs | 1 +
Content.Shared/Atmos/AtmosExposedEvents.cs | 57 ++++++
.../Atmos}/Components/AtmosDeviceComponent.cs | 5 +-
.../Components/GridAtmosphereComponent.cs | 155 +++++++++++++++
.../Components/MapAtmosphereComponent.cs | 14 +-
.../SharedAtmosphereSystem.API.cs | 89 +++++++++
.../SharedAtmosphereSystem.Gases.cs | 64 ++++++-
.../EntitySystems/SharedAtmosphereSystem.cs | 118 +++++++++---
.../Atmos/ExcitedGroup.cs | 2 +-
.../Atmos/Hotspot.cs | 2 +-
.../Atmos/MonstermosInfo.cs | 4 +-
.../TileAtmosCollectionSerializer.cs | 3 +-
.../Atmos/TileAtmosphere.cs | 21 +--
.../NodeContainer/NodeGroups/IPipeNet.cs | 11 ++
71 files changed, 723 insertions(+), 603 deletions(-)
delete mode 100644 Content.Client/Atmos/Components/MapAtmosphereComponent.cs
delete mode 100644 Content.Server/Atmos/Components/GridAtmosphereComponent.cs
delete mode 100644 Content.Server/Atmos/EntitySystems/AtmosExposedSystem.cs
create mode 100644 Content.Shared/Atmos/AtmosExposedEvents.cs
rename {Content.Server/Atmos/Piping => Content.Shared/Atmos}/Components/AtmosDeviceComponent.cs (95%)
create mode 100644 Content.Shared/Atmos/Components/GridAtmosphereComponent.cs
rename {Content.Server => Content.Shared}/Atmos/Components/MapAtmosphereComponent.cs (51%)
create mode 100644 Content.Shared/Atmos/EntitySystems/SharedAtmosphereSystem.API.cs
rename {Content.Server => Content.Shared}/Atmos/ExcitedGroup.cs (98%)
rename {Content.Server => Content.Shared}/Atmos/Hotspot.cs (98%)
rename {Content.Server => Content.Shared}/Atmos/MonstermosInfo.cs (98%)
rename {Content.Server => Content.Shared}/Atmos/Serialization/TileAtmosCollectionSerializer.cs (99%)
rename {Content.Server => Content.Shared}/Atmos/TileAtmosphere.cs (93%)
create mode 100644 Content.Shared/NodeContainer/NodeGroups/IPipeNet.cs
diff --git a/Content.Benchmarks/DeltaPressureBenchmark.cs b/Content.Benchmarks/DeltaPressureBenchmark.cs
index b31b3ed1a24..8d4929c47ff 100644
--- a/Content.Benchmarks/DeltaPressureBenchmark.cs
+++ b/Content.Benchmarks/DeltaPressureBenchmark.cs
@@ -1,11 +1,10 @@
using System.Threading.Tasks;
using BenchmarkDotNet.Attributes;
-using BenchmarkDotNet.Diagnosers;
using Content.IntegrationTests;
using Content.IntegrationTests.Pair;
-using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Atmos.Components;
+using Content.Shared.Atmos.EntitySystems;
using Content.Shared.CCVar;
using Robust.Shared;
using Robust.Shared.Analyzers;
diff --git a/Content.Client/Atmos/Components/MapAtmosphereComponent.cs b/Content.Client/Atmos/Components/MapAtmosphereComponent.cs
deleted file mode 100644
index abad2491347..00000000000
--- a/Content.Client/Atmos/Components/MapAtmosphereComponent.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using Content.Shared.Atmos.Components;
-
-namespace Content.Client.Atmos.Components;
-
-[RegisterComponent]
-public sealed partial class MapAtmosphereComponent : SharedMapAtmosphereComponent
-{
-
-}
diff --git a/Content.Client/Atmos/EntitySystems/AtmosphereSystem.Gases.cs b/Content.Client/Atmos/EntitySystems/AtmosphereSystem.Gases.cs
index cdae052b1b1..d950108922c 100644
--- a/Content.Client/Atmos/EntitySystems/AtmosphereSystem.Gases.cs
+++ b/Content.Client/Atmos/EntitySystems/AtmosphereSystem.Gases.cs
@@ -1,5 +1,6 @@
using System.Runtime.CompilerServices;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Reactions;
namespace Content.Client.Atmos.EntitySystems;
@@ -13,6 +14,15 @@ public sealed partial class AtmosphereSystem
implementation.
*/
+ ///
+ /// No-op on client as reactions aren't entirely in shared.
+ /// Don't call it. Smile.
+ public override ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder)
+ {
+ // Reactions don't work on client so don't even try.
+ throw new NotImplementedException();
+ }
+
public override bool IsMixtureFuel(GasMixture mixture, float epsilon = Atmospherics.Epsilon)
{
var tmp = new float[Atmospherics.AdjustedNumberOfGases];
diff --git a/Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs b/Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs
index 3a1ec7fd40e..45ccddfad98 100644
--- a/Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs
+++ b/Content.IntegrationTests/Tests/Atmos/GridJoinTest.cs
@@ -1,7 +1,6 @@
-using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.EntitySystems;
+using Content.Shared.Atmos.Components;
using Robust.Shared.GameObjects;
namespace Content.IntegrationTests.Tests.Atmos;
diff --git a/Content.IntegrationTests/Tests/Respirator/LungTest.cs b/Content.IntegrationTests/Tests/Respirator/LungTest.cs
index a4ad733348e..ae6b50ff0f4 100644
--- a/Content.IntegrationTests/Tests/Respirator/LungTest.cs
+++ b/Content.IntegrationTests/Tests/Respirator/LungTest.cs
@@ -1,4 +1,3 @@
-using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Server.Body.Components;
using Content.Shared.Body.Systems;
@@ -7,6 +6,7 @@ using Robust.Shared.Configuration;
using Robust.Shared.GameObjects;
using Robust.Shared.Map;
using System.Numerics;
+using Content.Shared.Atmos.Components;
using Robust.Shared.EntitySerialization.Systems;
using Robust.Shared.Utility;
diff --git a/Content.Server/Atmos/Commands/AddAtmosCommand.cs b/Content.Server/Atmos/Commands/AddAtmosCommand.cs
index d943b5bf066..70911f4d746 100644
--- a/Content.Server/Atmos/Commands/AddAtmosCommand.cs
+++ b/Content.Server/Atmos/Commands/AddAtmosCommand.cs
@@ -1,7 +1,7 @@
using Content.Server.Administration;
-using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Administration;
+using Content.Shared.Atmos.Components;
using Robust.Shared.Console;
using Robust.Shared.Map.Components;
diff --git a/Content.Server/Atmos/Commands/PauseAtmosCommand.cs b/Content.Server/Atmos/Commands/PauseAtmosCommand.cs
index 984f2a0869e..2893743d8b1 100644
--- a/Content.Server/Atmos/Commands/PauseAtmosCommand.cs
+++ b/Content.Server/Atmos/Commands/PauseAtmosCommand.cs
@@ -1,7 +1,7 @@
using Content.Server.Administration;
-using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Administration;
+using Content.Shared.Atmos.Components;
using Robust.Shared.Console;
namespace Content.Server.Atmos.Commands;
diff --git a/Content.Server/Atmos/Commands/SetMapAtmosCommand.cs b/Content.Server/Atmos/Commands/SetMapAtmosCommand.cs
index 3314bf08afa..3c31c79e75f 100644
--- a/Content.Server/Atmos/Commands/SetMapAtmosCommand.cs
+++ b/Content.Server/Atmos/Commands/SetMapAtmosCommand.cs
@@ -1,8 +1,8 @@
using Content.Server.Administration;
-using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
using Content.Shared.Administration;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Robust.Shared.Console;
using Robust.Shared.Map;
diff --git a/Content.Server/Atmos/Components/GridAtmosphereComponent.cs b/Content.Server/Atmos/Components/GridAtmosphereComponent.cs
deleted file mode 100644
index 2a0d87515cb..00000000000
--- a/Content.Server/Atmos/Components/GridAtmosphereComponent.cs
+++ /dev/null
@@ -1,135 +0,0 @@
-using System.Collections.Concurrent;
-using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
-using Content.Server.Atmos.Serialization;
-using Content.Server.NodeContainer.NodeGroups;
-using Content.Shared.Atmos.Components;
-
-namespace Content.Server.Atmos.Components
-{
- ///
- /// Internal Atmos class. Use to interact with atmos instead.
- ///
- [RegisterComponent, Serializable,
- Access(typeof(AtmosphereSystem), typeof(GasTileOverlaySystem), typeof(AtmosDebugOverlaySystem))]
- public sealed partial class GridAtmosphereComponent : Component
- {
- [ViewVariables(VVAccess.ReadWrite)]
- public bool Simulated { get; set; } = true;
-
- [ViewVariables]
- public bool ProcessingPaused { get; set; } = false;
-
- [ViewVariables]
- public float Timer { get; set; } = 0f;
-
- [ViewVariables]
- public int UpdateCounter { get; set; } = 1; // DO NOT SET TO ZERO BY DEFAULT! It will break roundstart atmos...
-
- [ViewVariables]
- [IncludeDataField(customTypeSerializer:typeof(TileAtmosCollectionSerializer))]
- public Dictionary Tiles = new(1000);
-
- [ViewVariables]
- public HashSet MapTiles = new(1000);
-
- [ViewVariables]
- public readonly HashSet ActiveTiles = new(1000);
-
- [ViewVariables]
- public int ActiveTilesCount => ActiveTiles.Count;
-
- [ViewVariables]
- public readonly HashSet ExcitedGroups = new(1000);
-
- [ViewVariables]
- public int ExcitedGroupCount => ExcitedGroups.Count;
-
- [ViewVariables]
- public readonly HashSet HotspotTiles = new(1000);
-
- [ViewVariables]
- public int HotspotTilesCount => HotspotTiles.Count;
-
- [ViewVariables]
- public readonly HashSet SuperconductivityTiles = new(1000);
-
- [ViewVariables]
- public int SuperconductivityTilesCount => SuperconductivityTiles.Count;
-
- [ViewVariables]
- public HashSet HighPressureDelta = new(1000);
-
- [ViewVariables]
- public int HighPressureDeltaCount => HighPressureDelta.Count;
-
- ///
- /// A list of entities that have a and are to
- /// be processed by the , if enabled.
- ///
- /// To prevent massive bookkeeping overhead, this list is processed in-place,
- /// with add/remove/find operations helped via a dict.
- ///
- /// If you want to add/remove/find entities in this list,
- /// use the API methods in the Atmospherics API.
- [ViewVariables]
- public readonly List> DeltaPressureEntities =
- new(AtmosphereSystem.DeltaPressurePreAllocateLength);
-
- ///
- /// An index lookup for the list.
- /// Used for add/remove/find operations to speed up processing.
- ///
- public readonly Dictionary DeltaPressureEntityLookup =
- new(AtmosphereSystem.DeltaPressurePreAllocateLength);
-
- ///
- /// Integer that indicates the current position in the
- /// list that is being processed.
- ///
- [ViewVariables(VVAccess.ReadOnly)]
- public int DeltaPressureCursor;
-
- ///
- /// Queue of entities that need to have damage applied to them.
- ///
- [ViewVariables]
- public readonly ConcurrentQueue DeltaPressureDamageResults = new();
-
- [ViewVariables]
- public readonly HashSet PipeNets = new();
-
- [ViewVariables]
- public readonly HashSet> AtmosDevices = new();
-
- [ViewVariables]
- public readonly Queue CurrentRunTiles = new();
-
- [ViewVariables]
- public readonly Queue CurrentRunExcitedGroups = new();
-
- [ViewVariables]
- public readonly Queue CurrentRunPipeNet = new();
-
- [ViewVariables]
- public readonly Queue> CurrentRunAtmosDevices = new();
-
- [ViewVariables]
- public readonly HashSet InvalidatedCoords = new(1000);
-
- [ViewVariables]
- public readonly Queue CurrentRunInvalidatedTiles = new();
-
- [ViewVariables]
- public readonly List PossiblyDisconnectedTiles = new(100);
-
- [ViewVariables]
- public int InvalidatedCoordsCount => InvalidatedCoords.Count;
-
- [ViewVariables]
- public long EqualizationQueueCycleControl { get; set; }
-
- [ViewVariables]
- public AtmosphereProcessingState State { get; set; } = AtmosphereProcessingState.Revalidate;
- }
-}
diff --git a/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs b/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs
index c3344c830c0..ad51f57f887 100644
--- a/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs
+++ b/Content.Server/Atmos/EntitySystems/AirFilterSystem.cs
@@ -1,8 +1,7 @@
using Content.Server.Atmos.Components;
-using Content.Server.Atmos.Piping.Components;
using Content.Shared.Atmos;
-using Robust.Shared.Map;
using System.Diagnostics.CodeAnalysis;
+using Content.Shared.Atmos.Components;
namespace Content.Server.Atmos.EntitySystems;
diff --git a/Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs b/Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs
index 505c4a3b385..243905f1bcd 100644
--- a/Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs
+++ b/Content.Server/Atmos/EntitySystems/AtmosDebugOverlaySystem.cs
@@ -1,6 +1,6 @@
using System.Numerics;
-using Content.Server.Atmos.Components;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.EntitySystems;
using Content.Shared.CCVar;
using JetBrains.Annotations;
diff --git a/Content.Server/Atmos/EntitySystems/AtmosExposedSystem.cs b/Content.Server/Atmos/EntitySystems/AtmosExposedSystem.cs
deleted file mode 100644
index 39469e993f0..00000000000
--- a/Content.Server/Atmos/EntitySystems/AtmosExposedSystem.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-using Content.Shared.Atmos;
-using Robust.Shared.Map;
-
-namespace Content.Server.Atmos.EntitySystems
-{
- /* doesn't seem to be a use for this at the moment, so it's disabled
- public sealed class AtmosExposedSystem : EntitySystem
- {}
- */
-
- [ByRefEvent]
- public readonly struct AtmosExposedUpdateEvent
- {
- public readonly EntityCoordinates Coordinates;
- public readonly GasMixture GasMixture;
- public readonly TransformComponent Transform;
-
- public AtmosExposedUpdateEvent(EntityCoordinates coordinates, GasMixture mixture, TransformComponent transform)
- {
- Coordinates = coordinates;
- GasMixture = mixture;
- Transform = transform;
- }
- }
-
- ///
- /// Event that tries to query the mixture a certain entity is exposed to.
- /// This is mainly intended for use with entities inside of containers.
- /// This event is not raised for entities that are directly parented to the grid.
- ///
- [ByRefEvent]
- public struct AtmosExposedGetAirEvent
- {
- ///
- /// The entity we want to query this for.
- ///
- public readonly Entity Entity;
-
- ///
- /// The mixture that the entity is exposed to. Output parameter.
- ///
- public GasMixture? Gas = null;
-
- ///
- /// Whether to excite the mixture, if possible.
- ///
- public readonly bool Excite = false;
-
- ///
- /// Whether this event has been handled or not.
- /// Check this before changing anything.
- ///
- public bool Handled = false;
-
- public AtmosExposedGetAirEvent(Entity entity, bool excite = false)
- {
- Entity = entity;
- Excite = excite;
- }
- }
-}
diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.API.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.API.cs
index 8c28fe0bcf0..e68bf7b2ec3 100644
--- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.API.cs
+++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.API.cs
@@ -1,9 +1,8 @@
using System.Diagnostics;
-using Content.Server.Atmos.Components;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.NodeContainer.NodeGroups;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
+using Content.Shared.Atmos.EntitySystems;
using Content.Shared.Atmos.Reactions;
using JetBrains.Annotations;
using Robust.Shared.Map.Components;
@@ -20,61 +19,6 @@ public partial class AtmosphereSystem
consider adding a method here instead of making your own way to work around it.
*/
- ///
- /// Gets the that an entity is contained within.
- ///
- /// The entity to get the mixture for.
- /// If true, will ignore mixtures that the entity is contained in
- /// (ex. lockers and cryopods) and just get the tile mixture.
- /// If true, will mark the tile as active for atmosphere processing.
- /// A if one could be found, null otherwise.
- [PublicAPI]
- public GasMixture? GetContainingMixture(Entity ent, bool ignoreExposed = false, bool excite = false)
- {
- if (!Resolve(ent, ref ent.Comp))
- return null;
-
- return GetContainingMixture(ent, ent.Comp.GridUid, ent.Comp.MapUid, ignoreExposed, excite);
- }
-
- ///
- /// Gets the that an entity is contained within.
- ///
- /// The entity to get the mixture for.
- /// The grid that the entity may be on.
- /// The map that the entity may be on.
- /// If true, will ignore mixtures that the entity is contained in
- /// (ex. lockers and cryopods) and just get the tile mixture.
- /// If true, will mark the tile as active for atmosphere processing.
- /// A if one could be found, null otherwise.
- [PublicAPI]
- public GasMixture? GetContainingMixture(
- Entity ent,
- Entity? grid,
- Entity? map,
- bool ignoreExposed = false,
- bool excite = false)
- {
- if (!Resolve(ent, ref ent.Comp))
- return null;
-
- if (!ignoreExposed && !ent.Comp.Anchored)
- {
- // Used for things like disposals/cryo to change which air people are exposed to.
- var ev = new AtmosExposedGetAirEvent((ent, ent.Comp), excite);
- RaiseLocalEvent(ent, ref ev);
- if (ev.Handled)
- return ev.Gas;
-
- // TODO ATMOS: recursively iterate up through parents
- // This really needs recursive InContainer metadata flag for performance
- // And ideally some fast way to get the innermost airtight container.
- }
-
- var position = _transformSystem.GetGridTilePositionOrDefault((ent, ent.Comp));
- return GetTileMixture(grid, map, position, excite);
- }
-
///
/// Checks if a grid has an atmosphere.
///
@@ -153,6 +97,69 @@ public partial class AtmosphereSystem
entity.Comp.InvalidatedCoords.Add(tile);
}
+ ///
+ /// Gets the gas mixture for a specific tile that an entity is on.
+ ///
+ /// The entity to get the tile mixture for.
+ /// Whether to mark the tile as active for atmosphere processing.
+ /// A if one could be found, null otherwise.
+ /// This does not return the that the entity
+ /// may be contained in, ex. if the entity is currently in a locker/crate with its own
+ /// .
+ [PublicAPI]
+ public GasMixture? GetTileMixture(Entity entity, bool excite = false)
+ {
+ if (!Resolve(entity.Owner, ref entity.Comp))
+ return null;
+
+ var indices = XformSystem.GetGridTilePositionOrDefault(entity);
+ return GetTileMixture(entity.Comp.GridUid, entity.Comp.MapUid, indices, excite);
+ }
+
+ ///
+ /// Gets the that an entity is contained within.
+ ///
+ /// The entity to get the mixture for.
+ /// If true, will ignore mixtures that the entity is contained in
+ /// (ex. lockers and cryopods) and just get the tile mixture.
+ /// If true, will mark the tile as active for atmosphere processing.
+ /// A if one could be found, null otherwise.
+ [PublicAPI]
+ public GasMixture? GetContainingMixture(Entity ent, bool ignoreExposed = false, bool excite = false)
+ {
+ if (!Resolve(ent, ref ent.Comp))
+ return null;
+
+ return GetContainingMixture(ent, ent.Comp.GridUid, ent.Comp.MapUid, ignoreExposed, excite);
+ }
+
+ ///
+ /// Gets the that an entity is contained within.
+ ///
+ /// The entity to get the mixture for.
+ /// The grid that the entity may be on.
+ /// The map that the entity may be on.
+ /// If true, will ignore mixtures that the entity is contained in
+ /// (ex. lockers and cryopods) and just get the tile mixture.
+ /// If true, will mark the tile as active for atmosphere processing.
+ /// A if one could be found, null otherwise.
+ [PublicAPI]
+ public GasMixture? GetContainingMixture(Entity ent,
+ Entity? grid,
+ Entity? map,
+ bool ignoreExposed = false,
+ bool excite = false)
+ {
+ if (!Resolve(ent, ref ent.Comp))
+ return null;
+
+ if (!ignoreExposed && TryGetExposedMixture(ent, out var mixture))
+ return mixture;
+
+ var position = XformSystem.GetGridTilePositionOrDefault((ent, ent.Comp));
+ return GetTileMixture(grid, map, position, excite);
+ }
+
///
/// Gets the gas mixtures for a list of tiles on a grid or map.
///
@@ -226,33 +233,6 @@ public partial class AtmosphereSystem
return mixtures;
}
- ///
- /// Gets the gas mixture for a specific tile that an entity is on.
- ///
- /// The entity to get the tile mixture for.
- /// Whether to mark the tile as active for atmosphere processing.
- /// A if one could be found, null otherwise.
- /// This does not return the that the entity
- /// may be contained in, ex. if the entity is currently in a locker/crate with its own
- /// .
- [PublicAPI]
- public GasMixture? GetTileMixture(Entity entity, bool excite = false)
- {
- if (!Resolve(entity.Owner, ref entity.Comp))
- return null;
-
- var indices = _transformSystem.GetGridTilePositionOrDefault(entity);
- return GetTileMixture(entity.Comp.GridUid, entity.Comp.MapUid, indices, excite);
- }
-
- ///
- /// Gets the gas mixture for a specific tile on a grid or map.
- ///
- /// The grid to get the mixture from.
- /// The map to get the mixture from.
- /// The tile to get the mixture from.
- /// Whether to mark the tile as active for atmosphere processing.
- /// >A if one could be found, null otherwise.
[PublicAPI]
public GasMixture? GetTileMixture(
Entity? grid,
@@ -281,6 +261,34 @@ public partial class AtmosphereSystem
return GasMixture.SpaceGas;
}
+ public override void MergeContainingMixture(Entity entity, GasMixture mixture, bool ignoreExposed = false, bool excite = false)
+ {
+ if (GetContainingMixture(entity, ignoreExposed, excite) is not { } containingMixture)
+ return;
+
+ Merge(containingMixture, mixture);
+ }
+
+ [PublicAPI]
+ public override void MergeTileMixture(Entity entity, GasMixture mixture, bool excite = false)
+ {
+ if (GetTileMixture(entity, excite) is not { } tileMixture)
+ return;
+
+ Merge(tileMixture, mixture);
+ }
+
+ public override void AdjustContainingMixture(Entity entity, Gas gas, float mols, bool ignoreExposed = false, bool excite = false)
+ {
+ GetContainingMixture(entity, ignoreExposed, excite)?.AdjustMoles(gas, mols);
+ }
+
+ [PublicAPI]
+ public override void AdjustTileMixture(Entity entity, Gas gas, float mols, bool excite = false)
+ {
+ GetTileMixture(entity, excite)?.AdjustMoles(gas, mols);
+ }
+
///
/// Triggers a tile's to react.
///
diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.BenchmarkHelpers.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.BenchmarkHelpers.cs
index 62cbbae68a8..4be0dbfc39a 100644
--- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.BenchmarkHelpers.cs
+++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.BenchmarkHelpers.cs
@@ -1,5 +1,6 @@
using Content.Server.Atmos.Components;
using Content.Shared.Atmos.Components;
+using Content.Shared.Atmos.EntitySystems;
using Robust.Shared.Map.Components;
namespace Content.Server.Atmos.EntitySystems;
diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.DeltaPressure.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.DeltaPressure.cs
index 529f24d610a..9457c5689c5 100644
--- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.DeltaPressure.cs
+++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.DeltaPressure.cs
@@ -3,6 +3,7 @@ using System.Collections.Concurrent;
using Content.Server.Atmos.Components;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
+using Content.Shared.Atmos.EntitySystems;
using Content.Shared.Damage;
using Robust.Shared.Random;
using Robust.Shared.Threading;
@@ -31,11 +32,6 @@ public sealed partial class AtmosphereSystem
///
private const int DeltaPressurePairCount = Atmospherics.Directions / 2;
- ///
- /// The length to pre-allocate list/dicts of delta pressure entities on a .
- ///
- public const int DeltaPressurePreAllocateLength = 1000;
-
///
/// Bulk processes a range of entities on a
/// from a starting index to an ending index,
@@ -321,18 +317,6 @@ public sealed partial class AtmosphereSystem
}
}
- ///
- /// Struct that holds the result of delta pressure damage processing for an entity.
- /// This is only created and enqueued when the entity needs to take damage.
- ///
- /// The entity to deal damage to.
- /// The current absolute pressure the entity is experiencing.
- /// The current delta pressure the entity is experiencing.
- public readonly record struct DeltaPressureDamageResult(
- Entity Ent,
- float Pressure,
- float DeltaPressure);
-
///
/// Does damage to an entity depending on the pressure experienced by it, based on the
/// entity's .
diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Gases.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Gases.cs
index 2acd8e4ecab..639a71ec608 100644
--- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Gases.cs
+++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Gases.cs
@@ -66,22 +66,6 @@ namespace Content.Server.Atmos.EntitySystems
return Speedup;
}
- ///
- /// Calculates the thermal energy for a gas mixture.
- ///
- public float GetThermalEnergy(GasMixture mixture)
- {
- return mixture.Temperature * GetHeatCapacity(mixture);
- }
-
- ///
- /// Calculates the thermal energy for a gas mixture, using a cached heat capacity value.
- ///
- public float GetThermalEnergy(GasMixture mixture, float cachedHeatCapacity)
- {
- return mixture.Temperature * cachedHeatCapacity;
- }
-
///
/// Add 'dQ' Joules of energy into 'mixture'.
///
@@ -92,28 +76,6 @@ namespace Content.Server.Atmos.EntitySystems
mixture.Temperature += dT;
}
- ///
- /// Merges the gas mixture into the gas mixture.
- /// The gas mixture is not modified by this method.
- ///
- public void Merge(GasMixture receiver, GasMixture giver)
- {
- if (receiver.Immutable) return;
-
- if (MathF.Abs(receiver.Temperature - giver.Temperature) > Atmospherics.MinimumTemperatureDeltaToConsider)
- {
- var receiverHeatCapacity = GetHeatCapacity(receiver);
- var giverHeatCapacity = GetHeatCapacity(giver);
- var combinedHeatCapacity = receiverHeatCapacity + giverHeatCapacity;
- if (combinedHeatCapacity > Atmospherics.MinimumHeatCapacity)
- {
- receiver.Temperature = (GetThermalEnergy(giver, giverHeatCapacity) + GetThermalEnergy(receiver, receiverHeatCapacity)) / combinedHeatCapacity;
- }
- }
-
- NumericsHelpers.Add(receiver.Moles, giver.Moles);
- }
-
///
/// Divides a source gas mixture into several recipient mixtures, scaled by their relative volumes. Does not
/// modify the source gas mixture. Used for pipe network splitting. Note that the total destination volume
@@ -506,10 +468,8 @@ namespace Content.Server.Atmos.EntitySystems
return GasCompareResult.NoExchange;
}
- ///
- /// Performs reactions for a given gas mixture on an optional holder.
- ///
- public ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder)
+ [PublicAPI]
+ public override ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder)
{
var reaction = ReactionResult.NoReaction;
var temperature = mixture.Temperature;
diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs
index 9720cd38a80..0c37bcefaf7 100644
--- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs
+++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.HighPressureDelta.cs
@@ -1,4 +1,3 @@
-using Content.Server.Atmos.Components;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.Mobs.Components;
@@ -129,7 +128,7 @@ namespace Content.Server.Atmos.EntitySystems
return;
// Used by ExperiencePressureDifference to correct push/throw directions from tile-relative to physics world.
- var gridWorldRotation = _transformSystem.GetWorldRotation(gridAtmosphere);
+ var gridWorldRotation = XformSystem.GetWorldRotation(gridAtmosphere);
// If we're using monstermos, smooth out the yeet direction to follow the flow
if (MonstermosEqualization)
@@ -248,7 +247,7 @@ namespace Content.Server.Atmos.EntitySystems
// TODO: Technically these directions won't be correct but uhh I'm just here for optimisations buddy not to fix my old bugs.
if (throwTarget != EntityCoordinates.Invalid)
{
- var pos = ((_transformSystem.ToMapCoordinates(throwTarget).Position - _transformSystem.GetWorldPosition(xform)).Normalized() + dirVec).Normalized();
+ var pos = ((XformSystem.ToMapCoordinates(throwTarget).Position - XformSystem.GetWorldPosition(xform)).Normalized() + dirVec).Normalized();
_physics.ApplyLinearImpulse(uid, pos * moveForce, body: physics);
}
else
diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs
index b98fd2756f3..c6567a4fd55 100644
--- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs
+++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Processing.cs
@@ -1,7 +1,8 @@
using Content.Server.Atmos.Components;
-using Content.Server.Atmos.Piping.Components;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
+using Content.Shared.Atmos.EntitySystems;
+using Content.Shared.Atmos.Piping.Components;
using Content.Shared.Maps;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
@@ -851,19 +852,4 @@ namespace Content.Server.Atmos.EntitySystems
///
Finished,
}
-
- public enum AtmosphereProcessingState : byte
- {
- Revalidate,
- TileEqualize,
- ActiveTiles,
- ExcitedGroups,
- HighPressureDelta,
- DeltaPressure,
- Hotspots,
- Superconductivity,
- PipeNet,
- AtmosDevices,
- NumStates
- }
}
diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Superconductivity.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Superconductivity.cs
index 46a554054b4..2b5979917ab 100644
--- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Superconductivity.cs
+++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Superconductivity.cs
@@ -1,5 +1,5 @@
-using Content.Server.Atmos.Components;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Robust.Shared.Map.Components;
namespace Content.Server.Atmos.EntitySystems
diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Utils.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Utils.cs
index 9b53d0d16cb..9c39c4dbb24 100644
--- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Utils.cs
+++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Utils.cs
@@ -1,7 +1,7 @@
using System.Runtime.CompilerServices;
-using Content.Server.Atmos.Components;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
+using Content.Shared.Atmos.EntitySystems;
using Content.Shared.Atmos.Piping.Components;
using Robust.Shared.Map.Components;
@@ -85,24 +85,6 @@ public partial class AtmosphereSystem
return Atmospherics.CellVolume * mapGrid.TileSize * tiles;
}
- ///
- /// Data on the airtightness of a .
- /// Cached on the and updated during
- /// if it was invalidated.
- ///
- /// The current directions blocked on this tile.
- /// This is where air cannot flow to.
- /// Whether the tile can have air when blocking directions.
- /// Common for entities like thin windows which only block one face but can still have air in the residing tile.
- /// If true, Atmospherics will generate air (yes, creating matter from nothing)
- /// using the adjacent tiles as a seed if the airtightness is removed and the tile has no air.
- /// This allows stuff like airlocks that void air when becoming airtight to keep opening/closing without
- /// draining a room by continuously voiding air.
- public readonly record struct AirtightData(
- AtmosDirection BlockedDirections,
- bool NoAirWhenBlocked,
- bool FixVacuum);
-
///
/// Updates the for a
/// immediately.
diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs
index df380912b6c..f02928b8e39 100644
--- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs
+++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.cs
@@ -1,8 +1,12 @@
+using System.Linq;
using Content.Server.Administration.Logs;
using Content.Server.Atmos.Components;
using Content.Server.Fluids.EntitySystems;
using Content.Server.NodeContainer.EntitySystems;
+using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.EntitySystems;
+using Content.Shared.Damage.Systems;
using Content.Shared.Decals;
using Content.Shared.Doors.Components;
using Content.Shared.Maps;
@@ -13,8 +17,6 @@ using Robust.Shared.Containers;
using Robust.Shared.Map;
using Robust.Shared.Physics.Systems;
using Robust.Shared.Prototypes;
-using System.Linq;
-using Content.Shared.Damage.Systems;
using Robust.Shared.Threading;
namespace Content.Server.Atmos.EntitySystems;
@@ -35,7 +37,6 @@ public sealed partial class AtmosphereSystem : SharedAtmosphereSystem
[Dependency] private readonly GasTileOverlaySystem _gasTileOverlaySystem = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[Dependency] private readonly SharedMapSystem _mapSystem = default!;
- [Dependency] private readonly SharedTransformSystem _transformSystem = default!;
[Dependency] private readonly TileSystem _tile = default!;
[Dependency] private readonly MapSystem _map = default!;
[Dependency] public readonly PuddleSystem Puddle = default!;
@@ -125,6 +126,6 @@ public sealed partial class AtmosphereSystem : SharedAtmosphereSystem
private void CacheDecals()
{
- _burntDecals = _protoMan.EnumeratePrototypes().Where(x => x.Tags.Contains("burnt")).Select(x => x.ID).ToArray();
+ _burntDecals = ProtoMan.EnumeratePrototypes().Where(x => x.Tags.Contains("burnt")).Select(x => x.ID).ToArray();
}
}
diff --git a/Content.Server/Atmos/EntitySystems/AutomaticAtmosSystem.cs b/Content.Server/Atmos/EntitySystems/AutomaticAtmosSystem.cs
index f1ffa0dafae..bc5621118d4 100644
--- a/Content.Server/Atmos/EntitySystems/AutomaticAtmosSystem.cs
+++ b/Content.Server/Atmos/EntitySystems/AutomaticAtmosSystem.cs
@@ -1,5 +1,5 @@
-using Content.Server.Atmos.Components;
using Content.Server.Shuttles.Systems;
+using Content.Shared.Atmos.Components;
using Robust.Shared.Map.Components;
using Robust.Shared.Physics.Events;
diff --git a/Content.Server/Atmos/EntitySystems/GasMinerSystem.cs b/Content.Server/Atmos/EntitySystems/GasMinerSystem.cs
index f7a3b9eed8a..3042fba0083 100644
--- a/Content.Server/Atmos/EntitySystems/GasMinerSystem.cs
+++ b/Content.Server/Atmos/EntitySystems/GasMinerSystem.cs
@@ -1,8 +1,8 @@
using System.Diagnostics.CodeAnalysis;
-using Content.Server.Atmos.Piping.Components;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.EntitySystems;
+using Content.Shared.Atmos.Piping.Components;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
diff --git a/Content.Server/Atmos/EntitySystems/HeatExchangerSystem.cs b/Content.Server/Atmos/EntitySystems/HeatExchangerSystem.cs
index 8183bb99e49..78d74d57c35 100644
--- a/Content.Server/Atmos/EntitySystems/HeatExchangerSystem.cs
+++ b/Content.Server/Atmos/EntitySystems/HeatExchangerSystem.cs
@@ -1,16 +1,9 @@
-using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
-using Content.Server.Atmos.Piping.Unary.Components;
-using Content.Server.Atmos;
using Content.Server.Atmos.Components;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
-using Content.Server.NodeContainer;
-using Content.Shared.Atmos.Piping;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.CCVar;
-using Content.Shared.Interaction;
-using JetBrains.Annotations;
using Robust.Shared.Configuration;
namespace Content.Server.Atmos.EntitySystems;
diff --git a/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs b/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs
index 8bd3608dfb1..669f390d695 100644
--- a/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs
+++ b/Content.Server/Atmos/Monitor/Systems/AirAlarmSystem.cs
@@ -1,5 +1,4 @@
using Content.Server.Atmos.Monitor.Components;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.DeviceLinking.Systems;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.Popups;
@@ -20,6 +19,7 @@ using Content.Shared.Power;
using Content.Shared.Wires;
using Robust.Server.GameObjects;
using System.Linq;
+using Content.Shared.Atmos.Components;
using Content.Shared.DeviceNetwork.Events;
using Content.Shared.DeviceNetwork.Components;
diff --git a/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs b/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs
index 7333b7b8142..83dafd0a29a 100644
--- a/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs
+++ b/Content.Server/Atmos/Monitor/Systems/AtmosMonitoringSystem.cs
@@ -1,16 +1,14 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Monitor.Components;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.EntitySystems;
-using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Systems;
-using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Shared.Administration.Logs;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Monitor;
using Content.Shared.Atmos.Piping.Components;
using Content.Shared.Database;
diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPassiveGateSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPassiveGateSystem.cs
index 008d3cb4ce6..b3da10513e1 100644
--- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPassiveGateSystem.cs
+++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPassiveGateSystem.cs
@@ -1,10 +1,9 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Piping.Binary.Components;
-using Content.Server.Atmos.Piping.Components;
-using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.Examine;
using JetBrains.Annotations;
diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs
index 63944cd5306..90e106a5b83 100644
--- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs
+++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressurePumpSystem.cs
@@ -1,12 +1,11 @@
using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
-using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.EntitySystems;
+using Content.Shared.Atmos.Piping.Components;
using Content.Shared.Audio;
using JetBrains.Annotations;
diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressureRegulatorSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressureRegulatorSystem.cs
index 076d5adf8ec..a79eceaa194 100644
--- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressureRegulatorSystem.cs
+++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasPressureRegulatorSystem.cs
@@ -1,8 +1,8 @@
using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.EntitySystems;
using Content.Shared.Atmos.Piping;
using Content.Shared.Atmos.Piping.Binary.Components;
diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasRecyclerSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasRecyclerSystem.cs
index 9645b0a133e..be485ac7440 100644
--- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasRecyclerSystem.cs
+++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasRecyclerSystem.cs
@@ -1,10 +1,9 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Piping.Binary.Components;
-using Content.Server.Atmos.Piping.Components;
-using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Piping;
using Content.Shared.Atmos.Piping.Components;
using Content.Shared.Audio;
diff --git a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs
index 455adfbafce..93526c6f6c1 100644
--- a/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs
+++ b/Content.Server/Atmos/Piping/Binary/EntitySystems/GasVolumePumpSystem.cs
@@ -1,10 +1,10 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Monitor.Systems;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Server.Power.Components;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Piping.Binary.Components;
using Content.Shared.Atmos.Piping.Binary.Systems;
using Content.Shared.Atmos.Piping.Components;
diff --git a/Content.Server/Atmos/Piping/EntitySystems/AtmosDeviceSystem.cs b/Content.Server/Atmos/Piping/EntitySystems/AtmosDeviceSystem.cs
index 3feaf79eb73..b7487cd5389 100644
--- a/Content.Server/Atmos/Piping/EntitySystems/AtmosDeviceSystem.cs
+++ b/Content.Server/Atmos/Piping/EntitySystems/AtmosDeviceSystem.cs
@@ -1,6 +1,5 @@
-using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Piping.Components;
using JetBrains.Annotations;
using Robust.Shared.Timing;
diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs
index 83da7ca7c22..8a286b68248 100644
--- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs
+++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasFilterSystem.cs
@@ -1,11 +1,10 @@
using Content.Server.Administration.Logs;
using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.Trinary.Components;
-using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Piping;
using Content.Shared.Atmos.Piping.Components;
using Content.Shared.Atmos.Piping.Trinary.Components;
diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs
index bcfeb658716..40070d6da2b 100644
--- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs
+++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/GasMixerSystem.cs
@@ -1,11 +1,10 @@
using Content.Server.Administration.Logs;
using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.Trinary.Components;
-using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Piping;
using Content.Shared.Atmos.Piping.Components;
using Content.Shared.Atmos.Piping.Trinary.Components;
diff --git a/Content.Server/Atmos/Piping/Trinary/EntitySystems/PressureControlledValveSystem.cs b/Content.Server/Atmos/Piping/Trinary/EntitySystems/PressureControlledValveSystem.cs
index d1570b11292..38f3ca8a470 100644
--- a/Content.Server/Atmos/Piping/Trinary/EntitySystems/PressureControlledValveSystem.cs
+++ b/Content.Server/Atmos/Piping/Trinary/EntitySystems/PressureControlledValveSystem.cs
@@ -1,9 +1,8 @@
using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.Trinary.Components;
-using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Piping;
using Content.Shared.Atmos.Piping.Components;
using Content.Shared.Audio;
diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs
index 9b377dfddfd..06807640a83 100644
--- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs
+++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCanisterSystem.cs
@@ -1,11 +1,11 @@
using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.NodeGroups;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Piping.Binary.Components;
+using Content.Shared.Atmos.Piping.Components;
using Content.Shared.Atmos.Piping.Unary.Systems;
using Content.Shared.Cargo;
using Content.Shared.Database;
diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCondenserSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCondenserSystem.cs
index e903ceedafa..7bec2136bed 100644
--- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCondenserSystem.cs
+++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasCondenserSystem.cs
@@ -1,12 +1,11 @@
using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.Unary.Components;
-using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.Chemistry.EntitySystems;
using Content.Shared.FixedPoint;
using JetBrains.Annotations;
diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs
index 62039185170..86738518e35 100644
--- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs
+++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasOutletInjectorSystem.cs
@@ -1,9 +1,8 @@
using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.Unary.Components;
-using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Piping;
using Content.Shared.Interaction;
using JetBrains.Annotations;
diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs
index 72812cb5237..84bd25d0688 100644
--- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs
+++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasPassiveVentSystem.cs
@@ -1,10 +1,9 @@
using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.Unary.Components;
-using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using JetBrains.Annotations;
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs
index 35ff89c7262..9f97f3560cd 100644
--- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs
+++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasThermoMachineSystem.cs
@@ -1,7 +1,5 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Monitor.Systems;
-using Content.Server.Atmos.Piping.Components;
-using Content.Server.Atmos.Piping.Unary.Components;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
@@ -10,10 +8,10 @@ using Content.Shared.Atmos;
using Content.Shared.Atmos.Piping.Unary.Components;
using JetBrains.Annotations;
using Content.Server.Power.EntitySystems;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Piping.Unary.Systems;
using Content.Shared.DeviceNetwork;
using Content.Shared.DeviceNetwork.Events;
-using Content.Shared.Examine;
using Content.Shared.DeviceNetwork.Components;
namespace Content.Server.Atmos.Piping.Unary.EntitySystems
diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs
index 1066e4e88d3..0716d96f14e 100644
--- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs
+++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentPumpSystem.cs
@@ -1,6 +1,5 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Monitor.Systems;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.Unary.Components;
using Content.Server.DeviceLinking.Systems;
using Content.Server.DeviceNetwork.Systems;
@@ -9,6 +8,7 @@ using Content.Server.NodeContainer.Nodes;
using Content.Server.Power.EntitySystems;
using Content.Shared.Administration.Logs;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Monitor;
using Content.Shared.Atmos.Piping.Components;
using Content.Shared.Atmos.Piping.Unary;
diff --git a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs
index 22f22a682a0..f6f3829142f 100644
--- a/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs
+++ b/Content.Server/Atmos/Piping/Unary/EntitySystems/GasVentScrubberSystem.cs
@@ -1,6 +1,5 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Atmos.Monitor.Systems;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.Unary.Components;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.NodeContainer.EntitySystems;
@@ -8,6 +7,7 @@ using Content.Server.NodeContainer.Nodes;
using Content.Server.Power.EntitySystems;
using Content.Shared.Administration.Logs;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Monitor;
using Content.Shared.Atmos.Piping.Components;
using Content.Shared.Atmos.Piping.Unary.Components;
diff --git a/Content.Server/Atmos/Portable/PortableScrubberSystem.cs b/Content.Server/Atmos/Portable/PortableScrubberSystem.cs
index b1b6ed36789..b421c1771c7 100644
--- a/Content.Server/Atmos/Portable/PortableScrubberSystem.cs
+++ b/Content.Server/Atmos/Portable/PortableScrubberSystem.cs
@@ -3,10 +3,7 @@ using Content.Shared.Atmos.Piping.Unary.Components;
using Content.Shared.Atmos.Visuals;
using Content.Shared.Examine;
using Content.Shared.Destructible;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.EntitySystems;
-using Content.Server.Power.Components;
-using Content.Server.NodeContainer;
using Robust.Server.GameObjects;
using Content.Server.NodeContainer.Nodes;
using Content.Server.NodeContainer.NodeGroups;
@@ -14,6 +11,7 @@ using Content.Server.Audio;
using Content.Server.Administration.Logs;
using Content.Server.NodeContainer.EntitySystems;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.Database;
using Content.Shared.Power;
diff --git a/Content.Server/Atmos/Portable/SpaceHeaterSystem.cs b/Content.Server/Atmos/Portable/SpaceHeaterSystem.cs
index 7410810f8b4..9385613d945 100644
--- a/Content.Server/Atmos/Portable/SpaceHeaterSystem.cs
+++ b/Content.Server/Atmos/Portable/SpaceHeaterSystem.cs
@@ -1,9 +1,8 @@
using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
-using Content.Server.Atmos.Piping.Unary.Components;
using Content.Server.Popups;
using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Piping.Portable.Components;
using Content.Shared.Atmos.Piping.Unary.Components;
using Content.Shared.Atmos.Visuals;
diff --git a/Content.Server/Atmos/Rotting/RottingSystem.cs b/Content.Server/Atmos/Rotting/RottingSystem.cs
index 3c4440ed7c1..07526e4b799 100644
--- a/Content.Server/Atmos/Rotting/RottingSystem.cs
+++ b/Content.Server/Atmos/Rotting/RottingSystem.cs
@@ -127,11 +127,11 @@ public sealed class RottingSystem : SharedRottingSystem
if (!TryComp(uid, out var physics))
continue;
+
// We need a way to get the mass of the mob alone without armor etc in the future
// or just remove the mass mechanics altogether because they aren't good.
var molRate = perishable.MolsPerSecondPerUnitMass * (float)rotting.RotUpdateRate.TotalSeconds;
- var tileMix = _atmosphere.GetTileMixture(uid, excite: true);
- tileMix?.AdjustMoles(Gas.Ammonia, molRate * physics.FixturesMass);
+ _atmosphere.AdjustTileMixture(uid, Gas.Ammonia, molRate * physics.FixturesMass, excite: true);
}
}
}
diff --git a/Content.Server/Disposal/Unit/BeingDisposedSystem.cs b/Content.Server/Disposal/Unit/BeingDisposedSystem.cs
index fcff4ba3b55..b2fa7239fb3 100644
--- a/Content.Server/Disposal/Unit/BeingDisposedSystem.cs
+++ b/Content.Server/Disposal/Unit/BeingDisposedSystem.cs
@@ -1,5 +1,6 @@
using Content.Server.Atmos.EntitySystems;
using Content.Server.Body.Systems;
+using Content.Shared.Atmos;
namespace Content.Server.Disposal.Unit;
diff --git a/Content.Server/Doors/Systems/FirelockSystem.cs b/Content.Server/Doors/Systems/FirelockSystem.cs
index be0c0250690..91cba14bd66 100644
--- a/Content.Server/Doors/Systems/FirelockSystem.cs
+++ b/Content.Server/Doors/Systems/FirelockSystem.cs
@@ -6,6 +6,7 @@ using Content.Server.Power.Components;
using Content.Server.Power.EntitySystems;
using Content.Server.Shuttles.Components;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Monitor;
using Content.Shared.Doors.Components;
using Content.Shared.Doors.Systems;
diff --git a/Content.Server/Mech/Systems/MechSystem.cs b/Content.Server/Mech/Systems/MechSystem.cs
index 36fd0722108..7b4c7f32f49 100644
--- a/Content.Server/Mech/Systems/MechSystem.cs
+++ b/Content.Server/Mech/Systems/MechSystem.cs
@@ -26,6 +26,7 @@ using Robust.Shared.Containers;
using Robust.Shared.Player;
using Robust.Shared.Prototypes;
using System.Linq;
+using Content.Shared.Atmos;
namespace Content.Server.Mech.Systems;
diff --git a/Content.Server/Medical/CryoPodSystem.cs b/Content.Server/Medical/CryoPodSystem.cs
index 239de94455b..9668b0ab58b 100644
--- a/Content.Server/Medical/CryoPodSystem.cs
+++ b/Content.Server/Medical/CryoPodSystem.cs
@@ -1,13 +1,14 @@
using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
using Content.Server.Atmos.Piping.Unary.EntitySystems;
using Content.Server.Medical.Components;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.NodeGroups;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.Damage.Systems;
using Content.Shared.Medical.Cryogenics;
+
namespace Content.Server.Medical;
public sealed partial class CryoPodSystem : SharedCryoPodSystem
diff --git a/Content.Server/Medical/InsideCryoPodSystem.cs b/Content.Server/Medical/InsideCryoPodSystem.cs
index 21827c105f9..f04bb3cc40e 100644
--- a/Content.Server/Medical/InsideCryoPodSystem.cs
+++ b/Content.Server/Medical/InsideCryoPodSystem.cs
@@ -1,6 +1,6 @@
-using Content.Server.Atmos.EntitySystems;
-using Content.Server.Body.Systems;
+using Content.Server.Body.Systems;
using Content.Server.Medical.Components;
+using Content.Shared.Atmos;
using Content.Shared.Medical.Cryogenics;
namespace Content.Server.Medical
diff --git a/Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs b/Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs
index 219f87805d3..06b6359cd6c 100644
--- a/Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs
+++ b/Content.Server/NodeContainer/EntitySystems/NodeGroupSystem.cs
@@ -2,7 +2,6 @@ using System.Diagnostics;
using System.Linq;
using Content.Server.Administration.Managers;
using Content.Server.NodeContainer.NodeGroups;
-using Content.Server.NodeContainer.Nodes;
using Content.Shared.Administration;
using Content.Shared.NodeContainer;
using Content.Shared.NodeContainer.NodeGroups;
diff --git a/Content.Server/NodeContainer/NodeGroups/PipeNet.cs b/Content.Server/NodeContainer/NodeGroups/PipeNet.cs
index 3c8e65ca91f..591278c8b00 100644
--- a/Content.Server/NodeContainer/NodeGroups/PipeNet.cs
+++ b/Content.Server/NodeContainer/NodeGroups/PipeNet.cs
@@ -1,103 +1,92 @@
using System.Linq;
-using Content.Server.Atmos;
using Content.Server.Atmos.EntitySystems;
using Content.Server.NodeContainer.Nodes;
using Content.Shared.Atmos;
using Content.Shared.NodeContainer;
using Content.Shared.NodeContainer.NodeGroups;
-using Robust.Shared.Utility;
-namespace Content.Server.NodeContainer.NodeGroups
+namespace Content.Server.NodeContainer.NodeGroups;
+
+[NodeGroup(NodeGroupID.Pipe)]
+public sealed class PipeNet : BaseNodeGroup, IPipeNet
{
- public interface IPipeNet : INodeGroup, IGasMixtureHolder
+ [ViewVariables] public GasMixture Air { get; set; } = new() {Temperature = Atmospherics.T20C};
+
+ [ViewVariables] private AtmosphereSystem? _atmosphereSystem;
+
+ public EntityUid? Grid { get; private set; }
+
+ public override void Initialize(Node sourceNode, IEntityManager entMan)
{
- ///
- /// Causes gas in the PipeNet to react.
- ///
- void Update();
+ base.Initialize(sourceNode, entMan);
+
+ Grid = entMan.GetComponent(sourceNode.Owner).GridUid;
+
+ if (Grid == null)
+ {
+ // This is probably due to a canister or something like that being spawned in space.
+ return;
+ }
+
+ _atmosphereSystem = entMan.EntitySysManager.GetEntitySystem();
+ _atmosphereSystem.AddPipeNet(Grid.Value, this);
}
- [NodeGroup(NodeGroupID.Pipe)]
- public sealed class PipeNet : BaseNodeGroup, IPipeNet
+ public void Update()
{
- [ViewVariables] public GasMixture Air { get; set; } = new() {Temperature = Atmospherics.T20C};
+ _atmosphereSystem?.React(Air, this);
+ }
- [ViewVariables] private AtmosphereSystem? _atmosphereSystem;
+ public override void LoadNodes(List groupNodes)
+ {
+ base.LoadNodes(groupNodes);
- public EntityUid? Grid { get; private set; }
-
- public override void Initialize(Node sourceNode, IEntityManager entMan)
+ foreach (var node in groupNodes)
{
- base.Initialize(sourceNode, entMan);
+ var pipeNode = (PipeNode) node;
+ Air.Volume += pipeNode.Volume;
+ }
+ }
- Grid = entMan.GetComponent(sourceNode.Owner).GridUid;
+ public override void RemoveNode(Node node)
+ {
+ base.RemoveNode(node);
- if (Grid == null)
- {
- // This is probably due to a cannister or something like that being spawned in space.
- return;
- }
+ // if the node is simply being removed into a separate group, we do nothing, as gas redistribution will be
+ // handled by AfterRemake(). But if it is being deleted, we actually want to remove the gas stored in this node.
+ if (!node.Deleting || node is not PipeNode pipe)
+ return;
- _atmosphereSystem = entMan.EntitySysManager.GetEntitySystem();
- _atmosphereSystem.AddPipeNet(Grid.Value, this);
+ Air.Multiply(1f - pipe.Volume / Air.Volume);
+ Air.Volume -= pipe.Volume;
+ }
+
+ public override void AfterRemake(IEnumerable> newGroups)
+ {
+ RemoveFromGridAtmos();
+
+ var newAir = new List(newGroups.Count());
+ foreach (var newGroup in newGroups)
+ {
+ if (newGroup.Key is IPipeNet newPipeNet)
+ newAir.Add(newPipeNet.Air);
}
- public void Update()
- {
- _atmosphereSystem?.React(Air, this);
- }
+ _atmosphereSystem?.DivideInto(Air, newAir);
+ }
- public override void LoadNodes(List groupNodes)
- {
- base.LoadNodes(groupNodes);
+ private void RemoveFromGridAtmos()
+ {
+ if (Grid == null)
+ return;
- foreach (var node in groupNodes)
- {
- var pipeNode = (PipeNode) node;
- Air.Volume += pipeNode.Volume;
- }
- }
+ _atmosphereSystem?.RemovePipeNet(Grid.Value, this);
+ }
- public override void RemoveNode(Node node)
- {
- base.RemoveNode(node);
-
- // if the node is simply being removed into a separate group, we do nothing, as gas redistribution will be
- // handled by AfterRemake(). But if it is being deleted, we actually want to remove the gas stored in this node.
- if (!node.Deleting || node is not PipeNode pipe)
- return;
-
- Air.Multiply(1f - pipe.Volume / Air.Volume);
- Air.Volume -= pipe.Volume;
- }
-
- public override void AfterRemake(IEnumerable> newGroups)
- {
- RemoveFromGridAtmos();
-
- var newAir = new List(newGroups.Count());
- foreach (var newGroup in newGroups)
- {
- if (newGroup.Key is IPipeNet newPipeNet)
- newAir.Add(newPipeNet.Air);
- }
-
- _atmosphereSystem?.DivideInto(Air, newAir);
- }
-
- private void RemoveFromGridAtmos()
- {
- if (Grid == null)
- return;
-
- _atmosphereSystem?.RemovePipeNet(Grid.Value, this);
- }
-
- public override string GetDebugData()
- {
- return @$"Pressure: { Air.Pressure:G3}
+ public override string GetDebugData()
+ {
+ return @$"Pressure: { Air.Pressure:G3}
Temperature: {Air.Temperature:G3}
Volume: {Air.Volume:G3}";
- }
}
}
diff --git a/Content.Server/NodeContainer/Nodes/PipeNode.cs b/Content.Server/NodeContainer/Nodes/PipeNode.cs
index 23a2c217506..bf1d2616117 100644
--- a/Content.Server/NodeContainer/Nodes/PipeNode.cs
+++ b/Content.Server/NodeContainer/Nodes/PipeNode.cs
@@ -3,6 +3,7 @@ using Content.Server.NodeContainer.NodeGroups;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.NodeContainer;
+using Content.Shared.NodeContainer.NodeGroups;
using Robust.Shared.Map.Components;
using Robust.Shared.Utility;
diff --git a/Content.Server/Power/Generation/Teg/TegSystem.cs b/Content.Server/Power/Generation/Teg/TegSystem.cs
index ef578c81bf1..c8b75559be9 100644
--- a/Content.Server/Power/Generation/Teg/TegSystem.cs
+++ b/Content.Server/Power/Generation/Teg/TegSystem.cs
@@ -1,13 +1,10 @@
-using Content.Server.Atmos;
-using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
+using Content.Server.Atmos.EntitySystems;
using Content.Server.Audio;
-using Content.Server.DeviceNetwork;
using Content.Server.DeviceNetwork.Systems;
-using Content.Server.NodeContainer;
using Content.Server.NodeContainer.Nodes;
using Content.Server.Power.Components;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.DeviceNetwork;
using Content.Shared.DeviceNetwork.Events;
using Content.Shared.Examine;
@@ -17,7 +14,6 @@ using Content.Shared.Power.EntitySystems;
using Content.Shared.Power.Generation.Teg;
using Content.Shared.Rounding;
using Robust.Server.GameObjects;
-using Robust.Shared.Utility;
namespace Content.Server.Power.Generation.Teg;
diff --git a/Content.Server/Power/Generator/GasPowerReceiverSystem.cs b/Content.Server/Power/Generator/GasPowerReceiverSystem.cs
index e3979a65192..d26977c87ae 100644
--- a/Content.Server/Power/Generator/GasPowerReceiverSystem.cs
+++ b/Content.Server/Power/Generator/GasPowerReceiverSystem.cs
@@ -1,10 +1,8 @@
using Content.Server.Atmos.EntitySystems;
-using Content.Server.Atmos.Piping.Components;
-using Content.Server.NodeContainer;
using Content.Server.NodeContainer.EntitySystems;
using Content.Server.NodeContainer.Nodes;
-using Content.Server.Power.Components;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.Power;
namespace Content.Server.Power.Generator;
diff --git a/Content.Server/Salvage/SpawnSalvageMissionJob.cs b/Content.Server/Salvage/SpawnSalvageMissionJob.cs
index f212fa4a833..d989a19cce9 100644
--- a/Content.Server/Salvage/SpawnSalvageMissionJob.cs
+++ b/Content.Server/Salvage/SpawnSalvageMissionJob.cs
@@ -1,19 +1,16 @@
-using System.Collections;
using System.Linq;
using System.Numerics;
using System.Threading;
using System.Threading.Tasks;
-using Content.Server.Atmos;
-using Content.Server.Atmos.Components;
using Content.Server.Atmos.EntitySystems;
-using Robust.Shared.CPUJob.JobQueues;
using Content.Server.Ghost.Roles.Components;
using Content.Server.Parallax;
using Content.Server.Procedural;
using Content.Server.Salvage.Expeditions;
+using Content.Server.Shuttles.Components;
using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
using Content.Shared.Construction.EntitySystems;
-using Content.Shared.Dataset;
using Content.Shared.Gravity;
using Content.Shared.Parallax.Biomes;
using Content.Shared.Physics;
@@ -24,15 +21,13 @@ using Content.Shared.Salvage;
using Content.Shared.Salvage.Expeditions;
using Content.Shared.Salvage.Expeditions.Modifiers;
using Content.Shared.Shuttles.Components;
-using Content.Shared.Storage;
using Robust.Shared.Collections;
-using Robust.Shared.Map;
+using Robust.Shared.CPUJob.JobQueues;
using Robust.Shared.Map.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
-using Content.Server.Shuttles.Components;
namespace Content.Server.Salvage;
diff --git a/Content.Server/SensorMonitoring/SensorMonitoringConsoleSystem.cs b/Content.Server/SensorMonitoring/SensorMonitoringConsoleSystem.cs
index ebe8f304bab..99779e2a0ee 100644
--- a/Content.Server/SensorMonitoring/SensorMonitoringConsoleSystem.cs
+++ b/Content.Server/SensorMonitoring/SensorMonitoringConsoleSystem.cs
@@ -1,9 +1,8 @@
using Content.Server.Atmos.Monitor.Components;
using Content.Server.Atmos.Monitor.Systems;
-using Content.Server.Atmos.Piping.Components;
-using Content.Server.Atmos.Piping.Unary.Components;
using Content.Server.DeviceNetwork.Systems;
using Content.Server.Power.Generation.Teg;
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Monitor;
using Content.Shared.Atmos.Piping.Binary.Components;
using Content.Shared.Atmos.Piping.Unary.Components;
diff --git a/Content.Server/Storage/EntitySystems/EntityStorageSystem.cs b/Content.Server/Storage/EntitySystems/EntityStorageSystem.cs
index e22a4f5d7ec..8fb898dfa84 100644
--- a/Content.Server/Storage/EntitySystems/EntityStorageSystem.cs
+++ b/Content.Server/Storage/EntitySystems/EntityStorageSystem.cs
@@ -2,6 +2,7 @@ using Content.Server.Atmos.EntitySystems;
using Content.Server.Body.Systems;
using Content.Server.Construction;
using Content.Server.Construction.Components;
+using Content.Shared.Atmos;
using Content.Shared.Storage.Components;
using Content.Shared.Storage.EntitySystems;
using Robust.Server.GameObjects;
diff --git a/Content.Shared/Atmos/AtmosExposedEvents.cs b/Content.Shared/Atmos/AtmosExposedEvents.cs
new file mode 100644
index 00000000000..41b65fe24f2
--- /dev/null
+++ b/Content.Shared/Atmos/AtmosExposedEvents.cs
@@ -0,0 +1,57 @@
+using Robust.Shared.Map;
+
+namespace Content.Shared.Atmos;
+
+///
+/// Raised on entities that have an AtmosExposedComponent when AtmosphereSystem updates.
+/// Exposure events are raised by AtmosphereSystem at some fixed interval.
+///
+/// The coordinates of the entity that is being exposed.
+/// The gas mixture that the entity is exposed to.
+/// The xform of the entity that is being exposed.
+[ByRefEvent]
+public readonly struct AtmosExposedUpdateEvent(
+ EntityCoordinates coordinates,
+ GasMixture mixture,
+ TransformComponent transform)
+{
+ public readonly EntityCoordinates Coordinates = coordinates;
+ public readonly GasMixture GasMixture = mixture;
+ public readonly TransformComponent Transform = transform;
+}
+
+///
+/// Event that tries to query the mixture a certain entity is exposed to.
+/// This is mainly intended for use with entities inside of containers.
+/// This event is not raised for entities that are directly parented to the grid.
+///
+[ByRefEvent]
+public struct AtmosExposedGetAirEvent
+{
+ ///
+ /// The entity we want to query this for.
+ ///
+ public readonly Entity Entity;
+
+ ///
+ /// The mixture that the entity is exposed to. Output parameter.
+ ///
+ public GasMixture? Gas = null;
+
+ ///
+ /// Whether to excite the mixture, if possible.
+ ///
+ public readonly bool Excite = false;
+
+ ///
+ /// Whether this event has been handled or not.
+ /// Check this before changing anything.
+ ///
+ public bool Handled = false;
+
+ public AtmosExposedGetAirEvent(Entity entity, bool excite = false)
+ {
+ Entity = entity;
+ Excite = excite;
+ }
+}
diff --git a/Content.Server/Atmos/Piping/Components/AtmosDeviceComponent.cs b/Content.Shared/Atmos/Components/AtmosDeviceComponent.cs
similarity index 95%
rename from Content.Server/Atmos/Piping/Components/AtmosDeviceComponent.cs
rename to Content.Shared/Atmos/Components/AtmosDeviceComponent.cs
index 5b55d9d3b67..2226f44981c 100644
--- a/Content.Server/Atmos/Piping/Components/AtmosDeviceComponent.cs
+++ b/Content.Shared/Atmos/Components/AtmosDeviceComponent.cs
@@ -1,7 +1,4 @@
-using Content.Server.Atmos.Components;
-using Content.Shared.Atmos.Components;
-
-namespace Content.Server.Atmos.Piping.Components;
+namespace Content.Shared.Atmos.Components;
///
/// Component for atmos devices which are updated in line with atmos, as part of a
diff --git a/Content.Shared/Atmos/Components/GridAtmosphereComponent.cs b/Content.Shared/Atmos/Components/GridAtmosphereComponent.cs
new file mode 100644
index 00000000000..f633947eea1
--- /dev/null
+++ b/Content.Shared/Atmos/Components/GridAtmosphereComponent.cs
@@ -0,0 +1,155 @@
+using System.Collections.Concurrent;
+using Content.Shared.Atmos.EntitySystems;
+using Content.Shared.Atmos.Serialization;
+using Content.Shared.NodeContainer.NodeGroups;
+
+namespace Content.Shared.Atmos.Components;
+
+///
+/// Internal class for storing all grid data.
+/// If you need to access this data, use the API methods in the /server
+/// instead of trying to scour this component or others for the data you need.
+///
+[RegisterComponent, Serializable,
+ Access(typeof(SharedAtmosphereSystem), typeof(SharedGasTileOverlaySystem), typeof(SharedAtmosDebugOverlaySystem))]
+public sealed partial class GridAtmosphereComponent : Component
+{
+ ///
+ /// Whether the grid is being updated by Atmospherics.
+ ///
+ [ViewVariables(VVAccess.ReadWrite)]
+ public bool Simulated = true;
+
+ ///
+ /// Indicator for if Atmospherics has delegated the processing of this
+ /// grid to another tick due to the time budget running out.
+ ///
+ /// If true, Atmospherics is not finished
+ /// processing the current stage and has yielded processing
+ /// to the next tick.
+ [ViewVariables]
+ public bool ProcessingPaused;
+
+ ///
+ /// Timer used to delay processing for every AtmosTick.
+ /// No, Atmospherics cannot tick every frame.
+ ///
+ /// TODO: Replace with TimeSpan please.
+ [ViewVariables]
+ public float Timer;
+
+ ///
+ /// Integer that is incremented every time the grid is processed by Atmospherics.
+ /// Used in multiple subsystems to prevent double-copy/processing of data.
+ ///
+ /// Do not set to zero by default.
+ /// You will break roundstart atmos otherwise.
+ [ViewVariables]
+ public int UpdateCounter = 1;
+
+ [ViewVariables]
+ [IncludeDataField(customTypeSerializer:typeof(TileAtmosCollectionSerializer))]
+ public Dictionary Tiles = new(1000);
+
+ [ViewVariables]
+ public HashSet MapTiles = new(1000);
+
+ [ViewVariables]
+ public readonly HashSet ActiveTiles = new(1000);
+
+ [ViewVariables]
+ public int ActiveTilesCount => ActiveTiles.Count;
+
+ [ViewVariables]
+ public readonly HashSet ExcitedGroups = new(1000);
+
+ [ViewVariables]
+ public int ExcitedGroupCount => ExcitedGroups.Count;
+
+ [ViewVariables]
+ public readonly HashSet HotspotTiles = new(1000);
+
+ [ViewVariables]
+ public int HotspotTilesCount => HotspotTiles.Count;
+
+ [ViewVariables]
+ public readonly HashSet SuperconductivityTiles = new(1000);
+
+ [ViewVariables]
+ public int SuperconductivityTilesCount => SuperconductivityTiles.Count;
+
+ [ViewVariables]
+ public HashSet HighPressureDelta = new(1000);
+
+ [ViewVariables]
+ public int HighPressureDeltaCount => HighPressureDelta.Count;
+
+ ///
+ /// A list of entities that have a and are to
+ /// be processed by the , if enabled.
+ ///
+ /// To prevent massive bookkeeping overhead, this list is processed in-place,
+ /// with add/remove/find operations helped via a dict.
+ ///
+ /// If you want to add/remove/find entities in this list,
+ /// use the API methods in the Atmospherics API.
+ [ViewVariables]
+ public readonly List> DeltaPressureEntities =
+ new(SharedAtmosphereSystem.DeltaPressurePreAllocateLength);
+
+ ///
+ /// An index lookup for the list.
+ /// Used for add/remove/find operations to speed up processing.
+ ///
+ public readonly Dictionary DeltaPressureEntityLookup =
+ new(SharedAtmosphereSystem.DeltaPressurePreAllocateLength);
+
+ ///
+ /// Integer that indicates the current position in the
+ /// list that is being processed.
+ ///
+ [ViewVariables(VVAccess.ReadOnly)]
+ public int DeltaPressureCursor;
+
+ ///
+ /// Queue of entities that need to have damage applied to them.
+ ///
+ [ViewVariables]
+ public readonly ConcurrentQueue DeltaPressureDamageResults = new();
+
+ [ViewVariables]
+ public readonly HashSet PipeNets = new();
+
+ [ViewVariables]
+ public readonly HashSet> AtmosDevices = new();
+
+ [ViewVariables]
+ public readonly Queue CurrentRunTiles = new();
+
+ [ViewVariables]
+ public readonly Queue CurrentRunExcitedGroups = new();
+
+ [ViewVariables]
+ public readonly Queue CurrentRunPipeNet = new();
+
+ [ViewVariables]
+ public readonly Queue> CurrentRunAtmosDevices = new();
+
+ [ViewVariables]
+ public readonly HashSet InvalidatedCoords = new(1000);
+
+ [ViewVariables]
+ public readonly Queue CurrentRunInvalidatedTiles = new();
+
+ [ViewVariables]
+ public readonly List PossiblyDisconnectedTiles = new(100);
+
+ [ViewVariables]
+ public int InvalidatedCoordsCount => InvalidatedCoords.Count;
+
+ [ViewVariables]
+ public long EqualizationQueueCycleControl { get; set; }
+
+ [ViewVariables]
+ public AtmosphereProcessingState State { get; set; } = AtmosphereProcessingState.Revalidate;
+}
diff --git a/Content.Server/Atmos/Components/MapAtmosphereComponent.cs b/Content.Shared/Atmos/Components/MapAtmosphereComponent.cs
similarity index 51%
rename from Content.Server/Atmos/Components/MapAtmosphereComponent.cs
rename to Content.Shared/Atmos/Components/MapAtmosphereComponent.cs
index bdd05e78494..37014ebfddb 100644
--- a/Content.Server/Atmos/Components/MapAtmosphereComponent.cs
+++ b/Content.Shared/Atmos/Components/MapAtmosphereComponent.cs
@@ -1,25 +1,23 @@
-using Content.Shared.Atmos;
-using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.EntitySystems;
-namespace Content.Server.Atmos.Components;
+namespace Content.Shared.Atmos.Components;
///
-/// Component that defines the default GasMixture for a map.
+/// Component that defines the default GasMixture for a map.
///
[RegisterComponent, Access(typeof(SharedAtmosphereSystem))]
public sealed partial class MapAtmosphereComponent : SharedMapAtmosphereComponent
{
///
- /// The default GasMixture a map will have. Space mixture by default.
+ /// The default GasMixture a map will have. Space mixture by default.
///
- [DataField, ViewVariables(VVAccess.ReadWrite)]
+ [DataField]
public GasMixture Mixture = GasMixture.SpaceGas;
///
- /// Whether empty tiles will be considered space or not.
+ /// Whether empty tiles will be considered space or not.
///
- [DataField, ViewVariables(VVAccess.ReadWrite)]
+ [DataField]
public bool Space = true;
public SharedGasTileOverlaySystem.GasOverlayData Overlay;
diff --git a/Content.Shared/Atmos/EntitySystems/SharedAtmosphereSystem.API.cs b/Content.Shared/Atmos/EntitySystems/SharedAtmosphereSystem.API.cs
new file mode 100644
index 00000000000..3852c30974c
--- /dev/null
+++ b/Content.Shared/Atmos/EntitySystems/SharedAtmosphereSystem.API.cs
@@ -0,0 +1,89 @@
+using System.Diagnostics.CodeAnalysis;
+using JetBrains.Annotations;
+
+namespace Content.Shared.Atmos.EntitySystems;
+
+public abstract partial class SharedAtmosphereSystem
+{
+ ///
+ /// Merges a given into this entity's containing .
+ ///
+ /// Entity who's containing
+ /// we're merging a given into.
+ /// The gas
+ /// we're merging into the containing
+ /// Whether we should ignore non-tile s.
+ /// Whether we should excite the gas upon merging.
+ [PublicAPI]
+ public virtual void MergeContainingMixture(Entity entity, GasMixture mixture, bool ignoreExposed = false, bool excite = false)
+ {
+ // Handled by server
+ }
+
+ ///
+ /// Merges a given gas into this entity's tile .
+ ///
+ /// Entity who's containing
+ /// we're merging a given into.
+ /// The gas
+ /// we're merging into the containing .
+ /// Whether we should excite the gas upon merging.
+ [PublicAPI]
+ public virtual void MergeTileMixture(Entity entity, GasMixture mixture, bool excite = false)
+ {
+ // Handled by server
+ }
+
+ ///
+ /// Adjusts a given gas in this entity's containing .
+ ///
+ /// Entity who's containing
+ /// we're merging a given into.
+ /// The gas in our given we're adjusting the mols of.
+ /// The amount of mols we're adjusting the gas by.
+ /// Whether we should ignore non-tile s.
+ /// Whether we should excite the gas upon merging.
+ [PublicAPI]
+ public virtual void AdjustContainingMixture(Entity entity, Gas gas, float mols, bool ignoreExposed = false, bool excite = false)
+ {
+ // Handled by server
+ }
+
+ ///
+ /// Adjusts a given gas in this entity's tile .
+ ///
+ /// Entity who's containing
+ /// we're merging a given into.
+ /// The gas in our given we're adjusting the mols of.
+ /// The amount of mols we're adjusting the gas by.
+ /// Whether we should excite the gas upon merging.
+ [PublicAPI]
+ public virtual void AdjustTileMixture(Entity entity, Gas gas, float mols, bool excite = false)
+ {
+ // Handled by server
+ }
+
+ ///
+ /// Tries to get the of a containing entity (ex. lockers and cryopods),
+ /// does not return tile s.
+ ///
+ /// Exposed entity that is in some .
+ /// The found gas .
+ /// Returns true if this entity is in an exposed , false otherwise.
+ [PublicAPI]
+ public bool TryGetExposedMixture(Entity entity, [NotNullWhen(true)] out GasMixture? mixture)
+ {
+ mixture = null;
+ if (!Resolve(entity, ref entity.Comp) || entity.Comp.Anchored)
+ return false;
+
+ // TODO ATMOS: recursively iterate up through parents
+ // This really needs recursive InContainer metadata flag for performance
+ // And ideally some fast way to get the innermost airtight container.
+ var ev = new AtmosExposedGetAirEvent((entity, entity.Comp));
+ RaiseLocalEvent(entity, ref ev);
+ mixture = ev.Gas;
+
+ return ev.Handled;
+ }
+}
diff --git a/Content.Shared/Atmos/EntitySystems/SharedAtmosphereSystem.Gases.cs b/Content.Shared/Atmos/EntitySystems/SharedAtmosphereSystem.Gases.cs
index db263495e9c..ce50fbb3b0e 100644
--- a/Content.Shared/Atmos/EntitySystems/SharedAtmosphereSystem.Gases.cs
+++ b/Content.Shared/Atmos/EntitySystems/SharedAtmosphereSystem.Gases.cs
@@ -1,5 +1,6 @@
using System.Runtime.CompilerServices;
using Content.Shared.Atmos.Prototypes;
+using Content.Shared.Atmos.Reactions;
using Content.Shared.CCVar;
using JetBrains.Annotations;
@@ -59,7 +60,7 @@ public abstract partial class SharedAtmosphereSystem
{
var idx = (int)gas;
// Log an error if the corresponding prototype isn't found
- if (!_prototypeManager.TryIndex(gas.ToString(), out var gasPrototype))
+ if (!ProtoMan.TryIndex(gas.ToString(), out var gasPrototype))
{
Log.Error($"Failed to find corresponding {nameof(GasPrototype)} for gas ID {(int)gas} ({gas}) with expected ID \"{gas.ToString()}\". Is your prototype named correctly?");
continue;
@@ -157,6 +158,67 @@ public abstract partial class SharedAtmosphereSystem
return applyScaling ? scale : scale * HeatScale;
}
+ ///
+ /// Calculates the thermal energy for a .
+ ///
+ /// The to calculate the thermal
+ /// energy of.
+ /// The 's thermal energy in joules.
+ [PublicAPI]
+ public float GetThermalEnergy(GasMixture mixture)
+ {
+ return mixture.Temperature * GetHeatCapacity(mixture);
+ }
+
+ ///
+ /// Calculates the thermal energy for a gas mixture,
+ /// using a provided cached heat capacity value.
+ ///
+ /// The to calculate the thermal energy of.
+ /// A cached heat capacity value for the gas mixture,
+ /// to avoid redundant heat capacity calculations.
+ /// The 's thermal energy in joules.
+ [PublicAPI]
+ public float GetThermalEnergy(GasMixture mixture, float cachedHeatCapacity)
+ {
+ return mixture.Temperature * cachedHeatCapacity;
+ }
+
+ ///
+ /// Merges one into another, modifying the receiver.
+ ///
+ /// The to merge into. This will be modified.
+ /// The to merge from. This will not be modified.
+ [PublicAPI]
+ public void Merge(GasMixture receiver, GasMixture giver)
+ {
+ if (receiver.Immutable)
+ return;
+
+ if (MathF.Abs(receiver.Temperature - giver.Temperature) > Atmospherics.MinimumTemperatureDeltaToConsider)
+ {
+ var receiverHeatCapacity = GetHeatCapacity(receiver);
+ var giverHeatCapacity = GetHeatCapacity(giver);
+ var combinedHeatCapacity = receiverHeatCapacity + giverHeatCapacity;
+ if (combinedHeatCapacity > Atmospherics.MinimumHeatCapacity)
+ {
+ receiver.Temperature = (GetThermalEnergy(giver, giverHeatCapacity) + GetThermalEnergy(receiver, receiverHeatCapacity)) / combinedHeatCapacity;
+ }
+ }
+
+ NumericsHelpers.Add(receiver.Moles, giver.Moles);
+ }
+
+ ///
+ /// Performs reactions for a given gas mixture on an optional holder.
+ ///
+ /// The to perform reactions on.
+ /// that holds the .
+ /// used by Atmospherics to determine locality for certain reaction effects.
+ /// The of the reactions performed.
+ [PublicAPI]
+ public abstract ReactionResult React(GasMixture mixture, IGasMixtureHolder? holder);
+
///
/// Gets the heat capacity for a .
///
diff --git a/Content.Shared/Atmos/EntitySystems/SharedAtmosphereSystem.cs b/Content.Shared/Atmos/EntitySystems/SharedAtmosphereSystem.cs
index 593c7728ded..04f02219947 100644
--- a/Content.Shared/Atmos/EntitySystems/SharedAtmosphereSystem.cs
+++ b/Content.Shared/Atmos/EntitySystems/SharedAtmosphereSystem.cs
@@ -1,34 +1,108 @@
+using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.Prototypes;
using Content.Shared.Body.Components;
using Content.Shared.Body.Systems;
using Robust.Shared.Configuration;
using Robust.Shared.Prototypes;
-namespace Content.Shared.Atmos.EntitySystems
+namespace Content.Shared.Atmos.EntitySystems;
+
+public abstract partial class SharedAtmosphereSystem : EntitySystem
{
- public abstract partial class SharedAtmosphereSystem : EntitySystem
+ [Dependency] private readonly IConfigurationManager _cfg = default!;
+ [Dependency] protected readonly IPrototypeManager ProtoMan = default!;
+ [Dependency] private readonly SharedInternalsSystem _internals = default!;
+ [Dependency] protected readonly SharedTransformSystem XformSystem = default!;
+
+ private EntityQuery _internalsQuery;
+
+ ///
+ /// The length to pre-allocate list/dicts of delta pressure entities on a .
+ ///
+ public const int DeltaPressurePreAllocateLength = 1000;
+
+ public override void Initialize()
{
- [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
- [Dependency] private readonly SharedInternalsSystem _internals = default!;
- [Dependency] private readonly IConfigurationManager _cfg = default!;
+ base.Initialize();
- private EntityQuery _internalsQuery;
+ _internalsQuery = GetEntityQuery();
- public override void Initialize()
- {
- base.Initialize();
-
- _internalsQuery = GetEntityQuery();
-
- InitializeBreathTool();
- InitializeGases();
- InitializeCVars();
- }
-
- public GasPrototype GetGas(int gasId) => GasPrototypes[gasId];
-
- public GasPrototype GetGas(Gas gasId) => GasPrototypes[(int) gasId];
-
- public IEnumerable Gases => GasPrototypes;
+ InitializeBreathTool();
+ InitializeGases();
+ InitializeCVars();
}
+
+ ///
+ /// Gets the of a given gas ID.
+ ///
+ /// The gas ID to get the prototype of.
+ /// The of the given gas ID.
+ public GasPrototype GetGas(int gasId)
+ {
+ return GasPrototypes[gasId];
+ }
+
+ ///
+ /// Gets the of a given gas ID.
+ ///
+ /// The gas ID to get the prototype of.
+ /// The of the given gas ID.
+ public GasPrototype GetGas(Gas gasId)
+ {
+ return GasPrototypes[(int)gasId];
+ }
+
+ ///
+ /// Gets an enumerable of all the s.
+ ///
+ public IEnumerable Gases => GasPrototypes;
}
+
+///
+/// Enum that represents the current processing state of a
+/// .
+///
+public enum AtmosphereProcessingState : byte
+{
+ Revalidate,
+ TileEqualize,
+ ActiveTiles,
+ ExcitedGroups,
+ HighPressureDelta,
+ DeltaPressure,
+ Hotspots,
+ Superconductivity,
+ PipeNet,
+ AtmosDevices,
+ NumStates,
+}
+
+///
+/// Data on the airtightness of a .
+/// Cached on the and updated during
+/// if it was invalidated.
+///
+/// The current directions blocked on this tile.
+/// This is where air cannot flow to.
+/// Whether the tile can have air when blocking directions.
+/// Common for entities like thin windows which only block one face but can still have air in the residing tile.
+/// If true, Atmospherics will generate air (yes, creating matter from nothing)
+/// using the adjacent tiles as a seed if the airtightness is removed and the tile has no air.
+/// This allows stuff like airlocks that void air when becoming airtight to keep opening/closing without
+/// draining a room by continuously voiding air.
+public readonly record struct AirtightData(
+ AtmosDirection BlockedDirections,
+ bool NoAirWhenBlocked,
+ bool FixVacuum);
+
+///
+/// Struct that holds the result of delta pressure damage processing for an entity.
+/// This is only created and enqueued when the entity needs to take damage.
+///
+/// The entity to deal damage to.
+/// The current absolute pressure the entity is experiencing.
+/// The current delta pressure the entity is experiencing.
+public readonly record struct DeltaPressureDamageResult(
+ Entity Ent,
+ float Pressure,
+ float DeltaPressure);
diff --git a/Content.Server/Atmos/ExcitedGroup.cs b/Content.Shared/Atmos/ExcitedGroup.cs
similarity index 98%
rename from Content.Server/Atmos/ExcitedGroup.cs
rename to Content.Shared/Atmos/ExcitedGroup.cs
index 1554318f654..837763f9ba6 100644
--- a/Content.Server/Atmos/ExcitedGroup.cs
+++ b/Content.Shared/Atmos/ExcitedGroup.cs
@@ -1,4 +1,4 @@
-namespace Content.Server.Atmos;
+namespace Content.Shared.Atmos;
///
/// Internal Atmospherics class that stores data about a group of s
diff --git a/Content.Server/Atmos/Hotspot.cs b/Content.Shared/Atmos/Hotspot.cs
similarity index 98%
rename from Content.Server/Atmos/Hotspot.cs
rename to Content.Shared/Atmos/Hotspot.cs
index 2783362c312..5dad064df4b 100644
--- a/Content.Server/Atmos/Hotspot.cs
+++ b/Content.Shared/Atmos/Hotspot.cs
@@ -1,4 +1,4 @@
-namespace Content.Server.Atmos;
+namespace Content.Shared.Atmos;
///
/// Internal Atmospherics struct that stores data about a hotspot in a tile.
diff --git a/Content.Server/Atmos/MonstermosInfo.cs b/Content.Shared/Atmos/MonstermosInfo.cs
similarity index 98%
rename from Content.Server/Atmos/MonstermosInfo.cs
rename to Content.Shared/Atmos/MonstermosInfo.cs
index 67995b5fb54..7b4b8b13470 100644
--- a/Content.Server/Atmos/MonstermosInfo.cs
+++ b/Content.Shared/Atmos/MonstermosInfo.cs
@@ -1,6 +1,4 @@
-using Content.Shared.Atmos;
-
-namespace Content.Server.Atmos;
+namespace Content.Shared.Atmos;
///
/// Atmospherics class that stores data on tiles for Monstermos calculations and operations.
diff --git a/Content.Server/Atmos/Serialization/TileAtmosCollectionSerializer.cs b/Content.Shared/Atmos/Serialization/TileAtmosCollectionSerializer.cs
similarity index 99%
rename from Content.Server/Atmos/Serialization/TileAtmosCollectionSerializer.cs
rename to Content.Shared/Atmos/Serialization/TileAtmosCollectionSerializer.cs
index c7f2c9379a0..d99cb3d2100 100644
--- a/Content.Server/Atmos/Serialization/TileAtmosCollectionSerializer.cs
+++ b/Content.Shared/Atmos/Serialization/TileAtmosCollectionSerializer.cs
@@ -1,5 +1,4 @@
using System.Globalization;
-using Content.Shared.Atmos;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager;
using Robust.Shared.Serialization.Markdown;
@@ -10,7 +9,7 @@ using Robust.Shared.Serialization.TypeSerializers.Implementations.Generic;
using Robust.Shared.Serialization.TypeSerializers.Interfaces;
using Robust.Shared.Utility;
-namespace Content.Server.Atmos.Serialization;
+namespace Content.Shared.Atmos.Serialization;
public sealed partial class TileAtmosCollectionSerializer : ITypeSerializer, MappingDataNode>, ITypeCopier>
{
diff --git a/Content.Server/Atmos/TileAtmosphere.cs b/Content.Shared/Atmos/TileAtmosphere.cs
similarity index 93%
rename from Content.Server/Atmos/TileAtmosphere.cs
rename to Content.Shared/Atmos/TileAtmosphere.cs
index eba0df192a5..9b1b5dbd622 100644
--- a/Content.Server/Atmos/TileAtmosphere.cs
+++ b/Content.Shared/Atmos/TileAtmosphere.cs
@@ -1,15 +1,14 @@
-using Content.Server.Atmos.Components;
-using Content.Server.Atmos.EntitySystems;
-using Content.Shared.Atmos;
+using Content.Shared.Atmos.Components;
+using Content.Shared.Atmos.EntitySystems;
-namespace Content.Server.Atmos;
+namespace Content.Shared.Atmos;
///
/// Internal Atmospherics class that stores data on an atmosphere in a single tile.
-/// You should not be using these directly outside of .
-/// Use the public APIs in instead.
+/// You should not be using these directly outside of .
+/// Use the public APIs in instead.
///
-[Access(typeof(AtmosphereSystem), typeof(GasTileOverlaySystem), typeof(AtmosDebugOverlaySystem))]
+[Access(typeof(SharedAtmosphereSystem), typeof(SharedGasTileOverlaySystem), typeof(SharedAtmosDebugOverlaySystem))]
public sealed class TileAtmosphere : IGasMixtureHolder
{
///
@@ -96,7 +95,7 @@ public sealed class TileAtmosphere : IGasMixtureHolder
/// Current information for this tile.
///
[ViewVariables]
- [Access(typeof(AtmosphereSystem), Other = AccessPermissions.ReadExecute)]
+ [Access(typeof(SharedAtmosphereSystem), Other = AccessPermissions.ReadExecute)]
public MonstermosInfo MonstermosInfo;
///
@@ -122,7 +121,7 @@ public sealed class TileAtmosphere : IGasMixtureHolder
/// Grid entity this tile belongs to.
///
[ViewVariables]
- [Access(typeof(AtmosphereSystem))]
+ [Access(typeof(SharedAtmosphereSystem))]
public EntityUid GridIndex;
///
@@ -142,7 +141,7 @@ public sealed class TileAtmosphere : IGasMixtureHolder
/// This can be immutable if the tile is spaced.
///
[ViewVariables]
- [Access(typeof(AtmosphereSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
+ [Access(typeof(SharedAtmosphereSystem), Other = AccessPermissions.ReadExecute)] // FIXME Friends
public GasMixture? Air;
///
@@ -202,7 +201,7 @@ public sealed class TileAtmosphere : IGasMixtureHolder
/// Cached information about airtight entities on this tile. This gets updated anytime a tile gets invalidated
/// (i.e., gets added to ).
///
- public AtmosphereSystem.AirtightData AirtightData;
+ public AirtightData AirtightData;
///
/// Creates a new TileAtmosphere.
diff --git a/Content.Shared/NodeContainer/NodeGroups/IPipeNet.cs b/Content.Shared/NodeContainer/NodeGroups/IPipeNet.cs
new file mode 100644
index 00000000000..e1777f05f20
--- /dev/null
+++ b/Content.Shared/NodeContainer/NodeGroups/IPipeNet.cs
@@ -0,0 +1,11 @@
+using Content.Shared.Atmos;
+
+namespace Content.Shared.NodeContainer.NodeGroups;
+
+public interface IPipeNet : INodeGroup, IGasMixtureHolder
+{
+ ///
+ /// Causes gas in the PipeNet to react.
+ ///
+ void Update();
+}