24 lines
648 B
Python
24 lines
648 B
Python
from nullptr.missions.survey import SurveyMission
|
|
from nullptr.missions.mine import MiningMission
|
|
from nullptr.missions.haul import HaulMission
|
|
from nullptr.missions.travel import TravelMission
|
|
from nullptr.missions.probe import ProbeMission
|
|
|
|
def get_mission_class( mtype):
|
|
types = {
|
|
'survey': SurveyMission,
|
|
'mine': MiningMission,
|
|
'haul': HaulMission,
|
|
'travel': TravelMission,
|
|
'probe': ProbeMission
|
|
}
|
|
if mtype not in types:
|
|
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)
|
|
return m
|
|
|