Fixes that annoying atmos zero pressure bug I've constantly been pinged and nagged about for like the past few days.
This commit is contained in:
@@ -42,12 +42,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
SetAirblocked(airtight, false);
|
||||
|
||||
InvalidatePosition(airtight.LastPosition.Item1, airtight.LastPosition.Item2);
|
||||
|
||||
if (airtight.FixVacuum)
|
||||
{
|
||||
_atmosphereSystem.FixVacuum(airtight.LastPosition.Item1, airtight.LastPosition.Item2);
|
||||
}
|
||||
InvalidatePosition(airtight.LastPosition.Item1, airtight.LastPosition.Item2, airtight.FixVacuum);
|
||||
}
|
||||
|
||||
private void OnMapInit(EntityUid uid, AirtightComponent airtight, MapInitEvent args)
|
||||
@@ -89,16 +84,19 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
var grid = _mapManager.GetGrid(airtight.Owner.Transform.GridID);
|
||||
airtight.LastPosition = (airtight.Owner.Transform.GridID, grid.TileIndicesFor(airtight.Owner.Transform.Coordinates));
|
||||
InvalidatePosition(airtight.LastPosition.Item1, airtight.LastPosition.Item2);
|
||||
InvalidatePosition(airtight.LastPosition.Item1, airtight.LastPosition.Item2, airtight.FixVacuum && !airtight.AirBlocked);
|
||||
}
|
||||
|
||||
public void InvalidatePosition(GridId gridId, Vector2i pos)
|
||||
public void InvalidatePosition(GridId gridId, Vector2i pos, bool fixVacuum = false)
|
||||
{
|
||||
if (!gridId.IsValid())
|
||||
return;
|
||||
|
||||
_atmosphereSystem.UpdateAdjacent(gridId, pos);
|
||||
_atmosphereSystem.InvalidateTile(gridId, pos);
|
||||
|
||||
if(fixVacuum)
|
||||
_atmosphereSystem.FixVacuum(gridId, pos);
|
||||
}
|
||||
|
||||
private AtmosDirection Rotate(AtmosDirection myDirection, Angle myAngle)
|
||||
|
||||
@@ -988,6 +988,7 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
private void UpdateAdjacent(IMapGrid mapGrid, GridAtmosphereComponent gridAtmosphere, TileAtmosphere tileAtmosphere)
|
||||
{
|
||||
tileAtmosphere.AdjacentBits = AtmosDirection.Invalid;
|
||||
tileAtmosphere.BlockedAirflow = GetBlockedDirections(mapGrid, tileAtmosphere.GridIndices);
|
||||
|
||||
for (var i = 0; i < Atmospherics.Directions; i++)
|
||||
{
|
||||
@@ -1006,6 +1007,9 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
tileAtmosphere.AdjacentBits |= direction;
|
||||
}
|
||||
}
|
||||
|
||||
if (!tileAtmosphere.AdjacentBits.IsFlagSet(tileAtmosphere.MonstermosInfo.CurrentTransferDirection))
|
||||
tileAtmosphere.MonstermosInfo.CurrentTransferDirection = AtmosDirection.Invalid;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1071,6 +1075,9 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
{
|
||||
tile.AdjacentBits &= ~direction;
|
||||
}
|
||||
|
||||
if (!tile.AdjacentBits.IsFlagSet(tile.MonstermosInfo.CurrentTransferDirection))
|
||||
tile.MonstermosInfo.CurrentTransferDirection = AtmosDirection.Invalid;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -65,7 +65,6 @@ namespace Content.Server.Atmos.EntitySystems
|
||||
|
||||
var isAirBlocked = IsTileAirBlocked(mapGrid, indices);
|
||||
|
||||
tile.BlockedAirflow = GetBlockedDirections(mapGrid, indices);
|
||||
UpdateAdjacent(mapGrid, atmosphere, tile);
|
||||
|
||||
if (IsTileSpace(mapGrid, indices) && !isAirBlocked)
|
||||
|
||||
@@ -366,6 +366,11 @@ namespace Content.Server.Doors.Components
|
||||
occluder.Enabled = false;
|
||||
}
|
||||
|
||||
if (Owner.TryGetComponent(out AirtightComponent? airtight))
|
||||
{
|
||||
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, false);
|
||||
}
|
||||
|
||||
_stateChangeCancelTokenSource?.Cancel();
|
||||
_stateChangeCancelTokenSource = new();
|
||||
|
||||
@@ -387,11 +392,13 @@ namespace Content.Server.Doors.Components
|
||||
|
||||
protected override void OnPartialOpen()
|
||||
{
|
||||
base.OnPartialOpen();
|
||||
|
||||
if (Owner.TryGetComponent(out AirtightComponent? airtight))
|
||||
{
|
||||
EntitySystem.Get<AirtightSystem>().SetAirblocked(airtight, false);
|
||||
}
|
||||
base.OnPartialOpen();
|
||||
|
||||
Owner.EntityManager.EventBus.RaiseEvent(EventSource.Local, new AccessReaderChangeMessage(Owner, false));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user