Page 1 of 1

Determining the main_product of a recipe

Posted: Sat May 01, 2021 10:53 am
by Pi-C
Suppose there is a recipe with >2 results. It doesn't have recipe.subgroup, so recipe.main_product is requiresd. (To keep this simple, let's ignore difficulties -- I know they can exist, but they are not relevant to my question.)

Replacing a result x for result y is easy:

Code: Select all

if recipe.results["x"].name == recipe.main_product then 
	recipe.main_product = recipe.results["y"].name 
end
But what if I remove result x and this was the main_product? Setting a new main_product is easy when I work on a single recipe -- but not if I want to loop over all available recipes. Sure, I could use the first result, or the one with the highest amount, or the only one without probability, but all of that seems to be only half-baked. Did anybody else already think about this?