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

Place to get help with not working mods / modding interface.
Post Reply
matjojo
Filter Inserter
Filter Inserter
Posts: 337
Joined: Wed Jun 17, 2015 6:08 pm
Contact:

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

Post 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 1381 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

Attachments
data.lua
(1.52 KiB) Downloaded 40 times
Last edited by matjojo on Thu Sep 15, 2022 5:32 pm, edited 1 time in total.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2529
Joined: Fri Nov 06, 2015 7:41 pm

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

Post by Deadlock989 »

Your new assembler doesn't have any fluid boxes so it can't handle any recipes with a fluid in them.

matjojo
Filter Inserter
Filter Inserter
Posts: 337
Joined: Wed Jun 17, 2015 6:08 pm
Contact:

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

Post 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.

Post Reply

Return to “Modding help”