Auto-reconnect to multicraft servers
This commit is contained in:
parent
05f58b3a04
commit
294b28d530
|
@ -82,6 +82,13 @@ function ui.update()
|
|||
|
||||
-- handle errors
|
||||
if gamedata ~= nil and gamedata.reconnect_requested then
|
||||
if core.settings:get_bool("auto_connect") == true then
|
||||
gamedata.reconnect_requested = false
|
||||
gamedata.errormessage = nil
|
||||
gamedata.do_reconnect = true
|
||||
core.start()
|
||||
return
|
||||
end
|
||||
formspec = wordwrap_quickhack(gamedata.errormessage or "")
|
||||
formspec = "size[12,5]" ..
|
||||
"label[0.5,0;" .. fgettext("The server has requested a reconnect:") ..
|
||||
|
|
|
@ -340,6 +340,15 @@ local function main_button_handler(tabview, fields, name, tabdata)
|
|||
gamedata.serverdescription = ""
|
||||
end
|
||||
|
||||
local auto_connect = false
|
||||
for _, server in pairs(serverlist) do
|
||||
if server.server_id and server.address == gamedata.address then
|
||||
auto_connect = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
core.settings:set_bool("auto_connect", auto_connect)
|
||||
core.settings:set("address", fields.te_address)
|
||||
core.settings:set("remote_port", fields.te_port)
|
||||
|
||||
|
|
Loading…
Reference in New Issue