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
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
require("language")
|
||||
require("background_effects")
|
||||
require("pausequit")
|
||||
|
||||
if game:issingleplayer() then
|
||||
require("sp_unlockall")
|
||||
|
32
data/cdata/ui_scripts/patches/pausequit.lua
Normal file
32
data/cdata/ui_scripts/patches/pausequit.lua
Normal file
@ -0,0 +1,32 @@
|
||||
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
|
Reference in New Issue
Block a user