Revert "Upstream (#148)"

This reverts commit 9f00d4b9aa.
This commit is contained in:
Jabak
2024-10-22 22:47:57 +03:00
parent 9f00d4b9aa
commit dbc492f3f3
96 changed files with 1080 additions and 1047 deletions

View File

@@ -1,5 +1,4 @@
using Content.Client.Atmos.Overlays;
using Content.Shared.Atmos;
using Content.Shared.Atmos.Components;
using Content.Shared.Atmos.EntitySystems;
using JetBrains.Annotations;
@@ -37,38 +36,28 @@ namespace Content.Client.Atmos.EntitySystems
private void OnHandleState(EntityUid gridUid, GasTileOverlayComponent comp, ref ComponentHandleState args)
{
Dictionary<Vector2i, GasOverlayChunk> modifiedChunks;
if (args.Current is not GasTileOverlayState state)
return;
switch (args.Current)
// is this a delta or full state?
if (!state.FullState)
{
// is this a delta or full state?
case GasTileOverlayDeltaState delta:
foreach (var index in comp.Chunks.Keys)
{
modifiedChunks = delta.ModifiedChunks;
foreach (var index in comp.Chunks.Keys)
{
if (!delta.AllChunks.Contains(index))
comp.Chunks.Remove(index);
}
break;
if (!state.AllChunks!.Contains(index))
comp.Chunks.Remove(index);
}
case GasTileOverlayState state:
}
else
{
foreach (var index in comp.Chunks.Keys)
{
modifiedChunks = state.Chunks;
foreach (var index in comp.Chunks.Keys)
{
if (!state.Chunks.ContainsKey(index))
comp.Chunks.Remove(index);
}
break;
if (!state.Chunks.ContainsKey(index))
comp.Chunks.Remove(index);
}
default:
return;
}
foreach (var (index, data) in modifiedChunks)
foreach (var (index, data) in state.Chunks)
{
comp.Chunks[index] = data;
}