diff options
Diffstat (limited to 'Northstar.Client/mod/scripts/vscripts/ui')
3 files changed, 62 insertions, 10 deletions
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut index 588fe705..ce117546 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_modmenu.nut @@ -1,5 +1,6 @@ global function AddNorthstarModMenu global function AddNorthstarModMenu_MainMenuFooter +global function ReloadMods struct { bool shouldReloadModsOnEnd @@ -147,7 +148,7 @@ void function ReloadMods() NSReloadMods() ClientCommand( "reload_localization" ) ClientCommand( "loadPlaylists" ) - // ClientCommand( "weapon_reparse" ) // this doesn't work, weapon_reparse only works if a server is running and sv_cheats is 1, gotta figure this out eventually + ClientCommand( "sv_cheats 1; weapon_reparse; sv_cheats 0" ) // weapon_reparse only works if a server is running and sv_cheats is 1, gotta figure this out eventually // note: the logic for this seems really odd, unsure why it doesn't seem to update, since the same code seems to get run irregardless of whether we've read weapon data before ClientCommand( "uiscript_reset" ) }
\ No newline at end of file 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 121de614..29c1f81a 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut @@ -161,7 +161,11 @@ string function FormatServerDescription( int server ) ret += NSGetServerName( server ) + "\n" ret += format( "%i/%i players\n", NSGetServerPlayerCount( server ), NSGetServerMaxPlayerCount( server ) ) - ret += NSGetServerDescription( server ) + "\n" + ret += NSGetServerDescription( server ) + "\n\n" + + ret += "Required Mods: \n" + for ( int i = 0; i < NSGetServerRequiredModsCount( server ); i++ ) + ret += " " + NSGetServerRequiredModName( server, i ) + " v" + NSGetServerRequiredModVersion( server, i ) + "\n" return ret } @@ -170,6 +174,36 @@ void function OnServerSelected( var button ) { if ( NSIsRequestingServerList() || !NSMasterServerConnectionSuccessful() ) return + + int server = int( Hud_GetScriptID( button ) ) + + // check mods + for ( int i = 0; i < NSGetServerRequiredModsCount( server ); i++ ) + { + if ( !NSGetModNames().contains( NSGetServerRequiredModName( server, i ) ) ) + { + DialogData dialogData + dialogData.header = "#ERROR" + dialogData.message = "Missing mod \"" + NSGetServerRequiredModName( server, i ) + "\" v" + NSGetServerRequiredModVersion( server, i ) + dialogData.image = $"ui/menu/common/dialog_error" + + #if PC_PROG + AddDialogButton( dialogData, "#DISMISS" ) + + AddDialogFooter( dialogData, "#A_BUTTON_SELECT" ) + #endif // PC_PROG + AddDialogFooter( dialogData, "#B_BUTTON_DISMISS_RUI" ) + + OpenDialog( dialogData ) + + return + } + else + { + string modVersion = NSGetServerRequiredModVersion( server, i ) + // check this is sorta valid semver, d + } + } var menu = GetMenu( "ServerBrowserMenu" ) int serverIndex = file.page * BUTTONS_PER_PAGE + int ( Hud_GetScriptID( button ) ) @@ -194,11 +228,22 @@ void function ThreadedAuthAndConnectToServer( string password = "" ) WaitFrame() if ( NSWasAuthSuccessful() ) - NSConnectToAuthedServer() - else { - print( "fuck" ) + array<string> requiredMods + for ( int i = 0; i < NSGetServerRequiredModsCount( file.lastSelectedServer ); i++ ) + requiredMods.append( NSGetServerRequiredModName( file.lastSelectedServer, i ) ) + // unload mods we don't need, load necessary ones and reload mods before connecting + foreach ( string mod in NSGetModNames() ) + if ( NSIsModRequiredOnClient( mod ) ) + NSSetModEnabled( mod, requiredMods.contains( mod ) ) + + ReloadMods() + + NSConnectToAuthedServer() + } + else + { DialogData dialogData dialogData.header = "#ERROR" dialogData.message = "Authentication Failed" diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut index 41721455..2c07ef71 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_private_match.nut @@ -264,9 +264,12 @@ void function SetupComboButtons( var menu, var navUpButton, var navDownButton ) file.matchSettingsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_MATCH_SETTINGS" ) Hud_AddEventHandler( file.matchSettingsButton, UIE_CLICK, OnSelectMatchSettings_Activate ) - var friendsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_FRIENDS" ) - file.inviteFriendsButton = friendsButton - Hud_AddEventHandler( friendsButton, UIE_CLICK, InviteFriendsIfAllowed ) + if ( !IsNorthstarServer() ) + { + var friendsButton = AddComboButton( comboStruct, headerIndex, buttonIndex++, "#MENU_TITLE_INVITE_FRIENDS" ) + file.inviteFriendsButton = friendsButton + Hud_AddEventHandler( friendsButton, UIE_CLICK, InviteFriendsIfAllowed ) + } headerIndex++ buttonIndex = 0 @@ -562,14 +565,17 @@ function UpdatePrivateMatchButtons() Hud_SetLocked( file.selectMapButton, true ) Hud_SetLocked( file.selectModeButton, true ) Hud_SetLocked( file.matchSettingsButton, true ) - Hud_SetLocked( file.inviteFriendsButton, true ) + + if ( !IsNorthstarServer() ) + Hud_SetLocked( file.inviteFriendsButton, true ) } else { RHud_SetText( file.startMatchButton, "#START_MATCH" ) Hud_SetLocked( file.selectMapButton, false ) Hud_SetLocked( file.selectModeButton, false ) - Hud_SetLocked( file.inviteFriendsButton, false ) + if ( !IsNorthstarServer() ) + Hud_SetLocked( file.inviteFriendsButton, false ) string modeName = PrivateMatch_GetSelectedMode() bool settingsLocked = IsFDMode( modeName ) |