@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user