A station has several ships on board. Default is scavengers 3, defense_ships 3, police_ships 8, traders 3 to 10 and shuttles 0 to 3.
The first 3 can be redefined in shipdata.plist with
max_scavengers max_defense_ships max_police
The system itself launches at regular intervals the shuttles (15 min), traders (6-20 min) and police_patrols (5 min) until the max value is reached.
Police patrols only launch by schedule from the main station and no shuttles and traders are launched by schedule from stations with scannClass: CLASS_ROCK. However starting from version 1.70 traders are launching from other stations that have the key has_npc_traffic set to yes.
Other ships are only launched by stationAI commands. Launching by AI is done with the AI-commands:
Both commands use the same counter and launch until max_scavengers is reached. They also do a check for ships around the station and in the launching queue.
When there is already a miner flying around the station (or already on the launching list), launchMiner will do nothing. When there are equal or more scavengers than max_scavenger flying around the station or on the launching list, launchScavenger will do nothing.
launchShuttle launchTrader launchEscort launchShipWithRole: role launchIndependentShipWithRole: role
All four can launch without a limit. traders have a 10% change of becoming a sunskim trader. Otherwise he makes a witchspace jump and returns at the witchspacepoint of the same system.
launchShipWithRole: will launch ships that belong to the station group while launchIndependentShipWithRole: will launch independent ships that belong to nobody other than an escort group of its own.
"launchIndependentShipWithRole:" handles two roles in a special way: "trader" will launch with an exitingTraderAI.plist and "sunskim-trader" will launch with a route2sunskimAI.plist.
launchPatrol launchPolice launchDefenseShip launchPirateShip
launchPolice will try to launch four police ships, when available, with one single launch instruction. launchPolice and launchDefenseShip will send back all docking ships so they can launch immediately.
All four commands use the same counter but patrols and police launch until max_police is reached and defenseShip and pirateShip launch until max_defense_schips is reached. For defense and pirates to launch the mothership must have a target otherwise the AI returns "TARGET_LOST".
Patrol-, Police- and DefenseShip are chosen from the pool of ships with role "police" or "interceptor". Patrol ships get a "planetPatrolAI" and Police or DefenseShips both get a "policeInterceptAI". In case an interceptor ship is selected, it will launch with role police.
launchPatrol launches a ship with role police and planetPatrolAI. This patrol was originally only meant for use by the main station. Starting with Oolite 1.73 it will use patrol coordinates based on the station it launched from and not always around the main station.
DefenseShips can be redefined with a definition in shipdata with key: "defense_ship" or "defense_ship_role". On launching all the DefenseShips get the new role of "defense_ship". However, custom DefenseShips from shipdata keep their original AI.
On docking the appropriate counters are lowered again. Docking of traders is counted, but leaving traders are only counted if launched by schedule not if launched by AI-command.