1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Mainmenu: Unify favorite servers with main serverlist

This commit is contained in:
kilbith 2016-04-18 18:20:04 +02:00 committed by Craig Robbins
parent fed5dd3b5d
commit 65db88d24e
3 changed files with 85 additions and 95 deletions

View file

@ -85,7 +85,7 @@ function order_favorite_list(list)
end
--------------------------------------------------------------------------------
function render_favorite(spec,render_details)
function render_favorite(spec, is_favorite)
local text = ""
if spec.name ~= nil then
@ -105,13 +105,15 @@ function render_favorite(spec,render_details)
end
end
if not render_details then
return text
end
local details = ""
local grey_out = not is_server_protocol_compat(spec.proto_min, spec.proto_max)
if is_favorite then
details = "1,"
else
details = "0,"
end
if spec.clients ~= nil and spec.clients_max ~= nil then
local clients_color = ''
local clients_percent = 100 * spec.clients / spec.clients_max
@ -253,15 +255,13 @@ function asyncOnlineFavourites()
end,
nil,
function(result)
if core.setting_getbool("public_serverlist") then
local favs = order_favorite_list(result)
if favs[1] then
menudata.public_known = favs
menudata.favorites = menudata.public_known
menudata.favorites_is_public = true
end
core.event_handler("Refresh")
local favs = order_favorite_list(result)
if favs[1] then
menudata.public_known = favs
menudata.favorites = menudata.public_known
menudata.favorites_is_public = true
end
core.event_handler("Refresh")
end
)
end