diff options
author | rubenwardy <rw@rubenwardy.com> | 2021-01-22 15:08:57 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-22 15:08:57 +0000 |
commit | 67aa75d444d0e5cfff2728dbbcffd6f95b2fe88b (patch) | |
tree | f3a2079a9b17056508e8197a701cf90447e4ea4b /builtin/mainmenu/common.lua | |
parent | 4fcd000e20a26120349184cb9d40342b7876e6b8 (diff) | |
download | minetest-67aa75d444d0e5cfff2728dbbcffd6f95b2fe88b.tar.gz minetest-67aa75d444d0e5cfff2728dbbcffd6f95b2fe88b.tar.bz2 minetest-67aa75d444d0e5cfff2728dbbcffd6f95b2fe88b.zip |
Use JSON for favorites, move server list code to Lua (#10085)
Co-authored-by: sfan5 <sfan5@live.de>
Diffstat (limited to 'builtin/mainmenu/common.lua')
-rw-r--r-- | builtin/mainmenu/common.lua | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/builtin/mainmenu/common.lua b/builtin/mainmenu/common.lua index 2bd8aa8a5..01f9a30b9 100644 --- a/builtin/mainmenu/common.lua +++ b/builtin/mainmenu/common.lua @@ -62,24 +62,6 @@ function image_column(tooltip, flagname) "5=" .. core.formspec_escape(defaulttexturedir .. "server_ping_1.png") end --------------------------------------------------------------------------------- -function order_favorite_list(list) - local res = {} - --orders the favorite list after support - for i = 1, #list do - local fav = list[i] - if is_server_protocol_compat(fav.proto_min, fav.proto_max) then - res[#res + 1] = fav - end - end - for i = 1, #list do - local fav = list[i] - if not is_server_protocol_compat(fav.proto_min, fav.proto_max) then - res[#res + 1] = fav - end - end - return res -end -------------------------------------------------------------------------------- function render_serverlist_row(spec, is_favorite) @@ -227,41 +209,6 @@ function menu_handle_key_up_down(fields, textlist, settingname) end -------------------------------------------------------------------------------- -function asyncOnlineFavourites() - if not menudata.public_known then - menudata.public_known = {{ - name = fgettext("Loading..."), - description = fgettext_ne("Try reenabling public serverlist and check your internet connection.") - }} - end - menudata.favorites = menudata.public_known - menudata.favorites_is_public = true - - if not menudata.public_downloading then - menudata.public_downloading = true - else - return - end - - core.handle_async( - function(param) - return core.get_favorites("online") - end, - nil, - function(result) - menudata.public_downloading = nil - 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 - --------------------------------------------------------------------------------- function text2textlist(xpos, ypos, width, height, tl_name, textlen, text, transparency) local textlines = core.wrap_text(text, textlen, true) local retval = "textlist[" .. xpos .. "," .. ypos .. ";" .. width .. |