]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Reduce shuttle smimsh allocations (#22952)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Sat, 30 Dec 2023 16:12:52 +0000 (03:12 +1100)
committerGitHub <noreply@github.com>
Sat, 30 Dec 2023 16:12:52 +0000 (03:12 +1100)
Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs

index 763e89e4f8173331c9e0f61b6bf6970e418498b6..636470e2e5fd0d1b890519b73821f62537205fe4 100644 (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))
                 {