weather_pack/weather/rain.lua

36 lines
881 B
Lua
Raw Normal View History

2013-03-24 14:40:18 +01:00
-- Rain
2015-04-16 16:56:32 +02:00
local spawnerdef = {
amount = 25,
time = 0.5,
minexptime = 0.8,
maxexptime = 0.8,
minsize = 0.8,
maxsize = 1.2,
collisiondetection = true,
vertical = true,
texture = "weather_rain.png",
}
2013-03-24 14:40:18 +01:00
minetest.register_globalstep(function(dtime)
2015-04-16 16:56:32 +02:00
if weather ~= "rain" then
return
end
2013-03-24 14:40:18 +01:00
for _, player in ipairs(minetest.get_connected_players()) do
local ppos = player:getpos()
-- Make sure player is not in a cave/house...
2015-04-16 16:56:32 +02:00
--if minetest.get_node_light(ppos, 0.5) ~= 15 then return end
spawnerdef.minpos = addvectors(ppos, {x=-9, y=7, z=-9})
spawnerdef.maxpos = addvectors(ppos, {x= 9, y=7, z= 9})
2013-03-24 14:40:18 +01:00
2015-04-16 16:56:32 +02:00
spawnerdef.minvel = {x=0, y= -40, z=0}
spawnerdef.maxvel = spawnerdef.minvel
spawnerdef.minacc = {x=0, y= 0, z=0}
spawnerdef.maxacc = spawnerdef.minacc
2013-03-24 14:40:18 +01:00
2015-04-16 16:56:32 +02:00
spawnerdef.playername = player:get_player_name()
2013-03-24 14:40:18 +01:00
2015-04-16 16:56:32 +02:00
minetest.add_particlespawner(spawnerdef)
2013-03-24 14:40:18 +01:00
end
end)