diff --git a/Northstar.Client/mod.json b/Northstar.Client/mod.json index 8040c14c4..a2a1fa146 100644 --- a/Northstar.Client/mod.json +++ b/Northstar.Client/mod.json @@ -5,6 +5,12 @@ "LoadPriority": 0, "InitScript": "cl_northstar_client_init.nut", "ConVars": [ + { + "Name": "ns_max_load_time", + "DefaultValue": "30", + "HelpString": "Amount of time (in seconds) until a loading screen returns to menu", + "Flags": "ARCHIVE_PLAYERPROFILE" + }, { "Name": "filter_hide_empty", "DefaultValue": "0" diff --git a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt index 5dabd5398..788e127b3 100644 Binary files a/Northstar.Client/mod/resource/northstar_client_localisation_english.txt and b/Northstar.Client/mod/resource/northstar_client_localisation_english.txt differ diff --git a/Northstar.Client/mod/scripts/vscripts/ui/_menus.nut b/Northstar.Client/mod/scripts/vscripts/ui/_menus.nut index c83381fdb..dfe0ce4ea 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/_menus.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/_menus.nut @@ -178,6 +178,23 @@ void function UICodeCallback_ToggleInGameMenu() } } + +void function TimeoutHandler() +{ + //Singleplayer "Continue" counts as finished loading and shouldn't be affected + EndSignal( uiGlobal.signalDummy, "LevelShutdown" ) // Cancels thread if map is unloaded + + float maxLoadTime = GetConVarFloat( "ns_max_load_time" ) + wait maxLoadTime + if ( uiGlobal.isLoading && IsConnected() ) //Disconnects client specified amount of time ( Default 30 seconds ) + { + printt( format( "TimeoutHandler disconnected because loading took too long (%f seconds)", maxLoadTime ) ) + UICodeCallback_LevelLoadingFinished( true ) //Removes loading screen + Disconnect() // Loads menu + OpenErrorDialog( format( Localize( "#MAX_LOAD_ERROR" ), maxLoadTime ) ) //Opens error dialog to notify user + } +} + // Return true to show load screen, false to not show load screen. // levelname can be "" because the level to load isn't always known when the load screen starts bool function UICodeCallback_LevelLoadingStarted( string levelname ) @@ -204,7 +221,7 @@ bool function UICodeCallback_LevelLoadingStarted( string levelname ) if ( !Console_IsSignedIn() ) return false #endif - + thread TimeoutHandler() return true } diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_mod_settings.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_mod_settings.nut index a45082c71..a97d728a2 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_mod_settings.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_mod_settings.nut @@ -82,6 +82,10 @@ struct { void function AddModSettingsMenu() { AddMenu( "ModSettings", $"resource/ui/menus/mod_settings.menu", InitModMenu ) + + AddModTitle( "^656dce00Northstar.Client" ) + AddModCategory( "#STATS_MISC" ) + ModSettings_AddSetting( "ns_max_load_time", "#MAX_LOAD", "float" ) } void function InitModMenu() @@ -445,7 +449,7 @@ void function UpdateList() } file.updatingList = false - if ( file.conVarList.len() <= 0 ) + if ( file.conVarList.len() <= 6 ) { Hud_SetVisible( Hud_GetChild( file.menu, "NoResultLabel" ), true ) Hud_SetText( Hud_GetChild( file.menu, "NoResultLabel" ), "#NO_MODS" ) @@ -949,6 +953,7 @@ void function SendTextPanelChanges( var textPanel ) ThrowInvalidValue( "This setting is an integer, and only accepts whole numbers." ) Hud_SetText( textPanel, GetConVarString( c.conVar ) ) } + break case "bool": if ( newSetting != "0" && newSetting != "1" ) {