preview: try to send mod channel messages 4 seconds after joining, not after loading mod
authorLoic Blot <loic.blot@unix-experience.fr>
Tue, 26 Sep 2017 06:31:56 +0000 (08:31 +0200)
committerLoic Blot <loic.blot@unix-experience.fr>
Tue, 26 Sep 2017 06:32:07 +0000 (08:32 +0200)
clientmods/preview/init.lua

index bf5fb3db810acfbe031dec11ff8f2d85e5e7b906..630059946a508b6cd1a570df55ab841a586e2435 100644 (file)
@@ -17,6 +17,12 @@ core.register_on_connect(function()
        print("Server port: " .. server_info.port)
 
        mod_channel = core.mod_channel_join("experimental_preview")
+
+       core.after(4, function()
+               if mod_channel:is_writeable() then
+                       mod_channel:send_all("preview talk to experimental")
+               end
+       end)
 end)
 
 core.register_on_modchannel_message(function(channel, sender, message)
@@ -116,12 +122,6 @@ core.after(2, function()
        preview_minimap()
 end)
 
-core.after(4, function()
-       if mod_channel:is_writeable() then
-               mod_channel:send_all("preview talk to experimental")
-       end
-end)
-
 core.after(5, function()
        if core.ui.minimap then
                core.ui.minimap:show()