From 94d39f7fcaf0919ddd0ec47e68c77c10b131cd5a Mon Sep 17 00:00:00 2001 From: ArtisticRoomba <145879011+ArtisticRoomba@users.noreply.github.com> Date: Mon, 10 Nov 2025 11:05:31 -0800 Subject: [PATCH] Document Atmospherics Utils (#41385) * Utils docs * Update Content.Server/Atmos/EntitySystems/AtmosphereSystem.Utils.cs --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> --- .../EntitySystems/AtmosphereSystem.Utils.cs | 55 +++++++++++++++++-- 1 file changed, 51 insertions(+), 4 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Utils.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Utils.cs index 596368f000..a402cf20f3 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Utils.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Utils.cs @@ -11,9 +11,15 @@ namespace Content.Server.Atmos.EntitySystems; public partial class AtmosphereSystem { + /* + Partial class that stores miscellaneous utility methods for Atmospherics. + */ + /// - /// Gets the particular price of an air mixture. + /// Gets the particular price of a . /// + /// The to get the price of. + /// The price of the gas mixture. public double GetPrice(GasMixture mixture) { float basePrice = 0; // moles of gas * price/mole @@ -26,7 +32,7 @@ public partial class AtmosphereSystem maxComponent = Math.Max(maxComponent, mixture.Moles[i]); } - // Pay more for gas canisters that are more pure + // Pay more for gas canisters that are purer float purity = 1; if (totalMoles > 0) { @@ -36,12 +42,32 @@ public partial class AtmosphereSystem return basePrice * purity; } + /// + /// Marks a tile's visual overlay as needing to be redetermined. + /// + /// A tile's overlay (how it looks like, ex. water vapor's texture) + /// is determined via determining how much gas there is on the tile. + /// This is expensive to do for every tile/gas that may have a custom overlay, + /// so its done once and only updated when it needs to be updated. + /// + /// The grid the tile is on. + /// The tile to invalidate. [MethodImpl(MethodImplOptions.AggressiveInlining)] public void InvalidateVisuals(Entity grid, Vector2i tile) { _gasTileOverlaySystem.Invalidate(grid, tile); } + /// + /// Marks a tile's visual overlay as needing to be redetermined. + /// + /// A tile's overlay (how it looks like, ex. water vapor's texture) + /// is determined via determining how much gas there is on the tile. + /// This is expensive to do for every tile/gas that may have a custom overlay, + /// so its done once and only updated when it needs to be updated. + /// + /// The grid the tile is on. + /// The tile to invalidate. [MethodImpl(MethodImplOptions.AggressiveInlining)] private void InvalidateVisuals( Entity ent, @@ -51,7 +77,7 @@ public partial class AtmosphereSystem } /// - /// Gets the volume in liters for a number of tiles, on a specific grid. + /// Gets the volume in liters for a number of tiles, on a specific grid. /// /// The grid in question. /// The amount of tiles. @@ -79,6 +105,18 @@ public partial class AtmosphereSystem bool NoAirWhenBlocked, bool FixVacuum); + /// + /// Updates the for a + /// immediately. + /// + /// This method is extremely important if you are doing something in Atmospherics + /// that is time-sensitive! is cached and invalidated on + /// a cycle, so airtight changes performed during or after an invalidation will + /// not take effect until the next Atmospherics tick! + /// The entity the grid is on. + /// The the tile is on. + /// The the tile is on. + /// The to update. private void UpdateAirtightData(EntityUid uid, GridAtmosphereComponent atmos, MapGridComponent grid, TileAtmosphere tile) { var oldBlocked = tile.AirtightData.BlockedDirections; @@ -91,6 +129,15 @@ public partial class AtmosphereSystem ExcitedGroupDispose(atmos, tile.ExcitedGroup); } + /// + /// Retrieves current for a tile on a grid. + /// This is determined on-the-fly, not from cached data, so it will reflect + /// changes done in the current Atmospherics tick. + /// + /// The entity the grid is on. + /// The the tile is on. + /// The indices of the tile. + /// The current for the tile. private AirtightData GetAirtightData(EntityUid uid, MapGridComponent grid, Vector2i tile) { var blockedDirs = AtmosDirection.Invalid; @@ -118,7 +165,7 @@ public partial class AtmosphereSystem } /// - /// Pries a tile in a grid. + /// Pries a tile in a grid. /// /// The grid in question. /// The indices of the tile.