Page 1 of 1

Make item only craftable within a certain machine

Posted: Fri Nov 02, 2018 3:48 am
by Kino_
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

Re: Make item only craftable within a certain machine

Posted: Fri Nov 02, 2018 8:32 am
by eradicator
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"
  },
  

Re: Make item only craftable within a certain machine

Posted: Fri Nov 02, 2018 8:54 am
by bobingabout
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.

Re: Make item only craftable within a certain machine

Posted: Fri Nov 02, 2018 3:38 pm
by eradicator
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.
Type, Name, done. See the end of the code example above. Type is "recipe-category" though, probably for "historic reasons" :p.

Re: Make item only craftable within a certain machine

Posted: Fri Nov 02, 2018 7:51 pm
by bobingabout
eradicator wrote:
Fri Nov 02, 2018 3:38 pm
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.
Type, Name, done. See the end of the code example above. Type is "recipe-category" though, probably for "historic reasons" :p.
advanced-crafting is one you added? Fair enough then.

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.

Re: Make item only craftable within a certain machine

Posted: Fri Nov 02, 2018 8:23 pm
by eradicator
bobingabout wrote:
Fri Nov 02, 2018 7:51 pm
advanced-crafting is one you added? Fair enough then.
No. Those are just quoted bits from vanilla. I didn't add anything there.