Gas tile overlay state handling changes (#12691)

This commit is contained in:
Leon Friedrich
2022-12-19 08:25:27 +13:00
committed by GitHub
parent 195bf86fe2
commit 2759ef009e
11 changed files with 268 additions and 108 deletions

View File

@@ -2,6 +2,7 @@ using System.Linq;
using Content.Server.Atmos.Components;
using Content.Server.Atmos.Reactions;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Utility;
@@ -48,6 +49,8 @@ public sealed partial class AtmosphereSystem
if (!TryComp(uid, out MapGridComponent? mapGrid))
return;
EnsureComp<GasTileOverlayComponent>(uid);
foreach (var (indices, tile) in gridAtmosphere.Tiles)
{
gridAtmosphere.InvalidatedCoords.Add(indices);
@@ -550,12 +553,14 @@ public sealed partial class AtmosphereSystem
var uid = gridAtmosphere.Owner;
TryComp(gridAtmosphere.Owner, out GasTileOverlayComponent? overlay);
// Gotta do this afterwards so we can properly update adjacent tiles.
foreach (var (position, _) in gridAtmosphere.Tiles.ToArray())
{
var ev = new UpdateAdjacentMethodEvent(uid, position);
GridUpdateAdjacent(uid, gridAtmosphere, ref ev);
InvalidateVisuals(mapGrid.Owner, position);
InvalidateVisuals(mapGrid.Owner, position, overlay);
}
}
}