def load_rooms(self): with open("areas.json") as f: raw_file_data = json.load(f) room_dict = {} for room_data in raw_file_data: room = Room(room_data["name"], room_data["desc"]) room.interior = room_data["interior"] room.items = room_data["items"] room.entities = [ self.get_entity(entity) for entity in room_data["entities"] ] room.paths = room_data["exits"] room_dict[room_data["name"]] = room for room in room_dict.values(): for path, exit in room.paths.items(): room.paths[path] = room_dict[exit] self.rooms = tuple([room for room in room_dict.values()])