Mainmenu: improve the Multiplayer tab

This commit is contained in:
MoNTE48 2020-03-16 18:36:06 +01:00
parent 9b08c73f70
commit d7e19ba0d8
3 changed files with 19 additions and 23 deletions

View File

@ -59,16 +59,17 @@ end
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
function order_favorite_list(list) function order_favorite_list(list)
local res = {} local res = {}
--orders the favorite list after support -- orders the multicraft list before support
for i = 1, #list do for i = 1, #list do
local fav = list[i] local fav = list[i]
if is_server_protocol_compat(fav.proto_min, fav.proto_max) then if fav.server_id ~= nil then
res[#res + 1] = fav res[#res + 1] = fav
end end
end end
for i = 1, #list do for i = 1, #list do
local fav = list[i] local fav = list[i]
if not is_server_protocol_compat(fav.proto_min, fav.proto_max) then if is_server_protocol_compat(fav.proto_min, fav.proto_max) and
fav.server_id == nil then
res[#res + 1] = fav res[#res + 1] = fav
end end
end end
@ -122,7 +123,7 @@ function render_serverlist_row(spec, is_favorite, is_approved)
-- (relatively to clients_max) -- (relatively to clients_max)
local clients_color local clients_color
if grey_out then clients_color = '#aaaaaa' if grey_out then clients_color = '#aaaaaa'
elseif spec.clients == 0 then clients_color = '' -- 0 players: default/white elseif spec.clients == 0 then clients_color = '' -- 0 players: default/white
elseif clients_percent <= 60 then clients_color = '#a1e587' -- 0-60%: green elseif clients_percent <= 60 then clients_color = '#a1e587' -- 0-60%: green
elseif clients_percent <= 90 then clients_color = '#ffdc97' -- 60-90%: yellow elseif clients_percent <= 90 then clients_color = '#ffdc97' -- 60-90%: yellow
elseif clients_percent == 100 then clients_color = '#dd5b5b' -- full server: red (darker) elseif clients_percent == 100 then clients_color = '#dd5b5b' -- full server: red (darker)
@ -139,16 +140,12 @@ function render_serverlist_row(spec, is_favorite, is_approved)
details = details .. ',?,/,?,' details = details .. ',?,/,?,'
end end
if spec.damage then if spec.creative then
details = details .. "4,"
else
details = details .. "5," details = details .. "5,"
end elseif spec.pvp then
if spec.pvp then
details = details .. "6," details = details .. "6,"
else else -- damage
details = details .. "0," details = details .. "4,"
end end
return details .. (grey_out and '#aaaaaa,' or ',') .. text return details .. (grey_out and '#aaaaaa,' or ',') .. text

View File

@ -47,7 +47,7 @@ local function get_formspec(_, _, tabdata)
"label[10.15,-0.3;" .. fgettext("Port") .. ":" .. "]" .. "label[10.15,-0.3;" .. fgettext("Port") .. ":" .. "]" ..
"field[7.4,0.6;3.2,0.5;te_address;;" .. "field[7.4,0.6;3.2,0.5;te_address;;" ..
core.formspec_escape(core.settings:get("address")) .. "]" .. core.formspec_escape(core.settings:get("address")) .. "]" ..
"field[10.45,0.6;1.9,0.5;te_port;;" .. "field[10.45,0.6;1.95,0.5;te_port;;" ..
core.formspec_escape(core.settings:get("remote_port")) .. "]" .. core.formspec_escape(core.settings:get("remote_port")) .. "]" ..
-- Name -- Name
@ -67,7 +67,7 @@ local function get_formspec(_, _, tabdata)
local pwd = password_save and core.formspec_escape(core.settings:get("password")) or password_tmp local pwd = password_save and core.formspec_escape(core.settings:get("password")) or password_tmp
-- Password -- Password
retval = retval .. "pwdfield[10.45,1.81;1.91,0.39;te_pwd;;" .. pwd .. "]" retval = retval .. "pwdfield[10.45,1.8;1.95,0.39;te_pwd;;" .. pwd .. "]"
if tabdata.fav_selected and fav_selected then if tabdata.fav_selected and fav_selected then
if gamedata.fav then if gamedata.fav then
@ -84,17 +84,16 @@ local function get_formspec(_, _, tabdata)
retval = retval .. retval = retval ..
"tableoptions[background=#27233F;border=false]" .. "tableoptions[background=#27233F;border=false]" ..
"tablecolumns[" .. "tablecolumns[" ..
image_column(fgettext("Favorite"), "favorite") .. ",align=center;" .. image_column(fgettext("Favorite")) .. ",align=center;" ..
image_column(fgettext("Lag, ms")) .. ",padding=0.25;" .. image_column(fgettext("Lag")) .. ",padding=0.25;" ..
"color,span=3;" .. "color,span=3;" ..
"text,align=right;" .. -- clients "text,align=right;" .. -- clients
"text,align=center,padding=0.25;" .. -- "/" "text,align=center,padding=0.25;" .. -- "/"
"text,align=right,padding=0.25;" .. -- clients_max "text,align=right,padding=0.25;" .. -- clients_max
image_column(fgettext("Server mode"), "damage") .. ",padding=0.25;" .. image_column(fgettext("Server mode")) .. ",padding=0.5;" ..
image_column(fgettext("PvP enabled"), "pvp") .. ",padding=0.25;" ..
"color,span=1;" .. "color,span=1;" ..
"text,padding=0.25]" .. "text,padding=0.5]" ..
"table[-0.09,0.7;7,4.9;favourites;" "table[-0.09,0.7;6.99,4.93;favourites;"
if menudata.search_result then if menudata.search_result then
for i = 1, #menudata.search_result do for i = 1, #menudata.search_result do

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 262 B