[Fixed]Can't completely hide items.

Place to get help with not working mods / modding interface.
Post Reply
User avatar
jamiechi1
Fast Inserter
Fast Inserter
Posts: 196
Joined: Wed Jan 03, 2018 10:12 pm

[Fixed]Can't completely hide items.

Post by jamiechi1 »

In one of my mods, I force belt immunity on and I want to hide the technology and recipes.
In data-final-fixes:

Code: Select all

-- force belt immunity on
data.raw['character']['character'].has_belt_immunity = true
data.raw.technology["belt-immunity-equipment"].hidden = true
data.raw.technology["belt-immunity-equipment"].visible_when_disabled = false
data.raw.recipe["belt-immunity-equipment"].hidden = true
data.raw.recipe["belt-immunity-equipment"].hidden_from_player_crafting = true
data.raw.item["belt-immunity-equipment"].group = nil
This hides everything except in the filters dialog when setting an item slot in the inventory. The item shows up under the unsorted items group.

Is there a way to hide the belt-immunity-equipment completely, or disable the display of the unsorted items group?
Can groups be hidden?
Last edited by jamiechi1 on Tue May 31, 2022 7:09 pm, edited 2 times in total.

robot256
Filter Inserter
Filter Inserter
Posts: 596
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: Can't completely hide items.

Post by robot256 »

I've never seen someone set item.group to nil. You can set items to hidden with the "flags" property. https://wiki.factorio.com/Prototype/Item#flags

User avatar
jamiechi1
Fast Inserter
Fast Inserter
Posts: 196
Joined: Wed Jan 03, 2018 10:12 pm

Re: Can't completely hide items.

Post by jamiechi1 »

Setting item group to null has the same effect as setting group or subgroup to "other". Which basically is the 'unsorted items group'. It appears that the "other" group can not be hidden.

Edit: That is what was missing. I added:

Code: Select all

data.raw.item["belt-immunity-equipment"].flags = { "hidden" }
Probably don't need to set the group to nil.

FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2530
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Can't completely hide items.

Post by FuryoftheStars »

jamiechi1 wrote:
Tue May 31, 2022 6:14 pm
Setting item group to null has the same effect as setting group or subgroup to "other". Which basically is the 'unsorted items group'. It appears that the "other" group can not be hidden.

Edit: That is what was missing. I added:

Code: Select all

data.raw.item["belt-immunity-equipment"].flags = { "hidden" }
Probably don't need to set the group to nil.
For the sake of "just in case", may be best to add the "hidden" flag to the table vs overwriting it.

Code: Select all

table.insert(data.raw.item["belt-immunity-equipment"].flags, "hidden")
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles

User avatar
jamiechi1
Fast Inserter
Fast Inserter
Posts: 196
Joined: Wed Jan 03, 2018 10:12 pm

Re: [Fixed]Can't completely hide items.

Post by jamiechi1 »

Cool. Thanks.
Edit: Since flags didn't exist, I had to do this.

Code: Select all

table.insert(data.raw.item["belt-immunity-equipment"], flags)
data.raw.item["belt-immunity-equipment"].flags = { "hidden" }
Related post: viewtopic.php?t=80768

And thanks to Bilka in this post: viewtopic.php?t=60020

Code: Select all

-- note that [item].flags is overwritten
local function disable_recipe(recipe) -- and item
   if not data.raw.recipe[recipe] then return end
   if data.raw.recipe[recipe].normal then
      data.raw.recipe[recipe].normal.enabled = false
      data.raw.recipe[recipe].expensive.enabled = false
      data.raw.recipe[recipe].normal.hidden = true
      data.raw.recipe[recipe].expensive.hidden = true
      data.raw.recipe[recipe].normal.hidden_from_player_crafting = true
      data.raw.recipe[recipe].expensive.hidden_from_player_crafting = true
   else
      data.raw.recipe[recipe].enabled = false
      data.raw.recipe[recipe].hidden = true
      data.raw.recipe[recipe].hidden_from_player_crafting = true
   end
   local item = recipe
   if not data.raw.item[item].flags
   then      
      table.insert(data.raw.item[item], flags)
   end
   data.raw.item[item].flags = { "hidden" }
end

-- call subroutine like this:
-- disable_recipe("electric-mining-drill")

Post Reply

Return to “Modding help”