Building objects can have defined positions, returned by buildingPos command.
Building objects can have a path LOD defined, which provides the AI with paths used to allow them to defined building positions using special internal pathfinding and movement routines.
AI use special internal pathfinding and movement routines when on an object path LODs.
AI use general external pathfinding and movement routines when not in object path LODs.
AI are generally unable to navigate inside buildings without correctly defined path LOD.
AI are able to navigate between adjacent buildings by following path LODs.
If AI are attempting to move to an internal building position, and that position cannot be reached externally (such as a back corner of a simple cube shaped shed with only one door on the front face), AI will sometimes fail to attempt to access that position using the predefined building paths. They will instead move as close as possible using their general external pathfinding, or worse, move as close as possible to the position via an adjacent building paths (which are frequently completely separate - ie it's impossible to move between buildings without first moving outside). This can create situations where AI walk through walls to access building paths.
AI should always be able to recognise if there is no possible way to move to the destination, other than first getting onto the destination building's path LOD (ie, they cannot move by any means from A to C without first moving to B first). They should first identify a way to move onto the building path in a valid way, rather than trying to get as close as possible to the destination, then worry about getting onto the building path.
A possible method to achieve this would be to add "externally accessible flags" to path LOD nodes/vertices. If destination position is not externally accessible, AI pathfinding from outside the building to inside would involve finding the closest valid externally accessible path access point, then follow the building path to the destination position.
When moving between adjacent buildings via paths, AI should recognise they are only able to transfer between building paths at locations where an externally accessible node of one building path coincides with the path of the other building.
Building positions could also have path accessible only flags to assist AI to identify when paths should be used.