diff --git a/Content.Server/Atmos/IGridAtmosphereComponent.cs b/Content.Server/Atmos/IGridAtmosphereComponent.cs
index 430c674bce..5518881767 100644
--- a/Content.Server/Atmos/IGridAtmosphereComponent.cs
+++ b/Content.Server/Atmos/IGridAtmosphereComponent.cs
@@ -40,6 +40,11 @@ namespace Content.Server.Atmos
///
void Invalidate(MapIndices indices);
+ ///
+ /// Attempts to fix a sudden vacuum by creating gas.
+ ///
+ void FixVacuum(MapIndices indices);
+
///
/// Adds an active tile so it becomes processed every update until it becomes inactive.
/// Also makes the tile excited.
diff --git a/Content.Server/Atmos/TileAtmosphere.cs b/Content.Server/Atmos/TileAtmosphere.cs
index eab7e6b9ad..5331f215f5 100644
--- a/Content.Server/Atmos/TileAtmosphere.cs
+++ b/Content.Server/Atmos/TileAtmosphere.cs
@@ -78,7 +78,6 @@ namespace Content.Server.Atmos
[ViewVariables]
public Hotspot Hotspot;
- [ViewVariables]
private Direction _pressureDirection;
[ViewVariables]
diff --git a/Content.Server/GameObjects/Components/Atmos/AirtightComponent.cs b/Content.Server/GameObjects/Components/Atmos/AirtightComponent.cs
index 478dd540cb..07c6ed66e9 100644
--- a/Content.Server/GameObjects/Components/Atmos/AirtightComponent.cs
+++ b/Content.Server/GameObjects/Components/Atmos/AirtightComponent.cs
@@ -40,7 +40,7 @@ namespace Content.Server.GameObjects.Components.Atmos
base.ExposeData(serializer);
serializer.DataField(ref _airBlocked, "airBlocked", true);
- serializer.DataField(ref _fixVacuum, "fixVacuum", false);
+ serializer.DataField(ref _fixVacuum, "fixVacuum", true);
}
public override void Initialize()
@@ -57,15 +57,6 @@ namespace Content.Server.GameObjects.Components.Atmos
UpdatePosition();
}
- public override void OnRemove()
- {
- base.OnRemove();
-
- _airBlocked = false;
-
- UpdatePosition();
- }
-
public void MapInit()
{
_snapGrid.OnPositionChanged += OnTransformMove;
@@ -80,6 +71,11 @@ namespace Content.Server.GameObjects.Components.Atmos
_airBlocked = false;
_snapGrid.OnPositionChanged -= OnTransformMove;
+
+ if(_fixVacuum)
+ EntitySystem.Get().GetGridAtmosphere(Owner.Transform.GridID)?
+ .FixVacuum(_snapGrid.Position);
+
UpdatePosition();
}
diff --git a/Content.Server/GameObjects/Components/Atmos/GridAtmosphereComponent.cs b/Content.Server/GameObjects/Components/Atmos/GridAtmosphereComponent.cs
index cb938944b4..c872ea8893 100644
--- a/Content.Server/GameObjects/Components/Atmos/GridAtmosphereComponent.cs
+++ b/Content.Server/GameObjects/Components/Atmos/GridAtmosphereComponent.cs
@@ -175,18 +175,7 @@ namespace Content.Server.GameObjects.Components.Atmos
{
if (tile.Air == null && obs.FixVacuum)
{
- var adjacent = GetAdjacentTiles(indices);
- tile.Air = new GasMixture(GetVolumeForCells(1)){Temperature = Atmospherics.T20C};
- _tiles[indices] = tile;
-
- var ratio = 1f / adjacent.Count;
-
- foreach (var (direction, adj) in adjacent)
- {
- var mix = adj.Air.RemoveRatio(ratio);
- tile.Air.Merge(mix);
- adj.Air.Merge(mix);
- }
+ FixVacuum(tile.GridIndices);
}
}
@@ -208,6 +197,25 @@ namespace Content.Server.GameObjects.Components.Atmos
_invalidatedCoords.Clear();
}
+ ///
+ public void FixVacuum(MapIndices indices)
+ {
+ var tile = GetTile(indices);
+ if (tile?.GridIndex != _grid.Index) return;
+ var adjacent = GetAdjacentTiles(indices);
+ tile.Air = new GasMixture(GetVolumeForCells(1)){Temperature = Atmospherics.T20C};
+ _tiles[indices] = tile;
+
+ var ratio = 1f / adjacent.Count;
+
+ foreach (var (direction, adj) in adjacent)
+ {
+ var mix = adj.Air.RemoveRatio(ratio);
+ tile.Air.Merge(mix);
+ adj.Air.Merge(mix);
+ }
+ }
+
///
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AddActiveTile(TileAtmosphere tile)