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