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).DRY411S wrote: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.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.
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.
Adding recipes in control.lua
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Adding recipes in control.lua
Re: Adding recipes in control.lua
Hmm, there are only 2 main_products in the base files, in 'fluid_recipe.lua'. Both are immediately followed by icon, subgroup and order.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.
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]"
},
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Adding recipes in control.lua
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.