Pathfinder hotfixes (#8201)

This commit is contained in:
metalgearsloth
2022-05-16 13:21:00 +10:00
committed by GitHub
parent 638ccb8500
commit 01d2d174fc
12 changed files with 301 additions and 460 deletions

View File

@@ -38,17 +38,6 @@ namespace Content.Server.AI.Pathfinding
GenerateMask();
}
public static bool IsRelevant(EntityUid entity, IPhysBody physicsComponent)
{
if (IoCManager.Resolve<IEntityManager>().GetComponent<TransformComponent>(entity).GridID == GridId.Invalid ||
(PathfindingSystem.TrackedCollisionLayers & physicsComponent.CollisionLayer) == 0)
{
return false;
}
return true;
}
/// <summary>
/// Return our neighboring nodes (even across chunks)
/// </summary>
@@ -93,7 +82,7 @@ namespace Content.Server.AI.Pathfinding
}
}
public PathfindingNode? GetNeighbor(Direction direction)
public PathfindingNode? GetNeighbor(Direction direction, IEntityManager? entManager = null)
{
var chunkXOffset = TileRef.X - ParentChunk.Indices.X;
var chunkYOffset = TileRef.Y - ParentChunk.Indices.Y;
@@ -254,9 +243,9 @@ namespace Content.Server.AI.Pathfinding
/// <param name="entity"></param>
/// TODO: These 2 methods currently don't account for a bunch of changes (e.g. airlock unpowered, wrenching, etc.)
/// TODO: Could probably optimise this slightly more.
public void AddEntity(EntityUid entity, IPhysBody physicsComponent)
public void AddEntity(EntityUid entity, IPhysBody physicsComponent, IEntityManager? entMan = null)
{
var entMan = IoCManager.Resolve<IEntityManager>();
IoCManager.Resolve(ref entMan);
// If we're a door
if (entMan.HasComponent<AirlockComponent>(entity) || entMan.HasComponent<DoorComponent>(entity))
{