DAMAGE!!! Autoreconnect for ANY(!) server issue

This commit is contained in:
Maksim 2019-05-20 21:45:23 +02:00
parent 294b28d530
commit 59f8ef3376
2 changed files with 9 additions and 8 deletions

View File

@ -79,16 +79,16 @@ end
--------------------------------------------------------------------------------
function ui.update()
local formspec = ""
local restart_btn
-- 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
if gamedata ~= nil and gamedata.errormessage ~= nil and core.settings:get_bool("auto_connect") == true then
gamedata.reconnect_requested = false
gamedata.errormessage = nil
gamedata.do_reconnect = true
core.start()
return
elseif gamedata ~= nil and gamedata.reconnect_requested then
formspec = wordwrap_quickhack(gamedata.errormessage or "")
formspec = "size[12,5]" ..
"label[0.5,0;" .. fgettext("The server has requested a reconnect:") ..

View File

@ -114,6 +114,7 @@ local function main_button_handler(this, fields, name, tabdata)
gamedata.port = fields["te_serverport"]
gamedata.address = ""
core.settings:set_bool("auto_connect", false)
core.settings:set("port",gamedata.port)
if fields["te_serveraddr"] ~= nil then
core.settings:set("bind_address",fields["te_serveraddr"])