]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Use approx NPC steering checks (#36110)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Mon, 14 Apr 2025 20:15:16 +0000 (06:15 +1000)
committerGitHub <noreply@github.com>
Mon, 14 Apr 2025 20:15:16 +0000 (22:15 +0200)
Much faster lookup and shouldn't affect final result.

Content.Server/NPC/Systems/NPCSteeringSystem.Context.cs

index 6a295198c2572e3c769cdbca5e155c42b9b15798..c083be6134f9b119a80a2abcdc06e6f8655c25b9 100644 (file)
@@ -507,7 +507,7 @@ public sealed partial class NPCSteeringSystem
         var objectRadius = 0.25f;
         var detectionRadius = MathF.Max(0.35f, agentRadius + objectRadius);
         var ents = _entSetPool.Get();
-        _lookup.GetEntitiesInRange(uid, detectionRadius, ents, LookupFlags.Dynamic | LookupFlags.Static);
+        _lookup.GetEntitiesInRange(uid, detectionRadius, ents, LookupFlags.Dynamic | LookupFlags.Static | LookupFlags.Approximate);
 
         foreach (var ent in ents)
         {
@@ -586,7 +586,7 @@ public sealed partial class NPCSteeringSystem
         var ourVelocity = body.LinearVelocity;
         _factionQuery.TryGetComponent(uid, out var ourFaction);
         var ents = _entSetPool.Get();
-        _lookup.GetEntitiesInRange(uid, detectionRadius, ents, LookupFlags.Dynamic);
+        _lookup.GetEntitiesInRange(uid, detectionRadius, ents, LookupFlags.Dynamic | LookupFlags.Approximate);
 
         foreach (var ent in ents)
         {