I propose a (hopefully) relatively simple change to the ingredient/product prototypes to allow mods to more powerfully interact with quality in recipes: the ability to specify a quality offset (relative to the recipe's quality) for ingredients and products. Along with it, recipes would gain a maximum and minimum quality.
So, in hopefully more useful/concrete terms:
Item ingredients and item products gain a quality offset property. This quality offset is a 16 bit signed integer limited between -254 and +254. (since there are only 255 possible qualities.)
When a recipe is set, this offset is applied to the ingredient/product's quality to determine the final quality used in the recipe. (may be better to be an 8-bit unsigned int and a bool to invert?)
Recipes' minimum quality and maximum quality are, by default, set to the lowest quality defined minus the largest negative offset and the highest quality defined minus the largest positive offset, to prevent undefined qualities from being used; if an ingredient or product has an offset that makes it possible for the quality to be an out of bounds index, the game errors at the end of data stage.
Recipes with only fluid inputs would, by default, have their maximum quality set to their minimum quality instead.
For example, if I added a quality_offset of -1 to the iron plate ingredient of a green circuit, and a quality_offset of +1 to the copper wire, the recipe could only be executed at uncommon, rare, and epic quality levels, (and would require quality to be unlocked to be usable) and would output products as appropriate for those recipe qualities.
...This is probably a far-fetched suggestion, but I figured I would make it nonetheless.
ItemIngredientPrototype/ItemProductPrototype.quality_offset
Re: ItemIngredientPrototype/ItemProductPrototype.quality_offset
I can’t think of a way to refine this, but I still think it would be really cool to be able to hook quality with recipes. It would make both recipes and quality far more powerful tools for modders to experiment with.
-
- Fast Inserter
- Posts: 134
- Joined: Fri Sep 09, 2022 4:33 pm
- Contact:
Re: ItemIngredientPrototype/ItemProductPrototype.quality_offset
+1, this could introduce some powerful tools for mods with multiple quality tiers
If you need to reach me, message me on discord.
I make qol mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
If you have a mod idea, I can look into it.
I make qol mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
If you have a mod idea, I can look into it.