diff --git a/cybersyn/prototypes/gui-style.lua b/cybersyn/prototypes/gui-style.lua index e0657da..b579675 100644 --- a/cybersyn/prototypes/gui-style.lua +++ b/cybersyn/prototypes/gui-style.lua @@ -360,30 +360,35 @@ styles.ltnm_tabbed_pane = { }, } -data:extend({ - -- custom inputs - --{ - -- type = "custom-input", - -- name = "cybersyn-toggle-gui", - -- key_sequence = "CONTROL + T", - --}, - --{ - -- type = "custom-input", - -- name = "ltnm-linked-focus-search", - -- key_sequence = "", - -- linked_game_control = "focus-search", - --}, - -- shortcuts - { - type = "shortcut", - name = "cybersyn-toggle-gui", - icon = data_util.build_sprite(nil, { 0, 0 }, util.paths.shortcut_icons, 32, 2), - disabled_icon = data_util.build_sprite(nil, { 48, 0 }, util.paths.shortcut_icons, 32, 2), - small_icon = data_util.build_sprite(nil, { 0, 32 }, util.paths.shortcut_icons, 24, 2), - disabled_small_icon = data_util.build_sprite(nil, { 36, 32 }, util.paths.shortcut_icons, 24, 2), - toggleable = true, - action = "lua", - --associated_control_input = "cybersyn-toggle-gui", - technology_to_unlock = "cybersyn-train-network", - }, -}) +if settings.startup["cybersyn-manager-enabled"].value then + + data:extend({ + -- custom inputs + { + type = "custom-input", + name = "cybersyn-toggle-gui", + key_sequence = "CONTROL + T", + action = "lua", + }, + --{ + -- type = "custom-input", + -- name = "ltnm-linked-focus-search", + -- key_sequence = "", + -- linked_game_control = "focus-search", + --}, + -- shortcuts + { + type = "shortcut", + name = "cybersyn-toggle-gui", + icon = data_util.build_sprite(nil, { 0, 0 }, util.paths.shortcut_icons, 32, 2), + disabled_icon = data_util.build_sprite(nil, { 48, 0 }, util.paths.shortcut_icons, 32, 2), + small_icon = data_util.build_sprite(nil, { 0, 32 }, util.paths.shortcut_icons, 24, 2), + disabled_small_icon = data_util.build_sprite(nil, { 36, 32 }, util.paths.shortcut_icons, 24, 2), + toggleable = true, + action = "lua", + associated_control_input = "cybersyn-toggle-gui", + technology_to_unlock = "cybersyn-train-network", + }, + }) + +end diff --git a/cybersyn/scripts/gui/main.lua b/cybersyn/scripts/gui/main.lua index 8c8cd4a..7992002 100644 --- a/cybersyn/scripts/gui/main.lua +++ b/cybersyn/scripts/gui/main.lua @@ -47,7 +47,7 @@ end local manager_gui = {} function manager_gui.on_lua_shortcut(e) - if e.prototype_name == "cybersyn-toggle-gui" then + if e.prototype_name == "cybersyn-toggle-gui" or e.input_name == "cybersyn-toggle-gui" then manager.wrapper(e, manager.handle.manager_toggle) end end diff --git a/cybersyn/scripts/main.lua b/cybersyn/scripts/main.lua index 326aae7..869dcdc 100644 --- a/cybersyn/scripts/main.lua +++ b/cybersyn/scripts/main.lua @@ -954,6 +954,7 @@ local function main() script.on_event(defines.events.on_player_removed, manager.on_player_removed) script.on_event(defines.events.on_player_created, manager.on_player_created) script.on_event(defines.events.on_lua_shortcut, manager.on_lua_shortcut) + script.on_event("cybersyn-toggle-gui", manager.on_lua_shortcut) -- TODO: rework this to work as a per-player runtime setting script.on_nth_tick(mod_settings.manager_update_rate, function() manager.tick(global)