bagel update (#34572)

* bagel update

* Decal fault tolerance

* Also fix writes

* fix mv cable, decal issues, yar

* fix a floor tile and some other shit

---------

Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Emisse
2025-01-21 22:48:41 -07:00
committed by GitHub
parent 20acef16ee
commit 3499b47465
2 changed files with 11254 additions and 11993 deletions

View File

@@ -32,6 +32,8 @@ namespace Content.Shared.Decals
node.TryGetValue(new ValueDataNode("version"), out var versionNode); node.TryGetValue(new ValueDataNode("version"), out var versionNode);
var version = ((ValueDataNode?) versionNode)?.AsInt() ?? 1; var version = ((ValueDataNode?) versionNode)?.AsInt() ?? 1;
Dictionary<Vector2i, DecalChunk> dictionary; Dictionary<Vector2i, DecalChunk> dictionary;
uint nextIndex = 0;
var ids = new HashSet<uint>();
// TODO: Dump this when we don't need support anymore. // TODO: Dump this when we don't need support anymore.
if (version > 1) if (version > 1)
@@ -53,16 +55,24 @@ namespace Content.Shared.Decals
var chunkOrigin = SharedMapSystem.GetChunkIndices(coords, SharedDecalSystem.ChunkSize); var chunkOrigin = SharedMapSystem.GetChunkIndices(coords, SharedDecalSystem.ChunkSize);
var chunk = dictionary.GetOrNew(chunkOrigin); var chunk = dictionary.GetOrNew(chunkOrigin);
var decal = new Decal(coords, data.Id, data.Color, data.Angle, data.ZIndex, data.Cleanable); var decal = new Decal(coords, data.Id, data.Color, data.Angle, data.ZIndex, data.Cleanable);
chunk.Decals.Add(dUid, decal);
nextIndex = Math.Max(nextIndex, dUid);
// Re-used ID somehow
// This will bump all IDs by up to 1 but will ensure the map is still readable.
if (!ids.Add(dUid))
{
dUid = nextIndex++;
ids.Add(dUid);
}
chunk.Decals[dUid] = decal;
} }
} }
} }
else else
{ {
dictionary = serializationManager.Read<Dictionary<Vector2i, DecalChunk>>(node, hookCtx, context, notNullableOverride: true); dictionary = serializationManager.Read<Dictionary<Vector2i, DecalChunk>>(node, hookCtx, context, notNullableOverride: true);
}
uint nextIndex = 0;
foreach (var decals in dictionary.Values) foreach (var decals in dictionary.Values)
{ {
@@ -71,6 +81,7 @@ namespace Content.Shared.Decals
nextIndex = Math.Max(uid, nextIndex); nextIndex = Math.Max(uid, nextIndex);
} }
} }
}
nextIndex++; nextIndex++;
return new DecalGridChunkCollection(dictionary) { NextDecalId = nextIndex }; return new DecalGridChunkCollection(dictionary) { NextDecalId = nextIndex };

File diff suppressed because it is too large Load Diff