34 lines
847 B
Python
34 lines
847 B
Python
from connector import get_connexion
|
|
|
|
|
|
def get_contract(title):
|
|
for c in get_connexion().space_center.contract_manager.active_contracts:
|
|
if c.title == title:
|
|
return c
|
|
|
|
raise LookupError('Contract "{}" not found'.format(title))
|
|
|
|
|
|
def get_vessel(name):
|
|
for v in get_connexion().space_center.vessels:
|
|
if v.name == name:
|
|
return v
|
|
|
|
raise LookupError("Vessel {} not found".format(name))
|
|
|
|
|
|
def get_rescuee_vessel(rescuee_name):
|
|
for v in get_connexion().space_center.vessels:
|
|
if rescuee_name in v.name:
|
|
return v
|
|
|
|
raise LookupError("Rescuee {} vessel not found".format(rescuee_name))
|
|
|
|
|
|
def get_body(name):
|
|
bodies = get_connexion().space_center.bodies
|
|
if name in bodies:
|
|
return bodies[name]
|
|
|
|
raise LookupError("Celestial body {} not found".format(name))
|