3 snow
.particles_count
= 15
6 -- calculates coordinates and draw particles for snow weather
7 snow
.add_rain_particles
= function(player
)
9 for i
=snow
.particles_count
, 1,-1 do
10 local random_pos_x
, random_pos_y
, random_pos_z
= weather
.get_random_pos_by_player_look_dir(player
)
11 random_pos_y
= math
.random() + math
.random(player
:getpos().y
- 1, player
:getpos().y
+ 7)
12 if minetest
.get_node_light({x
=random_pos_x
, y
=random_pos_y
, z
=random_pos_z
}, 0.5) == 15 then
13 rain
.last_rp_count
= rain
.last_rp_count
+ 1
14 minetest
.add_particle({
15 pos
= {x
=random_pos_x
, y
=random_pos_y
, z
=random_pos_z
},
16 velocity
= {x
= math
.random(-1,-0.5), y
= math
.random(-2,-1), z
= math
.random(-1,-0.5)},
17 acceleration
= {x
= math
.random(-1,-0.5), y
=-0.5, z
= math
.random(-1,-0.5)},
19 size
= math
.random(0.5, 2),
20 collisiondetection
= true,
21 collision_removal
= true,
23 texture
= snow
.get_texture(),
24 playername
= player
:get_player_name()
30 snow
.set_sky_box
= function()
32 "weather-pack-snow-sky",
34 {r
=241, g
=244, b
=249},
37 skycolor
.active
= true
40 snow
.clear
= function()
41 skycolor
.remove_layer("weather-pack-snow-sky")
42 snow
.init_done
= false
45 -- Simple random texture getter
46 snow
.get_texture
= function()
48 local random_number
= math
.random()
49 if random_number
> 0.5 then
50 texture_name
= "weather_pack_snow_snowflake1.png"
52 texture_name
= "weather_pack_snow_snowflake2.png"
58 minetest
.register_globalstep(function(dtime
)
59 if weather
.state
~= "snow" then
63 timer
= timer
+ dtime
;
70 if snow
.init_done
== false then
75 for _
, player
in ipairs(minetest
.get_connected_players()) do
76 if (weather
.is_underwater(player
) or not mcl_util
.has_weather(player
:getpos())) then
79 snow
.add_rain_particles(player
)
83 -- register snow weather
84 if weather
.reg_weathers
.snow
== nil then
85 weather
.reg_weathers
.snow
= {