Skip to content

Commit ec92831

Browse files
committed
2 parents 075ff3b + fcb6a5b commit ec92831

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

BaseClasses.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -651,34 +651,34 @@ def __init__(self, parent: MultiWorld):
651651

652652
def update_reachable_regions(self, player: int):
653653
self.stale[player] = False
654-
rrp = self.reachable_regions[player]
655-
bc = self.blocked_connections[player]
654+
reachable_regions = self.reachable_regions[player]
655+
blocked_connections = self.blocked_connections[player]
656656
queue = deque(self.blocked_connections[player])
657-
start = self.multiworld.get_region('Menu', player)
657+
start = self.multiworld.get_region("Menu", player)
658658

659659
# init on first call - this can't be done on construction since the regions don't exist yet
660-
if start not in rrp:
661-
rrp.add(start)
662-
bc.update(start.exits)
660+
if start not in reachable_regions:
661+
reachable_regions.add(start)
662+
blocked_connections.update(start.exits)
663663
queue.extend(start.exits)
664664

665665
# run BFS on all connections, and keep track of those blocked by missing items
666666
while queue:
667667
connection = queue.popleft()
668668
new_region = connection.connected_region
669-
if new_region in rrp:
670-
bc.remove(connection)
669+
if new_region in reachable_regions:
670+
blocked_connections.remove(connection)
671671
elif connection.can_reach(self):
672672
assert new_region, f"tried to search through an Entrance \"{connection}\" with no Region"
673-
rrp.add(new_region)
674-
bc.remove(connection)
675-
bc.update(new_region.exits)
673+
reachable_regions.add(new_region)
674+
blocked_connections.remove(connection)
675+
blocked_connections.update(new_region.exits)
676676
queue.extend(new_region.exits)
677677
self.path[new_region] = (new_region.name, self.path.get(connection, None))
678678

679679
# Retry connections if the new region can unblock them
680680
for new_entrance in self.multiworld.indirect_connections.get(new_region, set()):
681-
if new_entrance in bc and new_entrance not in queue:
681+
if new_entrance in blocked_connections and new_entrance not in queue:
682682
queue.append(new_entrance)
683683

684684
def copy(self) -> CollectionState:

worlds/factorio/Mod.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def flop_random(low, high, base=None):
177177
else:
178178
basepath = os.path.join(os.path.dirname(__file__), "data", "mod")
179179
for dirpath, dirnames, filenames in os.walk(basepath):
180-
base_arc_path = versioned_mod_name+"/"+os.path.relpath(dirpath, basepath)
180+
base_arc_path = (versioned_mod_name+"/"+os.path.relpath(dirpath, basepath)).rstrip("/.\\")
181181
for filename in filenames:
182182
mod.writing_tasks.append(lambda arcpath=base_arc_path+"/"+filename,
183183
file_path=os.path.join(dirpath, filename):

worlds/factorio/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ def set_rules(self):
246246
location.access_rule = lambda state, ingredient=ingredient, custom_recipe=custom_recipe: \
247247
(ingredient not in technology_table or state.has(ingredient, player)) and \
248248
all(state.has(technology.name, player) for sub_ingredient in custom_recipe.ingredients
249-
for technology in required_technologies[sub_ingredient])
249+
for technology in required_technologies[sub_ingredient]) and \
250+
all(state.has(technology.name, player) for technology in required_technologies[custom_recipe.crafting_machine])
250251
else:
251252
location.access_rule = lambda state, ingredient=ingredient: \
252253
all(state.has(technology.name, player) for technology in required_technologies[ingredient])

0 commit comments

Comments
 (0)