Page 1 of 1

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
by matjojo
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:
Screenshot from 2022-09-12 20-17-42.png
Screenshot from 2022-09-12 20-17-42.png (718.9 KiB) Viewed 1264 times
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


Re: recipe's "Made In" list empty when prototype explorer clearly shows recipe category matches machine's

Posted: Tue Sep 13, 2022 11:03 pm
by Deadlock989
Your new assembler doesn't have any fluid boxes so it can't handle any recipes with a fluid in them.

Re: Solved: recipe's "Made In" list empty when prototype explorer clearly shows recipe category matches machine's

Posted: Thu Sep 15, 2022 5:33 pm
by matjojo
Kinda annoyed since the wiki says nothing about this at all, but it did work, I had to add the

Code: Select all

fluid_boxes
and

Code: Select all

collision_box
fields for them to work.