0ptr/nullptr/missions/__init__.py
2024-01-20 20:33:50 +01:00

31 lines
879 B
Python

from nullptr.missions.survey import SurveyMission
from nullptr.missions.mine import MiningMission
from nullptr.missions.trade import TradeMission
from nullptr.missions.travel import TravelMission
from nullptr.missions.probe import ProbeMission
from nullptr.missions.idle import IdleMission
from nullptr.missions.siphon import SiphonMission
from nullptr.missions.haul import HaulMission
def get_mission_class( mtype):
types = {
'survey': SurveyMission,
'mine': MiningMission,
'trade': TradeMission,
'travel': TravelMission,
'probe': ProbeMission,
'idle': IdleMission,
'siphon': SiphonMission,
'haul': HaulMission,
}
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