From ca70578b1c45128a31b9fc5da464c33d0f790cea Mon Sep 17 00:00:00 2001 From: JMM889901 <41163714+JMM889901@users.noreply.github.com> Date: Mon, 12 Aug 2024 18:43:20 +0100 Subject: [PATCH] This is a cursed PR what is even --- .../mod/resource/ui/menus/mode_select.menu | 15 ++++++ .../vscripts/ui/menu_ns_serverbrowser.nut | 46 ++++++++----------- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/Northstar.Client/mod/resource/ui/menus/mode_select.menu b/Northstar.Client/mod/resource/ui/menus/mode_select.menu index e52ac41a6..fb525f31c 100644 --- a/Northstar.Client/mod/resource/ui/menus/mode_select.menu +++ b/Northstar.Client/mod/resource/ui/menus/mode_select.menu @@ -91,6 +91,21 @@ resource/ui/menus/mode_select.menu rui "ui/basic_image_add.rpak" zpos 3 } + ModeIconImagePatch //For patch icons + { + ControlName RuiPanel + xpos 0 + ypos -16 + wide 72 + tall 72 + visible 1 + scaleImage 1 + zpos 3 + pin_to_sibling NextModeImage + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_LEFT + rui "ui/callsign_icon_button.rpak" + } NextModeName { 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 95109bbdb..3cfe03e2d 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut @@ -756,16 +756,7 @@ void function FilterServerList() foreach ( ServerInfo server in servers ) { - serverStruct tempServer - tempServer.serverIndex = i - tempServer.serverProtected = NSServerRequiresPassword( i ) - tempServer.serverName = NSGetServerName( i ) - tempServer.serverPlayers = NSGetServerPlayerCount( i ) - tempServer.serverPlayersMax = NSGetServerMaxPlayerCount( i ) - tempServer.serverMap = NSGetServerMap( i ) - tempServer.serverGamemode = NSGetServerPlaylist ( i ) - - totalPlayers += tempServer.serverPlayers + totalPlayers += server.playerCount // Filters @@ -788,12 +779,13 @@ void function FilterServerList() if ( filterArguments.useSearch ) { array sName - sName.append( tempServer.serverName.tolower() ) - sName.append( Localize( GetMapDisplayName( tempServer.serverMap ) ).tolower() ) - sName.append( tempServer.serverMap.tolower() ) - sName.append( GetGameModeDisplayName( tempServer.serverGamemode ).tolower() ) - sName.append( Localize( GetGameModeDisplayName( tempServer.serverGamemode ) ).tolower() ) - sName.append( NSGetServerDescription( i ).tolower() ) + sName.append( server.name.tolower() ) + sName.append( Localize( GetMapDisplayName( server.map ) ).tolower() ) + sName.append( server.map.tolower() ) + sName.append( server.playlist.tolower() ) + sName.append( Localize( server.playlist ).tolower() ) + sName.append( server.description.tolower() ) + sName.append( server.region.tolower() ) string sTerm = filterArguments.searchTerm.tolower() @@ -841,11 +833,12 @@ void function UpdateShownPage() Hud_SetEnabled( file.serverButtons[ i ], true ) Hud_SetVisible( file.serverButtons[ i ], true ) - Hud_SetVisible( file.serversProtected[ i ], file.serversArrayFiltered[ buttonIndex ].serverProtected ) - Hud_SetText( file.serversName[ i ], file.serversArrayFiltered[ buttonIndex ].serverName ) - Hud_SetText( file.playerCountLabels[ i ], format( "%i/%i", file.serversArrayFiltered[ buttonIndex ].serverPlayers, file.serversArrayFiltered[ buttonIndex ].serverPlayersMax ) ) - Hud_SetText( file.serversMap[ i ], GetMapDisplayName( file.serversArrayFiltered[ buttonIndex ].serverMap ) ) - Hud_SetText( file.serversGamemode[ i ], GetGameModeDisplayName( file.serversArrayFiltered[ buttonIndex ].serverGamemode ) ) + Hud_SetVisible( file.serversProtected[ i ], server.requiresPassword ) + Hud_SetText( file.serversName[ i ], server.name ) + Hud_SetText( file.playerCountLabels[ i ], format( "%i/%i", server.playerCount, server.maxPlayerCount ) ) + Hud_SetText( file.serversMap[ i ], GetMapDisplayName( server.map ) ) + Hud_SetText( file.serversGamemode[ i ], GetGameModeDisplayName( server.playlist ) ) + Hud_SetText( file.serversRegion[ i ], server.region ) } @@ -934,17 +927,16 @@ void function DisplayFocusedServerInfo( int scriptID ) Hud_SetText( Hud_GetChild( menu, "ServerName" ), server.name ) // mode name/image - string mode = GetGameModeDisplayName( file.serversArrayFiltered[ serverIndex ].serverGamemode ) - string playlist = file.serversArrayFiltered[ serverIndex ].serverGamemode + string mode = server.playlist Hud_SetVisible( Hud_GetChild( menu, "NextModeIcon" ), true ) var nextModeIconAlt = Hud_GetChild( menu, "NextModeIconPatch" ) var nextModeIcon = Hud_GetChild( menu, "NextModeIcon" ) - string iconName = GetPlaylistVarOrUseValue( playlist, "iconOverride", "default" ) + string iconName = GetPlaylistVarOrUseValue( mode, "iconOverride", "default" ) if(iconName == "default") { - RuiSetImage( Hud_GetRui( nextModeIcon ), "basicImage", GetPlaylistThumbnailImage( playlist ) ) + RuiSetImage( Hud_GetRui( nextModeIcon ), "basicImage", GetPlaylistThumbnailImage( mode ) ) Hud_Show( nextModeIcon ) Hud_Hide( nextModeIconAlt ) @@ -1269,8 +1261,8 @@ int function ServerSortLogic ( ServerInfo a, ServerInfo b ) direction = filterDirection.serverMap break; case sortingBy.GAMEMODE: - aTemp = Localize( GetGameModeDisplayName( a.serverGamemode ) ).tolower() - bTemp = Localize( GetGameModeDisplayName( b.serverGamemode ) ).tolower() + aTemp = Localize( a.playlist ).tolower() + bTemp = Localize( b.playlist ).tolower() direction = filterDirection.serverGamemode break; case sortingBy.REGION: