Permalink
Browse files

Server browser improvements

Willox changes
1 parent 6e4bcec commit b3171137890829e2322e9c564b0d0baae9827255 @robotboy655 robotboy655 committed Nov 25, 2016
Showing with 10 additions and 1 deletion.
  1. +5 −1 garrysmod/html/js/menu/control.Servers.js
  2. +5 −0 garrysmod/lua/menu/mainmenu.lua
@@ -233,11 +233,15 @@ function AddServer( type, id, ping, name, desc, map, players, maxplayers, botpla
data.hasmap = DoWeHaveMap( data.map );
data.recommended = data.ping;
- if ( !data.hasmap ) data.recommended += 20; // We don't have that map
if ( data.players == 0 ) data.recommended += 100; // Server is empty
if ( data.players == data.maxplayers ) data.recommended += 75; // Server is full
if ( data.pass ) data.recommended += 300; // If we can't join it, don't put it to the top
+ // The first few bunches of players reduce the impact of the server's ping on the ranking a little
+ if ( data.players >= 16 ) data.recommended -= 40;
+ if ( data.players >= 32 ) data.recommended -= 20;
+ if ( data.players >= 64 ) data.recommended -= 10;
+
data.listen = data.desc.indexOf('[L]') >= 0;
if ( data.listen ) data.desc = data.desc.substr( 4 );
@@ -221,6 +221,9 @@ function GetServers( type, id )
local data = {
Callback = function( ping , name, desc, map, players, maxplayers, botplayers, pass, lastplayed, address, gamemode, workshopid )
+ if Servers[ address ] then return end
+ Servers[ address ] = true
@uRandomAlex
uRandomAlex Nov 27, 2016

why this 2 lines are ever needed?

@aStonedPenguin
aStonedPenguin Nov 27, 2016

I'd imagine because it queries more then once so it can show all servers.

+
name = string.JavascriptSafe( name )
desc = string.JavascriptSafe( desc )
map = string.JavascriptSafe( map )
@@ -238,6 +241,7 @@ function GetServers( type, id )
Finished = function()
pnlMainMenu:Call( "FinishedServeres( '" .. type .. "' )" )
+ Servers = {}
end,
Type = type,
@@ -252,6 +256,7 @@ end
function DoStopServers( type )
pnlMainMenu:Call( "FinishedServeres( '" .. type .. "' )" )
ShouldStop[ type ] = true
+ Servers = {}
end
--

1 comment on commit b317113

@mrpotatofactory

wowzers server browser changes

Please sign in to comment.