From 9a2778eabc7ba968968e41dda9f03525d6c5383d Mon Sep 17 00:00:00 2001 From: BobTheBob <32057864+BobTheBob9@users.noreply.github.com> Date: Thu, 14 Oct 2021 21:01:40 +0100 Subject: oh fuck i forgot to commit for a while --- .../mod/scripts/vscripts/lobby/_private_lobby.gnut | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut') diff --git a/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut b/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut index 60daa4528..63b2c81ac 100644 --- a/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut +++ b/Northstar.CustomServers/mod/scripts/vscripts/lobby/_private_lobby.gnut @@ -13,6 +13,11 @@ void function PrivateLobby_Init() print( "PrivateLobby_Init()" ) //ClearPlaylistVarOverrides() + file.map = GetConVarString( "ns_private_match_last_map" ) + file.mode = GetConVarString( "ns_private_match_last_mode" ) + + thread SetupPrivateMatchUIVarsWhenReady() + AddClientCommandCallback( "PrivateMatchLaunch", ClientCommandCallback_PrivateMatchLaunch ) AddClientCommandCallback( "PrivateMatchSetMode", ClientCommandCallback_PrivateMatchSetMode ) AddClientCommandCallback( "SetCustomMap", ClientCommandCallback_SetCustomMap ) @@ -22,6 +27,14 @@ void function PrivateLobby_Init() AddClientCommandCallback( "ResetMatchSettingsToDefault", ClientCommandCallback_ResetMatchSettingsToDefault ) } +void function SetupPrivateMatchUIVarsWhenReady() +{ + // have to wait until end of first frame for SetUIVar to work + WaitEndFrame() + SetUIVar( level, "privatematch_map", GetPrivateMatchMapIndex( file.map ) ) + SetUIVar( level, "privatematch_mode", GetPrivateMatchModeIndex( file.mode ) ) +} + bool function ClientCommandCallback_PrivateMatchLaunch( entity player, array args ) { if ( file.startState == ePrivateMatchStartState.STARTING ) @@ -127,6 +140,8 @@ void function StartMatch() RefreshPlayerTeams() + SetConVarString( "ns_private_match_last_map", file.map ) + SetConVarString( "ns_private_match_last_mode", file.mode ) SetConVarBool( "ns_should_return_to_lobby", true ) // potentially temp? // TEMP for now: start game -- cgit v1.2.3