From 64a91eb9f71e0ebba66db56333789c46db191d92 Mon Sep 17 00:00:00 2001 From: francisco athens Date: Wed, 6 Jan 2021 15:02:07 -0800 Subject: [PATCH] position checks for cottages branch --- witches.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/witches.lua b/witches.lua index e60e48a..02bd93f 100644 --- a/witches.lua +++ b/witches.lua @@ -55,10 +55,14 @@ 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") + if pos1 then + minetest.set_node(pos1, {name = "fireflies:firefly"}) + --print("setting firefly"..minetest.pos_to_string(pos1)) + end + end end end,