Page 1 of 1
[Fixed]Can't completely hide items.
Posted: Tue May 31, 2022 9:37 am
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?
Re: Can't completely hide items.
Posted: Tue May 31, 2022 12:28 pm
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
Re: Can't completely hide items.
Posted: Tue May 31, 2022 6:14 pm
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.
Re: Can't completely hide items.
Posted: Tue May 31, 2022 7:39 pm
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")
Re: [Fixed]Can't completely hide items.
Posted: Wed Jun 01, 2022 11:15 am
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")