How do I remove something and everything that refers to it without having to do it all manually?

Place to get help with not working mods / modding interface.
000
Inserter
Inserter
Posts: 31
Joined: Mon Dec 27, 2021 5:00 pm
Contact:

How do I remove something and everything that refers to it without having to do it all manually?

Post by 000 »

Or: How do I wildcard repetitive data.raw rules?

I am working on a mod in which all Intermediate items and crafting recipes will have no use, because every recipe that would use them will use items added by my mod instead, which I am splitting across their own crafting tabs. I have already found a thread on how to add new tabs, and its method works.

I want to hide the Intermediates tab in the crafting interface to prevent confusion and clutter. Ideally, I also want these items and recipes to not appear in the Factoriopedia for the same reason.

Thanks to How Do I Delete a Recipe or Item From Vanilla?, I know that I can do:

Code: Select all

data.raw["item-group"]["intermediate-products"] = nil
This does work. However, the game throws an error, blaming my mod for removing this category. The source of this error is apparently fluid-recipes.

Thanks to Darkfrei I know I must remove the referents throwing this error. That makes sense. I do:

Code: Select all

data.raw["item-subgroup"]["fluid-recipes"] = nil
data.raw["item-subgroup"]["raw-resource"] = nil
data.raw["item-subgroup"]["raw-material"] = nil
data.raw["item-subgroup"]["barrel"] = nil
data.raw["item-subgroup"]["fill-barrel"] = nil
data.raw["item-subgroup"]["empty-barrel"] = nil
data.raw["item-subgroup"]["intermediate-products"] = nil
data.raw["item-subgroup"]["intermediate-recipe"] = nil
data.raw["item-subgroup"]["uranium-processing"] = nil
data.raw["item-subgroup"]["science-pack"] = nil
data.raw["item-subgroup"]["internal-process"] = nil
This works. However, a new error. Now the problem is wood. I can see where this is going, and having re-read Darkfrei's answer I realise I should have expected this.

I have to set every intermediate item, and every intermediate recipe, to nil.

I can, but surely I'm missing something. Surely there's a simple way to do

Code: Select all

data.raw["item-group"]["intermediate-products"][*] = nil
I did try that, but this throws the error "unexpected symbol near *".

If there is clear, detailed documentation on how to use data.raw, I'd appreciate a link. Modders seem to know instinctively how to use it, and I cannot figure out how they know this stuff! For instance, I've found that it cannot be used to replace an image, even though it looks as though it could.
User avatar
Osmo
Filter Inserter
Filter Inserter
Posts: 357
Joined: Wed Oct 23, 2024 12:08 pm
Contact:

Re: How do I remove something and everything that refers to it without having to do it all manually?

Post by Osmo »

simply set the hidden, as well as hidden_in_factoriopedia properties to true instead of deleting the prototypes
https://lua-api.factorio.com/latest/pro ... tml#hidden
000
Inserter
Inserter
Posts: 31
Joined: Mon Dec 27, 2021 5:00 pm
Contact:

Re: How do I remove something and everything that refers to it without having to do it all manually?

Post by 000 »

Osmo wrote: Sun Sep 20, 2026 12:42 am simply set the hidden, as well as hidden_in_factoriopedia properties to true instead of deleting the prototypes
https://lua-api.factorio.com/latest/pro ... tml#hidden
Thank you for reply.

I must be doing something wrong. I tried:

Code: Select all

data.raw["item-group"]["intermediate-products"].hidden = true
data.raw["item-group"]["intermediate-products"].hidden_in_factoriopedia = true
This does nothing. The Intermediates tab remains visible.

What is the proper way of doing this please?
Post Reply

Return to “Modding help”