Page 2 of 2
Re: Adding recipes in control.lua
Posted: Wed Jun 01, 2016 11:49 am
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).
Re: Adding recipes in control.lua
Posted: Wed Jun 01, 2016 4:54 pm
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]"
},
Re: Adding recipes in control.lua
Posted: Thu Jun 02, 2016 8:27 am
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.