[2.0.23] RecipePrototype feature "auto_recycle" is undocumented in API Docs
Posted: Sun Dec 08, 2024 12:03 am
This is a bug within Factorio's documentation, not with Factorio itself.
The current version of Factorio's documentation does not document the "auto_recycle" recipe-prototype feature, which appears to control if a recipe is reversible via recyclers. Without documentation for this feature, modders will not know how to mark recipes as irreversible.
https://lua-api.factorio.com/latest/pro ... otype.html
This is an example of "auto_recycle" within Space Age's source code, in the recipe for carbon fiber.
I believe the reason this feature is undocumented is because it's not used by the engine in any way. Instead, the auto_recycle feature is only relevant when it's checked by the Quality mod to determine if it should generate a recycling recipe. I could be wrong. Here is an excerpt from the Quality mod where "auto_recycle" is checked to determine if it should auto-generate a recycling recipe.
The reason why this improvised feature doesn't crash the game is because immediately after generating recycling recipes, the Quality mod removes auto_recycle from every recipe in the game.
The current version of Factorio's documentation does not document the "auto_recycle" recipe-prototype feature, which appears to control if a recipe is reversible via recyclers. Without documentation for this feature, modders will not know how to mark recipes as irreversible.
https://lua-api.factorio.com/latest/pro ... otype.html
This is an example of "auto_recycle" within Space Age's source code, in the recipe for carbon fiber.
Code: Select all
type = "recipe",
name = "carbon-fiber",
category = "organic",
subgroup = "agriculture-products",
order = "a[organic-products]-h[carbon-fiber]",
auto_recycle = false,
energy_required = 5,
enabled = false,
ingredients =
{
{type = "item", name = "yumako-mash", amount = 10},
{type = "item", name = "carbon", amount = 1}
},
results = {{type="item", name="carbon-fiber", amount=1}},
allow_productivity = true,
crafting_machine_tint =
{
primary = {r = 0.306, g = 0.643, b = 0.684, a = 1.000},
secondary = {r = 0.684, g = 0.684, b = 0.684, a = 1.000},
},
},
Code: Select all
local default_can_recycle = function(recipe)
if recipe.category == "recycling" then return end
-- Allow recipes to opt-out
if recipe.auto_recycle == false then return end
-- Disallow smelting and chemistry recipes
if recipe.subgroup == "empty-barrel" then return end
if recipe.category == "smelting" then return end
if recipe.category == "chemistry" then return end
if recipe.category == "chemistry-or-cryogenics" and recipe.name ~= "battery" then return end
if recipe.category == "crushing" then return end
local recycling_metallurgy = {["big-mining-drill"]=true, ["turbo-transport-belt"]=true, ["turbo-underground-belt"]=true, ["turbo-splitter"]=true}
if recipe.category == "metallurgy" and recycling_metallurgy[recipe.name] == nil then return end
if recipe.category == "organic" then return end
if recipe.category == "cryogenics" and recipe.name ~= "railgun-turret" and recipe.name ~= "railgun" and recipe.name ~= "cryogenic-plant" and recipe.name ~= "fusion-reactor" and recipe.name ~= "fusion-generator" then return end
if string.find(recipe.name, "science") and string.find(recipe.name, "pack") then return end
-- Items which go into T3 modules recycle into themselves
if recipe.name == "tungsten-carbide" then return end
if recipe.name == "superconductor" then return end
if recipe.name == "biolab" then return end
return true
end
Code: Select all
for name, recipe in pairs(data.raw.recipe) do
recycling.generate_recycling_recipe(recipe)
recipe.auto_recycle = nil
end