def __init__(self,xPosition=0,yPosition=1,offsetX=4,offsetY=0,desiredPosition=None): roomLayout = """ X#XX$XXX#X X#Pv vID#X X#......#X X .@@ . X X .HHHH. X X ...... X XFFFFFFFFX XOOOOOOOOX X######### XXXXXXXXXX """ super().__init__(roomLayout,xPosition,yPosition,offsetX,offsetY,desiredPosition) self.name = "Boilerroom" self.lever1 = items.Lever(1,5,"engine control") self.lever2 = items.Lever(8,5,"boarding alarm") coalPile1 = items.Pile(8,3,"coal Pile1",items.Coal) coalPile2 = items.Pile(8,4,"coal Pile2",items.Coal) coalPile3 = items.Pile(1,3,"coal Pile1",items.Coal) coalPile4 = items.Pile(1,4,"coal Pile2",items.Coal) self.addItems([self.lever1,self.lever2,coalPile1,coalPile2,coalPile3,coalPile4]) self.furnaceQuest = None
def __init__(self,xPosition,yPosition,offsetX,offsetY,desiredPosition=None): self.roomLayout = """ XXXXXXXX Xö vX XÖ ... $ XÖ . .vX XÖ . .@X XÖ . . X XÖ . . X XÖ . . X XÖ ... X XÖ X XXXXXXXX """ super().__init__(self.roomLayout,xPosition,yPosition,offsetX,offsetY,desiredPosition) self.name = "WakeUpRoom" self.lever1 = items.Lever(3,1,"engine control") self.objectDispenser = items.OjectDispenser(4,1) self.gooDispenser = items.GooDispenser(5,9) self.furnace = items.Furnace(4,9) self.pile = items.Pile(6,9) def activateDispenser(dispenser): self.objectDispenser.dispenseObject() self.lever1.activateAction = activateDispenser self.addItems([self.lever1,self.gooDispenser,self.objectDispenser,self.furnace,self.pile])
def __init__(self,xPosition,yPosition,offsetX,offsetY,desiredPosition=None): self.roomLayout = """ XXXXXXXXXX X @@ X X ...... X X . . X X . . X $ . . X X . . X X ...... X X X X########X XXXXXXXXXX XOOOOOOOOX XFFFFFFFFX XXXXXXXXXX """ super().__init__(self.roomLayout,xPosition,yPosition,offsetX,offsetY,desiredPosition) bean = items.MarkerBean(1,2) beanPile = items.Pile(1,1,"markerPile",items.MarkerBean) self.addItems([bean,beanPile]) self.name = "Lab"
def __init__(self,xPosition=0,yPosition=1,offsetX=4,offsetY=0,desiredPosition=None): self.roomMeta = """ """ roomLayout = """ XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXXXXXXXXX XXX↓X↓↓X↓X X #8## #X X #8## #X X #8##8#X X # ## #X X # ##8#X X #8## #X X #8## #X X #8## #X XXX↓X↓↓↓↓X XXXXXXXXXX X X X X X 88##8 X X #8##8 X X 88##8 X X 8 X X X X X XXXXXXXXXX XXXXHXXXXX X@Iv vID#X X@ #X X@ 8#OF PX X@ ##OF PX XB 8#OF PX XB |DI PX XB #X XPPPPPID#X XXXXXXXXXX """ roomLayout = """ XXXX$XXXXX X@ v vID#X X@......#X [email protected]#O . X X@.##O . X XH.8#O . X XH.|DI . X XH......#X XXPPP ID#X XXXXXXXXXX """ super().__init__(roomLayout,xPosition,yPosition,offsetX,offsetY,desiredPosition=None) self.name = "Boilerroom" self.lever1 = items.Lever(3,6,"engine control") self.lever2 = items.Lever(1,2,"boarding alarm") coalPile1 = items.Pile(8,3,"coal Pile1",items.Coal) coalPile2 = items.Pile(8,4,"coal Pile2",items.Coal) coalPile3 = items.Pile(8,5,"coal Pile3",items.Coal) coalPile4 = items.Pile(8,6,"coal Pile4",items.Coal) self.furnace1 = items.Furnace(6,3,"Furnace") self.furnace2 = items.Furnace(6,4,"Furnace") self.furnace3 = items.Furnace(6,5,"Furnace") self.addItems([self.lever1,self.lever2,coalPile1,coalPile2,coalPile3,coalPile4,self.furnace]) quest0 = quests.ActivateQuest(self.lever1) quest1 = quests.MoveQuest(self,2,2) quest2 = quests.MoveQuest(self,2,7) quest3 = quests.MoveQuest(self,7,7) quest4 = quests.MoveQuest(self,7,2) quest0.followUp = quest1 quest1.followUp = quest2 quest2.followUp = quest3 quest3.followUp = quest4 quest4.followUp = quest1 npc = Character(staffCharacters[11],1,2,name="Erwin von Liebweg") self.addCharacter(npc,1,3) npc.room = self npc.assignQuest(quest0) #npc.automated = False lever2 = self.lever2 def lever2action(self): deactivateLeaverQuest = quests.ActivateQuest(lever2,desiredActive=False) npc.assignQuest(deactivateLeaverQuest,active=True) self.lever2.activateAction = lever2action
def __init__(self,layout,xPosition,yPosition,offsetX,offsetY,desiredPosition=None): self.desiredPosition = desiredPosition self.desiredSteamGeneration = None self.layout = layout self.hidden = True self.itemsOnFloor = [] self.characters = [] self.doors = [] self.xPosition = None self.yPosition = None self.name = "Room" self.open = False self.terrain = None self.shownQuestmarkerLastRender = False self.sizeX = None self.sizeY = None self.timeIndex = 0 self.delayedTicks = 0 self.events = [] self.floorDisplay = [displayChars.floor] self.lastMovementToken = None self.chainedTo = [] self.engineStrength = 0 self.boilers = [] self.furnaces = [] self.pipes = [] self.sprays = [] self.piles = [] self.steamGeneration = 0 self.firstOfficer = None self.secondOfficer = None self.offsetX = offsetX self.offsetY = offsetY self.xPosition = xPosition self.yPosition = yPosition self.lastRender = None self.isContainment = False self.id = "room_1_"+str(self.xPosition)+"_"+str(self.yPosition)+"_1" self.itemByCoordinates = {} self.walkingAccess = [] lineCounter = 0 itemsOnFloor = [] for line in self.layout[1:].split("\n"): rowCounter = 0 for char in line: if char in (" ","."): pass elif char in ("@",): if (not self.firstOfficer) or (not self.secondOfficer): if not self.firstOfficer: npc = characters.Character(displayChars.staffCharactersByLetter["e"],5,3,name="Eduart Eisenblatt") self.addCharacter(npc,rowCounter,lineCounter) npc.terrain = self.terrain self.firstOfficer = npc else: npc = characters.Character(displayChars.staffCharactersByLetter["s"],5,3,name="Siegfied Knobelbecher") self.addCharacter(npc,rowCounter,lineCounter) npc.terrain = self.terrain self.secondOfficer = npc elif char in ("X","&"): itemsOnFloor.append(items.Wall(rowCounter,lineCounter)) elif char == "$": door = items.Door(rowCounter,lineCounter) itemsOnFloor.append(door) self.walkingAccess.append((rowCounter,lineCounter)) self.doors.append(door) elif char == "P": item = items.Pile(rowCounter,lineCounter) itemsOnFloor.append(item) self.piles.append(item) elif char == "F": item = items.Furnace(rowCounter,lineCounter) itemsOnFloor.append(item) self.furnaces.append(item) elif char == "#": item = items.Pipe(rowCounter,lineCounter) itemsOnFloor.append(item) self.pipes.append(item) elif char == "D": itemsOnFloor.append(items.Display(rowCounter,lineCounter)) elif char == "v": #to be bin itemsOnFloor.append(items.Item(displayChars.binStorage,rowCounter,lineCounter)) elif char == "O": #to be pressure Tank item = items.Boiler(rowCounter,lineCounter) itemsOnFloor.append(item) self.boilers.append(item) #itemsOnFloor.append(items.Item(displayChars.boiler_active,rowCounter,lineCounter)) elif char == "8": #to be chains itemsOnFloor.append(items.Item(displayChars.chains,rowCounter,lineCounter)) elif char == "I": #to be commlink itemsOnFloor.append(items.Commlink(rowCounter,lineCounter)) elif char == "H": itemsOnFloor.append(items.Hutch(rowCounter,lineCounter)) elif char == "'": itemsOnFloor.append(items.Hutch(rowCounter,lineCounter,activated=True)) elif char == "o": #to be grid itemsOnFloor.append(items.Item(displayChars.grid,rowCounter,lineCounter)) elif char == "a": #to be acid item = items.Item(displayChars.acids[((2*rowCounter)+lineCounter)%5],rowCounter,lineCounter) item.walkable = True itemsOnFloor.append(item) elif char == "b": #to be foodstuffs itemsOnFloor.append(items.Item(displayChars.foodStuffs[((2*rowCounter)+lineCounter)%6],rowCounter,lineCounter)) elif char == "m": itemsOnFloor.append(items.Item(displayChars.machineries[((2*rowCounter)+lineCounter)%5],rowCounter,lineCounter)) elif char == "h": itemsOnFloor.append(items.Item(displayChars.hub,rowCounter,lineCounter)) elif char == "i": itemsOnFloor.append(items.Item(displayChars.ramp,rowCounter,lineCounter)) elif char == "p": itemsOnFloor.append(items.Item(displayChars.noClue,rowCounter,lineCounter)) elif char == "q": item = items.Item(displayChars.pipe_lr,rowCounter,lineCounter) item.walkable = True itemsOnFloor.append(item) elif char == "r": item = items.Item(displayChars.pipe_lrd,rowCounter,lineCounter) item.walkable = True itemsOnFloor.append(item) elif char == "s": item = items.Item(displayChars.pipe_ld,rowCounter,lineCounter) item.walkable = True itemsOnFloor.append(item) elif char == "t": item = items.Item(displayChars.pipe_lu,rowCounter,lineCounter) item.walkable = True itemsOnFloor.append(item) elif char == "u": item = items.Item(displayChars.pipe_ru,rowCounter,lineCounter) item.walkable = True itemsOnFloor.append(item) elif char == "w": item = items.Spray(rowCounter,lineCounter,direction="right") itemsOnFloor.append(item) self.sprays.append(item) elif char == "x": item = items.Spray(rowCounter,lineCounter,direction="left") itemsOnFloor.append(item) self.sprays.append(item) elif char == "y": itemsOnFloor.append(items.Item(displayChars.outlet,rowCounter,lineCounter)) elif char == "j": itemsOnFloor.append(items.Item(displayChars.vatSnake,rowCounter,lineCounter)) elif char == "c": item = items.Corpse(rowCounter,lineCounter) itemsOnFloor.append(item) elif char == "C": item = items.UnconciousBody(rowCounter,lineCounter) itemsOnFloor.append(item) elif char == "z": item = items.Item(displayChars.pipe_ud,rowCounter,lineCounter) item.walkable = True itemsOnFloor.append(item) elif char == "Ö": item = items.GrowthTank(rowCounter,lineCounter,filled=True) itemsOnFloor.append(item) elif char == "ö": item = items.GrowthTank(rowCounter,lineCounter,filled=False) itemsOnFloor.append(item) elif char == "B": item = items.Item(displayChars.barricade,rowCounter,lineCounter) item.walkable = True itemsOnFloor.append(item) else: itemsOnFloor.append(items.Item(displayChars.randomStuff2[((2*rowCounter)+lineCounter)%10],rowCounter,lineCounter)) rowCounter += 1 self.sizeX = rowCounter lineCounter += 1 self.sizeY = lineCounter-1 rawWalkingPath = [] lineCounter = 0 for line in self.layout[1:].split("\n"): rowCounter = 0 for char in line: if char == ".": rawWalkingPath.append((rowCounter,lineCounter)) rowCounter += 1 lineCounter += 1 self.walkingPath = [] startWayPoint = rawWalkingPath[0] endWayPoint = rawWalkingPath[0] self.walkingPath.append(rawWalkingPath[0]) rawWalkingPath.remove(rawWalkingPath[0]) while (1==1): endWayPoint = self.walkingPath[-1] east = (endWayPoint[0]+1,endWayPoint[1]) west = (endWayPoint[0]-1,endWayPoint[1]) south = (endWayPoint[0],endWayPoint[1]+1) north = (endWayPoint[0],endWayPoint[1]-1) if east in rawWalkingPath: self.walkingPath.append(east) rawWalkingPath.remove(east) elif west in rawWalkingPath: self.walkingPath.append(west) rawWalkingPath.remove(west) elif south in rawWalkingPath: self.walkingPath.append(south) rawWalkingPath.remove(south) elif north in rawWalkingPath: self.walkingPath.append(north) rawWalkingPath.remove(north) else: break self.addItems(itemsOnFloor)
def __init__(self, layout, detailedLayout): self.itemsOnFloor = [] self.characters = [] self.walkingPath = [] self.rooms = [] self.itemByCoordinates = {} self.roomByCoordinates = {} mapItems = [] self.detailedLayout = detailedLayout lineCounter = 0 for layoutline in self.detailedLayout.split("\n")[1:]: rowCounter = 0 for char in layoutline: if char in (" ", ".", ",", "@"): pass elif char == "X": mapItems.append(items.Wall(rowCounter, lineCounter)) elif char == "#": mapItems.append(items.Pipe(rowCounter, lineCounter)) elif char == "R": pass elif char == "O": mapItems.append( items.Item(displayChars.clamp_active, rowCounter, lineCounter)) elif char == "0": mapItems.append( items.Item(displayChars.clamp_inactive, rowCounter, lineCounter)) elif char == "8": mapItems.append(items.Chain(rowCounter, lineCounter)) elif char == "C": mapItems.append(items.Winch(rowCounter, lineCounter)) elif char == "P": mapItems.append(items.Pile(rowCounter, lineCounter)) else: mapItems.append( items.Item( displayChars.randomStuff2[( (2 * rowCounter) + lineCounter) % 10], rowCounter, lineCounter)) rowCounter += 1 lineCounter += 1 self.addItems(mapItems) roomsOnMap = [] self.tutorialVat = None self.tutorialVatProcessing = None self.tutorialMachineRoom = None lineCounter = 0 for layoutline in layout.split("\n")[1:]: rowCounter = 0 meta = False for char in layoutline: if meta: meta = False continue else: meta = True if char in (" ", ".", ",", "@"): pass elif char == "X": roomsOnMap.append( rooms.MechArmor(rowCounter, lineCounter, 0, 0)) elif char == "V": room = rooms.Vat2(rowCounter, lineCounter, 2, 2) if not self.tutorialVat: self.tutorialVat = room roomsOnMap.append(room) elif char == "v": room = rooms.Vat1(rowCounter, lineCounter, 2, 2) if not self.tutorialVatProcessing: self.tutorialVatProcessing = room roomsOnMap.append(room) elif char == "Q": roomsOnMap.append( rooms.InfanteryQuarters(rowCounter, lineCounter, 1, 2)) elif char == "r": roomsOnMap.append( rooms.Room1(rowCounter, lineCounter, 1, 2)) elif char == "M": room = rooms.TutorialMachineRoom(rowCounter, lineCounter, 4, 1) if not self.tutorialMachineRoom: self.tutorialMachineRoom = room roomsOnMap.append(room) elif char == "C": roomsOnMap.append( rooms.CargoRoom(rowCounter, lineCounter, 3, 0)) elif char == "?": roomsOnMap.append( rooms.CpuWasterRoom(rowCounter, lineCounter, 2, 2)) elif char == "t": miniMech = rooms.MiniMech(rowCounter, lineCounter, 2, 2) roomsOnMap.append(miniMech) else: pass rowCounter += 1 lineCounter += 1 self.addRooms(roomsOnMap) rawWalkingPath = [] lineCounter = 0 for line in self.detailedLayout[1:].split("\n"): rowCounter = 0 for char in line: if char == ".": rawWalkingPath.append((rowCounter, lineCounter)) rowCounter += 1 lineCounter += 1 startWayPoint = rawWalkingPath[0] endWayPoint = rawWalkingPath[0] self.walkingPath.append(rawWalkingPath[0]) rawWalkingPath.remove(rawWalkingPath[0]) while (1 == 1): endWayPoint = self.walkingPath[-1] east = (endWayPoint[0] + 1, endWayPoint[1]) west = (endWayPoint[0] - 1, endWayPoint[1]) south = (endWayPoint[0], endWayPoint[1] + 1) north = (endWayPoint[0], endWayPoint[1] - 1) if east in rawWalkingPath: self.walkingPath.append(east) rawWalkingPath.remove(east) elif west in rawWalkingPath: self.walkingPath.append(west) rawWalkingPath.remove(west) elif south in rawWalkingPath: self.walkingPath.append(south) rawWalkingPath.remove(south) elif north in rawWalkingPath: self.walkingPath.append(north) rawWalkingPath.remove(north) else: break