0ptr/nullptr/missions/__init__.py

27 lines
720 B
Python
Raw Normal View History

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
2024-01-04 20:34:31 +00:00
from nullptr.missions.idle import IdleMission
def get_mission_class( mtype):
types = {
'survey': SurveyMission,
'mine': MiningMission,
'haul': HaulMission,
'travel': TravelMission,
2024-01-04 20:34:31 +00:00
'probe': ProbeMission,
'idle': IdleMission
}
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