What I've determined so far is that order.dock.xml handles docking ships and move.undock.xml handles undocking. Docking is done by calling request_docking to choose and lock in a docking pad for the ship, and once the ship is in position dock is called to actually dock the ship. Similarly, undocking is done by calling request_undocking to move the ship to a docking pad or launch tube if not already there, then calling undock to actually undock. So docking looks like this:
Code: Select all
<!-- a bunch of logic to check if the ship is able to dock with the target -->
<request_docking ship="$thisship" container="$destination" requirebuilding="$building" requiretrading="$trading" allowplayeronly="$allowplayeronly" ventureronly="$ventureplatform" ventureplatform="$ventureplatform" queuedresult="$queuedresult" grantedresult="$grantedresult" />
<!-- a bunch of logic to get the ship onto the docking pad -->
<dock ship="$thisship" />
Code: Select all
<request_undocking ship="$thisship" queuedresult="$queuedresult" grantedresult="$grantedresult" highpriority="false"/>
<undock ship="$thisship" />
<!-- a bunch of logic to get the ship clear of the docking pad and ship/station -->
The key takeaway from this is that nowhere in the XML files is it mentioned how to get a ship that is currently docked to go into storage. There seem to be a hardcoded queues for docking and undocking, and the request_docking and request_undocking commands themselves place ships into these queues. Some internal logic then determines if ships need to be stored to let incoming ships dock or where currently stored ships may be retrieved for undocking. Therefore it seems as if there is no way to directly order a ship to be stored or retrieved using XML (although calling request_undocking without calling undock might retrieve a ship, but it could go to either a launch tube or a docking pad).
I did, however, discover in common.xsd a command called request_retrieval, which is supposed to retrieve a ship from storage. Strangely, this command is not used anywhere in any of the existing scripts. Unfortunately, there is no corresponding command for putting a ship into storage.
So therefore my conclusion is that the only way to force a ship to go into storage is to get enough queued docking requests such that all pads are required for docking. This will cause the internal logic to bring any currently docked ships into internal storage. My initial thought for achieving this is to just spawn a bunch of ships some obscene distance from the sector center, make them request docking on the ship/station I want to store ships, and then cancel the docking request and despawn them. Not exactly an elegant solution.
I'm pretty new to modding X games though, and this is actually my first time looking at the XML files, so I would appreciate thoughts on this from more experienced members of the community.