Removes AtmosCooldown from TileAtmosphere, fixes various atmos issues (#2297)
* Remove AtmosCooldown * Fix former space tiles always having an immutable gas mixture * _tile -> _tiles
This commit is contained in:
committed by
GitHub
parent
717a375abb
commit
19d32eb4ce
@@ -12,7 +12,7 @@ namespace Content.Server.Atmos
|
||||
private bool _disposed = false;
|
||||
|
||||
[ViewVariables]
|
||||
private readonly HashSet<TileAtmosphere> _tile = new HashSet<TileAtmosphere>();
|
||||
private readonly HashSet<TileAtmosphere> _tiles = new HashSet<TileAtmosphere>();
|
||||
|
||||
[ViewVariables]
|
||||
private GridAtmosphereComponent _gridAtmosphereComponent;
|
||||
@@ -25,35 +25,41 @@ namespace Content.Server.Atmos
|
||||
|
||||
public void AddTile(TileAtmosphere tile)
|
||||
{
|
||||
_tile.Add(tile);
|
||||
_tiles.Add(tile);
|
||||
tile.ExcitedGroup = this;
|
||||
ResetCooldowns();
|
||||
}
|
||||
|
||||
public bool RemoveTile(TileAtmosphere tile)
|
||||
{
|
||||
tile.ExcitedGroup = null;
|
||||
return _tiles.Remove(tile);
|
||||
}
|
||||
|
||||
public void MergeGroups(ExcitedGroup other)
|
||||
{
|
||||
var ourSize = _tile.Count;
|
||||
var otherSize = other._tile.Count;
|
||||
var ourSize = _tiles.Count;
|
||||
var otherSize = other._tiles.Count;
|
||||
|
||||
if (ourSize > otherSize)
|
||||
{
|
||||
foreach (var tile in other._tile)
|
||||
foreach (var tile in other._tiles)
|
||||
{
|
||||
tile.ExcitedGroup = this;
|
||||
_tile.Add(tile);
|
||||
_tiles.Add(tile);
|
||||
}
|
||||
other._tile.Clear();
|
||||
other._tiles.Clear();
|
||||
other.Dispose();
|
||||
ResetCooldowns();
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var tile in _tile)
|
||||
foreach (var tile in _tiles)
|
||||
{
|
||||
tile.ExcitedGroup = other;
|
||||
other._tile.Add(tile);
|
||||
other._tiles.Add(tile);
|
||||
}
|
||||
_tile.Clear();
|
||||
_tiles.Clear();
|
||||
Dispose();
|
||||
other.ResetCooldowns();
|
||||
}
|
||||
@@ -80,7 +86,7 @@ namespace Content.Server.Atmos
|
||||
{
|
||||
var combined = new GasMixture(Atmospherics.CellVolume);
|
||||
|
||||
var tileSize = _tile.Count;
|
||||
var tileSize = _tiles.Count;
|
||||
|
||||
if (_disposed) return;
|
||||
|
||||
@@ -90,7 +96,7 @@ namespace Content.Server.Atmos
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var tile in _tile)
|
||||
foreach (var tile in _tiles)
|
||||
{
|
||||
if (tile?.Air == null) continue;
|
||||
combined.Merge(tile.Air);
|
||||
@@ -101,11 +107,10 @@ namespace Content.Server.Atmos
|
||||
|
||||
combined.Multiply(1 / (float)tileSize);
|
||||
|
||||
foreach (var tile in _tile)
|
||||
foreach (var tile in _tiles)
|
||||
{
|
||||
if (tile?.Air == null) continue;
|
||||
tile.Air.CopyFromMutable(combined);
|
||||
tile.AtmosCooldown = 0;
|
||||
tile.UpdateVisuals();
|
||||
}
|
||||
|
||||
@@ -114,7 +119,7 @@ namespace Content.Server.Atmos
|
||||
|
||||
public void Dismantle(bool unexcite = true)
|
||||
{
|
||||
foreach (var tile in _tile)
|
||||
foreach (var tile in _tiles)
|
||||
{
|
||||
if (tile == null) continue;
|
||||
tile.ExcitedGroup = null;
|
||||
@@ -123,7 +128,7 @@ namespace Content.Server.Atmos
|
||||
_gridAtmosphereComponent.RemoveActiveTile(tile);
|
||||
}
|
||||
|
||||
_tile.Clear();
|
||||
_tiles.Clear();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace Content.Server.Atmos
|
||||
/// Use with caution.
|
||||
/// </summary>
|
||||
/// <param name="tile"></param>
|
||||
void RemoveActiveTile(TileAtmosphere tile);
|
||||
void RemoveActiveTile(TileAtmosphere tile, bool disposeGroup = true);
|
||||
|
||||
/// <summary>
|
||||
/// Marks a tile as having a hotspot so it can be processed.
|
||||
|
||||
@@ -44,9 +44,6 @@ namespace Content.Server.Atmos
|
||||
[ViewVariables]
|
||||
private static GasTileOverlaySystem _gasTileOverlaySystem;
|
||||
|
||||
[ViewVariables]
|
||||
public int AtmosCooldown { get; set; } = 0;
|
||||
|
||||
[ViewVariables]
|
||||
public float Temperature {get; private set; } = Atmospherics.T20C;
|
||||
|
||||
@@ -647,7 +644,7 @@ namespace Content.Server.Atmos
|
||||
// Can't process a tile without air
|
||||
if (Air == null)
|
||||
{
|
||||
_gridAtmosphereComponent.RemoveActiveTile(this);
|
||||
Excited = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -657,7 +654,6 @@ namespace Content.Server.Atmos
|
||||
_currentCycle = fireCount;
|
||||
var adjacentTileLength = 0;
|
||||
|
||||
AtmosCooldown++;
|
||||
for (var i = 0; i < Atmospherics.Directions; i++)
|
||||
{
|
||||
var direction = (AtmosDirection) (1 << i);
|
||||
@@ -738,7 +734,7 @@ namespace Content.Server.Atmos
|
||||
if (ConsiderSuperconductivity(true))
|
||||
remove = false;
|
||||
|
||||
if((ExcitedGroup == null && remove) || (AtmosCooldown > (Atmospherics.ExcitedGroupsDismantleCycles * 2)))
|
||||
if(ExcitedGroup == null && remove)
|
||||
_gridAtmosphereComponent.RemoveActiveTile(this);
|
||||
}
|
||||
|
||||
@@ -1187,11 +1183,9 @@ namespace Content.Server.Atmos
|
||||
if (lastShare > Atmospherics.MinimumAirToSuspend)
|
||||
{
|
||||
ExcitedGroup.ResetCooldowns();
|
||||
AtmosCooldown = 0;
|
||||
} else if (lastShare > Atmospherics.MinimumMolesDeltaToMove)
|
||||
{
|
||||
ExcitedGroup.DismantleCooldown = 0;
|
||||
AtmosCooldown = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user