Reduce shuttle smimsh allocations (#22952)

This commit is contained in:
metalgearsloth
2023-12-31 03:12:52 +11:00
committed by GitHub
parent 9ce847a840
commit 3a166e1423

View File

@@ -77,6 +77,8 @@ public sealed partial class ShuttleSystem
/// </summary>
public const float FTLDestinationMass = 500f;
private HashSet<EntityUid> _lookupEnts = new();
private EntityQuery<BodyComponent> _bodyQuery;
private EntityQuery<BuckleComponent> _buckleQuery;
private EntityQuery<GhostComponent> _ghostQuery;
@@ -716,8 +718,10 @@ public sealed partial class ShuttleSystem
// Handle clearing biome stuff as relevant.
tileSet.Clear();
_biomes.ReserveTiles(xform.MapUid.Value, aabb, tileSet);
_lookupEnts.Clear();
_lookup.GetEntitiesIntersecting(xform.MapUid.Value, aabb, _lookupEnts, LookupFlags.Uncontained);
foreach (var ent in _lookup.GetEntitiesIntersecting(xform.MapUid.Value, aabb, LookupFlags.Uncontained))
foreach (var ent in _lookupEnts)
{
if (ent == uid || immune.Contains(ent))
{