83e4eec5 by Barry

Bug fixes for exits

1 parent eded01f8
...@@ -85,8 +85,9 @@ class CommandHandler(object): ...@@ -85,8 +85,9 @@ class CommandHandler(object):
85 # store the exit name 85 # store the exit name
86 ex = self.params.lower().strip() 86 ex = self.params.lower().strip()
87 87
88 exits = roomloader.get_exits(self.players[self.id]["room"])
88 # if the specified exit is found in the room's exits list 89 # if the specified exit is found in the room's exits list
89 if ex in roomloader.get_exits(self.players[self.id]["room"]): 90 if ex in exits:
90 # go through all the players in the game 91 # go through all the players in the game
91 for pid, pl in self.players.items(): 92 for pid, pl in self.players.items():
92 # if player is in the same room and isn't the player 93 # if player is in the same room and isn't the player
...@@ -100,11 +101,11 @@ class CommandHandler(object): ...@@ -100,11 +101,11 @@ class CommandHandler(object):
100 101
101 # update the player's current room to the one the exit leads to 102 # update the player's current room to the one the exit leads to
102 103
103 if roomloader.get_title(ex) == None: 104 if roomloader.get_title(exits[ex]) == None:
104 self.mud.send_message(self.id, "An invisible force prevents you from going in that direction.") 105 self.mud.send_message(self.id, "An invisible force prevents you from going in that direction.")
105 return True 106 return True
106 else: 107 else:
107 self.players[self.id]["room"] = roomloader.get_exits(self.players[self.id]["room"])[ex] 108 self.players[self.id]["room"] = exits[ex]
108 self.room = ex 109 self.room = ex
109 110
110 # go through all the players in the game 111 # go through all the players in the game
......
1 { 1 {
2 "title": "Tavern", 2 "title": "Tavern",
3 "description": "You're in a cozy tavern warmed by an open fire.", 3 "description": "You're in a cozy tavern warmed by an open fire.",
4 "exits": {"outside": "Outside", "behind bar": "Room001", "dark": "Dark"}, 4 "exits": {"outside": "Outside", "behind": "Room001", "dark": "Dark"},
5 "look_items": { 5 "look_items": {
6 "bar": "The bar is a long wooden plank thrown over roughly hewn barrels.", 6 "bar": "The bar is a long wooden plank thrown over roughly hewn barrels.",
7 "barrel,barrels": "The old barrels bands are thick with oxidation and stained with the purple of spilled wine.", 7 "barrel,barrels": "The old barrels bands are thick with oxidation and stained with the purple of spilled wine.",
......