I've been searching for a while now but can't seem to find the answer to this simple question for the life of me.
How can I force a recipe to only be craftable inside a certain machine? So that they player can't hand craft and they have to use an assembling machine.
The answer is probably really simple but I can't find it wherever I look
Make item only craftable within a certain machine
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Make item only craftable within a certain machine
With crafting categories. Defaults to "crafting" if not explicitly defined in a recipe.
Code: Select all
--machine:
{
type = "assembling-machine",
name = "assembling-machine-2",
crafting_categories = {"crafting", "advanced-crafting", "crafting-with-fluid"
--etc...
},
{
type = "player",
name = "player",
crafting_categories = {"crafting"},
--etc...
}
--recipe:
{
type = "recipe",
name = "engine-unit",
category = "advanced-crafting",
--etc...
},
{
type = "recipe",
name = "electric-engine-unit",
category = "crafting-with-fluid",
--etc...
}
--category:
{
type = "recipe-category",
name = "advanced-crafting"
},
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Make item only craftable within a certain machine
Yeah, if you just want assembling machines, you could use the crafting category advanced-crafting.
if you're making it for a specific assembling machine, you could add a new category to the machine you want it to be crafted in, then use that on the recipe.
if you're adding new categories, don't forget that they need to be defined before you can use them too. I think all they need is a type, and name. I think the type is "crafting-category", but I'm not certain.
if you're making it for a specific assembling machine, you could add a new category to the machine you want it to be crafted in, then use that on the recipe.
if you're adding new categories, don't forget that they need to be defined before you can use them too. I think all they need is a type, and name. I think the type is "crafting-category", but I'm not certain.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Make item only craftable within a certain machine
Type, Name, done. See the end of the code example above. Type is "recipe-category" though, probably for "historic reasons" :p.bobingabout wrote: Fri Nov 02, 2018 8:54 am if you're adding new categories, don't forget that they need to be defined before you can use them too. I think all they need is a type, and name. I think the type is "crafting-category", but I'm not certain.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Make item only craftable within a certain machine
advanced-crafting is one you added? Fair enough then.eradicator wrote: Fri Nov 02, 2018 3:38 pmType, Name, done. See the end of the code example above. Type is "recipe-category" though, probably for "historic reasons" :p.bobingabout wrote: Fri Nov 02, 2018 8:54 am if you're adding new categories, don't forget that they need to be defined before you can use them too. I think all they need is a type, and name. I think the type is "crafting-category", but I'm not certain.
I think bob's mods adds "machine-crafting" to assembling machines. crafting-with-fluid is a good go to, but that means it's excluded from assembling machine 1.
- eradicator
- Smart Inserter
- Posts: 5211
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Make item only craftable within a certain machine
No. Those are just quoted bits from vanilla. I didn't add anything there.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.