Duplicating Blueprint Icon display .. Scaling Tables
Posted: Wed May 18, 2016 11:02 pm
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:
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?
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