|
18 | 18 | script.on_event(defines.events.on_gui_opened, function(event)
|
19 | 19 | if event.gui_type ~= defines.gui_type.custom then return end
|
20 | 20 | if event.element.name ~= "fp_frame_main_dialog" then return end
|
21 |
| - game.print(event.element.name) |
| 21 | + local root = event.element |
22 | 22 |
|
23 |
| - -- log(print_gui.path_to_caption(event.element, 'fp.pu_product' , 'event.element')) -- event.element[2][2][1][1][1][1] |
24 |
| - -- log(print_gui.path_to_caption(event.element, 'fp.pu_byingredient', 'event.element')) -- event.element[2][2][1][2][1][1] |
25 |
| - -- log(print_gui.path_to_caption(event.element, 'fp.pu_ingredient' , 'event.element')) -- event.element[2][2][1][3][1][1] |
| 23 | + game.print(root.name .. ' @ ' .. event.tick) |
26 | 24 |
|
27 |
| - log(serpent.block({ |
28 |
| - products = get_item_box_contents(event.element, item_box_products), |
29 |
| - byproducts = get_item_box_contents(event.element, item_box_byproducts), |
30 |
| - ingredients = get_item_box_contents(event.element, item_box_ingredients), |
31 |
| - })) |
| 25 | + -- log(print_gui.path_to_caption(root, 'fp.pu_product' , 'root')) -- root.children[2].children[2].children[1].children[1].children[1].children[1] |
| 26 | + -- log(print_gui.path_to_caption(root, 'fp.pu_byproduct' , 'root')) -- root.children[2].children[2].children[1].children[2].children[1].children[1] |
| 27 | + -- log(print_gui.path_to_caption(root, 'fp.pu_ingredient', 'root')) -- root.children[2].children[2].children[1].children[3].children[1].children[1] |
| 28 | + |
| 29 | + -- log(print_gui.serpent( root )) |
| 30 | + -- log(print_gui.serpent( root.children[2].children[2].children[1] )) |
| 31 | + |
| 32 | + local ingredient_labels = root.children[2].children[2].children[1].children[item_box_products].children[1] |
| 33 | + if not ingredient_labels['ingredients_to_factorissimo'] then |
| 34 | + local button_factorissimo = ingredient_labels.add{ |
| 35 | + name = "ingredients_to_factorissimo", |
| 36 | + type = "sprite-button", |
| 37 | + sprite = "entity/fietff-container-1", |
| 38 | + tooltip = {"fp.ingredients_to_factorissimo_tt"}, |
| 39 | + mouse_button_filter = {"left"}, |
| 40 | + } |
| 41 | + button_factorissimo.style.size = 24 |
| 42 | + button_factorissimo.style.padding = -2 |
| 43 | + button_factorissimo.style.left_margin = 4 |
| 44 | + end |
| 45 | + |
| 46 | + log('products: ' .. serpent.line(get_item_box_contents(root, item_box_products))) |
| 47 | + log('byproducts: ' .. serpent.line(get_item_box_contents(root, item_box_byproducts))) |
| 48 | + log('ingredients: ' .. serpent.line(get_item_box_contents(root, item_box_ingredients))) |
32 | 49 | end)
|
0 commit comments