This addresses two related issues:
- Units visibly garrisoned on gates keep the gate open.
- Units visibly garrisoned on entities keep their pathfinding blocker flags.
The second is fixed by switching gates to look for "block movement" flag, instead of block-construction, and by removing the "block-movement" flag of visibly garrisoned entities.
This also fixes #5151 .
The first is fixed by changing some logic to consider the ability of units to move.
Add a "SetImmobile" function to UnitAI, to mark a unit as incapable of moving (though it theoretically could).
Change from IsTurret checks to use that function instead.
Packing logic is kept separate as it's trickier.
With this, gates can subscribe to those events and can choose to ignore units that can't move (since it makes no sense to open the gate for those), fixing the issue.
Attached is a small replay of some cases that wouldn't work properly on SVN.