From 56d49e08b86cabd26f90cd51c3c95736fd3482dc Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 4 Jun 2020 16:36:53 +0200 Subject: [PATCH] Delay before calling get_connected_players --- mods/ENVIRONMENT/mcl_weather/skycolor.lua | 12 +++++++++++- mods/HELP/mcl_craftguide/init.lua | 4 +++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/mods/ENVIRONMENT/mcl_weather/skycolor.lua b/mods/ENVIRONMENT/mcl_weather/skycolor.lua index d32c02809..a79410739 100644 --- a/mods/ENVIRONMENT/mcl_weather/skycolor.lua +++ b/mods/ENVIRONMENT/mcl_weather/skycolor.lua @@ -1,3 +1,5 @@ +local mods_loaded = false + mcl_weather.skycolor = { -- Should be activated before do any effect. active = true, @@ -169,7 +171,11 @@ mcl_weather.skycolor = { -- Simply getter. Ether returns user given players list or get all connected players if none provided get_players = function(players) if players == nil or #players == 0 then - players = minetest.get_connected_players() + if mods_loaded then + players = minetest.get_connected_players() + elseif players == nil then + players = {} + end end return players end, @@ -222,3 +228,7 @@ minetest.register_on_respawnplayer(initsky) mcl_worlds.register_on_dimension_change(function(player) mcl_weather.skycolor.update_sky_color({player}) end) + +minetest.register_on_mods_loaded(function() + mods_loaded = true +end) diff --git a/mods/HELP/mcl_craftguide/init.lua b/mods/HELP/mcl_craftguide/init.lua index 5d9c23359..86bd742a9 100644 --- a/mods/HELP/mcl_craftguide/init.lua +++ b/mods/HELP/mcl_craftguide/init.lua @@ -1088,7 +1088,9 @@ if progressive_mode then M.after(POLL_FREQ, poll_new_items) end - poll_new_items() + M.register_on_mods_loaded(function() + M.after(1, poll_new_items) + end) mcl_craftguide.add_recipe_filter("Default progressive filter", progressive_filter)