Page 1 of 1
Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)
Posted: Sat Jan 04, 2025 2:10 pm
by IsaacOscar
Bassically, I suggest deleting the following line of Lua code:
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.
Re: Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)
Posted: Mon Jan 06, 2025 6:13 am
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
Re: Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)
Posted: Tue Jan 07, 2025 3:47 pm
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.
Re: Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)
Posted: Tue Jan 07, 2025 11:50 pm
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.
Re: Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)
Posted: Wed Jan 08, 2025 2:37 am
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.
Re: Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)
Posted: Wed Jan 08, 2025 2:39 pm
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.
Re: Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)
Posted: Wed Jan 08, 2025 2:43 pm
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.
Re: Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)
Posted: Wed Jan 08, 2025 2:59 pm
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.
Re: Stop automatically deleting the auto_recycle field (allowing mod's to easilly regenerate the recycling recipes)
Posted: Mon Jan 20, 2025 3:52 am
by brevven
Seems like this made it into
2.0.31? Thank you!