]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix mice steering (#25965)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Sun, 10 Mar 2024 15:41:42 +0000 (02:41 +1100)
committerGitHub <noreply@github.com>
Sun, 10 Mar 2024 15:41:42 +0000 (02:41 +1100)
Thinks there's obstacles when there isn't.

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

index 7ac6768e35923b22f12679c1b23a2a25f4e7141a..e7af2c91073798daaf8930e6f5cc12a85774db2c 100644 (file)
@@ -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;
     }
 
     /// <summary>