Skip to content

Commit

Permalink
Cherry-picked commit 819ec63 from space-wizards/space-station-14/master
Browse files Browse the repository at this point in the history
  • Loading branch information
metalgearsloth authored and SimpleStation14 committed Apr 21, 2024
1 parent 3bf08c7 commit ce7587a
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion Content.Server/NPC/Systems/NPCSteeringSystem.Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,30 @@ private bool IsFreeSpace(
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>
Expand Down

0 comments on commit ce7587a

Please sign in to comment.