Fix TileAtmosInfo pressure direction being east when created.
This commit is contained in:
@@ -220,7 +220,8 @@ namespace Content.Server.Atmos
|
|||||||
{
|
{
|
||||||
if (Air == null || (_tileAtmosInfo.LastCycle >= cycleNum)) return; // Already done.
|
if (Air == null || (_tileAtmosInfo.LastCycle >= cycleNum)) return; // Already done.
|
||||||
|
|
||||||
_tileAtmosInfo = new TileAtmosInfo();
|
ResetTileAtmosInfo();
|
||||||
|
|
||||||
|
|
||||||
var startingMoles = Air.TotalMoles;
|
var startingMoles = Air.TotalMoles;
|
||||||
var runAtmos = false;
|
var runAtmos = false;
|
||||||
@@ -263,7 +264,7 @@ namespace Content.Server.Atmos
|
|||||||
{
|
{
|
||||||
if (adj?.Air == null) continue;
|
if (adj?.Air == null) continue;
|
||||||
if(adj._tileAtmosInfo.LastQueueCycle == queueCycle) continue;
|
if(adj._tileAtmosInfo.LastQueueCycle == queueCycle) continue;
|
||||||
adj._tileAtmosInfo = new TileAtmosInfo();
|
adj.ResetTileAtmosInfo();
|
||||||
|
|
||||||
adj._tileAtmosInfo.LastQueueCycle = queueCycle;
|
adj._tileAtmosInfo.LastQueueCycle = queueCycle;
|
||||||
if(tileCount < Atmospherics.ZumosHardTileLimit)
|
if(tileCount < Atmospherics.ZumosHardTileLimit)
|
||||||
@@ -503,16 +504,16 @@ namespace Content.Server.Atmos
|
|||||||
for (var i = queueLength - 1; i >= 0; i--)
|
for (var i = queueLength - 1; i >= 0; i--)
|
||||||
{
|
{
|
||||||
var tile = queue[i];
|
var tile = queue[i];
|
||||||
if (tile._tileAtmosInfo.CurrentTransferAmount == 0 ||
|
if (tile._tileAtmosInfo.CurrentTransferAmount == 0 || tile._tileAtmosInfo.CurrentTransferDirection == Direction.Invalid)
|
||||||
tile._tileAtmosInfo.CurrentTransferDirection == Direction.Invalid) continue;
|
continue;
|
||||||
tile.AdjustEqMovement(tile._tileAtmosInfo.CurrentTransferDirection,
|
|
||||||
tile._tileAtmosInfo.CurrentTransferAmount);
|
|
||||||
|
|
||||||
if (tile._adjacentTiles.TryGetValue(tile._tileAtmosInfo.CurrentTransferDirection,
|
tile.AdjustEqMovement(tile._tileAtmosInfo.CurrentTransferDirection, tile._tileAtmosInfo.CurrentTransferAmount);
|
||||||
out var adjacent))
|
|
||||||
adjacent._tileAtmosInfo.CurrentTransferAmount +=
|
if (tile._adjacentTiles.TryGetValue(tile._tileAtmosInfo.CurrentTransferDirection, out var adjacent))
|
||||||
tile._tileAtmosInfo.CurrentTransferAmount;
|
{
|
||||||
tile._tileAtmosInfo.CurrentTransferAmount = 0;
|
adjacent._tileAtmosInfo.CurrentTransferAmount += tile._tileAtmosInfo.CurrentTransferAmount;
|
||||||
|
tile._tileAtmosInfo.CurrentTransferAmount = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -605,8 +606,14 @@ namespace Content.Server.Atmos
|
|||||||
private void AdjustEqMovement(Direction direction, float molesToMove)
|
private void AdjustEqMovement(Direction direction, float molesToMove)
|
||||||
{
|
{
|
||||||
_tileAtmosInfo[direction] += molesToMove;
|
_tileAtmosInfo[direction] += molesToMove;
|
||||||
if(direction != (Direction)(-1) && _adjacentTiles.TryGetValue(direction, out var adj))
|
if(direction != Direction.Invalid && _adjacentTiles.TryGetValue(direction, out var adj))
|
||||||
_adjacentTiles[direction]._tileAtmosInfo[direction.GetOpposite()] -= molesToMove;
|
adj._tileAtmosInfo[direction.GetOpposite()] -= molesToMove;
|
||||||
|
}
|
||||||
|
|
||||||
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
|
private void ResetTileAtmosInfo()
|
||||||
|
{
|
||||||
|
_tileAtmosInfo = new TileAtmosInfo {CurrentTransferDirection = Direction.Invalid};
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
@@ -928,11 +935,10 @@ namespace Content.Server.Atmos
|
|||||||
var tiles = new List<TileAtmosphere>();
|
var tiles = new List<TileAtmosphere>();
|
||||||
var spaceTiles = new List<TileAtmosphere>();
|
var spaceTiles = new List<TileAtmosphere>();
|
||||||
tiles.Add(this);
|
tiles.Add(this);
|
||||||
_tileAtmosInfo = new TileAtmosInfo
|
|
||||||
{
|
ResetTileAtmosInfo();
|
||||||
LastQueueCycle = queueCycle,
|
_tileAtmosInfo.LastQueueCycle = queueCycle;
|
||||||
CurrentTransferDirection = Direction.Invalid
|
|
||||||
};
|
|
||||||
var tileCount = 1;
|
var tileCount = 1;
|
||||||
for (var i = 0; i < tileCount; i++)
|
for (var i = 0; i < tileCount; i++)
|
||||||
{
|
{
|
||||||
@@ -955,7 +961,8 @@ namespace Content.Server.Atmos
|
|||||||
tile.ConsiderFirelocks(tile2);
|
tile.ConsiderFirelocks(tile2);
|
||||||
if (tile._adjacentTiles[direction]?.Air != null)
|
if (tile._adjacentTiles[direction]?.Air != null)
|
||||||
{
|
{
|
||||||
tile2._tileAtmosInfo = new TileAtmosInfo {LastQueueCycle = queueCycle};
|
tile2.ResetTileAtmosInfo();
|
||||||
|
tile2._tileAtmosInfo.LastQueueCycle = queueCycle;
|
||||||
tiles.Add(tile2);
|
tiles.Add(tile2);
|
||||||
tileCount++;
|
tileCount++;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user