h1-mod/data/cdata/ui_scripts/patches/pausequit.lua
Vlad Loktionov bf2d533ac5
Add "Quit to desktop" button in pause menu (#558)
* Add "Quit to desktop" button in pause menu

* classes & custom_weapons: fix for SP

* "Quit to desktop" button for MP
2023-04-03 08:59:10 -05:00

33 lines
964 B
Lua

if (Engine.InFrontend()) then
return
end
if game:issingleplayer() and Engine.GetDvarString("mapname") == "coup" then
LUI.onmenuopen("sp_pause_menu", function(element)
local menu = element:getFirstChild()
menu:AddButton("@MENU_SP_SKIP_MISSION", function()
Engine.Exec("map blackout")
end)
end)
end
if game:issingleplayer() then
LUI.onmenuopen("sp_pause_menu", function(element)
local menu = element:getFirstChild()
menu:AddButton("@MENU_QUIT_TO_DESKTOP", function()
LUI.FlowManager.RequestAddMenu(nil, "quit_popmenu")
end)
end)
end
if not game:issingleplayer() then
local quitToDesktop = function()
LUI.FlowManager.RequestAddMenu(nil, "quit_popmenu")
end
local addQuitButton = function(element)
local menu = element
menu:AddButton("@MENU_QUIT_TO_DESKTOP", quitToDesktop)
end
LUI.onmenuopen("mp_pause_menu", addQuitButton)
end