Skip to content

Commit

Permalink
rule optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
nbrochu committed Dec 1, 2023
1 parent 2cb4741 commit 0946528
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions worlds/zork_grand_inquisitor/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,22 @@ def create_regions(self) -> None:
)
)

location.access_rule = eval(location_access_rule_for(location_enum_item, self.player))
location_access_rule: str = location_access_rule_for(location_enum_item, self.player)

if location_access_rule != "lambda state: True":
location.access_rule = eval(location_access_rule)

region.locations.append(location)

# Connections
region_exit: ZorkGrandInquisitorRegions
for region_exit in region_data[region_enum_item].exits or tuple():
region.connect(
region_mapping[region_exit],
rule=eval(entrance_access_rule_for(region_enum_item, region_exit, self.player)),
)
entrance_access_rule: str = entrance_access_rule_for(region_enum_item, region_exit, self.player)

if entrance_access_rule == "lambda state: True":
region.connect(region_mapping[region_exit])
else:
region.connect(region_mapping[region_exit], rule=eval(entrance_access_rule))

self.multiworld.regions.append(region)

Expand Down

0 comments on commit 0946528

Please sign in to comment.