DRY411S / Recycling-Machines

A factorio mod that adds Recycling Machines to the game. These disassemble products back into their original ingredients.
GNU General Public License v3.0
10 stars 2 forks source link

Error Loading Mod with Factorio 0.17.25 (bug with Power Armor Mk2 recycling) #56

Closed LucoEldritch closed 5 years ago

LucoEldritch commented 5 years ago

Mod Version: 0.17.6 Game Version: 0.17.25 (0.17.x branch) OS: Windows 10 64-bit Mods: Recycling Machine (I disabled everything else to confirm it would error alone) Bug Actual error (with emphasis mine):

Error loading mods Failed to load mods: Error while running setup for recipe prototype "dry411srev-power-armor-mk2" (recipe). Duplicate item products are not allowed (low-density-structure exists 2 or more times). image

I won't include repro steps 'cause it's basically enabling the mod.

Context Based on 0.17.25 changelog:

Recipes with duplicate ingredients or products will now error at startup instead breaking crafting runtime. https://forums.factorio.com/67857

From that, I suppose that trying to recycle Power Armor Mk2 would crash before 0.17.25. I remember recycling Power Armor Mk2 in 0.16.51, so if it wasn't working before, it's a problem only since 0.17 (which was expected, since the problem is with Low Density Structure, and the recipe changed in 0.17). I suppose no one found earlier because now they don't have durability, so why should anyone recycle it?

From what I know, your mod automagically add the recipes by using the parameters of the item, but reversing ingredients and products. Because of that, I thought the problem could actually be in the Power Armor Mk2 Recipe. I first tested normally with an Assembling Machine (see the link from the changelog for understanding what I expected), and it was OK. Then, I ran the command I found here: https://www.reddit.com/r/factorio/comments/72g4p7/export_recipe_data/ and it returned this (only showing the power-armor-mk2 recipe):

{
    ingredients =
    {
        {
            amount = 60,
            name = "processing-unit",
            type = "item"
        },
        {
            amount = 40,
            name = "electric-engine-unit",
            type = "item"
        },
        {
            amount = 30,
            name = "low-density-structure",
            type = "item"
        },
        {
            amount = 25,
            name = "speed-module-2",
            type = "item"
        },
        {
            amount = 25,
            name = "effectivity-module-2",
            type = "item"
        }
    },
    name = "power-armor-mk2",
    products =
    {
        {
            amount = 1,
            catalyst_amount = 0,
            name = "power-armor-mk2",
            type = "item"
        }
    }
}

And from that, looks like Low Density Structure is not duplicated, so I don't know what really happened :c . (edit: I double-checked in https://github.com/wube/factorio-data/blob/dc5c17d6719f3fb94fd55ce289a3d011379447e3/base/prototypes/recipe/recipe.lua#L286 )

DRY411S commented 5 years ago

What a comprehensive bug report, thank you. Low density structures have a stack size of 10. It's never been possible in factorio for an assembler to produce more than more than 1 stack of anything. Therefore when recycling the power armor mk2, ,the mod is producing 3 stacks of low density structure.

["dry411srev-power-armor-mk2"] = { category = "recycling-1", enabled = false, energy_required = 25, group = "dry411srev-combat", hidden = false, icon = "__base__/graphics/icons/power-armor-mk2.png", icon_size = 32, ingredients = { { "power-armor-mk2", 1 } }, localised_name = { "recipe-name.recycledparts", { "item-name.power-armor-mk2" } }, name = "dry411srev-power-armor-mk2", order = "e[power-armor-mk2]", results = { { "effectivity-module-2", 25 }, { "speed-module-2", 25 }, { "processing-unit", 60 }, { "electric-engine-unit", 40 }, { "low-density-structure", 10 }, { "low-density-structure", 10 }, { "low-density-structure", 10 } }, subgroup = "dry411srev-armor", type = "recipe" },

It would appear that with 0.17.25, that is no longer possible.

DRY411S commented 5 years ago

From the topic that you've linked on the forums, it looks as though the 'fix' will be backed out of the factorio product.

LucoEldritch commented 5 years ago

Somehow I missed the part where in this case, it's not the ingredients, it's the results, woops. And thanks for the explanation!

Anyway, I saw your comments/the rest of the discussion on the forums now, glad it'll be fixed.

DRY411S commented 5 years ago

I missed it too. Fingers crossed the Devs will back their change out. The forum topic suggests they will.

DRY411S commented 5 years ago

Factorio 0.17.26 has been released, and this issue is now longer present in the mod. Therefore to remove the issue, upgrade factorio.