Delay connecting until the first server step

This fixes an issue with servers on a restart loop starting up and immedietely
crashing, causing a join/quit flood.
This commit is contained in:
ShadowNinja 2014-02-22 13:49:47 -05:00
parent d1a0579135
commit 8d8a8ec519
1 changed files with 8 additions and 4 deletions

View File

@ -41,10 +41,18 @@ minetest.register_privilege("irc_admin", {
give_to_singleplayer = true
})
local firstrun = true
minetest.register_globalstep(function(dtime) return mt_irc:step(dtime) end)
function mt_irc:step(dtime)
if firstrun then
firstrun = false
if self.config.auto_connect then
self:connect()
end
end
if not self.connected then return end
-- Tick down the recent message count
@ -146,7 +154,3 @@ function mt_irc:send(line)
end
if mt_irc.config.auto_connect then
mt_irc:connect()
end