Handler can now log critical room load errors,
This commit is contained in:
parent
56f3fb2fee
commit
773d48b732
|
@ -43,7 +43,15 @@ class Handler(npyscreen.ButtonPress):
|
|||
# Localize the player
|
||||
player = self.parent.parentApp.player
|
||||
roomlocation = player.playerData['player']['location'] + '.yaml'
|
||||
room = parse(self.parent.parentApp.mainPath / 'gamedata/world' / roomlocation)
|
||||
try:
|
||||
room = parse(self.parent.parentApp.mainPath / 'gamedata/world' / roomlocation)
|
||||
|
||||
# If the file could not be found
|
||||
except FileNotFoundError:
|
||||
# Log a critical error!
|
||||
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(self.parent.parentApp.mainPath / 'gamedata/world' / roomlocation))
|
||||
# Put the player in a blank room i forgot to finish
|
||||
room = parse(self.parent.parentApp.mainPath / 'gamedata/world/blank_room.yaml')
|
||||
self.parent.update_log('You are in {0}.'.format(room))
|
||||
|
||||
# Log the command that we parsed
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
blank_room:
|
||||
grid: [-1, -1]
|
||||
upon_enter: "You're in a blank room. It looks unfinished, like joe forgot to put something here"
|
||||
look_around: "There is nothing to look at, you should tell joe you're here."
|
|
@ -1,4 +1,4 @@
|
|||
player:
|
||||
name: 'Default'
|
||||
location: 'office'
|
||||
location: 'officee'
|
||||
inventory: ['test', 'test2']
|
Loading…
Reference in New Issue