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>
|
/// <param name="indices"></param>
|
||||||
void Invalidate(MapIndices indices);
|
void Invalidate(MapIndices indices);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempts to fix a sudden vacuum by creating gas.
|
||||||
|
/// </summary>
|
||||||
|
void FixVacuum(MapIndices indices);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds an active tile so it becomes processed every update until it becomes inactive.
|
/// Adds an active tile so it becomes processed every update until it becomes inactive.
|
||||||
/// Also makes the tile excited.
|
/// Also makes the tile excited.
|
||||||
|
|||||||
@@ -78,7 +78,6 @@ namespace Content.Server.Atmos
|
|||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
public Hotspot Hotspot;
|
public Hotspot Hotspot;
|
||||||
|
|
||||||
[ViewVariables]
|
|
||||||
private Direction _pressureDirection;
|
private Direction _pressureDirection;
|
||||||
|
|
||||||
[ViewVariables]
|
[ViewVariables]
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
base.ExposeData(serializer);
|
base.ExposeData(serializer);
|
||||||
|
|
||||||
serializer.DataField(ref _airBlocked, "airBlocked", true);
|
serializer.DataField(ref _airBlocked, "airBlocked", true);
|
||||||
serializer.DataField(ref _fixVacuum, "fixVacuum", false);
|
serializer.DataField(ref _fixVacuum, "fixVacuum", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
@@ -57,15 +57,6 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
UpdatePosition();
|
UpdatePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnRemove()
|
|
||||||
{
|
|
||||||
base.OnRemove();
|
|
||||||
|
|
||||||
_airBlocked = false;
|
|
||||||
|
|
||||||
UpdatePosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MapInit()
|
public void MapInit()
|
||||||
{
|
{
|
||||||
_snapGrid.OnPositionChanged += OnTransformMove;
|
_snapGrid.OnPositionChanged += OnTransformMove;
|
||||||
@@ -80,6 +71,11 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
_airBlocked = false;
|
_airBlocked = false;
|
||||||
|
|
||||||
_snapGrid.OnPositionChanged -= OnTransformMove;
|
_snapGrid.OnPositionChanged -= OnTransformMove;
|
||||||
|
|
||||||
|
if(_fixVacuum)
|
||||||
|
EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(Owner.Transform.GridID)?
|
||||||
|
.FixVacuum(_snapGrid.Position);
|
||||||
|
|
||||||
UpdatePosition();
|
UpdatePosition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -175,18 +175,7 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
{
|
{
|
||||||
if (tile.Air == null && obs.FixVacuum)
|
if (tile.Air == null && obs.FixVacuum)
|
||||||
{
|
{
|
||||||
var adjacent = GetAdjacentTiles(indices);
|
FixVacuum(tile.GridIndices);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,6 +197,25 @@ namespace Content.Server.GameObjects.Components.Atmos
|
|||||||
_invalidatedCoords.Clear();
|
_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 />
|
/// <inheritdoc />
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
public void AddActiveTile(TileAtmosphere tile)
|
public void AddActiveTile(TileAtmosphere tile)
|
||||||
|
|||||||
Reference in New Issue
Block a user