diff --git a/Content.Server/Atmos/AtmosHelpers.cs b/Content.Server/Atmos/AtmosHelpers.cs index 21d85a0b08..b0e0baac24 100644 --- a/Content.Server/Atmos/AtmosHelpers.cs +++ b/Content.Server/Atmos/AtmosHelpers.cs @@ -65,15 +65,7 @@ namespace Content.Server.Atmos public static bool InvalidateTileAir(this ITransformComponent transform, AtmosphereSystem? atmosSystem = null) { - atmosSystem ??= EntitySystem.Get(); - - if (!transform.Coordinates.TryGetTileAtmosphere(out var tileAtmos)) - { - return false; - } - - atmosSystem.GetGridAtmosphere(transform.GridID).Invalidate(tileAtmos.GridIndices); - return true; + return InvalidateTileAir(transform.Coordinates, atmosSystem); } public static bool InvalidateTileAir(this EntityCoordinates coordinates, AtmosphereSystem? atmosSystem = null, IEntityManager? entityManager = null) @@ -86,8 +78,7 @@ namespace Content.Server.Atmos return false; } - var gridId = coordinates.GetGridId(entityManager); - atmosSystem.GetGridAtmosphere(gridId).Invalidate(tileAtmos.GridIndices); + tileAtmos.Invalidate(); return true; } } diff --git a/Content.Server/Atmos/TileAtmosphere.cs b/Content.Server/Atmos/TileAtmosphere.cs index 828f5a1b72..749a441d61 100644 --- a/Content.Server/Atmos/TileAtmosphere.cs +++ b/Content.Server/Atmos/TileAtmosphere.cs @@ -1177,6 +1177,14 @@ namespace Content.Server.Atmos } } + /// + /// Calls on this tile atmosphere's position. + /// + public void Invalidate() + { + _gridAtmosphereComponent.Invalidate(GridIndices); + } + private void LastShareCheck() { var lastShare = Air.LastShare; diff --git a/Content.Server/Commands/Atmos/AddGasCommand.cs b/Content.Server/Commands/Atmos/AddGasCommand.cs index 0599a2408a..73c3ab28a1 100644 --- a/Content.Server/Commands/Atmos/AddGasCommand.cs +++ b/Content.Server/Commands/Atmos/AddGasCommand.cs @@ -70,7 +70,7 @@ namespace Content.Server.Commands.Atmos } tile.Air.AdjustMoles(gasId, moles); - gam.Invalidate(indices); + tile.Invalidate(); } } } diff --git a/Content.Server/Commands/Atmos/DeleteGasCommand.cs b/Content.Server/Commands/Atmos/DeleteGasCommand.cs index 570686d158..dd92aeb957 100644 --- a/Content.Server/Commands/Atmos/DeleteGasCommand.cs +++ b/Content.Server/Commands/Atmos/DeleteGasCommand.cs @@ -162,7 +162,7 @@ namespace Content.Server.Commands.Atmos tile.Air.Clear(); - atmosphere.Invalidate(tile.GridIndices); + tile.Invalidate(); } } else @@ -176,7 +176,7 @@ namespace Content.Server.Commands.Atmos tile.Air.SetMoles(gas.Value, 0); - atmosphere.Invalidate(tile.GridIndices); + tile.Invalidate(); } } diff --git a/Content.Server/Commands/Atmos/FillGasCommand.cs b/Content.Server/Commands/Atmos/FillGasCommand.cs index 75dae44d6c..63efd89b63 100644 --- a/Content.Server/Commands/Atmos/FillGasCommand.cs +++ b/Content.Server/Commands/Atmos/FillGasCommand.cs @@ -55,7 +55,7 @@ namespace Content.Server.Commands.Atmos foreach (var tile in gam) { tile.Air?.AdjustMoles(gasId, moles); - gam.Invalidate(tile.GridIndices); + tile.Invalidate(); } } } diff --git a/Content.Server/Commands/Atmos/RemoveGasCommand.cs b/Content.Server/Commands/Atmos/RemoveGasCommand.cs index 9f85a15ce7..7bf83f33dd 100644 --- a/Content.Server/Commands/Atmos/RemoveGasCommand.cs +++ b/Content.Server/Commands/Atmos/RemoveGasCommand.cs @@ -73,7 +73,7 @@ namespace Content.Server.Commands.Atmos else tile.Air.Remove(amount); - gam.Invalidate(indices); + tile.Invalidate(); } } diff --git a/Content.Server/Commands/Atmos/SetAtmosTemperatureCommand.cs b/Content.Server/Commands/Atmos/SetAtmosTemperatureCommand.cs index 08fd4458ed..6d935e004a 100644 --- a/Content.Server/Commands/Atmos/SetAtmosTemperatureCommand.cs +++ b/Content.Server/Commands/Atmos/SetAtmosTemperatureCommand.cs @@ -66,7 +66,7 @@ namespace Content.Server.Commands.Atmos tiles++; tile.Air.Temperature = temperature; - gam.Invalidate(tile.GridIndices); + tile.Invalidate(); } shell.SendText(player, $"Changed the temperature of {tiles} tiles."); diff --git a/Content.Server/Commands/Atmos/SetTemperatureCommand.cs b/Content.Server/Commands/Atmos/SetTemperatureCommand.cs index 0e6521e018..c761c9cac4 100644 --- a/Content.Server/Commands/Atmos/SetTemperatureCommand.cs +++ b/Content.Server/Commands/Atmos/SetTemperatureCommand.cs @@ -75,7 +75,7 @@ namespace Content.Server.Commands.Atmos } tile.Air.Temperature = temperature; - gam.Invalidate(indices); + tile.Invalidate(); } } } diff --git a/Content.Server/GameObjects/Components/Atmos/Piping/Scrubbers/BaseSiphonComponent.cs b/Content.Server/GameObjects/Components/Atmos/Piping/Scrubbers/BaseSiphonComponent.cs index 8d0d2826e5..77acc61780 100644 --- a/Content.Server/GameObjects/Components/Atmos/Piping/Scrubbers/BaseSiphonComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/Piping/Scrubbers/BaseSiphonComponent.cs @@ -68,7 +68,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Scrubbers if (tileAtmos == null) return; ScrubGas(tileAtmos.Air, _scrubberOutlet.Air); - _atmosSystem.GetGridAtmosphere(Owner.Transform.GridID)?.Invalidate(tileAtmos.GridIndices); + tileAtmos.Invalidate(); } protected abstract void ScrubGas(GasMixture inletGas, GasMixture outletGas); diff --git a/Content.Server/GameObjects/Components/Atmos/Piping/Vents/BaseVentComponent.cs b/Content.Server/GameObjects/Components/Atmos/Piping/Vents/BaseVentComponent.cs index 36a618aab3..8c0ba7f833 100644 --- a/Content.Server/GameObjects/Components/Atmos/Piping/Vents/BaseVentComponent.cs +++ b/Content.Server/GameObjects/Components/Atmos/Piping/Vents/BaseVentComponent.cs @@ -68,7 +68,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Vents if (tileAtmos == null) return; VentGas(_ventInlet.Air, tileAtmos.Air); - _atmosSystem.GetGridAtmosphere(Owner.Transform.GridID).Invalidate(tileAtmos.GridIndices); + tileAtmos.Invalidate(); } protected abstract void VentGas(GasMixture inletGas, GasMixture outletGas);