Skip to content

Commit

Permalink
DS3: Make your own region cache (#4040)
Browse files Browse the repository at this point in the history
* Make your own region cache

* Using a string
  • Loading branch information
Exempt-Medic authored Oct 11, 2024
1 parent 6287bc2 commit 2751ccd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion worlds/dark_souls_3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ def __init__(self, multiworld: MultiWorld, player: int):
self.all_excluded_locations = set()

def generate_early(self) -> None:
self.created_regions = set()
self.all_excluded_locations.update(self.options.exclude_locations.value)

# Inform Universal Tracker where Yhorm is being randomized to.
Expand Down Expand Up @@ -294,6 +295,7 @@ def create_region(self, region_name, location_table) -> Region:
new_region.locations.append(new_location)

self.multiworld.regions.append(new_region)
self.created_regions.add(region_name)
return new_region

def create_items(self) -> None:
Expand Down Expand Up @@ -1305,7 +1307,7 @@ def _add_location_rule(self, location: Union[str, List[str]], rule: Union[Collec
def _add_entrance_rule(self, region: str, rule: Union[CollectionRule, str]) -> None:
"""Sets a rule for the entrance to the given region."""
assert region in location_tables
if not any(region == reg for reg in self.multiworld.regions.region_cache[self.player]): return
if region not in self.created_regions: return
if isinstance(rule, str):
if " -> " not in rule:
assert item_dictionary[rule].classification == ItemClassification.progression
Expand Down

0 comments on commit 2751ccd

Please sign in to comment.