Delay before calling get_connected_players

This commit is contained in:
Wuzzy 2020-06-04 16:36:53 +02:00
parent 28710bb819
commit 56d49e08b8
2 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,5 @@
local mods_loaded = false
mcl_weather.skycolor = { mcl_weather.skycolor = {
-- Should be activated before do any effect. -- Should be activated before do any effect.
active = true, 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 -- Simply getter. Ether returns user given players list or get all connected players if none provided
get_players = function(players) get_players = function(players)
if players == nil or #players == 0 then 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 end
return players return players
end, end,
@ -222,3 +228,7 @@ minetest.register_on_respawnplayer(initsky)
mcl_worlds.register_on_dimension_change(function(player) mcl_worlds.register_on_dimension_change(function(player)
mcl_weather.skycolor.update_sky_color({player}) mcl_weather.skycolor.update_sky_color({player})
end) end)
minetest.register_on_mods_loaded(function()
mods_loaded = true
end)

View File

@ -1088,7 +1088,9 @@ if progressive_mode then
M.after(POLL_FREQ, poll_new_items) M.after(POLL_FREQ, poll_new_items)
end 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) mcl_craftguide.add_recipe_filter("Default progressive filter", progressive_filter)