]> git.lizzy.rs Git - crafter_client.git/blob - init.lua
Make client check for extremely specific crafter signature node and update version
[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 --declare globals
12 weather_intake = nil
13 weather = nil
14 weather_type = nil
15 player_movement_state = nil
16 nether = nil
17 aether = nil
18 name = nil
19 version_channel = nil
20 fire_handling_channel = nil
21
22 function initialize_all()
23         --declare globals for now
24         weather_intake = minetest.mod_channel_join("weather_intake")
25         weather = minetest.mod_channel_join("weather_nodes")
26         weather_type = minetest.mod_channel_join("weather_type")
27         player_movement_state = minetest.mod_channel_join(name..":player_movement_state")
28         nether = minetest.mod_channel_join(name..":nether_teleporters")
29         aether = minetest.mod_channel_join(name..":aether_teleporters")
30         version_channel = minetest.mod_channel_join(name..":client_version_channel")
31         fire_handling_channel = minetest.mod_channel_join(name..":fire_state")
32
33         --next we load everything seperately because it's easier to work on individual files than have everything jammed into one file
34         --not into seperate mods because that is unnecessary and cumbersome
35         local path = minetest.get_modpath("crafter_client")
36         dofile(path.."/player_input.lua")
37         dofile(path.."/weather_handling.lua")
38         dofile(path.."/environment_effects.lua")
39         dofile(path.."/nether.lua")
40         dofile(path.."/aether.lua")
41         dofile(path.."/waila.lua")
42         dofile(path.."/music_handling.lua")
43         dofile(path.."/version_send.lua")
44         dofile(path.."/colored_names/colored_names.lua")
45         dofile(path.."/fire_handling.lua")
46 end
47
48 --we must delay initialization until the player exists in the world
49 local function recursive_startup_attempt()
50         local ready_to_go = minetest.localplayer
51         if ready_to_go and minetest.get_node_or_nil(minetest.localplayer:get_pos()) then
52                 name = minetest.localplayer:get_name()
53                 --good to begin
54                 initialize_all()
55         else
56                 --try again
57                 minetest.after(0,function()
58                         recursive_startup_attempt()
59                 end)
60         end
61 end
62
63 --begin initial attempt
64 recursive_startup_attempt()