Duplicating Blueprint Icon display .. Scaling Tables

Place to get help with not working mods / modding interface.
Post Reply
AenAllAin
Long Handed Inserter
Long Handed Inserter
Posts: 61
Joined: Sat Apr 02, 2016 3:10 am
Contact:

Duplicating Blueprint Icon display .. Scaling Tables

Post by AenAllAin »

I'm trying to make a button for a selected blueprint item and duplicate the icon appearance ...how can I do that?

Here is the code I am using at the moment, which works but not as desired:

Code: Select all

    if event.element.parent.name == "registry" then
        e_registry = event.element.parent
        e_schematic = event.element
...
        local l_inventory = global.blueprinter.inventory[ l_player.index ].get_inventory( defines.inventory.player_main )
...
        -- Update GUI
        for xi, xv in ipairs(e_registry.children_names) do
            local l_schematic = e_registry[xv]

            if l_schematic.icons then
                l_schematic.icons.destroy()
            end

            if l_inventory[xi] and l_inventory[xi].valid_for_read and
                l_inventory[xi].type == "blueprint" and l_inventory[xi].is_blueprint_setup()
            then
                local icon_quad = l_schematic.add{type="table", name="icons", colspan=2, style="slot_table_style"}
                for ik, iv in pairs(l_inventory[xi].blueprint_icons) do
                    icon_quad.add{type="button", name="icon_"..iv.name, style="bpr_gs_"..iv.name}
                end
            end
        end
Sadly, the table does not scale automatically to fit within the button (of course), nor does the button (again, of course) ...is there anyway to make them do so? Or alternatively, anyway to mimic the default GUIs blueprint icon behavior other than the brute-force method of mapping every case?

Post Reply

Return to “Modding help”