Fix deconstructing walls creating an atmos void.
This caused a lot of high pressure movements.
This commit is contained in:
@@ -40,6 +40,11 @@ namespace Content.Server.Atmos
|
||||
/// <param name="indices"></param>
|
||||
void Invalidate(MapIndices indices);
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to fix a sudden vacuum by creating gas.
|
||||
/// </summary>
|
||||
void FixVacuum(MapIndices indices);
|
||||
|
||||
/// <summary>
|
||||
/// Adds an active tile so it becomes processed every update until it becomes inactive.
|
||||
/// Also makes the tile excited.
|
||||
|
||||
@@ -78,7 +78,6 @@ namespace Content.Server.Atmos
|
||||
[ViewVariables]
|
||||
public Hotspot Hotspot;
|
||||
|
||||
[ViewVariables]
|
||||
private Direction _pressureDirection;
|
||||
|
||||
[ViewVariables]
|
||||
|
||||
@@ -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<AtmosphereSystem>().GetGridAtmosphere(Owner.Transform.GridID)?
|
||||
.FixVacuum(_snapGrid.Position);
|
||||
|
||||
UpdatePosition();
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void AddActiveTile(TileAtmosphere tile)
|
||||
|
||||
Reference in New Issue
Block a user