diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-05-08 23:41:38 +0100 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2022-05-08 23:41:38 +0100 |
commit | 89e189d5e752dd5b83a3c7b30fcbc8a1d5686c67 (patch) | |
tree | 7c9e286515ec8298e9bfad86399b6060e41ccde1 /Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut | |
parent | 468e778066c0e79a5417c8923e640ebaf7c7528c (diff) | |
download | NorthstarMods-89e189d5e752dd5b83a3c7b30fcbc8a1d5686c67.tar.gz NorthstarMods-89e189d5e752dd5b83a3c7b30fcbc8a1d5686c67.zip |
more reliable reload => connect logicbetter-reload-mods-connect-timing-pr
Diffstat (limited to 'Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut')
-rw-r--r-- | Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut index ce52c5fb..6899e535 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut @@ -99,6 +99,20 @@ bool function floatCompareInRange(float arg1, float arg2, float tolerance) void function AddNorthstarServerBrowserMenu() { AddMenu( "ServerBrowserMenu", $"resource/ui/menus/server_browser.menu", InitServerBrowserMenu, "#MENU_SERVER_BROWSER" ) + + // if we're reloading mods for a connect, then we've just finished reloading mods since ui has reset + // so start trying to connect + if ( GetConVarBool( "ns_try_connect_server_on_ui_reload" ) && NSWasAuthSuccessful() ) + { + try + { + NSConnectToAuthedServer() + } + catch ( ex ) + {} + } + + SetConVarBool( "ns_try_connect_server_on_ui_reload", false ) } void function UpdatePrivateMatchModesAndMaps() @@ -1021,7 +1035,7 @@ void function ThreadedAuthAndConnectToServer( string password = "" ) } } - DelayedReloadModsAndConnect( modsChanged ) + TryReloadModsAndConnect( modsChanged ) } else { @@ -1041,16 +1055,16 @@ void function ThreadedAuthAndConnectToServer( string password = "" ) } } -void function DelayedReloadModsAndConnect( bool modsChanged ) +void function TryReloadModsAndConnect( bool modsChanged ) { // only actually reload if we need to since the uiscript reset on reload lags hard if ( modsChanged ) { ReloadMods() - wait 0.25 + SetConVarBool( "ns_try_connect_server_on_ui_reload", true ) // don't connect, instead connect when uiscript has reloaded in the init func for this file } - - NSConnectToAuthedServer() + else + NSConnectToAuthedServer() } ////////////////////////////////////// |