From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sun, 10 Mar 2024 15:41:42 +0000 (+1100) Subject: Fix mice steering (#25965) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=819ec6361d0d2792b43357a6c45f8c95cb08d9ed;p=space-station-14.git Fix mice steering (#25965) Thinks there's obstacles when there isn't. --- diff --git a/Content.Server/NPC/Systems/NPCSteeringSystem.Context.cs b/Content.Server/NPC/Systems/NPCSteeringSystem.Context.cs index 7ac6768e35..e7af2c9107 100644 --- a/Content.Server/NPC/Systems/NPCSteeringSystem.Context.cs +++ b/Content.Server/NPC/Systems/NPCSteeringSystem.Context.cs @@ -56,7 +56,30 @@ public sealed partial class NPCSteeringSystem return true; } - return false; + // TODO: Ideally for "FreeSpace" we check all entities on the tile and build flags dynamically (pathfinder refactor in future). + var ents = _entSetPool.Get(); + _lookup.GetLocalEntitiesIntersecting(node.GraphUid, node.ChunkOrigin, ents, flags: LookupFlags.Static); + var result = true; + + if (ents.Count > 0) + { + var fixtures = _fixturesQuery.GetComponent(uid); + var physics = _physicsQuery.GetComponent(uid); + + foreach (var intersecting in ents) + { + if (!_physics.IsCurrentlyHardCollidable((uid, fixtures, physics), intersecting)) + { + continue; + } + + result = false; + break; + } + } + + _entSetPool.Return(ents); + return result; } ///