From e844ac23f4bfbda7663fb27b257c8b8b79290b95 Mon Sep 17 00:00:00 2001 From: Joe S <31870999+KenwoodFox@users.noreply.github.com> Date: Fri, 26 Feb 2021 21:59:58 -0500 Subject: [PATCH] Fix critical error when moving between rooms. --- Adventure Game/adventure_game/Handler.py | 5 ++--- Adventure Game/adventure_game/gamedata/world/hallway.yaml | 6 +++++- .../adventure_game/playerdata/defaults/default_player.yaml | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Adventure Game/adventure_game/Handler.py b/Adventure Game/adventure_game/Handler.py index 4c866e9..4e3b727 100644 --- a/Adventure Game/adventure_game/Handler.py +++ b/Adventure Game/adventure_game/Handler.py @@ -44,15 +44,14 @@ class Handler(npyscreen.ButtonPress): # Localize the player player = self.parent.parentApp.player - roomlocation = player.playerData['player']['location'] + '.yaml' + roomlocation = player.playerData['player']['location'] try: room = parse(self.parent.parentApp.mainPath / 'gamedata/world' / roomlocation)['room'] # 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.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') diff --git a/Adventure Game/adventure_game/gamedata/world/hallway.yaml b/Adventure Game/adventure_game/gamedata/world/hallway.yaml index e6dfa89..e6855db 100644 --- a/Adventure Game/adventure_game/gamedata/world/hallway.yaml +++ b/Adventure Game/adventure_game/gamedata/world/hallway.yaml @@ -7,5 +7,9 @@ room: inspect: "Its still a closet door." open: "You cant open this door." 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." + 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." \ No newline at end of file diff --git a/Adventure Game/adventure_game/playerdata/defaults/default_player.yaml b/Adventure Game/adventure_game/playerdata/defaults/default_player.yaml index 811f696..3c3c126 100644 --- a/Adventure Game/adventure_game/playerdata/defaults/default_player.yaml +++ b/Adventure Game/adventure_game/playerdata/defaults/default_player.yaml @@ -1,4 +1,4 @@ player: name: 'Default' - location: 'office' + location: 'office.yaml' inventory: ['test', 'test2'] \ No newline at end of file