mirror of
https://github.com/minetest/minetest.git
synced 2024-11-09 17:23:45 +01:00
More reliable serverlist behaviour
-> remember the previously loaded serverlist, and use if new one failed -> show a "loading" serverlist
This commit is contained in:
parent
e481745433
commit
05f4e9ee08
@ -234,7 +234,13 @@ end
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
function asyncOnlineFavourites()
|
function asyncOnlineFavourites()
|
||||||
|
|
||||||
menudata.favorites = {}
|
if not menudata.public_known then
|
||||||
|
menudata.public_known = {{
|
||||||
|
name = fgettext("Loading..."),
|
||||||
|
description = fgettext("Try reenabling public serverlist and check your internet connection.")
|
||||||
|
}}
|
||||||
|
end
|
||||||
|
menudata.favorites = menudata.public_known
|
||||||
core.handle_async(
|
core.handle_async(
|
||||||
function(param)
|
function(param)
|
||||||
return core.get_favorites("online")
|
return core.get_favorites("online")
|
||||||
@ -242,11 +248,15 @@ function asyncOnlineFavourites()
|
|||||||
nil,
|
nil,
|
||||||
function(result)
|
function(result)
|
||||||
if core.setting_getbool("public_serverlist") then
|
if core.setting_getbool("public_serverlist") then
|
||||||
menudata.favorites = order_favorite_list(result)
|
local favs = order_favorite_list(result)
|
||||||
|
if favs[1] then
|
||||||
|
menudata.public_known = favs
|
||||||
|
menudata.favorites = menudata.public_known
|
||||||
|
end
|
||||||
core.event_handler("Refresh")
|
core.event_handler("Refresh")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user