]> git.lizzy.rs Git - crafter_client.git/blob - init.lua
Fix bug 10 in crafter
[crafter_client.git] / init.lua
1 --don't crash if not in crafter client
2 for _,r in pairs(minetest.get_csm_restrictions()) do 
3         if r == true then
4                 return
5         end
6 end
7 if not minetest.get_node_def("client_version_checker:this_is_the_signature_of_crafter00111010010001000011110000110011") then
8         return
9 end
10
11 function initialize_all()
12         --declare globals for now
13
14         --next we load everything seperately because it's easier to work on individual files than have everything jammed into one file
15         --not into seperate mods because that is unnecessary and cumbersome
16         local path = minetest.get_modpath("crafter_client")
17         dofile(path.."/player_input.lua")
18         dofile(path.."/weather_handling.lua")
19         dofile(path.."/environment_effects.lua")
20         dofile(path.."/nether.lua")
21         dofile(path.."/aether.lua")
22         dofile(path.."/waila.lua")
23         dofile(path.."/music_handling.lua")
24         dofile(path.."/version_send.lua")
25         dofile(path.."/colored_names/colored_names.lua")
26         dofile(path.."/fire_handling.lua")
27 end
28
29 --we must delay initialization until the player exists in the world
30 local function recursive_startup_attempt()
31         local ready_to_go = minetest.localplayer
32         if ready_to_go and minetest.get_node_or_nil(minetest.localplayer:get_pos()) then
33                 --good to begin
34                 initialize_all()
35         else
36                 --try again
37                 minetest.after(0,function()
38                         recursive_startup_attempt()
39                 end)
40         end
41 end
42
43 --begin initial attempt
44 recursive_startup_attempt()
45
46 --leave mod channels on shutdown
47 --[[
48 minetest.register_on_shutdown(function()
49         weather_intake = nil
50         weather = nil
51         weather_type = nil
52         player_movement_state = nil
53         nether = nil
54         aether = nil
55         name = nil
56         version_channel = nil
57         fire_handling_channel = nil
58 end)
59 ]]--