From 412f2b9f0516593f84c368d457e01c1f990d1144 Mon Sep 17 00:00:00 2001 From: uniboi Date: Fri, 15 Apr 2022 00:06:01 +0200 Subject: [PATCH 1/2] Show menu that links to every required server mod --- Northstar.Client/mod.json | 7 + .../mod/resource/ui/menus/required_mods.menu | 328 ++++++++++++++++++ .../vscripts/ui/menu_ns_serverbrowser.nut | 57 ++- .../vscripts/ui/menu_required_mods.nut | 119 +++++++ 4 files changed, 479 insertions(+), 32 deletions(-) create mode 100644 Northstar.Client/mod/resource/ui/menus/required_mods.menu create mode 100644 Northstar.Client/mod/scripts/vscripts/ui/menu_required_mods.nut diff --git a/Northstar.Client/mod.json b/Northstar.Client/mod.json index 4748d82e2..c66d04a67 100644 --- a/Northstar.Client/mod.json +++ b/Northstar.Client/mod.json @@ -98,6 +98,13 @@ { "Path": "ui/controller_prompts.nut", "RunOn": "UI" + }, + { + "Path": "ui/menu_required_mods.nut", + "RunOn": "UI", + "UICallback": { + "Before": "AddNorthstarServerBrowserMenu" + } } ], "Localisation": [ diff --git a/Northstar.Client/mod/resource/ui/menus/required_mods.menu b/Northstar.Client/mod/resource/ui/menus/required_mods.menu new file mode 100644 index 000000000..798c99be1 --- /dev/null +++ b/Northstar.Client/mod/resource/ui/menus/required_mods.menu @@ -0,0 +1,328 @@ +resource/ui/menus/required_mods.menu +{ + menu + { + ControlName Frame + xpos 0 + ypos 0 + zpos 3 + wide f0 + tall f0 + autoResize 0 + pinCorner 0 + visible 1 + enabled 1 + PaintBackgroundType 0 + infocus_bgcolor_override "0 0 0 0" + outoffocus_bgcolor_override "0 0 0 0" + + FocusedModFrame + { + ControlName RuiPanel + xpos 800 + ypos 160 + wide 860 + tall 250 + visible 1 + bgcolor_override "0 0 0 0" + paintbackground 1 + rui "ui/basic_border_box.rpak" + } + + FrameTitle + { + ControlName Label + pin_to_sibling FocusedModFrame + pin_corner_to_sibling TOP + pin_to_sibling_corner TOP + ypos -20 + wide 840 + auto_tall_tocontents 1 + visible 1 + labelText "Required Mod" + textAlignment center + font Default_17_ShadowGlow + allcaps 1 + fgcolor_override "255 180 0 255" + } + + FocusModName + { + ControlName Label + pin_to_sibling FrameTitle + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_LEFT + xpos -20 + ypos -50 + wide 840 + wrap 1 + auto_tall_tocontents 1 + labelText "ModAuthor.ModName" + textAlignment west + font Default_17_ShadowGlow + } + + FocusModVersion + { + ControlName Label + pin_to_sibling FocusModName + pin_corner_to_sibling TOP + pin_to_sibling_corner BOTTOM + wide 840 + wrap 1 + auto_tall_tocontents 1 + labelText "0.0.0" + textAlignment west + font Default_17_ShadowGlow + fgcolor_override "255 255 255 255" + } + + FocusModDownloadLink + { + ControlName Label + pin_to_sibling FocusModVersion + pin_corner_to_sibling TOP + pin_to_sibling_corner BOTTOM + wide 840 + wrap 1 + auto_tall_tocontents 1 + labelText "The mod author has not specified where the mod is available for download. Ask the server administrator for more information" + textAlignment west + font Default_17_ShadowGlow + fgcolor_override "251 120 5 255" + } + + FocusModHint + { + ControlName Label + pin_to_sibling FocusModDownloadLink + pin_corner_to_sibling TOP + pin_to_sibling_corner TOP + ypos -80 + wide 840 + auto_tall_tocontents 1 + labelText "Go to the mod's page by clicking it's button" + textAlignment center + font Default_17_ShadowGlow + fgcolor_override "128 128 128 255" + } + + MenuTitle + { + ControlName Label + InheritProperties MenuTitle + labelText "Download required Mods" + } + + ButtonRowAnchor + { + ControlName Label + labelText "" + + xpos 96 + ypos 160 + } + + BtnMod1 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname ModButton + scriptID 0 + navUp BtnMod15 + navDown BtnMod2 + + pin_to_sibling ButtonRowAnchor + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_LEFT + } + BtnMod2 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname ModButton + scriptID 1 + pin_to_sibling BtnMod1 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + navUp BtnMod1 + navDown BtnMod3 + } + BtnMod3 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname ModButton + scriptID 2 + pin_to_sibling BtnMod2 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + navUp BtnMod2 + navDown BtnMod4 + } + BtnMod4 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname ModButton + scriptID 3 + pin_to_sibling BtnMod3 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + //ypos 11 + navUp BtnMod3 + navDown BtnMod5 + } + BtnMod5 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname ModButton + scriptID 4 + pin_to_sibling BtnMod4 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + navUp BtnMod4 + navDown BtnMod6 + } + BtnMod6 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname ModButton + scriptID 5 + pin_to_sibling BtnMod5 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + navUp BtnMod5 + navDown BtnMod7 + } + BtnMod7 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname ModButton + scriptID 6 + pin_to_sibling BtnMod6 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + navUp BtnMod6 + navDown BtnMod8 + } + BtnMod8 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname ModButton + scriptID 7 + pin_to_sibling BtnMod7 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + navUp BtnMod7 + navDown BtnMod9 + } + BtnMod9 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname ModButton + scriptID 8 + pin_to_sibling BtnMod8 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + navUp BtnMod8 + navDown BtnMod10 + } + BtnMod10 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname ModButton + scriptID 9 + pin_to_sibling BtnMod9 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + navUp BtnMod9 + navDown BtnMod11 + } + BtnMod11 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname ModButton + scriptID 10 + pin_to_sibling BtnMod10 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + navUp BtnMod10 + navDown BtnMod12 + } + BtnMod12 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname ModButton + scriptID 11 + pin_to_sibling BtnMod11 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + navUp BtnMod11 + navDown BtnMod13 + } + BtnMod13 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname ModButton + scriptID 12 + pin_to_sibling BtnMod12 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + navUp BtnMod12 + navDown BtnMod14 + } + BtnMod14 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname ModButton + scriptID 13 + pin_to_sibling BtnMod13 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + navUp BtnMod13 + navDown BtnMod15 + } + BtnMod15 + { + ControlName RuiButton + InheritProperties RuiSmallButton + classname ModButton + scriptID 14 + pin_to_sibling BtnMod14 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + navUp BtnMod14 + navDown BtnMod1 + } + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + + ButtonTooltip + { + ControlName CNestedPanel + InheritProperties ButtonTooltip + } + + FooterButtons + { + ControlName CNestedPanel + xpos 0 + ypos r119 + wide f0 + tall 36 + visible 1 + controlSettingsFile "resource/ui/menus/panels/footer_buttons.res" + } + } +} 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 6bffe8bb9..3d4c68557 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut @@ -4,6 +4,7 @@ untyped global function AddNorthstarServerBrowserMenu global function ThreadedAuthAndConnectToServer +global int lastSelectedServer // So this is accesible in menu_required_mods.nut // Stop peeking @@ -63,7 +64,6 @@ struct serverStruct { struct { var menu - int lastSelectedServer = 999 int focusedServerIndex = 0 int scrollOffset = 0 bool serverListRequestFailed = false @@ -856,15 +856,15 @@ void function CheckDoubleClick(int scriptID, bool wasClickNav) int serverIndex = file.scrollOffset + scriptID bool sameServer = false - if (file.lastSelectedServer == serverIndex) sameServer = true + if (lastSelectedServer == serverIndex) sameServer = true file.serverSelectedTimeLast = file.serverSelectedTime file.serverSelectedTime = Time() - printt(file.serverSelectedTime - file.serverSelectedTimeLast, file.lastSelectedServer, serverIndex) + printt(file.serverSelectedTime - file.serverSelectedTimeLast, lastSelectedServer, serverIndex) - file.lastSelectedServer = serverIndex + lastSelectedServer = serverIndex if (wasClickNav && (file.serverSelectedTime - file.serverSelectedTimeLast < DOUBLE_CLICK_TIME_MS) && sameServer) @@ -936,28 +936,21 @@ void function OnServerSelected( var button ) int serverIndex = file.focusedServerIndex - file.lastSelectedServer = serverIndex + lastSelectedServer = serverIndex // check mods for ( int i = 0; i < NSGetServerRequiredModsCount( serverIndex ); i++ ) { if ( !NSGetModNames().contains( NSGetServerRequiredModName( serverIndex, i ) ) ) { - DialogData dialogData - dialogData.header = "#ERROR" - dialogData.message = "Missing mod \"" + NSGetServerRequiredModName( serverIndex, i ) + "\" v" + NSGetServerRequiredModVersion( serverIndex, 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 + DeregisterButtonPressedCallback(MOUSE_WHEEL_UP , OnScrollUp) + DeregisterButtonPressedCallback(MOUSE_WHEEL_DOWN , OnScrollDown) + DeregisterButtonPressedCallback(KEY_TAB , OnKeyTabPressed) + DeregisterButtonPressedCallback(KEY_ENTER, OnEnterPressed) + DeregisterButtonPressedCallback(KEY_R, OnKeyRPressed) + + AdvanceMenu( GetMenu( "ServerRequiredModsMenu" ) ) + return } else { @@ -1013,9 +1006,9 @@ void function ThreadedAuthAndConnectToServer( string password = "" ) if ( NSIsAuthenticatingWithServer() ) return - print( "trying to authenticate with server " + NSGetServerName( file.lastSelectedServer ) + " with password " + password ) + print( "trying to authenticate with server " + NSGetServerName( lastSelectedServer ) + " with password " + password ) - NSTryAuthWithServer( file.lastSelectedServer, password ) + NSTryAuthWithServer( lastSelectedServer, password ) ToggleConnectingHUD( true ) @@ -1037,15 +1030,15 @@ void function ThreadedAuthAndConnectToServer( string password = "" ) file.cancelConnection = false NSSetLoading(true) NSUpdateServerInfo( - NSGetServerID(file.lastSelectedServer), - NSGetServerName(file.lastSelectedServer), + NSGetServerID(lastSelectedServer), + NSGetServerName(lastSelectedServer), password, - NSGetServerPlayerCount(file.lastSelectedServer), - NSGetServerMaxPlayerCount(file.lastSelectedServer), - NSGetServerMap(file.lastSelectedServer), - Localize(GetMapDisplayName(NSGetServerMap(file.lastSelectedServer))), - NSGetServerPlaylist(file.lastSelectedServer), - Localize(GetPlaylistDisplayName(NSGetServerPlaylist(file.lastSelectedServer))) + NSGetServerPlayerCount(lastSelectedServer), + NSGetServerMaxPlayerCount(lastSelectedServer), + NSGetServerMap(lastSelectedServer), + Localize(GetMapDisplayName(NSGetServerMap(lastSelectedServer))), + NSGetServerPlaylist(lastSelectedServer), + Localize(GetPlaylistDisplayName(NSGetServerPlaylist(lastSelectedServer))) ) if ( NSWasAuthSuccessful() ) @@ -1053,8 +1046,8 @@ void function ThreadedAuthAndConnectToServer( string password = "" ) bool modsChanged array requiredMods - for ( int i = 0; i < NSGetServerRequiredModsCount( file.lastSelectedServer ); i++ ) - requiredMods.append( NSGetServerRequiredModName( file.lastSelectedServer, i ) ) + for ( int i = 0; i < NSGetServerRequiredModsCount( lastSelectedServer ); i++ ) + requiredMods.append( NSGetServerRequiredModName( lastSelectedServer, i ) ) // unload mods we don't need, load necessary ones and reload mods before connecting foreach ( string mod in NSGetModNames() ) diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_required_mods.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_required_mods.nut new file mode 100644 index 000000000..32b43429a --- /dev/null +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_required_mods.nut @@ -0,0 +1,119 @@ +global function AddServerRequiredModLinkMenu + +struct modInfo { + string name + string version + string downloadLink +} + +struct { + int currentModPage + var menu + array missingMods +} file + +const int MODS_PER_PAGE = 15 + +void function AddServerRequiredModLinkMenu() +{ + // This is just the menu_mode_select.nut with a few changes + AddMenu( "ServerRequiredModsMenu", $"resource/ui/menus/required_mods.menu", InitServerRequiredModsMenu ) +} + +void function InitServerRequiredModsMenu() +{ + file.menu = GetMenu( "ServerRequiredModsMenu" ) + + AddMenuEventHandler( file.menu, eUIEvent.MENU_OPEN, OnOpenModListMenu ) + + AddEventHandlerToButtonClass( file.menu, "ModButton", UIE_GET_FOCUS, ModButton_GetFocus ) + AddEventHandlerToButtonClass( file.menu, "ModButton", UIE_CLICK, ModButton_Click ) + + AddMenuFooterOption( file.menu, BUTTON_A, "#A_BUTTON_SELECT" ) + AddMenuFooterOption( file.menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) + + AddMenuFooterOption( file.menu, BUTTON_SHOULDER_LEFT, "#PRIVATE_MATCH_PAGE_PREV", "#PRIVATE_MATCH_PAGE_PREV", CycleModesBack, IsNorthstarServer ) + AddMenuFooterOption( file.menu, BUTTON_SHOULDER_RIGHT, "#PRIVATE_MATCH_PAGE_NEXT", "#PRIVATE_MATCH_PAGE_NEXT", CycleModesForward, IsNorthstarServer ) +} + +void function OnOpenModListMenu() +{ + file.missingMods = [] + for ( int i = 0; i < NSGetServerRequiredModsCount( lastSelectedServer ); i++ ) + { + if ( !NSGetModNames().contains( NSGetServerRequiredModName( lastSelectedServer, i ) ) ) + { + modInfo m; + m.name = NSGetServerRequiredModName( lastSelectedServer, i ) + m.version = NSGetServerRequiredModVersion( lastSelectedServer, i ) + m.downloadLink = NSGetServerRequiredModDownloadLink(lastSelectedServer,i) + file.missingMods.append(m) + } + } + UpdateVisibleMods() + Hud_SetFocused( GetElementsByClassname( file.menu, "ModButton" )[ 0 ] ) +} + +void function UpdateVisibleMods() +{ + array buttons = GetElementsByClassname( file.menu, "ModButton" ) + foreach ( var button in buttons ) + { + Hud_SetEnabled( button, false ) + Hud_SetVisible( button, false ) + } + + for ( int i = 0; i < MODS_PER_PAGE; i++ ) + { + if ( i + ( file.currentModPage * MODS_PER_PAGE ) >= file.missingMods.len() ) + break + + int modIndex = i + ( file.currentModPage * MODS_PER_PAGE ) + SetButtonRuiText( buttons[ i ], file.missingMods[ modIndex ].name ) + + Hud_SetEnabled( buttons[ i ], true ) + Hud_SetVisible( buttons[ i ], true ) + } +} + +void function ModButton_GetFocus( var button ) +{ + var focusModName = Hud_GetChild( file.menu, "FocusModName" ) + var focusModVersion = Hud_GetChild( file.menu, "FocusModVersion" ) + var focusModDownloadLink = Hud_GetChild( file.menu, "FocusModDownloadLink" ) + + modInfo modInfo = file.missingMods[ int( Hud_GetScriptID( button ) ) + ( file.currentModPage * MODS_PER_PAGE ) ] + + Hud_SetText( focusModName, modInfo.name ) + Hud_SetText( focusModVersion, modInfo.version ) + Hud_SetText( focusModDownloadLink, modInfo.downloadLink ) + Hud_SetColor( focusModDownloadLink, 141, 197, 84, 255 ) + + if ( !modInfo.downloadLink.len() ) + Hud_SetVisible( Hud_GetChild( file.menu, "FocusModHint" ), false ) +} + +void function ModButton_Click( var button ) +{ + string link = NSGetServerRequiredModDownloadLink( lastSelectedServer, int( Hud_GetScriptID( button ) ) + ( file.currentModPage * MODS_PER_PAGE ) ) + if ( link.len() ) + LaunchExternalWebBrowser( link, WEBBROWSER_FLAG_FORCEEXTERNAL ) +} + +void function CycleModesBack( var button ) +{ + if ( file.currentModPage == 0 ) + return + + file.currentModPage-- + UpdateVisibleMods() +} + +void function CycleModesForward( var button ) +{ + if ( ( file.currentModPage + 1 ) * MODS_PER_PAGE >= file.missingMods.len() ) + return + + file.currentModPage++ + UpdateVisibleMods() +} \ No newline at end of file From 5ee1606feaa208fcb01e0f93c09eb8fa13d525ca Mon Sep 17 00:00:00 2001 From: uniboi Date: Fri, 15 Apr 2022 20:40:35 +0200 Subject: [PATCH 2/2] small fixes --- Northstar.Client/mod.json | 2 +- .../vscripts/ui/menu_required_mods.nut | 41 ++++++++++++++----- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/Northstar.Client/mod.json b/Northstar.Client/mod.json index c66d04a67..62d107082 100644 --- a/Northstar.Client/mod.json +++ b/Northstar.Client/mod.json @@ -103,7 +103,7 @@ "Path": "ui/menu_required_mods.nut", "RunOn": "UI", "UICallback": { - "Before": "AddNorthstarServerBrowserMenu" + "Before": "AddServerRequiredModLinkMenu" } } ], diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_required_mods.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_required_mods.nut index 32b43429a..dc425164a 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_required_mods.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_required_mods.nut @@ -32,21 +32,29 @@ void function InitServerRequiredModsMenu() AddMenuFooterOption( file.menu, BUTTON_A, "#A_BUTTON_SELECT" ) AddMenuFooterOption( file.menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) - AddMenuFooterOption( file.menu, BUTTON_SHOULDER_LEFT, "#PRIVATE_MATCH_PAGE_PREV", "#PRIVATE_MATCH_PAGE_PREV", CycleModesBack, IsNorthstarServer ) - AddMenuFooterOption( file.menu, BUTTON_SHOULDER_RIGHT, "#PRIVATE_MATCH_PAGE_NEXT", "#PRIVATE_MATCH_PAGE_NEXT", CycleModesForward, IsNorthstarServer ) + AddMenuFooterOption( file.menu, BUTTON_X, "%[X_BUTTON|]%" + Localize( "#RELOAD_MODS" ), "#RELOAD_MODS", void function( var button ) { thread void function() { ClientCommand( "disconnect" ); WaitFrame(); AdvanceMenu( GetMenu( "ModListMenu" ) ) }() } ) + AddMenuFooterOption( file.menu, BUTTON_SHOULDER_LEFT, "#PRIVATE_MATCH_PAGE_PREV", "#PRIVATE_MATCH_PAGE_PREV", CycleModsBack ) + AddMenuFooterOption( file.menu, BUTTON_SHOULDER_RIGHT, "#PRIVATE_MATCH_PAGE_NEXT", "#PRIVATE_MATCH_PAGE_NEXT", CycleModsForward ) } void function OnOpenModListMenu() { + // Get every mod that is required on the server and not installed on client file.missingMods = [] - for ( int i = 0; i < NSGetServerRequiredModsCount( lastSelectedServer ); i++ ) + for ( int i; i < NSGetServerRequiredModsCount( lastSelectedServer ); i++ ) { if ( !NSGetModNames().contains( NSGetServerRequiredModName( lastSelectedServer, i ) ) ) { modInfo m; m.name = NSGetServerRequiredModName( lastSelectedServer, i ) m.version = NSGetServerRequiredModVersion( lastSelectedServer, i ) - m.downloadLink = NSGetServerRequiredModDownloadLink(lastSelectedServer,i) + string link = NSGetServerRequiredModDownloadLink(lastSelectedServer,i) + if ( link.len() > 0 /* If no link is provided, don't add a protocol so the link stays empty */ + && link.find( "http://" ) != 0 && link.find( "https://" ) != 0 ) + // for some reason links that don't have the http or https protocol launch in the origin browser + // defaulting to http in case someone hosts their mod on a http server. Most servers redirect to https anyways so it doesn't really matter this way. + link = "http://" + link + m.downloadLink = link file.missingMods.append(m) } } @@ -59,11 +67,12 @@ void function UpdateVisibleMods() array buttons = GetElementsByClassname( file.menu, "ModButton" ) foreach ( var button in buttons ) { + // Used buttons will be enabled later Hud_SetEnabled( button, false ) Hud_SetVisible( button, false ) } - for ( int i = 0; i < MODS_PER_PAGE; i++ ) + for ( int i; i < MODS_PER_PAGE; i++ ) { if ( i + ( file.currentModPage * MODS_PER_PAGE ) >= file.missingMods.len() ) break @@ -86,21 +95,31 @@ void function ModButton_GetFocus( var button ) Hud_SetText( focusModName, modInfo.name ) Hud_SetText( focusModVersion, modInfo.version ) - Hud_SetText( focusModDownloadLink, modInfo.downloadLink ) - Hud_SetColor( focusModDownloadLink, 141, 197, 84, 255 ) if ( !modInfo.downloadLink.len() ) + { + // This is to restore the default after a mod with a link has been deselected Hud_SetVisible( Hud_GetChild( file.menu, "FocusModHint" ), false ) + Hud_SetColor( focusModDownloadLink, 251, 120, 5, 255 ) + Hud_SetText( focusModDownloadLink, "The mod author has not specified where the mod is available for download. Ask the server administrator for more information" ) + + } + else + { + Hud_SetVisible( Hud_GetChild( file.menu, "FocusModHint" ), true ) + Hud_SetColor( focusModDownloadLink, 141, 197, 84, 255 ) + Hud_SetText( focusModDownloadLink, modInfo.downloadLink ) + } } void function ModButton_Click( var button ) { - string link = NSGetServerRequiredModDownloadLink( lastSelectedServer, int( Hud_GetScriptID( button ) ) + ( file.currentModPage * MODS_PER_PAGE ) ) - if ( link.len() ) + string link = file.missingMods[ int( Hud_GetScriptID( button ) ) + ( file.currentModPage * MODS_PER_PAGE ) ].downloadLink + if ( link.len() ) // Make sure a link has been provided LaunchExternalWebBrowser( link, WEBBROWSER_FLAG_FORCEEXTERNAL ) } -void function CycleModesBack( var button ) +void function CycleModsBack( var button ) { if ( file.currentModPage == 0 ) return @@ -109,7 +128,7 @@ void function CycleModesBack( var button ) UpdateVisibleMods() } -void function CycleModesForward( var button ) +void function CycleModsForward( var button ) { if ( ( file.currentModPage + 1 ) * MODS_PER_PAGE >= file.missingMods.len() ) return