This calls for a new AI command: setTargetToRandomStation. When used it makes a list with all stations within 'desiredRange' that are no carriers and allow npc traffic. Than it selects a random one from that list. I just wrote and tested it with a modified route1traderAI and a desired range of 500 000. Looks good, does not affect clean traders but makes it happen that offender 'traders' regularly dock other stations like rock hermits or constores.
(it also needed the new command setTargetToLastStation to re-find the station he was heading for after a waypoint or attack action.)
Needs a bit more testing though.
A better description would be an AI command to go to secondary stations.
This would rule out the main station and carriers (as they're not true stations).
A better description would be an AI command to go to secondary stations.
This would rule out the main station and carriers (as they're not true stations).
Problem with carriers is that there is no official difference in the code between carriers and stations. The ship-key 'is_carrier' only defines something as station. The only characteristic for differentiating I now use is max_speed. When zero it's a true station, when > 0 it is treated as a carrier. But this is not foolproof as there might be stations around that have no "max_flight_speed" defined, and than it will default to 160.
I now updated trunk with the new route1traderAI so pirates with bounty that try to sell there loot have a big chance to go to another station than the main one.
I also noticed that we had the "setTargetToNearestFriendlyStation" that was never documented in the wiki and in the oolite change-log it was not explained what it really does. Maybe that one should be redefined to only go for non-carriers that allow npc traffic.
I didn't see any mention of "has_npc_traffic" for Rock Hermits, so those seem a likely docking station for "full" pirates.
If carrier types disallowed npc traffic via "has_npc_traffic", a further distinction for them might not be necessary.
HMM, has_npc_traffic means "this station allows NPCs to dock and undock". Sending a pirate to try and dock with something that doesn't allow it to dock seems 'slightly' counterintuitive to me!
So does the lack of a "has_npc_traffic = true;" line mean the station/carrier will not have random npc ships docking with it?
And if so, is that what's wanted in this case?