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()
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
weather = "none"
save_weather()
end
else
if math.random(1, 50000) == 1 then
local ran = math.random(1, 5000000)
if ran == 1 then
weather = "rain"
save_weather()
end
if math.random(1, 50000) == 2 then
elseif ran == 2 then
weather = "snow"
save_weather()
end

View File

@ -1,24 +1,35 @@
-- 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)
if weather ~= "rain" then return end
if weather ~= "rain" then
return
end
for _, player in ipairs(minetest.get_connected_players()) do
local ppos = player:getpos()
-- 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})
local maxp = addvectors(ppos, {x= 9, y=7, z= 9})
spawnerdef.minpos = 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}
local acc = {x=0, y=-9.81, z=0}
spawnerdef.minvel = {x=0, y= -40, 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,
minpos=minp, maxpos=maxp,
minvel=vel, maxvel=vel,
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()})
spawnerdef.playername = player:get_player_name()
minetest.add_particlespawner(spawnerdef)
end
end)

View File

@ -1,40 +1,41 @@
-- 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)
if weather ~= "snow" then return end
if weather ~= "snow" then
return
end
for _, player in ipairs(minetest.get_connected_players()) do
local ppos = player:getpos()
-- 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})
local maxp = addvectors(ppos, {x= 9, y=7, z= 9})
spawnerdef.minpos = 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})
local maxp_deep = addvectors(ppos, {x= 10, y=2.6, z= 10})
spawnerdef.minvel = {x=0, y= -1, z=0}
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}
local acc = {x=0, y= -0.5, z=0}
spawnerdef.playername = player:get_player_name()
minetest.add_particlespawner(5, 0.5,
minp, maxp,
vel, vel,
acc, acc,
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())
for _,i in ipairs({"", "2"}) do
spawnerdef.texture = "weather_snow"..i..".png"
minetest.add_particlespawner(spawnerdef)
end
end
end)
local snow_box =
--[[local snow_box =
{
type = "fixed",
fixed = {-0.5, -0.5, -0.5, 0.5, -0.4, 0.5}
@ -51,7 +52,7 @@ minetest.register_node("weather:snow_cover", {
drop = {}
})
--[[ Enable this section if you have a very fast PC
--[ Enable this section if you have a very fast PC
minetest.register_abm({
nodenames = {"group:crumbly", "group:snappy", "group:cracky", "group:choppy"},
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