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:
Vlad Loktionov
2023-04-03 16:59:10 +03:00
committed by GitHub
parent 839269c54e
commit bf2d533ac5
16 changed files with 49 additions and 4 deletions

View File

@ -1,4 +1,4 @@
if (Engine.InFrontend()) then
if game:issingleplayer() or (Engine.InFrontend()) then
return
end

View File

@ -1,4 +1,4 @@
if (not Engine.InFrontend()) then
if game:issingleplayer() or (not Engine.InFrontend()) then
return
end

View File

@ -1,5 +1,6 @@
require("language")
require("background_effects")
require("pausequit")
if game:issingleplayer() then
require("sp_unlockall")

View 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