From 4a27fae1abc6ab0c6822622cd4c8a03b984a138d Mon Sep 17 00:00:00 2001 From: CaitSith2 Date: Wed, 20 Sep 2023 02:22:01 -0700 Subject: [PATCH] Core: Allow any valid priority location in yaml even when they are not used in a given game. (#2128) * Allow any valid priority location in yaml. For some games, the use location group name "Everywhere", results in the generator failing no matter what, as only a subset of the location names will actually be present. A good example of that is Zillion. It has 21 location names per room, of which, only at most 2 is ever used. Co-authored-by: Fabian Dill --- Main.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Main.py b/Main.py index ab3a8a66..48b37764 100644 --- a/Main.py +++ b/Main.py @@ -139,7 +139,13 @@ def main(args, seed=None, baked_server_options: Optional[Dict[str, object]] = No exclusion_rules(world, player, world.exclude_locations[player].value) world.priority_locations[player].value -= world.exclude_locations[player].value for location_name in world.priority_locations[player].value: - world.get_location(location_name, player).progress_type = LocationProgressType.PRIORITY + try: + location = world.get_location(location_name, player) + except KeyError as e: # failed to find the given location. Check if it's a legitimate location + if location_name not in world.worlds[player].location_name_to_id: + raise Exception(f"Unable to prioritize location {location_name} in player {player}'s world.") from e + else: + location.progress_type = LocationProgressType.PRIORITY # Set local and non-local item rules. if world.players > 1: