Adds Invalidate method to TileAtmosphere, clean up a bunch of tile invalidations
This commit is contained in:
@@ -65,15 +65,7 @@ namespace Content.Server.Atmos
|
|||||||
|
|
||||||
public static bool InvalidateTileAir(this ITransformComponent transform, AtmosphereSystem? atmosSystem = null)
|
public static bool InvalidateTileAir(this ITransformComponent transform, AtmosphereSystem? atmosSystem = null)
|
||||||
{
|
{
|
||||||
atmosSystem ??= EntitySystem.Get<AtmosphereSystem>();
|
return InvalidateTileAir(transform.Coordinates, atmosSystem);
|
||||||
|
|
||||||
if (!transform.Coordinates.TryGetTileAtmosphere(out var tileAtmos))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
atmosSystem.GetGridAtmosphere(transform.GridID).Invalidate(tileAtmos.GridIndices);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool InvalidateTileAir(this EntityCoordinates coordinates, AtmosphereSystem? atmosSystem = null, IEntityManager? entityManager = null)
|
public static bool InvalidateTileAir(this EntityCoordinates coordinates, AtmosphereSystem? atmosSystem = null, IEntityManager? entityManager = null)
|
||||||
@@ -86,8 +78,7 @@ namespace Content.Server.Atmos
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var gridId = coordinates.GetGridId(entityManager);
|
tileAtmos.Invalidate();
|
||||||
atmosSystem.GetGridAtmosphere(gridId).Invalidate(tileAtmos.GridIndices);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1177,6 +1177,14 @@ namespace Content.Server.Atmos
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Calls <see cref="GridAtmosphereComponent.Invalidate"/> on this tile atmosphere's position.
|
||||||
|
/// </summary>
|
||||||
|
public void Invalidate()
|
||||||
|
{
|
||||||
|
_gridAtmosphereComponent.Invalidate(GridIndices);
|
||||||
|
}
|
||||||
|
|
||||||
private void LastShareCheck()
|
private void LastShareCheck()
|
||||||
{
|
{
|
||||||
var lastShare = Air.LastShare;
|
var lastShare = Air.LastShare;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace Content.Server.Commands.Atmos
|
|||||||
}
|
}
|
||||||
|
|
||||||
tile.Air.AdjustMoles(gasId, moles);
|
tile.Air.AdjustMoles(gasId, moles);
|
||||||
gam.Invalidate(indices);
|
tile.Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ namespace Content.Server.Commands.Atmos
|
|||||||
|
|
||||||
tile.Air.Clear();
|
tile.Air.Clear();
|
||||||
|
|
||||||
atmosphere.Invalidate(tile.GridIndices);
|
tile.Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -176,7 +176,7 @@ namespace Content.Server.Commands.Atmos
|
|||||||
|
|
||||||
tile.Air.SetMoles(gas.Value, 0);
|
tile.Air.SetMoles(gas.Value, 0);
|
||||||
|
|
||||||
atmosphere.Invalidate(tile.GridIndices);
|
tile.Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace Content.Server.Commands.Atmos
|
|||||||
foreach (var tile in gam)
|
foreach (var tile in gam)
|
||||||
{
|
{
|
||||||
tile.Air?.AdjustMoles(gasId, moles);
|
tile.Air?.AdjustMoles(gasId, moles);
|
||||||
gam.Invalidate(tile.GridIndices);
|
tile.Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace Content.Server.Commands.Atmos
|
|||||||
else
|
else
|
||||||
tile.Air.Remove(amount);
|
tile.Air.Remove(amount);
|
||||||
|
|
||||||
gam.Invalidate(indices);
|
tile.Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ namespace Content.Server.Commands.Atmos
|
|||||||
tiles++;
|
tiles++;
|
||||||
|
|
||||||
tile.Air.Temperature = temperature;
|
tile.Air.Temperature = temperature;
|
||||||
gam.Invalidate(tile.GridIndices);
|
tile.Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
shell.SendText(player, $"Changed the temperature of {tiles} tiles.");
|
shell.SendText(player, $"Changed the temperature of {tiles} tiles.");
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace Content.Server.Commands.Atmos
|
|||||||
}
|
}
|
||||||
|
|
||||||
tile.Air.Temperature = temperature;
|
tile.Air.Temperature = temperature;
|
||||||
gam.Invalidate(indices);
|
tile.Invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Scrubbers
|
|||||||
if (tileAtmos == null)
|
if (tileAtmos == null)
|
||||||
return;
|
return;
|
||||||
ScrubGas(tileAtmos.Air, _scrubberOutlet.Air);
|
ScrubGas(tileAtmos.Air, _scrubberOutlet.Air);
|
||||||
_atmosSystem.GetGridAtmosphere(Owner.Transform.GridID)?.Invalidate(tileAtmos.GridIndices);
|
tileAtmos.Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void ScrubGas(GasMixture inletGas, GasMixture outletGas);
|
protected abstract void ScrubGas(GasMixture inletGas, GasMixture outletGas);
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ namespace Content.Server.GameObjects.Components.Atmos.Piping.Vents
|
|||||||
if (tileAtmos == null)
|
if (tileAtmos == null)
|
||||||
return;
|
return;
|
||||||
VentGas(_ventInlet.Air, tileAtmos.Air);
|
VentGas(_ventInlet.Air, tileAtmos.Air);
|
||||||
_atmosSystem.GetGridAtmosphere(Owner.Transform.GridID).Invalidate(tileAtmos.GridIndices);
|
tileAtmos.Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void VentGas(GasMixture inletGas, GasMixture outletGas);
|
protected abstract void VentGas(GasMixture inletGas, GasMixture outletGas);
|
||||||
|
|||||||
Reference in New Issue
Block a user