Finally fix error 23
parent
a66d5449f2
commit
167177e948
57
init.lua
57
init.lua
|
@ -1,19 +1,20 @@
|
|||
--first we join the necessary channels so the mod can "listen" to what the server says and "talk" to it
|
||||
weather_intake = minetest.mod_channel_join("weather_intake")
|
||||
weather = minetest.mod_channel_join("weather_nodes")
|
||||
weather_type = minetest.mod_channel_join("weather_type")
|
||||
running_send = minetest.mod_channel_join("running_send")
|
||||
player_movement_state = minetest.mod_channel_join("player.player_movement_state")
|
||||
|
||||
nether = minetest.mod_channel_join("nether_teleporters")
|
||||
|
||||
--declare globals
|
||||
weather_intake = nil
|
||||
weather = nil
|
||||
weather_type = nil
|
||||
running_send = nil
|
||||
player_movement_state = nil
|
||||
nether = nil
|
||||
|
||||
function initialize_all()
|
||||
--first we tell the server we're ready
|
||||
weather_intake:send_all("READY")
|
||||
weather_intake:leave()
|
||||
weather_intake = nil --leave the channel
|
||||
|
||||
--declare globals for now
|
||||
weather_intake = minetest.mod_channel_join("weather_intake")
|
||||
weather = minetest.mod_channel_join("weather_nodes")
|
||||
weather_type = minetest.mod_channel_join("weather_type")
|
||||
running_send = minetest.mod_channel_join("running_send")
|
||||
player_movement_state = minetest.mod_channel_join("player.player_movement_state")
|
||||
nether = minetest.mod_channel_join("nether_teleporters")
|
||||
|
||||
--next we load everything seperately because it's easier to work on individual files than have everything jammed into one file
|
||||
--not into seperate mods because that is unnecessary and cumbersome
|
||||
local path = minetest.get_modpath("crafter_client")
|
||||
|
@ -23,16 +24,22 @@ function initialize_all()
|
|||
dofile(path.."/nether.lua")
|
||||
end
|
||||
|
||||
--we must delay initialization until the player's camera exists in the world
|
||||
--since there does not seem to be any client_loaded function
|
||||
local initialize = false
|
||||
minetest.register_globalstep(function(dtime)
|
||||
if not initialize and minetest.camera and not vector.equals(minetest.camera:get_pos(),vector.new(0,0,0)) then
|
||||
minetest.after(2, function()
|
||||
if weather_intake then
|
||||
initialize = true
|
||||
initialize_all()
|
||||
end
|
||||
--we must delay initialization until the server tells us it's ready to begin
|
||||
local initialize_client_modchannels = minetest.mod_channel_join("initializer")
|
||||
|
||||
local function recursive_startup_attempt()
|
||||
local ready_to_go = initialize_client_modchannels:is_writeable()
|
||||
if ready_to_go == true then
|
||||
--good to begin
|
||||
initialize_all()
|
||||
initialize_client_modchannels:leave()
|
||||
else
|
||||
--try again
|
||||
minetest.after(0,function()
|
||||
recursive_startup_attempt()
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
--begin initial attempt
|
||||
recursive_startup_attempt()
|
||||
|
|
|
@ -235,3 +235,11 @@ minetest.register_on_modchannel_message(function(channel_name, sender, message)
|
|||
rain_sound_handle = nil
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
--We must tell the server that we're ready
|
||||
minetest.after(0,function()
|
||||
weather_intake:send_all("READY")
|
||||
weather_intake:leave()
|
||||
weather_intake = nil --leave the channel
|
||||
end)
|
||||
|
|
Loading…
Reference in New Issue