mapgen torchspine wasn't having its timer set

This commit is contained in:
FaceDeer
2022-08-07 17:52:55 -06:00
parent cdaeb36b14
commit a1e837f9c0
4 changed files with 20 additions and 11 deletions

View File

@ -68,7 +68,7 @@ local grow_torchspine = function(pos)
local node_above_def = minetest.registered_nodes[node_above.name]
if not node_above_def.buildable_to then
-- don't grow, but do continue cycling the torch state
minetest.swap_node(pos, {name = "df_trees:torchspine_1", param2 = node.param2})
minetest.swap_node(pos, {name = "df_trees:torchspine_1", param2 = param2})
minetest.get_node_timer(pos):start(math.random(torchspine_min_delay, torchspine_max_delay))
return
end
@ -85,7 +85,7 @@ local grow_torchspine = function(pos)
end
if height >= 4 then
-- don't grow, but do continue cycling the torch state
minetest.swap_node(pos, {name = "df_trees:torchspine_1", param2 = node.param2})
minetest.swap_node(pos, {name = "df_trees:torchspine_1", param2 = param2})
minetest.get_node_timer(pos):start(math.random(torchspine_min_delay, torchspine_max_delay))
return
end
@ -94,7 +94,7 @@ local grow_torchspine = function(pos)
pos.y = pos.y + 1
minetest.get_node_timer(pos):start(math.random(torchspine_min_delay, torchspine_max_delay))
for i = 1, height+1 do
minetest.swap_node(pos, {name=torchspine_list[i], param2=param2})
minetest.swap_node(pos, {name=torchspine_list[i], param2 = param2})
pos.y = pos.y - 1
end
end
@ -355,7 +355,14 @@ df_trees.spawn_torchspine_vm = function(vi, area, data, data_param2, height, lit
local index = vi + area.ystride*i
data[index] = list[height-i]
data_param2[index] = param2
end
end
local pos = area:position(vi)
pos.y = pos.y+height-1
minetest.after(10, function()
local node = minetest.get_node(pos)
minetest.get_node_timer(pos):start(math.random()*3000)
end)
end
minetest.register_lbm({