2023-06-22 17:57:07 +00:00
|
|
|
from nullptr.missions.survey import SurveyMission
|
|
|
|
from nullptr.missions.mine import MiningMission
|
|
|
|
from nullptr.missions.haul import HaulMission
|
|
|
|
from nullptr.missions.travel import TravelMission
|
2023-06-25 15:35:06 +00:00
|
|
|
from nullptr.missions.probe import ProbeMission
|
2023-06-22 17:57:07 +00:00
|
|
|
|
2023-06-25 15:35:06 +00:00
|
|
|
def get_mission_class( mtype):
|
2023-06-22 17:57:07 +00:00
|
|
|
types = {
|
|
|
|
'survey': SurveyMission,
|
|
|
|
'mine': MiningMission,
|
|
|
|
'haul': HaulMission,
|
2023-06-25 15:35:06 +00:00
|
|
|
'travel': TravelMission,
|
|
|
|
'probe': ProbeMission
|
2023-06-22 17:57:07 +00:00
|
|
|
}
|
|
|
|
if mtype not in types:
|
2023-06-25 15:35:06 +00:00
|
|
|
raise ValueError(f'invalid mission type {mtype}')
|
|
|
|
return types[mtype]
|
|
|
|
|
|
|
|
def create_mission(mtype, ship, store, api):
|
|
|
|
typ = get_mission_class(mtype)
|
|
|
|
m = typ(ship, store, api)
|
2023-06-22 17:57:07 +00:00
|
|
|
return m
|
2023-06-25 15:35:06 +00:00
|
|
|
|