Possible bug? Setting data.raw.recipe["submachine-gun"].hidden = true doesn't hide the recipe
Posted: Sat Jun 20, 2020 3:51 pm
I'm working on a mod that hides most military technology and items, and I'm doing that by setting the technologies, recipes, and items to hidden using the following code:
This works for 95% of the items/recipes/technologies. However, for some reason setting the following recipes to be hidden doesn't actually work:
In game, if I open up the console and type the following, it will return false, even though I have set the prototype to be hidden in data.lua.
Doing the same thing with the pistol works:
I don't have any other mods active at all, so it's not another mod altering the settings. I'm also starting up a fresh save to make sure it's not caused by previously loaded mods or other factors.
I could be doing something wrong, but it seems to work for all the other recipes. Just those 4 recipes (that I have found so far at least) don't seem to hide correctly. Setting the hidden flag to the item itself works - so the items don't show up in filters, but the recipes stills show up in the crafting menus.
This is in Factorio v0.18.32.
Any ideas? Thanks!
Code: Select all
-- in data.lua
data.raw.recipe["submachine-gun"].hidden = true -- hide the submachine gun from the crafting menus
data.raw["gun"]["submachine-gun"].flags = { "hidden" } -- hide the submachine gun item from filter menus (e.g., requester chests)
data.raw.technology["military"].hidden = true -- hide the military technology
Code: Select all
-- in data.lua
data.raw.recipe["submachine-gun"].hidden = true
data.raw.recipe["tank"].hidden = true
data.raw.recipe["cannon-shell"].hidden = true
data.raw.recipe["explosive-cannon-shell"].hidden = true
Code: Select all
-- in game console
/c game.print(game.player.force.recipes["submachine-gun"].prototype.hidden) -- prints false
Code: Select all
-- in data.lua
data.raw.recipe["pistol"].hidden = true
Code: Select all
-- in game console
/c game.print(game.player.force.recipes["pistol"].prototype.hidden) -- prints true
I could be doing something wrong, but it seems to work for all the other recipes. Just those 4 recipes (that I have found so far at least) don't seem to hide correctly. Setting the hidden flag to the item itself works - so the items don't show up in filters, but the recipes stills show up in the crafting menus.
This is in Factorio v0.18.32.
Any ideas? Thanks!