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 from nullptr.missions.sit import SitMission def get_mission_class( mtype): types = { 'survey': SurveyMission, 'mine': MiningMission, 'trade': TradeMission, 'travel': TravelMission, 'probe': ProbeMission, 'idle': IdleMission, 'siphon': SiphonMission, 'haul': HaulMission, 'sit': SitMission, } if mtype not in types: raise ValueError(f'invalid mission type {mtype}') return types[mtype] def create_mission(mtype, ship, c): typ = get_mission_class(mtype) m = typ(ship, c) return m