mirror of
https://github.com/Splizard/minetest-mod-snow.git
synced 2024-12-28 23:40:17 +01:00
update particlespawner and use a random rotation and/or mirroring for the falling snow texture
This commit is contained in:
parent
96086a048f
commit
d0f7233b3d
@ -103,6 +103,27 @@ if snow.enable_snowfall then
|
|||||||
return {x=x,y=y,z=z}
|
return {x=x,y=y,z=z}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local default_snow_particle = {
|
||||||
|
amount = 3,
|
||||||
|
time = 0.5,
|
||||||
|
exptime = 5,
|
||||||
|
size = 50,
|
||||||
|
collisiondetection = false,
|
||||||
|
vertical = false,
|
||||||
|
}
|
||||||
|
|
||||||
|
local function get_snow_particledef(data)
|
||||||
|
for n,i in pairs(default_snow_particle) do
|
||||||
|
data[n] = data[n] or i
|
||||||
|
end
|
||||||
|
for _,i in pairs({"vel", "acc", "exptime", "size"}) do
|
||||||
|
data["min"..i] = data[i]
|
||||||
|
data["max"..i] = data[i]
|
||||||
|
end
|
||||||
|
data.texture = "weather_snow.png^[transform"..math.random(0,7)
|
||||||
|
return data
|
||||||
|
end
|
||||||
|
|
||||||
local snow_fall=function (pos, player, animate)
|
local snow_fall=function (pos, player, animate)
|
||||||
local ground_y = nil
|
local ground_y = nil
|
||||||
for y=pos.y+10,pos.y+20,1 do
|
for y=pos.y+10,pos.y+20,1 do
|
||||||
@ -129,13 +150,13 @@ if snow.enable_snowfall then
|
|||||||
local maxp = addvectors(spos, {x= 9, y=5, z= 9})
|
local maxp = addvectors(spos, {x= 9, y=5, z= 9})
|
||||||
local vel = {x=0, y= -1, z=-1}
|
local vel = {x=0, y= -1, z=-1}
|
||||||
local acc = {x=0, y= 0, z=0}
|
local acc = {x=0, y= 0, z=0}
|
||||||
minetest.add_particlespawner(3, 0.5,
|
minetest.add_particlespawner(get_snow_particledef({
|
||||||
minp, maxp,
|
minpos = minp,
|
||||||
vel, vel,
|
maxpos = maxp,
|
||||||
acc, acc,
|
vel = vel,
|
||||||
5, 5,
|
acc = acc,
|
||||||
50, 50,
|
playername = player:get_player_name()
|
||||||
false, "weather_snow.png", player:get_player_name())
|
}))
|
||||||
end
|
end
|
||||||
snow.place(pos, true)
|
snow.place(pos, true)
|
||||||
--minetest.place_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="default:snow"}) -- LazyJ
|
--minetest.place_node({x=pos.x, y=pos.y+2, z=pos.z}, {name="default:snow"}) -- LazyJ
|
||||||
@ -163,22 +184,27 @@ if snow.enable_snowfall then
|
|||||||
local acc = {x=0, y= 0, z=0}
|
local acc = {x=0, y= 0, z=0}
|
||||||
|
|
||||||
if not snow.lighter_snowfall then
|
if not snow.lighter_snowfall then
|
||||||
minetest.add_particlespawner(5, 0.5,
|
minetest.add_particlespawner(get_snow_particledef({
|
||||||
minp, maxp,
|
amount = 5,
|
||||||
vel, vel,
|
minpos = minp,
|
||||||
acc, acc,
|
maxpos = maxp,
|
||||||
5, 5,
|
vel = vel,
|
||||||
25, 25,
|
acc = acc,
|
||||||
false, "weather_snow.png", player:get_player_name())
|
size = 25,
|
||||||
|
playername = player:get_player_name()
|
||||||
|
}))
|
||||||
|
|
||||||
|
minetest.add_particlespawner(get_snow_particledef({
|
||||||
|
amount = 4,
|
||||||
|
minpos = minp_deep,
|
||||||
|
maxpos = maxp_deep,
|
||||||
|
vel = vel,
|
||||||
|
acc = acc,
|
||||||
|
exptime = 4,
|
||||||
|
size = 25,
|
||||||
|
playername = player:get_player_name()
|
||||||
|
}))
|
||||||
|
|
||||||
minetest.add_particlespawner(4, 0.5,
|
|
||||||
minp_deep, maxp_deep,
|
|
||||||
vel, vel,
|
|
||||||
acc, acc,
|
|
||||||
4, 4,
|
|
||||||
25, 25,
|
|
||||||
false, "weather_snow.png", player:get_player_name())
|
|
||||||
|
|
||||||
if math.random(1,5) == 4 then
|
if math.random(1,5) == 4 then
|
||||||
snow_fall(randpos(sminp, smaxp), player)
|
snow_fall(randpos(sminp, smaxp), player)
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user