From feb2e0be0396b23102ef93ee070025d3d35bdebe Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Sat, 4 Dec 2021 10:54:11 +0100 Subject: [PATCH] Factorio: fix selecting wrong goal requirements due to convoluted if tree. --- worlds/factorio/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/worlds/factorio/__init__.py b/worlds/factorio/__init__.py index 3dc6e7d3..6166e73c 100644 --- a/worlds/factorio/__init__.py +++ b/worlds/factorio/__init__.py @@ -142,12 +142,14 @@ class Factorio(World): Rules.add_rule(location, lambda state, locations=locations: all(state.can_reach(loc) for loc in locations)) - silo_recipe = None if self.world.silo[self.player].value == Silo.option_spawn \ - else self.custom_recipes["rocket-silo"] if "rocket-silo" in self.custom_recipes \ + silo_recipe = None + if self.world.silo[self.player] == Silo.option_spawn: + silo_recipe = self.custom_recipes["rocket-silo"] if "rocket-silo" in self.custom_recipes \ else next(iter(all_product_sources.get("rocket-silo"))) part_recipe = self.custom_recipes["rocket-part"] - satellite_recipe = None if self.world.goal[self.player].value != Goal.option_rocket \ - else self.custom_recipes["satellite"] if "satellite" in self.custom_recipes \ + satellite_recipe = None + if self.world.goal[self.player] == Goal.option_satellite: + satellite_recipe = self.custom_recipes["satellite"] if "satellite" in self.custom_recipes \ else next(iter(all_product_sources.get("satellite"))) victory_tech_names = get_rocket_requirements(silo_recipe, part_recipe, satellite_recipe) world.get_location("Rocket Launch", player).access_rule = lambda state: all(state.has(technology, player)