If a unit is ordered to garrison a wall turret that is not accessible from the inside as it is blocked by the adjacent walls,
the unit will forever walk against the wall, never succeed the garrison nor show up as idle.
It was reported here #4473. It is a very annoying and easy to trigger pathfinder bug.
It can be traced to rP17154 which fixed #3539 but introduced an inconsistency in CCmpUnitMotion::TryGoingStraightToTargetEntity.
This function is the only one not ignoring the target obstruction, while all other calls do account for the target obstructions.
Removing this inconsistency fixes the issue.
The obstruction filter ignores all obstruction shapes that have one of the two controlGroups equal to the target entity.
The wall pieces adjacent to the target wall tower have the same control group, hence are ignored in this one line of code.
It seems the inconsistency comes from a confusion of nearestPointOfGoal:
It doesn't return the nearest point on the obstruction but the point in the garrisonrange.
In rP17154:
Yes, but it put as next waypoint goalPos which the the nearestPointOnGoal which for a wall should be the nearest point on the obstruction square. And there should be no obstruction between the unit and this goalPos.
In https://trac.wildfiregames.com/ticket/3539#comment:4:
tryGoingStraightToTarget which will never suceed as it will always find the way obstructed by the target itself.