diff --git a/csm/init.lua b/csm/init.lua index f25d4c1..480bd9a 100644 --- a/csm/init.lua +++ b/csm/init.lua @@ -269,6 +269,13 @@ end) -- Send "0" local function request_csms(c) + -- Don't request SSCSMs until TOSERVER_CLIENT_READY has been sent. + -- There is no callback for this, polling must be used instead. + if not minetest.localplayer then + minetest.after(0.05, request_csms, c) + return + end + base_env._raw.minetest.localplayer = minetest.localplayer base_env._raw.minetest.camera = minetest.camera c = c or 10 diff --git a/csm_strict/init.lua b/csm_strict/init.lua index 64e6dc5..288e6f6 100644 --- a/csm_strict/init.lua +++ b/csm_strict/init.lua @@ -344,6 +344,13 @@ end) -- Send "0" local function request_csms(c) + -- Don't request SSCSMs until TOSERVER_CLIENT_READY has been sent. + -- There is no callback for this, polling must be used instead. + if not minetest.localplayer then + minetest.after(0.05, request_csms, c) + return + end + base_env._raw.minetest.localplayer = minetest.localplayer base_env._raw.minetest.camera = minetest.camera c = c or 10