From ef45db6811375fb47393f9ba4be53c53a608995b Mon Sep 17 00:00:00 2001 From: Vera Aguilera Puerto Date: Thu, 7 Oct 2021 16:51:36 +0200 Subject: [PATCH] Remove atmos assert, fix GridRevalidate adding virtual space tiles to list of active tiles on grid. --- .../Atmos/EntitySystems/AtmosphereSystem.Grid.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs index d089c9b947..fa31bd8fc8 100644 --- a/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs +++ b/Content.Server/Atmos/EntitySystems/AtmosphereSystem.Grid.cs @@ -305,7 +305,7 @@ namespace Content.Server.Atmos.EntitySystems { var direction = (AtmosDirection) (1 << i); var otherIndices = indices.Offset(direction); - var otherTile = GetTileAtmosphereOrCreateSpace(mapGrid, gridAtmosphere, otherIndices); + var otherTile = GetTileAtmosphere(gridAtmosphere, otherIndices); if (otherTile != null) AddActiveTile(gridAtmosphere, otherTile); } @@ -523,12 +523,12 @@ namespace Content.Server.Atmos.EntitySystems { var tileAtmosphere = GetTileAtmosphere(gridAtmosphere, tile); - if (tileAtmosphere != null) - return tileAtmosphere; + // Please note, you might run into a race condition when using this or GetTileAtmosphere. + // The race condition occurs when a tile goes from being space to not-space, and then something + // attempts to get the tile atmosphere for it before it has been revalidated by atmos. + // The tile atmosphere will get revalidated on the next atmos tick, however. - // That tile must be space, or something has gone horribly wrong! - DebugTools.Assert(IsTileSpace(mapGrid, tile)); - return new TileAtmosphere(mapGrid.Index, tile, new GasMixture(Atmospherics.CellVolume) {Temperature = Atmospherics.TCMB}, true); + return tileAtmosphere ?? new TileAtmosphere(mapGrid.Index, tile, new GasMixture(Atmospherics.CellVolume) {Temperature = Atmospherics.TCMB}, true); } #endregion