Create new (crafting) category like "advanced-crafting"

Place to get help with not working mods / modding interface.
Alwin4you
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Aug 24, 2020 2:14 pm
Contact:

Create new (crafting) category like "advanced-crafting"

Post by Alwin4you »

Hello,

I'm trying to create an item which would ONLY be craftable in a special machine (so cannot be crafted in hand).
This machine is based on an assembling machine.

In order to do so, i'm using the category "advanced-crafting" but i would like the item not to be craftable in Assembling machine 2 and 3 but only in mine new special machine.

I thought i could create a new category with the characteristic of the "advanced-crafting" and assign this category only to my machine.
How to do so ?
Or is there an other way to do so ?

Thanks in advance,

Sydney R
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Create new (crafting) category like "advanced-crafting"

Post by darkfrei »

Alwin4you wrote: Mon Aug 24, 2020 2:25 pm Hello,

I'm trying to create an item which would ONLY be craftable in a special machine (so cannot be crafted in hand).
This machine is based on an assembling machine.

In order to do so, i'm using the category "advanced-crafting" but i would like the item not to be craftable in Assembling machine 2 and 3 but only in mine new special machine.

I thought i could create a new category with the characteristic of the "advanced-crafting" and assign this category only to my machine.
How to do so ?
Or is there an other way to do so ?

Thanks in advance,

Sydney R
Vanilla has 9 recipe categories, but you can make a new one.
2020-08-24T17_07_15-_D__Factorio_0.18_factorio-current.lua - Notepad++.png
2020-08-24T17_07_15-_D__Factorio_0.18_factorio-current.lua - Notepad++.png (34.87 KiB) Viewed 853 times

Code: Select all

data:extend({
{type = "recipe-category", name = "my-awesome-recipe-category"}
})
The player can craft items of "crafting" recipe category only.

Recipes without category have "crafting" recipe category by default.

Code: Select all

data.raw.recipe["refined-hazard-concrete"].category = "crafting"
Alwin4you
Manual Inserter
Manual Inserter
Posts: 2
Joined: Mon Aug 24, 2020 2:14 pm
Contact:

Re: Create new (crafting) category like "advanced-crafting"

Post by Alwin4you »

Thank you for your quick answer,

Where should i write the new line(s) according to the model you sent me ?
In the file : data.lua ? or in a prototype (recipies)

Thanks again,

Sydney R
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Create new (crafting) category like "advanced-crafting"

Post by darkfrei »

Alwin4you wrote: Mon Aug 24, 2020 3:14 pm Thank you for your quick answer,

Where should i write the new line(s) according to the model you sent me ?
In the file : data.lua ? or in a prototype (recipies)

Thanks again,

Sydney R
All code will be played once: data.lua, all "required" files in data.lua and all "required" files deeper.
There is no difference at all.

Here is example:
data.lua:

Code: Select all

require('prototypes.recipe-category')
/prototypes/recipe-category.lua:

Code: Select all

data:extend({
{type = "recipe-category", name = "my-awesome-recipe-category"}
})
See also: https://lua-api.factorio.com/latest/Data-Lifecycle.html
Short version: First will be started file data.lua from every mod, than data-updates.lua from every mod, than data-final-fixes.lua from every mod.
Vanilla is actually is a mod and you must set this as prerequisite to start it before your mod.
Post Reply

Return to “Modding help”