From 1d40e1039f61ab84c6f1328fb52341d2e02d0fdf Mon Sep 17 00:00:00 2001 From: Anthony Date: Sat, 23 Jun 2012 11:43:47 -0300 Subject: [PATCH] Handle nil placer as it might occur when using minetest.env:place_node. --- builtin/item.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/item.lua b/builtin/item.lua index f85bd7223..756c1de6a 100644 --- a/builtin/item.lua +++ b/builtin/item.lua @@ -148,7 +148,7 @@ function minetest.item_place_node(itemstack, placer, pointed_thing) local dir = {x = under.x - above.x, y = under.y - above.y, z = under.z - above.z} newnode.param2 = minetest.dir_to_wallmounted(dir) -- Calculate the direction for furnaces and chests and stuff - elseif def.paramtype2 == 'facedir' then + elseif def.paramtype2 == 'facedir' and placer then local playerpos = placer:getpos() local dir = {x = pos.x - playerpos.x, y = pos.y - playerpos.y, z = pos.z - playerpos.z} newnode.param2 = minetest.dir_to_facedir(dir)