OOT: Fix incorrect region accessibility after update_reachable_regions() (#3712)

`CollectionState.update_reachable_regions()` un-stales the state for all
players, but when checking `OOTRegion.can_reach()`, it would only update
OOT's age region accessibility when the state was stale, so if the state
was always un-staled by `update_reachable_regions()` immediately before
`OOTRegion.can_reach()`, OOT's age region accessibility would never
update.

This patch fixes the issue by replacing use of CollectionState.stale
with a separate stale state dictionary specific to OOT that is only
un-staled by `_oot_update_age_reachable_regions()`.

OOT's collect() and remove() implementations have been updated to stale
the new OOT-specific state.
This commit is contained in:
Mysteryem
2024-09-17 14:11:35 +01:00
committed by GitHub
parent 96542fb2d8
commit dae3fe188d
3 changed files with 17 additions and 7 deletions

View File

@@ -1301,6 +1301,7 @@ class OOTWorld(World):
# the appropriate number of keys in the collection state when they are
# picked up.
def collect(self, state: CollectionState, item: OOTItem) -> bool:
state._oot_stale[self.player] = True
if item.advancement and item.special and item.special.get('alias', False):
alt_item_name, count = item.special.get('alias')
state.prog_items[self.player][alt_item_name] += count
@@ -1313,8 +1314,12 @@ class OOTWorld(World):
state.prog_items[self.player][alt_item_name] -= count
if state.prog_items[self.player][alt_item_name] < 1:
del (state.prog_items[self.player][alt_item_name])
state._oot_stale[self.player] = True
return True
return super().remove(state, item)
changed = super().remove(state, item)
if changed:
state._oot_stale[self.player] = True
return changed
# Helper functions
@@ -1389,7 +1394,7 @@ class OOTWorld(World):
# If free_scarecrow give Scarecrow Song
if self.free_scarecrow:
all_state.collect(self.create_item("Scarecrow Song"), prevent_sweep=True)
all_state.stale[self.player] = True
all_state._oot_stale[self.player] = True
return all_state