def send_module(self, module=None, station="", extras=[],cost=200000000): if not self.scenario: return None if not station and self.scenario.stations: station = self.scenario.focus_station.id modDrag = DragonCargoModule() modDrag.location = np.array([ -100000 , 0 , 0 ]) newStation = Station(modDrag,'AddStation', self.logger) self.counter += 1 if module: module.location = np.array([ -100000 , 0 , 0 ]) newStation.dock_module(None,None,module, None, True) vessel = VesselPlan( station = newStation, target_station_id = station ) self.vessel_queue.append( vessel ) self.player_nasa_funds -= cost if module is not None: self.last_module = self.time_elapsed self.module_available = False else: self.last_resupply = self.time_elapsed self.resupply_available = False return newStation
def __init__(self,name='DEFAULT',logger=util.generic_logger): if name=='BERTNERNIE': modA = DestinyModule() modDock = UnityModule() modB = ZvezdaModule() modDrag = DragonCargoModule() modDrag.setup_simple_resupply() self.station = Station(modDock, "BnE Station", logger) self.station.berth_module(None,None,modB, None, True) self.station.berth_module(None,None,modA, None, True) self.station.berth_module(None,None,modDrag, None, True) '''rob = Robot('Robby') rob.station = station station.actors[rob.id]=rob rob.location = modB.node('hall0') rob.xyz = modB.location''' ernie = Human('Ernest',station=self.station,logger=self.station.logger) self.station.actors[ernie.id] = ernie ernie.location = modA.node('hall0') ernie.xyz = modA.location bert = Human('Bertholomew',station=self.station,logger=self.station.logger) self.station.actors[bert.id] = bert bert.location = modB.node('hall0') bert.xyz = modB.location ernie.needs['WasteCapacityLiquid'].amt=0.1 ernie.needs['Food'].set_amt_to_severity('HIGH') ernie.nutrition = [0.5, 0.5, 0.5, 0.5, 0.5] #modB.equipment['Electrolyzer'][3].broken=True elif name == 'DOCKINGTEST': '''Ernie, in a station badly needing resupply, gets a Dragon shipment. He installs a docking computer, docks Dragon, unloads food, loads waste, undocks Dragon, Dragon reenters''' modB = ZvezdaModule() self.station = Station(modB, "Docker Station", logger) modDrag = DragonCargoModule() modDrag.setup_simple_resupply() #TODO: position Dragon on "docking" approach, add docking task self.station.begin_docking_approach(modDrag) print modDrag.location, modDrag.orientation ernie = Human('Ernest',station=self.station,logger=self.station.logger) self.station.actors[ernie.id] = ernie ernie.location = modB.node('hall0') ernie.xyz = modB.location else: #'DEFAULT' modDock = UnityModule() self.station = Station(modDock, 'NewbieStation',logger)
logger.setLevel(logging.DEBUG) #DEBUG INFO WARNING ERROR CRITICAL #create console handler and set level to debug ch = logging.StreamHandler() ch.setLevel(logging.INFO) #create formatter formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") #add formatter to ch ch.setFormatter(formatter) #add ch to logger logger.addHandler(ch) modA = DestinyModule() modDock = UnityModule() modB = ZvezdaModule() modDrag = DragonCargoModule() modDrag.setup_simple_resupply() station = Station(modDock, 'NewbieStation', logger) station.berth_module(modDock,'CBM0',modA, None, True) station.berth_module(modDock,'CBM3',modB, None, True) station.berth_module(modA,None,modDrag, None, True) '''rob = Robot('Robby') rob.station = station station.actors[rob.id]=rob rob.location = modB.node('hall0') rob.xyz = modB.location''' ernie= Human('Bela Lugosi',station=station,logger=station.logger) station.actors[ernie.id] = ernie