Item subgroup vs recipe subgroup

Place to get help with not working mods / modding interface.
Post Reply
User avatar
moon69
Fast Inserter
Fast Inserter
Posts: 181
Joined: Sun Sep 18, 2016 6:53 pm
Contact:

Item subgroup vs recipe subgroup

Post 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.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2919
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Item subgroup vs recipe subgroup

Post 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.

Adamo
Filter Inserter
Filter Inserter
Posts: 479
Joined: Sat May 24, 2014 7:00 am
Contact:

Re: Item subgroup vs recipe subgroup

Post 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. :)

User avatar
moon69
Fast Inserter
Fast Inserter
Posts: 181
Joined: Sun Sep 18, 2016 6:53 pm
Contact:

Re: Item subgroup vs recipe subgroup

Post 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.
Last edited by moon69 on Wed Sep 18, 2019 6:21 pm, edited 1 time in total.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Item subgroup vs recipe subgroup

Post by Deadlock989 »

Adamo wrote:
Wed Sep 18, 2019 3:39 pm
I 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.
Image

Adamo
Filter Inserter
Filter Inserter
Posts: 479
Joined: Sat May 24, 2014 7:00 am
Contact:

Re: Item subgroup vs recipe subgroup

Post by Adamo »

Deadlock989 wrote:
Wed Sep 18, 2019 5:59 pm
Adamo wrote:
Wed Sep 18, 2019 3:39 pm
I 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.

Post Reply

Return to “Modding help”