Page 1 of 1

Item subgroup vs recipe subgroup

Posted: Wed Sep 18, 2019 1:07 pm
by moon69
Hi All.

I'm creating a LUA code generator with a GUI to allow drag/drop rearranging of groups/subsgroups/icons in the players crafting window.

I want to make sure I understand the functionality around Item/fluid subgroups and Recipe subgroups - particularly how it affects when & where icons are shown in the players Crafting window.

Does the following sound correct?
  • Group icons (Logistics, Production etc.) appear only if its LuaGroup.subgroups is not empty.
  • Subgroups appear only if at least one item/fluid/recipe is assigned to it.
  • If a Recipe has a subgroup defined, it overrides the Item/Fluid subgroup - the Item/Fluid being selected by Recipe.result rather than Recipe.name. :?: What happens where there are mulitple products? (Recipe.results)
  • If multiple recipes have the same resulting product, each recipe without a subgroup will use the subgroup of that resulting product.
  • If no subgroup is assigned at all, the icon appears in the unsorted "?" group.
Cheers.

Re: Item subgroup vs recipe subgroup

Posted: Wed Sep 18, 2019 3:28 pm
by Optera
Recipe order has nothing to do with Item, Fluid, Virtual Signal order.

Recipe order is used when opening inventory or setting recipes in crafting machines.
Item, Fluid, Virtual Signal order is used when picking combinator signals.

For consistency recipe order matches item and fluid order, but it's not required.

Edit:
I'm not 100% sure if setting requests uses item order or recipe order. The former would make more sense to me though.

Re: Item subgroup vs recipe subgroup

Posted: Wed Sep 18, 2019 3:39 pm
by Adamo
moon69 wrote: Wed Sep 18, 2019 1:07 pm
Sounds like you're pretty close. According to my testing, recipes will inherit orderings and groups from the associated items under certain conditions, at least. If it's just a single item or fluid result, then it acts essentially as you've described. The best thing, if there are multiple items, is to set the main_product value on the recipe. Then, the recipe will know that is the main result, and inherit from that item appropriately. Setting the main_product should work for either an item or a fluid result.

I forgot now what happens if there are multiple results with no main_product and no order/subgroup of its own. I never set it up that way, because it seems bad form: I always set the main_result, so I know exactly what item's data is being inherited. Otherwise, I set the recipe order and subgroup directly on the recipe. You could try it and let us know. :)

Re: Item subgroup vs recipe subgroup

Posted: Wed Sep 18, 2019 5:43 pm
by moon69
Thanks both.

advanced-oil-processing has no main_product, and when the subgroup is removed...

Code: Select all

Error while running setup for recipe prototype "advanced-oil-processing" (recipe):
Subgroup must be defined when there is no common main product.

Re: Item subgroup vs recipe subgroup

Posted: Wed Sep 18, 2019 5:59 pm
by Deadlock989
Adamo wrote: Wed Sep 18, 2019 3:39 pmI forgot now what happens if there are multiple results with no main_product and no order/subgroup of its own.
The game refuses to load the mod.

Re: Item subgroup vs recipe subgroup

Posted: Wed Sep 18, 2019 6:05 pm
by Adamo
Deadlock989 wrote: Wed Sep 18, 2019 5:59 pm
Adamo wrote: Wed Sep 18, 2019 3:39 pmI forgot now what happens if there are multiple results with no main_product and no order/subgroup of its own.
The game refuses to load the mod.
Ahh, yes, good to know.