I *think* it needs to not be available "nearby" but I'm not 100% sure. You'd probably need to dig through ProcurementMissionIntel to figure it out for sure.
Ok I took a look at this in the API. I think you are correct in that:
for (MarketAPI curr : Misc.getMarketsInLocation(from.getContainingLocation())) {
//if (curr == from) continue;
if (curr.getPrimaryEntity() != null && from.getPrimaryEntity() != null) {
float dist = Misc.getDistance(curr.getPrimaryEntity().getLocation(), from.getPrimaryEntity().getLocation());
if (dist > 10000) continue;
}
- from doNearbyMarketsHave() checks for the selected commodity of the mission to be available in a sufficient quantity at all nearby markets relative to the candidate market once a commodity itself has been chosen. All those that have enough within that distance
won't be chosen so the more efficient the campaigns systems are the less likely these types of missions will be available without some kind of dynamic interference. (It also won't choose hidden or player owned markets in general).
So deficits don't seem to matter - But!- if you have created your colonies to have the resources they need nearby regardless of faction (within 10000 in system) then likely no procurement missions will spawn there for that commodity.
Please correct any inaccuracies as this is a first pass. Just my take so far.
What does this mean when it checks settings?
Global.getSettings().profilerBegin(this.getClass().getSimpleName() + ".pickCommodity()");
Or
Global.getSettings().profilerBegin(this.getClass().getSimpleName() + ".pickMarket()");
(And a side note)
WeightedRandomPicker<Float> durationPicker = new WeightedRandomPicker<Float>();
durationPicker.add(20f);
durationPicker.add(30f);
durationPicker.add(40f);
durationPicker.add(60f);
The lowest duration here is a little too low, imo. (I didn't thoroughly check whether this gets modified later like, say, the commodity size requested which later gets modified by market size, etc.) I've found that sometimes it's all but impossible to complete the mission in that short an amount of time if the RNG is right. It makes these less appealing than the bar missions- both because the reward is less and the difficulty can be higher due to the variance. Just some pondering.