0ptr/nullptr/roles/hauler.py
Richard 74ce884b05 major command staff restructure
Heads had to roll
2024-02-09 15:52:30 +01:00

16 lines
521 B
Python

from nullptr.util import AppError
from nullptr.analyzer import best_sell_market
from random import choice
def assign_hauler(c, s):
if s.crew is None:
raise AppError('ship has no crew')
w = s.crew.site
resources = s.crew.resources
resource = choice(resources)
m = best_sell_market(c,s.location.system, resource)
s.log(f'assigning haul mission from {w} to {m}')
c.captain.init_mission(s, 'haul')
c.captain.smipa(s, 'site', w)
c.captain.smipa(s, 'dest', m)
c.captain.smipa(s, 'resources', resources)