Hi, thanks for keeping this mod alive on 2.1!
Full disclosure: this bug was found by Claude (Anthropic's AI assistant), which I've been using to locally patch mods that aren't maintained for 2.1 anymore. While reviewing your fork against the original, it spotted the issue below. I checked the explanation and the patch, but the analysis is the AI's, not mine.
Cause
In Factorio 2.1, RecipePrototype::category and additional_categories were merged into categories (array). You already updated the mod's own recipes to categories, but the complexity calculation still reads recipe.category, which is now always nil for vanilla and modded 2.1 recipes:
- line 90:
shared.array_contains(excluded_recipe_categories, recipe.category)
- lines 690–691:
recipe_category_multiplier[recipe.category]
Effect
No crash, but upgrade costs are calculated differently than intended:
- recycling recipes (recycling category) are no longer excluded from the recipe graph,
- the smelting x2 multiplier is never applied, so smelted items are cheaper to upgrade.
Suggested fix
A small helper that reads both the 2.1 and the old format:
local function get_recipe_categories(recipe)
if recipe.categories then return recipe.categories end
if recipe.category then return {recipe.category} end
return {"crafting"}
end
local function has_excluded_category(recipe)
for _, category in pairs(get_recipe_categories(recipe)) do
if shared.array_contains(excluded_recipe_categories, category) then return true end
end
return false
end
local function get_category_multiplier(recipe)
local multiplier = 1
for _, category in pairs(get_recipe_categories(recipe)) do
local m = recipe_category_multiplier[category]
if m ~= nil and m > multiplier then multiplier = m end
end
return multiplier
end
Then line 90 becomes if has_excluded_category(recipe) then and lines 689–692 become local multiplier = get_category_multiplier(recipe).
I'm running this patch locally and it loads fine.
Minor side note: loot recipe collection is commented out in processing_recipes.lua (lines 58–63), so loot-only items fall back to the fallback complexity. Not sure if that's intentional.