]> git.lizzy.rs Git - crafter_client.git/blob - init.lua
Add slightly better nether teleport animation
[crafter_client.git] / init.lua
1 --first we join the necessary channels so the mod can "listen"  to what the server says and "talk" to it
2 weather_intake = minetest.mod_channel_join("weather_intake")
3 weather = minetest.mod_channel_join("weather_nodes")
4 weather_type = minetest.mod_channel_join("weather_type")
5 running_send = minetest.mod_channel_join("running_send")
6 player_movement_state = minetest.mod_channel_join("player.player_movement_state")
7
8 nether = minetest.mod_channel_join("nether_teleporters")
9
10
11 function initialize_all()
12         --first we tell the server we're ready
13         weather_intake:send_all("READY")
14         weather_intake:leave()
15         weather_intake = nil --leave the channel
16         
17         --next we load everything seperately because it's easier to work on individual files than have everything jammed into one file
18         --not into seperate mods because that is unnecessary and cumbersome
19         local path = minetest.get_modpath("crafter_client")
20         dofile(path.."/player_input.lua")
21         dofile(path.."/weather_handling.lua")
22         dofile(path.."/environment_effects.lua")
23         dofile(path.."/nether.lua")
24 end
25
26 --we must delay initialization until the player's camera exists in the world
27 --since there does not seem to be any client_loaded function
28 local initialize = false
29 minetest.register_globalstep(function(dtime)
30         if not initialize and minetest.camera and not vector.equals(minetest.camera:get_pos(),vector.new(0,0,0)) then
31                 minetest.after(2, function()
32                         if weather_intake then
33                                 initialize = true
34                                 initialize_all()
35                         end
36                 end)
37         end
38 end)