Add pos check to spawn fireflies to close

https://gitlab.com/freelikegnu/witches/-/issues/1
master
Francisco 2021-01-06 21:54:10 +00:00
parent a45596c3c3
commit 37a8f0774c
1 changed files with 6 additions and 4 deletions

View File

@ -55,10 +55,12 @@ witches.witch_types = {
do_custom_addendum = function(self)
if math.random() < .0001 and minetest.registered_nodes["fireflies:firefly"] then
local pos = self.object:get_pos()
pos.y = pos.y+1
local pos1 = minetest.find_node_near(pos, 3, "air")
minetest.set_node(pos1, {name = "fireflies:firefly"})
--print("setting firefly"..minetest.pos_to_string(pos1))
if pos then
pos.y = pos.y+1
local pos1 = minetest.find_node_near(pos, 3, "air")
minetest.set_node(pos1, {name = "fireflies:firefly"})
--print("setting firefly"..minetest.pos_to_string(pos1))
end
end
end,