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

@@ -56,43 +56,34 @@ namespace Content.Client.Decals
private void OnHandleState(EntityUid gridUid, DecalGridComponent gridComp, ref ComponentHandleState args)
{
if (args.Current is not DecalGridState state)
return;
// is this a delta or full state?
_removedChunks.Clear();
Dictionary<Vector2i, DecalChunk> modifiedChunks;
switch (args.Current)
if (!state.FullState)
{
case DecalGridDeltaState delta:
foreach (var key in gridComp.ChunkCollection.ChunkCollection.Keys)
{
modifiedChunks = delta.ModifiedChunks;
foreach (var key in gridComp.ChunkCollection.ChunkCollection.Keys)
{
if (!delta.AllChunks.Contains(key))
_removedChunks.Add(key);
}
break;
if (!state.AllChunks!.Contains(key))
_removedChunks.Add(key);
}
case DecalGridState state:
}
else
{
foreach (var key in gridComp.ChunkCollection.ChunkCollection.Keys)
{
modifiedChunks = state.Chunks;
foreach (var key in gridComp.ChunkCollection.ChunkCollection.Keys)
{
if (!state.Chunks.ContainsKey(key))
_removedChunks.Add(key);
}
break;
if (!state.Chunks.ContainsKey(key))
_removedChunks.Add(key);
}
default:
return;
}
if (_removedChunks.Count > 0)
RemoveChunks(gridUid, gridComp, _removedChunks);
if (modifiedChunks.Count > 0)
UpdateChunks(gridUid, gridComp, modifiedChunks);
if (state.Chunks.Count > 0)
UpdateChunks(gridUid, gridComp, state.Chunks);
}
private void OnChunkUpdate(DecalChunkUpdateEvent ev)