changes dunno

This commit is contained in:
Víctor Aguilera Puerto
2020-08-30 13:20:08 +02:00
parent 16f0eebf15
commit c137d1bc16
3 changed files with 56 additions and 49 deletions

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using Content.Server.GameObjects.Components.Atmos.Piping; using Content.Server.GameObjects.Components.Atmos.Piping;
using Content.Server.GameObjects.Components.NodeContainer.NodeGroups; using Content.Server.GameObjects.Components.NodeContainer.NodeGroups;
using Content.Shared.Atmos;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Map; using Robust.Shared.Map;
using Robust.Shared.Maths; using Robust.Shared.Maths;
@@ -152,7 +153,7 @@ namespace Content.Server.Atmos
/// <summary> /// <summary>
/// Returns a dictionary of adjacent TileAtmospheres. /// Returns a dictionary of adjacent TileAtmospheres.
/// </summary> /// </summary>
Dictionary<Direction, TileAtmosphere> GetAdjacentTiles(MapIndices indices, bool includeAirBlocked = false); Dictionary<AtmosDirection, TileAtmosphere> GetAdjacentTiles(MapIndices indices, bool includeAirBlocked = false);
void Update(float frameTime); void Update(float frameTime);

View File

@@ -35,7 +35,7 @@ namespace Content.Server.GameObjects.Components.Atmos
if (Owner.TryGetComponent(out SnapGridComponent? snapGrid)) if (Owner.TryGetComponent(out SnapGridComponent? snapGrid))
{ {
EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(Owner.Transform.GridID)?.Invalidate(snapGrid.Position); EntitySystem.Get<AtmosphereSystem>().GetGridAtmosphere(Owner.Transform.GridID)?.Revalidate(snapGrid.Position);
} }
} }
} }

View File

@@ -210,12 +210,20 @@ namespace Content.Server.GameObjects.Components.Atmos
private void Revalidate() private void Revalidate()
{ {
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
foreach (var indices in _invalidatedCoords.ToArray()) foreach (var indices in _invalidatedCoords.ToArray())
{ {
Revalidate(indices);
}
_invalidatedCoords.Clear();
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Revalidate(MapIndices indices)
{
if (!Owner.TryGetComponent(out IMapGridComponent? mapGrid)) return;
var tile = GetTile(indices); var tile = GetTile(indices);
AddActiveTile(tile);
if (tile == null) if (tile == null)
{ {
@@ -248,6 +256,7 @@ namespace Content.Server.GameObjects.Components.Atmos
tile.Air ??= new GasMixture(GetVolumeForCells(1)){Temperature = Atmospherics.T20C}; tile.Air ??= new GasMixture(GetVolumeForCells(1)){Temperature = Atmospherics.T20C};
} }
AddActiveTile(tile);
tile.UpdateAdjacent(); tile.UpdateAdjacent();
tile.UpdateVisuals(); tile.UpdateVisuals();
@@ -261,9 +270,6 @@ namespace Content.Server.GameObjects.Components.Atmos
} }
} }
_invalidatedCoords.Clear();
}
/// <inheritdoc /> /// <inheritdoc />
public void FixVacuum(MapIndices indices) public void FixVacuum(MapIndices indices)
{ {