Use approx NPC steering checks (#36110)

Much faster lookup and shouldn't affect final result.
This commit is contained in:
metalgearsloth
2025-04-15 06:15:16 +10:00
committed by GitHub
parent 22639a3cdf
commit 3cc544705c

View File

@@ -507,7 +507,7 @@ public sealed partial class NPCSteeringSystem
var objectRadius = 0.25f; var objectRadius = 0.25f;
var detectionRadius = MathF.Max(0.35f, agentRadius + objectRadius); var detectionRadius = MathF.Max(0.35f, agentRadius + objectRadius);
var ents = _entSetPool.Get(); 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) foreach (var ent in ents)
{ {
@@ -586,7 +586,7 @@ public sealed partial class NPCSteeringSystem
var ourVelocity = body.LinearVelocity; var ourVelocity = body.LinearVelocity;
_factionQuery.TryGetComponent(uid, out var ourFaction); _factionQuery.TryGetComponent(uid, out var ourFaction);
var ents = _entSetPool.Get(); 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) foreach (var ent in ents)
{ {