diff --git a/weather/init.lua b/weather/init.lua index dd5c43e..b145380 100644 --- a/weather/init.lua +++ b/weather/init.lua @@ -5,10 +5,6 @@ assert(minetest.add_particlespawner, "I told you to run the latest GitHub!") -addvectors = function (v1, v2) - return {x=v1.x+v2.x, y=v1.y+v2.y, z=v1.z+v2.z} -end - save_weather = function () local file = io.open(minetest.get_worldpath().."/weather", "w+") file:write(minetest.serialize(weather)) diff --git a/weather/rain.lua b/weather/rain.lua index 411e174..b57fefb 100644 --- a/weather/rain.lua +++ b/weather/rain.lua @@ -7,8 +7,8 @@ minetest.register_globalstep(function(dtime) -- Make sure player is not in a cave/house... if minetest.env: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}) + local minp = vector.add(ppos, {x=-9, y=7, z=-9}) + local maxp = vector.add(ppos, {x= 9, y=7, z= 9}) local vel = {x=math.random()*weather.wind, y= -4, z=math.random()*weather.wind} local acc = {x=0, y=-9.81, z=0} diff --git a/weather/snow.lua b/weather/snow.lua index 634ff5b..98b0158 100644 --- a/weather/snow.lua +++ b/weather/snow.lua @@ -7,11 +7,11 @@ minetest.register_globalstep(function(dtime) -- Make sure player is not in a cave/house... if minetest.env: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}) + local minp = vector.add(ppos, {x=-9, y=7, z=-9}) + local maxp = vector.add(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}) + local minp_deep = vector.add(ppos, {x=-10, y=3.2, z=-10}) + local maxp_deep = vector.add(ppos, {x= 10, y=2.6, z= 10}) local vel = {x=math.random()*weather.wind, y= -0.5, z=math.random()*weather.wind} local acc = {x=0, y= -0.5, z=0} @@ -61,7 +61,7 @@ minetest.register_abm({ if weather == "snow" then if minetest.registered_nodes[node.name].drawtype == "normal" or minetest.registered_nodes[node.name].drawtype == "allfaces_optional" then - local np = addvectors(pos, {x=0, y=1, z=0}) + local np = vector.add(pos, {x=0, y=1, z=0}) if minetest.env:get_node_light(np, 0.5) == 15 and minetest.env:get_node(np).name == "air" then minetest.env:add_node(np, {name="weather:snow_cover"})