Salvage dungeons (#14520)

This commit is contained in:
metalgearsloth
2023-03-10 16:41:22 +11:00
committed by GitHub
parent 214ca06997
commit 6157dfa3c0
145 changed files with 24649 additions and 396 deletions

View File

@@ -319,6 +319,33 @@ namespace Content.Server.Decals
return decalIds;
}
public HashSet<(uint Index, Decal Decal)> GetDecalsIntersecting(EntityUid gridUid, Box2 bounds, DecalGridComponent? component = null)
{
var decalIds = new HashSet<(uint, Decal)>();
var chunkCollection = ChunkCollection(gridUid, component);
if (chunkCollection == null)
return decalIds;
var chunks = new ChunkIndicesEnumerator(bounds, ChunkSize);
while (chunks.MoveNext(out var chunkOrigin))
{
if (!chunkCollection.TryGetValue(chunkOrigin.Value, out var chunk))
continue;
foreach (var (id, decal) in chunk.Decals)
{
if (!bounds.Contains(decal.Coordinates))
continue;
decalIds.Add((id, decal));
}
}
return decalIds;
}
/// <summary>
/// Changes a decals position. Note this will actually result in a new decal being created, possibly on a new grid or chunk.
/// </summary>