[0.18.8] Adding a modded recipe that is hidden from graphs

Place to get help with not working mods / modding interface.
Zaflis
Filter Inserter
Filter Inserter
Posts: 519
Joined: Sun Apr 24, 2016 12:51 am
Contact:

[0.18.8] Adding a modded recipe that is hidden from graphs

Post by Zaflis »

Working on SimpleCompress for which compressing/decompressing items should not count as production or consumption in the graphs. It's basically same as barreling, logistic recipes.

I tried looking into how barrelling works and match it to the mod but so far no success. Even this script which i believe shouldn't be necessary:

Code: Select all

/c for _, force in pairs(game.forces) do
  local recipes = force.recipes
  recipes["compress-iron-ore"].reload()
  recipes["decompress-iron-ore"].reload()
end
Did even reset the recipes in assemblers just in case.

What i found in data-updates.lua of basemod is "allow_decomposition = false":
https://lua-api.factorio.com/latest/Lua ... omposition
Its description doesn't exactly say it's related to graphs in any way, but i tried with that as well as other more fitting one;
"hidden_from_flow_stats = true"
Is the recipe hidden from flow statistics (item/fluid production statistics)?
So either these recipe properties are bugged or i'm missing something? I can still tell that barreling water for example does not appear in graphs.
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: [0.18.8] Adding a modded recipe that is hidden from graphs

Post by Deadlock989 »

hidden_from_flow_stats is read-only at runtime. If you want to change those recipes to be hidden from the P screen, you'll have to do it in the data stage. And look out for normal/expensive variations because that's a barrel of laughs.
Zaflis
Filter Inserter
Filter Inserter
Posts: 519
Joined: Sun Apr 24, 2016 12:51 am
Contact:

Re: [0.18.8] Adding a modded recipe that is hidden from graphs

Post by Zaflis »

It is done in data stage, from within data.lua calling my functions that generate recipes

Code: Select all

function SimpleCompress_AddRecipe(_name, _ingredient)
  _ingredient = _ingredient or _name
  data:extend({{
    type = "recipe",
    name = "compress-" .. _name,
    energy_required = simpleCompress.EnergyCost,
    category = "advanced-crafting",
    enabled = false,
    ingredients = {{_ingredient, simpleCompress.CompressAmount}},
    result = "compressed-" .. _name,
    --hidden_from_flow_stats = true
    allow_decomposition = false
  },
  {
    type = "recipe",
    name = "decompress-" .. _name,
    energy_required = simpleCompress.EnergyCost,
    category = "advanced-crafting",
    enabled = false,
    ingredients = {{"compressed-" .. _name, 1}},
    result = _ingredient,
	  result_count = simpleCompress.CompressAmount,
    --hidden_from_flow_stats = true
    allow_decomposition = false
  }})
end
I commented hidden_from_flow_stats after it didn't work but allow_decomposition still shows in graphs too. They do compile fine though.
User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

Re: [0.18.8] Adding a modded recipe that is hidden from graphs

Post by Deadlock989 »

You linked to the control stage API which is why I mentioned the data stage.

It's called hide_from_stats in the data stage.

allow_decomposition has nothing to do with those stats, it's for the "total raw" calculations - if you disallow decomposition for a recipe then it stops the recursive search for the total raw info on the recipe tooltips at that item.
Zaflis
Filter Inserter
Filter Inserter
Posts: 519
Joined: Sun Apr 24, 2016 12:51 am
Contact:

Re: [0.18.8] Adding a modded recipe that is hidden from graphs

Post by Zaflis »

Thanks that works. I think i need decomposition off for compressed items as well as they're not actual raw materials.
Post Reply

Return to “Modding help”