auto: bis Keller

This commit is contained in:
Olli Graf
2022-05-13 07:51:28 +02:00
parent 3b29f77d57
commit 9230a418ae
3 changed files with 31 additions and 1 deletions

View File

@@ -143,13 +143,14 @@ class ActionModul:
item = self.world.findItemImInventarOderAktuellerRaum(parsedCommand.gegenstand) item = self.world.findItemImInventarOderAktuellerRaum(parsedCommand.gegenstand)
if item != None: if item != None:
if item.id == '4': if item.id == self.world.RAUM_SCHLAFZIMMER:
glas = self.world.findRaumItemById(self.world.ITEM_GLAS) glas = self.world.findRaumItemById(self.world.ITEM_GLAS)
logging.debug(f'mache Gegenstand {glas.name} sichtbar') logging.debug(f'mache Gegenstand {glas.name} sichtbar')
glas.sichtbar = True glas.sichtbar = True
elif item.id == self.world.ITEM_BETT: elif item.id == self.world.ITEM_BETT:
# Falltür sichtbar machen # Falltür sichtbar machen
self.world.aktuellerRaum.ausgaenge[self.world.RUNTER] = self.world.RAUM_KELLER self.world.aktuellerRaum.ausgaenge[self.world.RUNTER] = self.world.RAUM_KELLER
logging.debug('untersuche(): Keller ist jetzt zugänglich')
self.setFehler('Im Boden unter dem Bett findest du eine Falltür, die nach unten führt.') self.setFehler('Im Boden unter dem Bett findest du eine Falltür, die nach unten führt.')
elif item.id == self.world.ITEM_NACHTSCHRANK: elif item.id == self.world.ITEM_NACHTSCHRANK:
self.setFehler('In der Schublade findest du einen Schlüssel') self.setFehler('In der Schublade findest du einen Schlüssel')

View File

@@ -9,13 +9,39 @@ class TestModule:
self.world = world self.world = world
self.actionmodul = ActionModul.ActionModul(world) self.actionmodul = ActionModul.ActionModul(world)
def debug(self,msg):
logging.debug(f'AUTO: {msg}')
def testOeffneTruhe(self): def testOeffneTruhe(self):
pcmd = self.world.parseInput('nimm Truhe') pcmd = self.world.parseInput('nimm Truhe')
#Auf den Dachboden
self.actionmodul.rauf() self.actionmodul.rauf()
self.actionmodul.nimm(pcmd) self.actionmodul.nimm(pcmd)
#Zurück ins Wohnzimmer
self.actionmodul.runter() self.actionmodul.runter()
#In den Flur
self.actionmodul.sued() self.actionmodul.sued()
# Ins Schlafzimmer
self.actionmodul.west()
self.debug(f'aktueller Raum: {self.world.aktuellerRaum.name}')
self.debug(f'Ausgänge: {self.world.aktuellerRaum.ausgaenge}')
pcmd = self.world.parseInput('untersuche Bett')
self.actionmodul.untersuche(pcmd)
self.debug(f'Ausgänge: {self.world.aktuellerRaum.ausgaenge}')
# In den Keller
self.actionmodul.runter()
pcmd = self.world.parseInput('untersuche Keller')
self.actionmodul.untersuche(pcmd)
pcmd = self.world.parseInput('nimm Schlüssel')
self.actionmodul.nimm(pcmd)
pcmd = self.world.parseInput('öffne Truhe')

View File

@@ -160,11 +160,14 @@ class World:
def parseInput(self,input): def parseInput(self,input):
logging.debug(f'parseInput() {input}')
words = input.split(' ') words = input.split(' ')
parsedCommand = ParsedCommand.ParsedCommand() parsedCommand = ParsedCommand.ParsedCommand()
words = self.removeSortouts(words,parsedCommand) words = self.removeSortouts(words,parsedCommand)
befehlid = self.ermittleBefehlId(words[0]) befehlid = self.ermittleBefehlId(words[0])
logging.debug(f'parseInput() befehlid {befehlid}')
if befehlid != None: if befehlid != None:
befehl = self.befehle[befehlid] befehl = self.befehle[befehlid]
parsedCommand.commandid = befehl.id parsedCommand.commandid = befehl.id