Adding recipes in control.lua

Place to get help with not working mods / modding interface.
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Adding recipes in control.lua

Post by bobingabout »

DRY411S wrote:
bobingabout wrote:I think with using a results table, you also need to specify a few extra tags... icon, order and subgroup, not to mention a locale entry for the recipe. some of these tags can be mitigated though if you use... I forget the tag... main_product? if you use that, then the 4 tags I mentioned earlier will be copied from the item listed on that tag.
Ooh, please remember the tag, discussing how to address the locale issues for recipes created on the fly like this was going to be my next topic. :)

The mod is now functioning, icons are in place, category too. The order is alphabetic by recipe name, and the subgroups don't exist yet.
I don't have access to the code to look it up at my current location, but take a look at the file... data/base/prototypes/recipe/chemistry.lua, it's the one where the oil processing recipes are listed, many of those have a results table, and some of them use a main_product(or whatever it is) tag, some of them just set to "" (no name).
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 727
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: Adding recipes in control.lua

Post by DRY411S »

bobingabout wrote:I think with using a results table, you also need to specify a few extra tags... icon, order and subgroup, not to mention a locale entry for the recipe. some of these tags can be mitigated though if you use... I forget the tag... main_product? if you use that, then the 4 tags I mentioned earlier will be copied from the item listed on that tag.
Hmm, there are only 2 main_products in the base files, in 'fluid_recipe.lua'. Both are immediately followed by icon, subgroup and order.

So what exactly is it for again? The locale description of the first product in the results?

Code: Select all

  {
    type = "recipe",
    name = "heavy-oil-cracking",
    category = "chemistry",
    enabled = false,
    energy_required = 5,
    ingredients =
    {
      {type="fluid", name="water", amount=3},
      {type="fluid", name="heavy-oil", amount=4}
    },
    results=
    {
      {type="fluid", name="light-oil", amount=3}
    },
    main_product= "",
    icon = "__base__/graphics/icons/fluid/heavy-oil-cracking.png",
    subgroup = "fluid-recipes",
    order = "b[fluid-chemistry]-a[heavy-oil-cracking]"
  },

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Adding recipes in control.lua

Post by bobingabout »

From what I understand, if you set main_product then the recipe will function as if you were using result= instead of a results table, so the recipe would use the locale entry, icon, order and subgroup (if not overwritten by a tag on the recipe specified afterwards) of the item listed as the main product.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

Post Reply

Return to “Modding help”