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

Incorrect expensive recycling recipes #83

Closed DRY411S closed 4 years ago

DRY411S commented 4 years ago

Where an item has an expensive recipe, the Recycling Machines are not generating the recycling recipes correctly. The normal recipe has ingredients = 0. Example:

["dry411srev-electronic-circuit"] = { category = "recycling-1", expensive = { energy_required = 0.5, hide_from_player_crafting = true, ingredients = { { "electronic-circuit", 1 } }, results = { { "iron-plate", 2 }, { "copper-cable", 8 } } }, group = "dry411srev-intermediate-products", hidden = false, icon = "__base__/graphics/icons/electronic-circuit.png", icon_size = 64, localised_name = { "recipe-name.recycledparts", { "item-name.electronic-circuit" } }, name = "dry411srev-electronic-circuit", normal = { energy_required = 0.5, hide_from_player_crafting = true, ingredients = { 0 }, results = { { "iron-plate", 1 }, { "copper-cable", 3 } } }, order = "e[electronic-circuit]", subgroup = "dry411srev-intermediate-product", type = "recipe" },

For recipes that have only 1 ingredient, the expensive recipe is being replaced by the normal recipe. For example:

["dry411srev-cobalt-steel-bearing-ball"] = { category = "recycling-1", expensive = { enabled = false, energy_required = 0.5, hide_from_player_crafting = true, ingredients = { { "cobalt-steel-bearing-ball", 12 } }, results = { { "cobalt-steel-alloy", 1 } } }, group = "dry411srev-bob-intermediate-products", hidden = false, icon = "__bobplates__/graphics/icons/cobalt-steel-bearing-ball.png", icon_size = 32, name = "dry411srev-cobalt-steel-bearing-ball", normal = { enabled = false, energy_required = 0.5, hide_from_player_crafting = true, ingredients = { 0 }, results = { { "cobalt-steel-alloy", 1 } } }, order = "bac[ball-bearing-cobalt-steel]", subgroup = "dry411srev-bob-bearings", type = "recipe" },

DRY411S commented 4 years ago

The electronic machines example above is confirmed NOT a bug. The .normal.ingredients = { 0 } is a POINTER to the .expensive.ingredients because they are the same.

HOWEVER for the cobalt-steel-bearing ball (part of bobplates mod) the ingredients should be different. 8 balls for the expensive recipe, 12 for the the normal.

This is quite a serious bug since the code assumes that the normal and expensive results in a game (which are then turned into the reverse recipe ingredients) are always the same. A large rewrite will be required.