Fix mice steering (#25965)

Thinks there's obstacles when there isn't.
This commit is contained in:
metalgearsloth
2024-03-11 02:41:42 +11:00
committed by GitHub
parent 950a786ed0
commit 819ec6361d

View 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>