The FluidPrototype has auto_barrel listed, why does RecipePrototype not have the auto_recycle as well? This would help people realize it's there so they can disable alternative recipes from accidentally being picked as the recycling recipe.
It'd need a disclaimer that it does nothing without the Quality mod from the Space Age dlc (I'd say that means it should get the SA icon, but that's up to you) as part of a similar note to what auto_barrel has about it being a lua only field.
Add auto_recycle to RecipePrototype
Re: Add auto_recycle to RecipePrototype
I would not have been able to find this information; auto_recycle, can_recycle without google. So here it is again:
https://github.com/wube/factorio-data/b ... g.lua#L153
Main part is this though:
Basically the symptom was unwanted modded items coming out of recycler.
https://github.com/wube/factorio-data/b ... g.lua#L153
Main part is this though:
If you already set the can_recycle it won't even go for a default value.local can_recycle = can_recycle or default_can_recycle
Basically the symptom was unwanted modded items coming out of recycler.
- IsaacOscar
- Filter Inserter
- Posts: 843
- Joined: Sat Nov 09, 2024 2:36 pm
- Contact:
Re: Add auto_recycle to RecipePrototype
In the base game, the original value of can_recycle is nil, so I think it's simply there to allow mods to force generate a recycling recipe for something the base game doesn't want to.Zaflis wrote: Wed Jan 01, 2025 1:45 pm I would not have been able to find this information; auto_recycle, can_recycle without google. So here it is again:
https://github.com/wube/factorio-data/b ... g.lua#L153
Main part is this though:If you already set the can_recycle it won't even go for a default value.local can_recycle = can_recycle or default_can_recycle
Basically the symptom was unwanted modded items coming out of recycler.
Re: Add auto_recycle to RecipePrototype
It will, if you set it to false.Zaflis wrote: Wed Jan 01, 2025 1:45 pm If you already set the can_recycle it won't even go for a default value.
...Oh, it's supposed to be a function. This is why it needs to be documented.
- IsaacOscar
- Filter Inserter
- Posts: 843
- Joined: Sat Nov 09, 2024 2:36 pm
- Contact:
Re: Add auto_recycle to RecipePrototype
For anyone confused by what's going oncuriosity wrote: Wed Jan 01, 2025 3:25 pm It will, if you set it to false.
...Oh, it's supposed to be a function. This is why it needs to be documented.
auto_recycle is a field on recipe prototypes, it should be false, true, or nil (the last two are the same as not setting it)
can_recycle is the paramater to the generate_recycling_recipe function, it should be a function that returns true, false, or nil, or itself be nil (the last is the same as ommitting it).
Neither auto_recycle nor
There are two ways to call the generate_recycling_recipe function:
Code: Select all
local recycling = require("__quality__.prototypes.recycling")
recycling.generate_recycling_recipe(recipe)
recycling.generate_recycling_recipe(recipe, function(r)
...
end)
The second call will generate a recycling recipe if the given function returns true, of some other non-false/nil value (the r parameter will always equal the given recipe, so I don't know why it doesn't just let you pass a boolean).
(Except that neither will generate a recipe if the recipe does not hace exactly one non-fluid output, or if the recipe has no non-fluid ingredients).
Note that auto_recycle is only read by the lua code in the quality mod, so if you don't call generate_recycling_recipe or it isn't called automatically, the game will completely ignore it. Also can_recycle is never actually passed by the games lua code, so I think it's just their for modders or something they forgot to delete.
Last edited by IsaacOscar on Wed Jan 01, 2025 4:07 pm, edited 2 times in total.
Re: Add auto_recycle to RecipePrototype
Passing true to can_recycle will cause it to crash.IsaacOscar wrote: Wed Jan 01, 2025 3:46 pm can_recycle is the paramater to the generate_recycling_recipe function, it should be true, false, or nil (the last two are the same as ommitting it).
Neither auto_recycle nor can_recycle should be a function
It is supposed to be an optional function that returns a boolean:
https://github.com/wube/factorio-data/b ... #L179-L181
Also, the random functions that we can use in data aren't normally documented. They probably should be, but that's a separate documentation request.
- IsaacOscar
- Filter Inserter
- Posts: 843
- Joined: Sat Nov 09, 2024 2:36 pm
- Contact:
Re: Add auto_recycle to RecipePrototype
Dammit, I misread the code. I've fixed my dumb comment.PennyJim wrote: Wed Jan 01, 2025 4:00 pmPassing true to can_recycle will cause it to crash.IsaacOscar wrote: Wed Jan 01, 2025 3:46 pm can_recycle is the paramater to the generate_recycling_recipe function, it should be true, false, or nil (the last two are the same as ommitting it).
Neither auto_recycle nor can_recycle should be a function
It is supposed to be an optional function that returns a boolean:
https://github.com/wube/factorio-data/b ... #L179-L181
Also, the random functions that we can use in data aren't normally documented. They probably should be, but that's a separate documentation request.