]> git.lizzy.rs Git - crafter_client.git/blob - init.lua
Finally fix client not initializing fully, randomly :)
[crafter_client.git] / init.lua
1 --declare globals
2 weather_intake = nil
3 weather = nil
4 weather_type = nil
5 running_send = nil
6 player_movement_state = nil
7 nether = nil
8 aether = nil
9 run = nil
10
11 function initialize_all()
12         --declare globals for now
13         weather_intake = minetest.mod_channel_join("weather_intake")
14         weather = minetest.mod_channel_join("weather_nodes")
15         weather_type = minetest.mod_channel_join("weather_type")
16         running_send = minetest.mod_channel_join("running_send")
17         player_movement_state = minetest.mod_channel_join("player.player_movement_state")
18         nether = minetest.mod_channel_join("nether_teleporters")
19         aether = minetest.mod_channel_join("aether_teleporters")
20                 
21         --next we load everything seperately because it's easier to work on individual files than have everything jammed into one file
22         --not into seperate mods because that is unnecessary and cumbersome
23         local path = minetest.get_modpath("crafter_client")
24         dofile(path.."/player_input.lua")
25         dofile(path.."/weather_handling.lua")
26         dofile(path.."/environment_effects.lua")
27         dofile(path.."/nether.lua")
28         dofile(path.."/aether.lua")
29         dofile(path.."/waila.lua")
30         dofile(path.."/music_handling.lua")
31 end
32
33 --we must delay initialization until the player exists in the world
34 local function recursive_startup_attempt()
35         local ready_to_go = minetest.localplayer
36         if ready_to_go and minetest.get_node_or_nil(minetest.localplayer:get_pos()) then
37                 --good to begin
38                 initialize_all()
39         else
40                 --try again
41                 minetest.after(0,function()
42                         recursive_startup_attempt()
43                 end)
44         end
45 end
46
47 --begin initial attempt
48 recursive_startup_attempt()