Factorio: more condensed raw_recipes creation

(by black-sliver)
This commit is contained in:
Fabian Dill 2022-06-19 21:52:42 +02:00 committed by Fabian Dill
parent 6d4c4295b3
commit a7e8c82633
1 changed files with 4 additions and 7 deletions
worlds/factorio

View File

@ -208,16 +208,13 @@ all_product_sources: Dict[str, Set[Recipe]] = {"character": set()}
raw_recipes = recipes_future.result()
del recipes_future
for resource_name, resource_data in resources_future.result().items():
raw_recipes[f"mining-{resource_name}"] = current_recipe = {
"ingredients": {},
"products": {},
raw_recipes[f"mining-{resource_name}"] = {
"ingredients": {resource_data["required_fluid"]: resource_data["fluid_amount"]}
if "required_fluid" in resource_data else {},
"products": {data["name"]: data["amount"] for data in resource_data["products"].values()},
"energy": resource_data["mining_time"],
"category": resource_data["category"]
}
for name, data in resource_data["products"].items():
current_recipe["products"].update({data["name"]: data["amount"]})
if "required_fluid" in resource_data:
current_recipe["ingredients"] = {resource_data["required_fluid"]: resource_data["fluid_amount"]}
del resources_future
for recipe_name, recipe_data in raw_recipes.items():