Begin snow optimization
This commit is contained in:
parent
58d2eb3a21
commit
32ba43a793
@ -85,11 +85,8 @@ end)
|
||||
|
||||
|
||||
--spawn snow nodes
|
||||
local snow_timer = 0
|
||||
local do_snow = function(dtime)
|
||||
snow_timer = snow_timer + dtime
|
||||
if snow_timer > 3 then
|
||||
snow_timer = 0
|
||||
local function do_snow()
|
||||
if weather_type == 1 then
|
||||
for _,player in ipairs(minetest.get_connected_players()) do
|
||||
--print("running")
|
||||
local pos = player:get_pos()
|
||||
@ -97,7 +94,7 @@ local do_snow = function(dtime)
|
||||
local meta = player:get_meta()
|
||||
local particle_table = {}
|
||||
|
||||
local area = vector.new(40,40,40)
|
||||
local area = vector.new(80,40,80)
|
||||
|
||||
local min = vector.subtract(pos, area)
|
||||
local max = vector.add(pos, area)
|
||||
@ -122,7 +119,6 @@ local do_snow = function(dtime)
|
||||
local ice_list = {}
|
||||
for x,x_index in pairs(spawn_table) do
|
||||
for z,y in pairs(x_index) do
|
||||
if math.random() > 0.995 then
|
||||
local lightlevel = minetest.get_node_light(vector.new(x,y+1,z), 0.5)
|
||||
if lightlevel >= 14 then
|
||||
--make it so buildable to nodes get replaced
|
||||
@ -144,7 +140,6 @@ local do_snow = function(dtime)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if bulk_list then
|
||||
minetest.bulk_set_node(bulk_list, {name="weather:snow"})
|
||||
end
|
||||
@ -153,8 +148,14 @@ local do_snow = function(dtime)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.after(1.5, function()
|
||||
do_snow()
|
||||
end)
|
||||
end
|
||||
|
||||
do_snow()
|
||||
|
||||
|
||||
|
||||
--this sets random weather
|
||||
@ -168,10 +169,6 @@ minetest.register_globalstep(function(dtime)
|
||||
function_send_weather_type()
|
||||
update_player_sky()
|
||||
end
|
||||
--spawn snow nodes
|
||||
if weather_type == 1 then
|
||||
do_snow(dtime)
|
||||
end
|
||||
end)
|
||||
|
||||
local snowball_throw = function(player)
|
||||
|
Loading…
x
Reference in New Issue
Block a user