Skip to content

Commit 0df0955

Browse files
Core: check if a location is an event before excluding it (ArchipelagoMW#2653)
* Core: check if a location is an event before excluding it * log a warning * put the warning in the right spot
1 parent bf17582 commit 0df0955

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

worlds/generic/Rules.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import collections
2+
import logging
23
import typing
34

45
from BaseClasses import LocationProgressType, MultiWorld, Location, Region, Entrance
@@ -81,15 +82,18 @@ def forbid(sender: int, receiver: int, items: typing.Set[str]):
8182
i.name not in sending_blockers[i.player] and old_rule(i)
8283

8384

84-
def exclusion_rules(world: MultiWorld, player: int, exclude_locations: typing.Set[str]) -> None:
85+
def exclusion_rules(multiworld: MultiWorld, player: int, exclude_locations: typing.Set[str]) -> None:
8586
for loc_name in exclude_locations:
8687
try:
87-
location = world.get_location(loc_name, player)
88+
location = multiworld.get_location(loc_name, player)
8889
except KeyError as e: # failed to find the given location. Check if it's a legitimate location
89-
if loc_name not in world.worlds[player].location_name_to_id:
90+
if loc_name not in multiworld.worlds[player].location_name_to_id:
9091
raise Exception(f"Unable to exclude location {loc_name} in player {player}'s world.") from e
9192
else:
92-
location.progress_type = LocationProgressType.EXCLUDED
93+
if not location.event:
94+
location.progress_type = LocationProgressType.EXCLUDED
95+
else:
96+
logging.warning(f"Unable to exclude location {loc_name} in player {player}'s world.")
9397

9498

9599
def set_rule(spot: typing.Union["BaseClasses.Location", "BaseClasses.Entrance"], rule: CollectionRule):

0 commit comments

Comments
 (0)