Solved: recipe's "Made In" list empty when prototype explorer clearly shows recipe category matches machine's
Posted: Mon Sep 12, 2022 6:43 pm
When I change the recipe category for the processing unit recipe to "crafting-with-fluid-phantom-machine", create that category, and then create a new assembler that can craft that category, the "made in" list at the bottom of the recipe stays empty, it does make the header of the list, but does not populate it.
Screenshot of the issue: Some notes:
- It looks like this happens when the recipe has a fluid ingredient.
- This recipe normally does have a "made in" list, which is populated in vanilla with the 2nd and 3rd assembler.
- Usually when a recipe has no "made in" list the header isn't added to the GUI, in this case, as visible in the screenshot, it is added.
This happened in a larger mod, but I made a 50 line reproduction: (Also attached as file)
Screenshot of the issue: Some notes:
- It looks like this happens when the recipe has a fluid ingredient.
- This recipe normally does have a "made in" list, which is populated in vanilla with the 2nd and 3rd assembler.
- Usually when a recipe has no "made in" list the header isn't added to the GUI, in this case, as visible in the screenshot, it is added.
This happened in a larger mod, but I made a 50 line reproduction: (Also attached as file)
Code: Select all
local function copy_icon_specification_from_rhs(lhs, rhs)
if rhs.icons then -- `icons` takes precdence over `icon`
lhs.icons = rhs.icons
lhs.icon_size = rhs.icon_size
lhs.icon_mipmaps = rhs.icon_mipmaps
return true
end
if rhs.icon then
lhs.icon = rhs.icon
lhs.icon_size = rhs.icon_size
lhs.icon_mipmaps = rhs.icon_mipmaps
return true
end
return false
end
local function map(t, f)
-- TODO: Make this into an iterable somehow
local res = {}
for _, v in pairs(t) do
table.insert(res, f(v))
end
return res
end
local assembler = data.raw["assembling-machine"]["assembling-machine-3"]
local new_assembler = {
type = assembler.type,
name = assembler.name .. "-new-assembler",
crafting_categories = map(assembler.crafting_categories, function(e) return e .. "-phantom-machine" end),
energy_usage = assembler.energy_usage,
crafting_speed = assembler.crafting_speed,
energy_source = assembler.energy_source,
source_inventory_size = assembler.source_inventory_size,
result_inventory_size = assembler.result_inventory_size,
}
copy_icon_specification_from_rhs(new_assembler, assembler)
data.raw["recipe"]["processing-unit"].category = data.raw["recipe"]["processing-unit"].category .. "-phantom-machine"
data:extend{new_assembler}
for _, v in pairs(assembler.crafting_categories) do
data:extend({
{
type = "recipe-category",
name = v .. "-phantom-machine"
}
})
end