This commit is contained in:
HybridDog 2015-04-16 16:56:32 +02:00
parent b2195be046
commit 7896bacadc
9 changed files with 55 additions and 42 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -26,17 +26,18 @@ end
weather = read_weather() weather = read_weather()
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
if weather == "rain" or weather == "snow" then if weather == "rain"
or weather == "snow" then
if math.random(1, 10000) == 1 then if math.random(1, 10000) == 1 then
weather = "none" weather = "none"
save_weather() save_weather()
end end
else else
if math.random(1, 50000) == 1 then local ran = math.random(1, 5000000)
if ran == 1 then
weather = "rain" weather = "rain"
save_weather() save_weather()
end elseif ran == 2 then
if math.random(1, 50000) == 2 then
weather = "snow" weather = "snow"
save_weather() save_weather()
end end

View File

@ -1,24 +1,35 @@
-- Rain -- Rain
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",
}
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
if weather ~= "rain" then return end if weather ~= "rain" then
return
end
for _, player in ipairs(minetest.get_connected_players()) do for _, player in ipairs(minetest.get_connected_players()) do
local ppos = player:getpos() local ppos = player:getpos()
-- Make sure player is not in a cave/house... -- Make sure player is not in a cave/house...
if minetest.env:get_node_light(ppos, 0.5) ~= 15 then return end --if minetest.get_node_light(ppos, 0.5) ~= 15 then return end
local minp = addvectors(ppos, {x=-9, y=7, z=-9}) spawnerdef.minpos = addvectors(ppos, {x=-9, y=7, z=-9})
local maxp = addvectors(ppos, {x= 9, y=7, z= 9}) spawnerdef.maxpos = addvectors(ppos, {x= 9, y=7, z= 9})
local vel = {x=0, y= -4, z=0} spawnerdef.minvel = {x=0, y= -40, z=0}
local acc = {x=0, y=-9.81, z=0} spawnerdef.maxvel = spawnerdef.minvel
spawnerdef.minacc = {x=0, y= 0, z=0}
spawnerdef.maxacc = spawnerdef.minacc
minetest.add_particlespawner({amount=25, time=0.5, spawnerdef.playername = player:get_player_name()
minpos=minp, maxpos=maxp,
minvel=vel, maxvel=vel, minetest.add_particlespawner(spawnerdef)
minacc=acc, maxacc=acc,
minexptime=0.8, maxexptime=0.8,
minsize=25, maxsize=25,
collisiondetection=false, vertical=true, texture="weather_rain.png", player=player:get_player_name()})
end end
end) end)

View File

@ -1,40 +1,41 @@
-- Snow -- Snow
local spawnerdef = {
amount = 8,
time = 0.5,
minexptime = 3,
maxexptime = 15,
minsize = 0.8,
maxsize = 1.2,
collisiondetection = true,
}
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
if weather ~= "snow" then return end if weather ~= "snow" then
return
end
for _, player in ipairs(minetest.get_connected_players()) do for _, player in ipairs(minetest.get_connected_players()) do
local ppos = player:getpos() local ppos = player:getpos()
-- Make sure player is not in a cave/house... -- Make sure player is not in a cave/house...
if minetest.env:get_node_light(ppos, 0.5) ~= 15 then return end --if minetest.get_node_light(ppos, 0.5) ~= 15 then return end
local minp = addvectors(ppos, {x=-9, y=7, z=-9}) spawnerdef.minpos = addvectors(ppos, {x=-9, y=7, z=-9})
local maxp = addvectors(ppos, {x= 9, y=7, z= 9}) spawnerdef.maxpos = addvectors(ppos, {x= 9, y=7, z= 9})
local minp_deep = addvectors(ppos, {x=-10, y=3.2, z=-10}) spawnerdef.minvel = {x=0, y= -1, z=0}
local maxp_deep = addvectors(ppos, {x= 10, y=2.6, z= 10}) spawnerdef.maxvel = spawnerdef.minvel
spawnerdef.minacc = {x=0, y= 0, z=0}
spawnerdef.maxacc = spawnerdef.minacc
local vel = {x=0, y= -0.5, z=0} spawnerdef.playername = player:get_player_name()
local acc = {x=0, y= -0.5, z=0}
minetest.add_particlespawner(5, 0.5, for _,i in ipairs({"", "2"}) do
minp, maxp, spawnerdef.texture = "weather_snow"..i..".png"
vel, vel, minetest.add_particlespawner(spawnerdef)
acc, acc, end
5, 5,
25, 25,
false, "weather_snow.png", 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())
end end
end) end)
local snow_box = --[[local snow_box =
{ {
type = "fixed", type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5} fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}
@ -51,7 +52,7 @@ minetest.register_node("weather:snow_cover", {
drop = {} drop = {}
}) })
--[[ Enable this section if you have a very fast PC --[ Enable this section if you have a very fast PC
minetest.register_abm({ minetest.register_abm({
nodenames = {"group:crumbly", "group:snappy", "group:cracky", "group:choppy"}, nodenames = {"group:crumbly", "group:snappy", "group:cracky", "group:choppy"},
neighbors = {"default:air"}, neighbors = {"default:air"},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

View File

Before

Width:  |  Height:  |  Size: 647 B

After

Width:  |  Height:  |  Size: 647 B