From cebd7fb54597e21310d41686ee0e8d21d0f85596 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Thu, 31 Mar 2022 03:30:06 +0200 Subject: [PATCH] Core: check for key-only once in sweep (#361) --- BaseClasses.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index 0797001d..cf0cf6d0 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -643,11 +643,10 @@ class CollectionState(): locations = self.world.get_filled_locations() new_locations = True # since the loop has a good chance to run more than once, only filter the events once - locations = {location for location in locations if location.event} + locations = {location for location in locations if location.event and + not key_only or getattr(location.item, "locked_dungeon_item", False)} while new_locations: - reachable_events = {location for location in locations if - (not key_only or getattr(location.item, "locked_dungeon_item", False)) - and location.can_reach(self)} + reachable_events = {location for location in locations if location.can_reach(self)} new_locations = reachable_events - self.events for event in new_locations: self.events.add(event)