1 print("weather client go")
2 local weather = minetest.mod_channel_join("weather_nodes")
3 local weather_type = minetest.mod_channel_join("weather_type")
4 local server = minetest.mod_channel_join("server")
7 local do_effects = false
9 local weather_update_timer = 0
12 local spawn_weather = function(player)
13 local pos = player:get_pos()
15 local particle_table = {}
17 local area = vector.new(10,10,10)
19 local min = vector.subtract(pos, area)
20 local max = vector.add(pos, area)
23 local area_index = minetest.find_nodes_in_area_under_air(min, max, all_nodes)
25 local spawn_table = {}
26 --find the highest y value
27 for _,index in pairs(area_index) do
28 if not spawn_table[index.x] then spawn_table[index.x] = {} end
29 if not spawn_table[index.x][index.z] then
30 spawn_table[index.x][index.z] = index.y
31 elseif spawn_table[index.x][index.z] < index.y then
32 spawn_table[index.x][index.z] = index.y
36 for x,x_index in pairs(spawn_table) do
37 for z,y in pairs(x_index) do
38 if minetest.get_node_or_nil(vector.new(x,y+1,z)) ~= nil then
39 --print("got to this spointa")
40 local pos = vector.new(x,y+1,z)
42 --local lightlevel = minetest.get_node_light(pos, 0.5)
43 --print("but not here")
44 if lightlevel >= 14 then
45 minetest.add_particlespawner({
48 minpos = vector.new(x-0.5,y,z-0.5),
49 maxpos = vector.new(x+0.5,y+20,z+0.5),
50 minvel = {x=-0.2, y=-0.2, z=-0.2},
51 maxvel = {x=0.2, y=-0.5, z=0.2},
52 minacc = {x=0, y=0, z=0},
53 maxacc = {x=0, y=0, z=0},
58 collisiondetection = true,
59 collision_removal = true,
60 object_collision = false,
61 texture = "snowflake_"..math.random(1,2)..".png",
62 playername = player:get_name(),
70 minetest.register_globalstep(function(dtime)
73 weather_update_timer = weather_update_timer + dtime
74 if weather_update_timer >= 0.5 then
75 weather_update_timer = 0
76 local player = minetest.localplayer
77 spawn_weather(minetest.localplayer)
85 minetest.register_on_modchannel_message(function(channel_name, sender, message)
86 if channel_name == "weather_nodes" then
87 all_nodes = minetest.deserialize(message)
90 if channel_name == "weather_type" then
91 if message == "1" then