Page 1 of 1

ItemIngredientPrototype/ItemProductPrototype.quality_offset

Posted: Wed Nov 20, 2024 3:49 am
by braxbro
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.