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