Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)

User avatar
IsaacOscar
Filter Inserter
Filter Inserter
Posts: 833
Joined: Sat Nov 09, 2024 2:36 pm
Contact:

Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)

Post by IsaacOscar »

Bassically, I suggest deleting the following line of Lua code:

Code: Select all

recipe.auto_recycle = nil
See https://github.com/wube/factorio-data/b ... tes.lua#L6

I don't know why it's there, and is causing problems for mod's that that want to add new recipes/items to the game.
With out that line of code, one can simply write:

Code: Select all

if mods["quality"] then require("__quality__.data-updates") end
After adding/changing any recipes/items, and the recycling recipes will re-generate.
Unfortunately, due to the `recipe.auto_recycle = nil` line, it will generate incorrect recycling recipes for Landfill, Nutrients, Raw Fish, Uranium-238, Uranium Fuel Cells, and Tree Seeds.

To fix this issue, I can of course write:

Code: Select all

if mods["quality"] then
	for _, k in pairs{"landfill", "nutrients-from-biter-egg", "nuclear-fuel-reprocessing", "uranium-fuel-cell", "wood-processing", "fish-breeding"} do
		if data.raw.recipe[k] then
			data.raw.recipe[k].auto_recycle = false end end
	require("__quality__.data-updates") end
But that won't work if other mod's define recipes with auto_recycle = false.

See 124656 for more discussion about problems re-generating recycling recipes.
User avatar
brevven
Long Handed Inserter
Long Handed Inserter
Posts: 81
Joined: Mon May 01, 2017 1:02 am
Contact:

Re: Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)

Post by brevven »

+1 to this.

Current behavior makes it quite literally impossible to broadly guarantee mods can respect one another's "auto_recycle=false" parameters. This is especially true given that every mod that modifies recipes has to regenerate recycling recipes, because they cannot guarantee their modifications load before quality generates recycling recipes.

Here's some further context: https://mods.factorio.com/mod/bzlead/di ... ffce2d5207
My mods include Titanium, Lead, and more
Rseding91
Factorio Staff
Factorio Staff
Posts: 14776
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)

Post by Rseding91 »

The reason it is being removed now is to make the "check unused prototype data" not flag it as unused - since it's used during data stage and not by the engine itself.

I'll make the engine mark it as used even if it doesn't do anything with it. That way it can stay during the whole data stage.
If you want to get ahold of me I'm almost always on Discord.
curiosity
Filter Inserter
Filter Inserter
Posts: 553
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)

Post by curiosity »

Rseding91 wrote: Tue Jan 07, 2025 3:47 pm I'll make the engine mark it as used even if it doesn't do anything with it. That way it can stay during the whole data stage.
Would be great if this was available to mods. There are other mods that add properties in this manner.
User avatar
IsaacOscar
Filter Inserter
Filter Inserter
Posts: 833
Joined: Sat Nov 09, 2024 2:36 pm
Contact:

Re: Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)

Post by IsaacOscar »

curiosity wrote: Tue Jan 07, 2025 11:50 pm
Rseding91 wrote: Tue Jan 07, 2025 3:47 pm I'll make the engine mark it as used even if it doesn't do anything with it. That way it can stay during the whole data stage.
Would be great if this was available to mods. There are other mods that add properties in this manner.
I think they're talking about the --check-unused-prototype-data command line option, so its only an opt-in check. Also, according to https://wiki.factorio.com/Command_line_parameters, mods can opt out of it by putting they're data in a table with ignore set to true.
curiosity
Filter Inserter
Filter Inserter
Posts: 553
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)

Post by curiosity »

IsaacOscar wrote: Wed Jan 08, 2025 2:37 am
curiosity wrote: Tue Jan 07, 2025 11:50 pm Would be great if this was available to mods. There are other mods that add properties in this manner.
I think they're talking about the --check-unused-prototype-data command line option, so its only an opt-in check. Also, according to https://wiki.factorio.com/Command_line_parameters, mods can opt out of it by putting they're data in a table with ignore set to true.
Why are you telling me? I am well aware.
User avatar
IsaacOscar
Filter Inserter
Filter Inserter
Posts: 833
Joined: Sat Nov 09, 2024 2:36 pm
Contact:

Re: Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)

Post by IsaacOscar »

curiosity wrote: Wed Jan 08, 2025 2:39 pm Why are you telling me? I am well aware.
Sorry, I wasn't sure!
It's just there's already a way for mods to have stuff ignored so you don't need a new engine feature for it.
curiosity
Filter Inserter
Filter Inserter
Posts: 553
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)

Post by curiosity »

IsaacOscar wrote: Wed Jan 08, 2025 2:43 pm Sorry, I wasn't sure!
It's just there's already a way for mods to have stuff ignored so you don't need a new engine feature for it.
Oh, didn't notice you were pointing out the ignore mechanic specifically. That mechanic is a massive hack. Field named "ignore" can easily collide with a legitimate field and it only works for table values anyway. Better replace it with something proper now that the foundation has been laid.
Post Reply

Return to “Implemented mod requests”