From 1a63ed970ad946e3f3bc6629a89e26250a38f645 Mon Sep 17 00:00:00 2001 From: CaitSith2 Date: Thu, 25 Nov 2021 16:38:33 -0800 Subject: [PATCH] fixed bug with not being able to use fluid barrels as last ingredient in balanced recipes. fluid barrels don't have a direct recipe name to ingredient name match, but instead recipe name is fill-ingredient. --- worlds/factorio/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/worlds/factorio/__init__.py b/worlds/factorio/__init__.py index e9174209..49c2e19d 100644 --- a/worlds/factorio/__init__.py +++ b/worlds/factorio/__init__.py @@ -246,10 +246,12 @@ class Factorio(World): pool = fallback_pool while remaining_num_ingredients > 0 and pool: ingredient = pool.pop() - if ingredient not in recipes: + ingredient_recipe = recipes.get(ingredient, None) + if not ingredient_recipe and ingredient.endswith("-barrel"): + ingredient_recipe = recipes.get(f"fill-{ingredient}", None) + if not ingredient_recipe: logging.warning(f"missing recipe for {ingredient}") continue - ingredient_recipe = recipes[ingredient] ingredient_raw = sum((count for ingredient, count in ingredient_recipe.base_cost.items())) ingredient_energy = ingredient_recipe.total_energy num_raw = remaining_raw / ingredient_raw / remaining_num_ingredients