ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

Dock

From ModEnc
Revision as of 22:25, 25 February 2021 by 4SG (talk | contribs) (Art coding)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Tiberian Dawn The Covert Operations Red Alert Counterstrike Aftermath Tiberian Sun Firestorm HyperPatch Red Alert 2 Yuri's Revenge Ares Generals Zero Hour Tiberium Wars Kane's Wrath
Flag: Dock
File(s): rules(md).ini
Values: Names of BuildingTypes
Default: none (as opposed to "None", meaning none set)
Applicable to: VehicleTypes, AircraftTypes


Dock= specifies which buildings this object can dock with, for whatever purpose. In order to make the docking work, the specified building(s) needs to be set up as well (see below).

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. In TS, NonVehicle=yes prevents a unit being repaired, while in RA2 it only prevents other vehicles repairing them, not the service depot. 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=.

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 foundation of a 2x2 structure like so:

-A-
BXC
-D-

, the X increases from A to C, and Y - from A to B.

To make it more clear, here's the Aircraft Command HQ:

Dockoffsets.png

Here we can see the X axis, Y axis, and Z axis offsets in leptons from the center (0) of the building, where the red cells are not docks. As an example, from this image you can see that if you wanted to make Dock #5 where the topmost red cell is located, you would use DockingOffset4=-256,-128,0 where the center of that cell's X coordinate is -256 and center of the cell's Y coordinate is -128.

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.


Note: The rules' comment is

<<< applies only to moving units (not buildings) >>>
Dock = preferred docking building [e.g., harvester -> refinery, helicopter -> helipad] (def=none)
...since the Type-specific flags are listed below that section, this comment does theoretically not exclude InfantryTypes as users of Dock. The Guide only lists AircraftTypes and VehicleTypes. If anyone has made entirely sure that InfantryTypes cannot dock to buildings, please alter this page accordingly. (Just because a simple VehicleType-like connection does not work, it's not automatically impossible.)