mirror of
https://github.com/minetest-mods/irc.git
synced 2024-12-27 09:10:21 +01:00
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:
parent
d1a0579135
commit
8d8a8ec519
12
src/init.lua
12
src/init.lua
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user