Fixed sweep_for_events to better detect new locations

This commit is contained in:
codemann8
2022-11-01 15:26:11 -05:00
parent 3e17b61428
commit dadf88bcda

View File

@@ -1006,18 +1006,17 @@ class CollectionState(object):
if locations is None: if locations is None:
locations = self.world.get_filled_locations() locations = self.world.get_filled_locations()
new_locations = True new_locations = True
checked_locations = 0
while new_locations: while new_locations:
reachable_events = [location for location in locations if location.event and reachable_events = [location for location in locations if location.event and
(not key_only or (not self.world.keyshuffle[location.item.player] and location.item.smallkey) or (not self.world.bigkeyshuffle[location.item.player] and location.item.bigkey)) (not key_only or (not self.world.keyshuffle[location.item.player] and location.item.smallkey) or (not self.world.bigkeyshuffle[location.item.player] and location.item.bigkey))
and location.can_reach(self)] and location.can_reach(self)]
reachable_events = self._do_not_flood_the_keys(reachable_events) reachable_events = self._do_not_flood_the_keys(reachable_events)
new_locations = False
for event in reachable_events: for event in reachable_events:
if (event.name, event.player) not in self.events: if (event.name, event.player) not in self.events:
self.events.append((event.name, event.player)) self.events.append((event.name, event.player))
self.collect(event.item, True, event) self.collect(event.item, True, event)
new_locations = len(reachable_events) > checked_locations new_locations = True
checked_locations = len(reachable_events)
def can_reach_blue(self, region, player): def can_reach_blue(self, region, player):