Bind the on_gui_closed event for manager_window

This commit is contained in:
Will Berry
2023-04-03 15:16:24 -04:00
parent 9f9477bffa
commit 7c61dcff18
3 changed files with 10 additions and 1 deletions

View File

@@ -370,6 +370,14 @@ if settings.startup["cybersyn-manager-enabled"].value then
key_sequence = "CONTROL + T",
action = "lua",
},
{
type = "custom-input",
name = "cybersyn-manager-confirm-gui",
key_sequence = "",
action = "lua",
linked_game_control = "confirm-gui"
},
-- TODO: bind this input to focusing on the station_name box
--{
-- type = "custom-input",
-- name = "ltnm-linked-focus-search",

View File

@@ -47,7 +47,7 @@ end
local manager_gui = {}
function manager_gui.on_lua_shortcut(e)
if e.prototype_name == "cybersyn-toggle-gui" or e.input_name == "cybersyn-toggle-gui" then
if e.prototype_name == "cybersyn-toggle-gui" or e.input_name == "cybersyn-toggle-gui" or e.element.name == "manager_window" then
manager.wrapper(e, manager.handle.manager_toggle)
end
end

View File

@@ -955,6 +955,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(defines.events.on_gui_closed, manager.on_lua_shortcut)
script.on_event("cybersyn-toggle-gui", manager.on_lua_shortcut)
end