Dock
Docking
Certain units can dock with their parent structures (aircraft -> AFC, harvester -> refinery, vehicles -> repair bay/tank bunker, ships -> shipyard). Docking can repair/reload/unload the unit or fortify it, depending on the structure.
Rules coding
Buildings that only certain units can dock with should be listed in the Dock= statement in the unit's code, and the structures themselves should have NumberOfDocks= set (equal to .. number of docking points within a structure, duh). NumberImpassableRows= is also needed - otherwise units will acknowledge the "Enter" command, but will stop at the structure, unable to move over it. Repair bays and tank bunkers accompany any vehicle, and none of them has Dock= set to the repair bay. That's because the repair bay has UnitRepair=yes and NumberImpassableRows=1, which flags it as an area passable by any VehicleType without NonVehicle=yes where they can be repaired. And the Tank Bunker can hold units inside because it has Bunker=yes set. The AFC can hold only aircraft on it because of Helipad=yes, it doesn't need NumberImpassableRows=. (obvious, isn't all this?)
Art coding
By default, the units dock with the structure in it's exact center point. This can be changed by adding DockingOffsetN=X,Y,Z to the structure's art.ini coding. N is the number of the docking position, and will be used if all the docks with smaller N are used up. N starts at 0, not at 1. X, Y and Z are measured in leptons (1/256th of a cell). The center point of the structure is 0,0,0 and if you imagine a 2x2 structure to be foundated like this:
-A- BXC -D-
, the X increases from A to C, and Y - from A to B.
Structure-specific info
From testing, I've seen that:
- A refinery is hardcoded to use only one cell for it's docking location, and it ignores both NumberOfDocks= and DockingOffset= and uses the center cell in the bottom-most row of the structure.
- A repair bay can only have one dock, otherwise it'll crash.
- A tank bunker is hardcoded to only one dock too, though I'm not sure if it can be not the exact center of the structure.
- An AFC can use a lot of docks... a lot more than the usual 4. I've tested it more thoroughly and I've seen it support up to 16 docking locations. They'll work perfectly as long as you make sure all the DockingOffsets= are within the structure's Foundation=. If DockingOffset= points to outside the Foundation=, the aircraft will be produced on that offset as usual, but they'll refuse to land there after flying.