What is the purpose of a recipe's hidden property?

Place to get help with not working mods / modding interface.
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 736
Joined: Sun Mar 13, 2016 9:48 am
Contact:

What is the purpose of a recipe's hidden property?

Post by DRY411S »

Subject says it all. It seems to me that setting this property doesn't hide the recipe from the crafting menu, or the research tab for when research unlocks that recipe.

I can't find anywhere that it did appear but then doesn't after it's hidden, if that makes sense. Help!
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: What is the purpose of a recipe's hidden property?

Post by bobingabout »

An extract from my mod.

Code: Select all

  {
    type = "recipe",
    name = "void-oxygen",
    category = "void-fluid",
    hidden = "true",
    energy_required = 1,
    ingredients =
    {
      {type="fluid", name="oxygen", amount=25}
    },
    results=
    {
      {type="item", name="void", amount=1, probability=0},
    },
    subgroup = "void",
    icon = "__bobplates__/graphics/icons/void-oxygen.png",
    order = "oxygen"
  },
This recipe is hidden, it does not show up in the recipe lists when I open my inventory.
Being used on a furnace type building, it is automatically selected, but there's no indication that it is actually a recipe anywhere in the game.

There is actually a base game example of the hidden tag being used. I THINK it's on the rocket silo or something.


Off topic, I love that results line, that's a work around for a recipe that deletes things. The result has to be an item that isn't used in any recipes, with a probability of 0. So I made an item called Void, it looks like some kind of black hole, or vortex.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 736
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: What is the purpose of a recipe's hidden property?

Post by DRY411S »

Does the void item have flags "hidden" as a property? In my limited experience playing around, it's that property which stops the recipe from appearing in your inventory?
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 736
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: What is the purpose of a recipe's hidden property?

Post by DRY411S »

bobingabout wrote:An extract from my mod.
<snip>
This recipe is hidden, it does not show up in the recipe lists when I open my inventory.
Being used on a furnace type building, it is automatically selected, but there's no indication that it is actually a recipe anywhere in the game.

There is actually a base game example of the hidden tag being used. I THINK it's on the rocket silo or something.
It's the rocket-part.
bobingabout wrote:Off topic, I love that results line, that's a work around for a recipe that deletes things. The result has to be an item that isn't used in any recipes, with a probability of 0. So I made an item called Void, it looks like some kind of black hole, or vortex.
DRY411S wrote:Does the void item have flags "hidden" as a property? In my limited experience playing around, it's that property which stops the recipe from appearing in your inventory?
Hmm...
  1. The vanilla rocket-part has the item.flags "hidden" set and the recipe.hidden = true.
  2. It doesn't show in the inventory crafting menu.
  3. It does however display in the crafting menu if recipe.hidden is false whether or not the item.flags array includes "hidden"
  4. It does not appear if recipe.hidden is true whether or not the item.flags array includes "hidden"
  5. This suggests that the recipe.hidden property takes the greatest priority over item.flags.
So that answers my question as to how the property is used, and it is as you describe.

This suggests that my mod is faulty, because I'm trying to hide a vanilla recipe and failing spectacularly.

Example (in recipes.lua, required by data.lua) ....

Code: Select all

data.raw.recipe.battery.hidden = true
Any ideas? Perhaps too early in the data cycle?
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 736
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: What is the purpose of a recipe's hidden property?

Post by DRY411S »

Sometimes writing these things down to explain them to other people helps you find the bugs in your own code. And you end up talking to yourself on forums. :lol:

So going back to the subject of the topic, the purpose of a recipe's hidden property is to hide the recipe from the crafting menus. This only works if you write code that sets the property correctly. In my case,

Code: Select all

data.raw.recipe.battery.hidden = true
should in fact be:

Code: Select all

data.raw.recipe.battery.normal.hidden = true
data.raw.recipe.battery.expensive.hidden = true
I blame the Wube documentation ....
User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: What is the purpose of a recipe's hidden property?

Post by Arch666Angel »

hidden = true in recipes hides the recipe from the crafting menu ("e") so the recipe is not selectable for crafting by hand or machine, but the recipe can still be selected by autocrafting entities -> smelters, that's how bobs and my void entities work. If a recipe with the tag is included in a tech it is visible in the tech itself, but that wont change the crafting menu behavior.

adding flags = {"hidden"} to an item hides it from the item menu which you can look at from selecting filters in your toolbar for example. I use this to hide items I override and are no longer used.

---

Code: Select all

data.raw.recipe.battery.hidden = true
wont error, but I wont go into effect either? I'm experimenting around with the normal/expensive setting myself at the moment and some things are...mystic...
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 736
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: What is the purpose of a recipe's hidden property?

Post by DRY411S »

Arch666Angel wrote:<snip>
adding flags = {"hidden"} to an item hides it from the item menu which you can look at from selecting filters in your toolbar for example. I use this to hide items I override and are no longer used.
<snip>
I don't think I understand your example. Can you say more please?

The documentation says it is removed from all crafting menus. http://lua-api.factorio.com/latest/LuaI ... type.flags However my testing suggests that it isn't hidden unless the recipe.hidden flag is set.
Arch666Angel wrote:<snip>

Code: Select all

data.raw.recipe.battery.hidden = true
wont error, but I wont go into effect either? I'm experimenting around with the normal/expensive setting myself at the moment and some things are...mystic...
It appears to me that you can only set the hidden flags in data-final-fixes. If I set them in data.lua, they seem to have been reset by the time the game starts.
Rseding91
Factorio Staff
Factorio Staff
Posts: 16016
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: What is the purpose of a recipe's hidden property?

Post by Rseding91 »

DRY411S wrote:It appears to me that you can only set the hidden flags in data-final-fixes. If I set them in data.lua, they seem to have been reset by the time the game starts.
The game does no such thing so if that's happening then some other mod(s) you're using are causing it.
If you want to get ahold of me I'm almost always on Discord.
User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 736
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: What is the purpose of a recipe's hidden property?

Post by DRY411S »

Arch666Angel wrote:<snip>

Code: Select all

data.raw.recipe.battery.hidden = true
wont error, but I wont go into effect either? I'm experimenting around with the normal/expensive setting myself at the moment and some things are...mystic...
Mystic like this? viewtopic.php?t=51070
User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: What is the purpose of a recipe's hidden property?

Post by bobingabout »

DRY411S wrote:Does the void item have flags "hidden" as a property? In my limited experience playing around, it's that property which stops the recipe from appearing in your inventory?
My void item is also hidden, yes. But as explained above, that doesn't change the functionality of hiding the recipe.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.
Post Reply

Return to “Modding help”