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

Dock

From ModEnc
Revision as of 18:21, 7 June 2009 by 213.46.101.32 (talk) (Art coding)
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 2x2 structure to be foundated like this:

-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:

http://img200.imageshack.us/my.php?image=aicraftcommandhq.png

We can see the docking area (sort of), were aircraft land. And the coordinates 0,0,0 (X,Y,Z) are in he center. But we have to take into consideration that there is a part of the building where aircraft can't land but which is still part of the building, left of these 4 docks. So, the middle point then is somewhere between the upper dock and the left dock. The coordinates for the upper dock are for example, on top of my head, 0,-128,0, as X and Z stay the same, but Y is half a cell higher, -128. Easy, not?

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.)