More powerful recipe 'categories'
Posted: Thu May 25, 2017 1:03 am
Some mod created crafting devices want to handle a set of recipes related to but not the same as the recipes handled by another crafting device. Even in the built in sets of categories we see this sort of structure: "crafting", "advanced-crafting", crafting-with-fluid".
Productivity modules are meant to handle a subset of recipes that can be crafted, yet this winds up being stored on each module individually rather than being a property of the recipe.
Bob's electronics assemblers create the recipe categories 'electronics' and 'electronics-machine', meant to be a subset of recipes that can be crafted in an ordinarily assembler. This work-around however creates problems if multiple people want to do similar things.
The recipe prototype currently takes a single category string. I propose replacing it with a set of tags, and then machines and modules can operate on these tags using intersection, union, and negation operators.
"hand" would be a tag, indicating that the recipe can be done in hand. "assembler" would be a tag, indicating that the recipe can be done in an assembler. "fluid" would be a tag indicating that the recipe requires a fluid (and could be applied automatically). Then bob's assemblers would simply say "assembler UNION electronics" and the "electronics" tag would be added to rather than having to add a new crafting category to existing machines and then moving certain recipes into that category.
Alternatively, the tag system could be used and then crafting_categories/limitation could use a tag, dictionary or a function rather than having a built in union/intersection/negation system.
Productivity modules are meant to handle a subset of recipes that can be crafted, yet this winds up being stored on each module individually rather than being a property of the recipe.
Bob's electronics assemblers create the recipe categories 'electronics' and 'electronics-machine', meant to be a subset of recipes that can be crafted in an ordinarily assembler. This work-around however creates problems if multiple people want to do similar things.
The recipe prototype currently takes a single category string. I propose replacing it with a set of tags, and then machines and modules can operate on these tags using intersection, union, and negation operators.
"hand" would be a tag, indicating that the recipe can be done in hand. "assembler" would be a tag, indicating that the recipe can be done in an assembler. "fluid" would be a tag indicating that the recipe requires a fluid (and could be applied automatically). Then bob's assemblers would simply say "assembler UNION electronics" and the "electronics" tag would be added to rather than having to add a new crafting category to existing machines and then moving certain recipes into that category.
Alternatively, the tag system could be used and then crafting_categories/limitation could use a tag, dictionary or a function rather than having a built in union/intersection/negation system.