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.
This commit is contained in:
CaitSith2 2021-11-25 16:38:33 -08:00
parent 744b12345a
commit 1a63ed970a
1 changed files with 4 additions and 2 deletions

View File

@ -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