Update commander.py

This commit is contained in:
Richard Bronkhorst 2023-06-18 21:56:49 +02:00
parent 21f93f078d
commit 3a85c6c367

View File

@ -217,6 +217,17 @@ class Commander(CommandLine):
r = list(self.store.all('Contract')) r = list(self.store.all('Contract'))
pprint(r) pprint(r)
def do_deliver(self):
if not self.has_ship(): return
site = self.ship.location_str
contract = self.active_contract()
delivery = contract.unfinished_delivery()
if delivery is None:
raise CommandError('no delivery')
resource = delivery['trade_symbol']
self.api.deliver(self.ship, resource, contract)
pprint(contract)
def do_ship(self, arg=''): def do_ship(self, arg=''):
if arg != '': if arg != '':
symbol = f'{self.agent.symbol}-{arg}' symbol = f'{self.agent.symbol}-{arg}'