recipes¶
- raw¶
A collection of all recipes indexed by their name.
- Example:
import json from draftsman.data import recipes print(json.dumps(recipes.raw["iron-plate"], indent=4)){ "type": "recipe", "ingredients": [ [ "iron-ore", 1 ] ], "result": "iron-plate", "energy_required": 3.2, "category": "smelting", "name": "iron-plate" }
- categories¶
A
dictof lists of valid recipes organized by their category. Exists as the format:See also
{ "category_name": [ "recipe_1", "recipe_2", # ... ], # ... }- Example:
import json from draftsman.data import recipes print(json.dumps(recipes.categories["centrifuging"], indent=4))[ "uranium-processing", "nuclear-fuel", "nuclear-fuel-reprocessing", "kovarex-enrichment-process" ]
- for_machine¶
A
dictof lists of valid recipes for eachAssemblingMachine. Exists as the format:{ "machine_name" : [ "recipe_1", "recipe_2", # ... ], # ... }- Example:
import json from draftsman.data import recipes print(json.dumps(recipes.for_machine["oil-refinery"], indent=4))[ "advanced-oil-processing", "coal-liquefaction", "basic-oil-processing" ]
-
get_recipe_ingredients(recipe_name: str, expensive: bool =
False)¶ Returns a
setof all item types thatrecipe_namerequires. Discards quantities.First attempts to get the
"ingredients"key from the recipe. If that fails, we then attempt to get the contents of the"normal"key from recipe (which is the list of ingredients under non-expensive map settings).- Parameters:
- Returns:
A
setof names of each Factorio item that the recipe requires.- Raises:
KeyError – If
recipe_nameis not a valid recipe.- Example:
print(recipes.get_recipe_ingredients("electronic-circuit")) # {'iron-plate', 'copper-cable'}