From 2735d8c151fe507b2948dd815d3ae9876d74bd70 Mon Sep 17 00:00:00 2001 From: Patrick 'Quezler' Mounier Date: Sat, 13 Jan 2024 17:37:43 +0100 Subject: [PATCH] Remote view compat + get machine count + get factory name --- .../README.md | 7 +++++-- .../control.lua | 19 ++++++++++++++++--- .../info.json | 5 +++-- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/mods/factoryplanner-is-exportable-to-fake-factorissimo/README.md b/mods/factoryplanner-is-exportable-to-fake-factorissimo/README.md index 85e25b76..7471a48f 100644 --- a/mods/factoryplanner-is-exportable-to-fake-factorissimo/README.md +++ b/mods/factoryplanner-is-exportable-to-fake-factorissimo/README.md @@ -32,7 +32,10 @@ It falls to the player to use common sense, and to not simulate an entire SPM fa Well as you can see my data stage mod failed due to complexity reasons, easier to let another mod do the work, i just read the finished result from the gui. -# licences +# credits -- the files under `./graphics/` and their prototype defintions are MIT licenced to MagmaMcFry (original author) and notnotmelon (fork maintainer) +- `./graphics/factory/*` and their prototype defintions are MIT licenced to MagmaMcFry (original author) and notnotmelon (fork maintainer) +- `./graphics/icon/*` and their prototype defintions are MIT licenced to MagmaMcFry (original author) and notnotmelon (fork maintainer) - parts of the control script (e.g. the `ingredients_to_factorissimo` button style/construction) come from Therenas's MIT licenced Factory Planner mod +- the thumbnail is part of a frame from a rick and morty episode about the car battery +- the power panel above the factory archways is a sprite from among us diff --git a/mods/factoryplanner-is-exportable-to-fake-factorissimo/control.lua b/mods/factoryplanner-is-exportable-to-fake-factorissimo/control.lua index 7953c96f..93e46de1 100644 --- a/mods/factoryplanner-is-exportable-to-fake-factorissimo/control.lua +++ b/mods/factoryplanner-is-exportable-to-fake-factorissimo/control.lua @@ -56,7 +56,11 @@ script.on_event(defines.events.on_gui_opened, function(event) -- game.print(root.name .. ' @ ' .. event.tick) - -- log(print_gui.serpent( root )) + -- log(print_gui.serpent( root.children[2].children[1].children[1].children[2] )) + -- local factories = root.children[2].children[1].children[1].children[2].children + -- local factory_name = active_radio_button(factories).caption[3] + -- log(factory_name) + -- log(print_gui.serpent( root.children[2].children[1].children[2].children[3].children[1].children[3] )) -- log(print_gui.path_to_tooltip(root, 'fp.timescale_tt', 'root')) @@ -98,9 +102,13 @@ script.on_event(defines.events.on_gui_click, function(event) log('byproducts: ' .. serpent.line(byproducts)) log('ingredients: ' .. serpent.line(ingredients)) + -- todo: check if products can be barreled + -- todo: check if byproducts can be barreled + -- todo: check if ingredients can be unbarreled + if #ingredients == 0 then return player.create_local_flying_text{ - text = "No ingredients defined at all.", + text = "No ingredients defined at all.", -- a check whether a factory is selected "should" come first, but who has none? create_at_cursor = true, } end @@ -138,6 +146,7 @@ script.on_event(defines.events.on_gui_click, function(event) local recipe_class, recipe_name = split_class_and_name(table.children[offset + columns['fp.pu_recipe']].children[2].sprite) local machine_class, machine_name = split_class_and_name(table.children[offset + columns['fp.pu_machine']].children[1].sprite) + local machine_count = math.ceil(table.children[offset + columns['fp.pu_machine']].children[1].number) local modules = {} for i = 2, #table.children[offset + columns['fp.pu_machine']].children do @@ -148,7 +157,7 @@ script.on_event(defines.events.on_gui_click, function(event) end end - log(serpent.line({recipe_name, machine_name, modules})) + log(serpent.line({recipe_name, machine_count .. 'x ' .. machine_name, modules})) if #table.children[offset + columns['fp.pu_beacon']].children > 1 then -- 1 = supports beacons, 2+ = beacon and module(s) selected return player.create_local_flying_text{ @@ -173,6 +182,10 @@ script.on_event(defines.events.on_gui_click, function(event) } end + local factories = root.children[2].children[1].children[1].children[2].children + local factory_name = active_radio_button(factories).caption[3] + log(factory_name) + local energy_amount = tonumber(root.children[2].children[1].children[2].children[1].children[3].children[1].tooltip[2]) local energy_prefix = root.children[2].children[1].children[2].children[1].children[3].children[1].tooltip[3][1] -- k/m/w (watt) log(energy_amount * prefix_to_multiplier(energy_prefix)) -- /60 = number to put into electric energy interface usage (* for buffer) diff --git a/mods/factoryplanner-is-exportable-to-fake-factorissimo/info.json b/mods/factoryplanner-is-exportable-to-fake-factorissimo/info.json index ffb7f227..17524abb 100644 --- a/mods/factoryplanner-is-exportable-to-fake-factorissimo/info.json +++ b/mods/factoryplanner-is-exportable-to-fake-factorissimo/info.json @@ -2,10 +2,11 @@ "name": "factoryplanner-is-exportable-to-fake-factorissimo", "title": "Factory Planner - exportable to fake factorissimo", "description": "Skips the building stage, just feed items into the magic box.", - "version": "0.0.12", + "version": "0.0.13", "author": "Quezler", "factorio_version": "1.1", "dependencies": [ - "factoryplanner" + "factoryplanner", + "(?) space-exploration" ] }