This is the same diff as D1418, fixing noted issues:
- skirmish-replaced entities did not work, as I ran into a weird issue with the "construction->movement" change (see D1445).
- OnEntityRenamed was broken. I thought it was necessary for wall/gate upgrading, but it turns out that the renamed entity does get OwnershipChanged messages, and thus this worked. I suppose it might have been broken at some point in the past? I'm unsure what I've done here.
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 removing the obstruction of visibly garrisoned entities. This 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.