Can you add support for the GUI-unifier mod?
https://mods.factorio.com/mod/GUI_Unifyer
My quickbar is getting full :|
Just add a button via the mod-gui like
local mod_gui = require("mod-gui")
in your control.lua and add the button like
local function create_gui_button(player)
local button_flow = mod_gui.get_button_flow(player)
if not button_flow.calcui_gui_button then
button_flow.add({
type = "sprite-button",
name = "calcui_gui_button",
sprite = "sprite_calcui_calculator",
tooltip = {"calculator-ui.title"}
})
end
end
Then register the events
script.on_init(function()
for _, player in pairs(game.players) do
create_gui_button(player)
end
end)
script.on_configuration_changed(function()
for _, player in pairs(game.players) do
create_gui_button(player)
end
end)
script.on_event(defines.events.on_player_created, function(event)
create_gui_button(game.players[event.player_index])
end)
and in your on_gui_click() event add
if event_name == "calcui_gui_button" then
toggle_calculator(player)
return
end
This alone won't add it to the unifier mod but it enables the integration by the author. I will ask him to add the button and also to add a public function for create_icon_entry() so other mods can add their butttons easily. Thanks in advance.