diff --git a/crates/hud/src/menus/mod.rs b/crates/hud/src/menus/mod.rs index 26e2689..af28515 100644 --- a/crates/hud/src/menus/mod.rs +++ b/crates/hud/src/menus/mod.rs @@ -789,6 +789,20 @@ fn flush_outputs(menus: &mut ScriptMenus, out: &mut MenuOutputs, local: sim::Cli diag::info!(Ui, "menu exec: {text}"); out.exec.write(UiExecCommand { text }); } + let private_host = out.dvars.get("ui_lobby_host") == Some("1") + && out.dvars.get("ui_lobby_public") != Some("1"); + menus.responses.retain(|(menu, response)| { + let end_game = menu.eq_ignore_ascii_case("popup_endgame") + || menu.eq_ignore_ascii_case("popup_endgame_ranked"); + if !end_game || !response.eq_ignore_ascii_case("endround") || private_host { + return true; + } + diag::info!(Ui, "menu exec: disconnect"); + out.exec.write(UiExecCommand { + text: "disconnect".into(), + }); + false + }); let (Some(inbox), Some(ids)) = (out.inbox.as_mut(), out.ids.as_mut()) else { menus.responses.clear(); return; diff --git a/crates/ui/src/menu.rs b/crates/ui/src/menu.rs index 6359205..f37912a 100644 --- a/crates/ui/src/menu.rs +++ b/crates/ui/src/menu.rs @@ -116,7 +116,7 @@ pub fn install_frontend_menus(catalog: &mut asset_game::MenuCatalog) -> Result<( for item in &mut menu.items { if item.name == "button_yes" { item.handlers.action = vec![asset_game::MenuEvent::Script( - "play mouse_click; close self; exec \"disconnect\";".into(), + "play mouse_click; close self; scriptmenuresponse \"endround\";".into(), )]; } } diff --git a/docs/GSC-RUNTIME.md b/docs/GSC-RUNTIME.md index dcb37a1..4ed8a27 100644 --- a/docs/GSC-RUNTIME.md +++ b/docs/GSC-RUNTIME.md @@ -373,9 +373,9 @@ record is imported or initialized. ## Remaining A live bomb plant/defuse check. Native IW4L menus can create a private lobby, -select a map/mode and start a match. When the match scripts end it, the host -returns to the same private lobby with map, mode and rules kept, as it does when -the map fails to load. A disconnect, including End Game from the pause menu, +select a map/mode and start a match. When the match scripts end it, or the host +picks End Game from the pause menu, the host returns to the same private lobby with +map, mode and rules kept, as it does when the map fails to load. A disconnect returns to the main menu. Browser/public-lobby actions are connected but still need multiplayer validation. Display mode/resolution, brightness, volume, VSync, shadows, depth of field and bloom are bound to runtime settings and persisted locally. Surround output, voice/chat