Fix critical error when moving between rooms.

This commit is contained in:
Joe S 2021-02-26 21:59:58 -05:00
parent 493b663b4e
commit e844ac23f4
3 changed files with 8 additions and 5 deletions

View File

@ -44,15 +44,14 @@ class Handler(npyscreen.ButtonPress):
# Localize the player # Localize the player
player = self.parent.parentApp.player player = self.parent.parentApp.player
roomlocation = player.playerData['player']['location'] + '.yaml' roomlocation = player.playerData['player']['location']
try: try:
room = parse(self.parent.parentApp.mainPath / 'gamedata/world' / roomlocation)['room'] room = parse(self.parent.parentApp.mainPath / 'gamedata/world' / roomlocation)['room']
# If the file could not be found # If the file could not be found
except FileNotFoundError: except FileNotFoundError:
# Log a critical error! # Log a critical error!
self.parent.parentApp.log.critical( self.parent.parentApp.log.critical('Handler could not load the current room! Is the player file corrupt or was there a typo? Path was {0}'.format(
'Handler could not load the current room! Is the player file corrupt or was there a typo? Path was {0}'.format(
self.parent.parentApp.mainPath / 'gamedata/world' / roomlocation)) self.parent.parentApp.mainPath / 'gamedata/world' / roomlocation))
# Put the player in a blank room i forgot to finish # Put the player in a blank room i forgot to finish
room = parse(self.parent.parentApp.mainPath / 'gamedata/world/blank_room.yaml') room = parse(self.parent.parentApp.mainPath / 'gamedata/world/blank_room.yaml')

View File

@ -7,5 +7,9 @@ room:
inspect: "Its still a closet door." inspect: "Its still a closet door."
open: "You cant open this door." open: "You cant open this door."
desk: desk:
look_at: "Its your receptionists desks, she's not sitting behind it." look_at: "Its your receptionists desk, she's not sitting behind it."
inspect: "She's still not there." inspect: "She's still not there."
door:
leads_to: office.yaml
look_at: "Its a door, it leads to your office. You should try to |OPEN| it."
inspect: "Its ornate but basic, this side of the door has your name on a plaque."

View File

@ -1,4 +1,4 @@
player: player:
name: 'Default' name: 'Default'
location: 'office' location: 'office.yaml'
inventory: ['test', 'test2'] inventory: ['test', 'test2']