From b8dbb5a223d3def8f6e2d37c5b7ad39118605e92 Mon Sep 17 00:00:00 2001 From: Anthony Date: Fri, 20 Jul 2012 22:17:43 -0300 Subject: [PATCH] placer is not nil, but placer:getpos() is. Ensure that is checked for. --- builtin/item.lua | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/builtin/item.lua b/builtin/item.lua index 756c1de6a..612427fe7 100644 --- a/builtin/item.lua +++ b/builtin/item.lua @@ -148,11 +148,13 @@ 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' and placer then + elseif def.paramtype2 == 'facedir' 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) - minetest.log("action", "facedir: " .. newnode.param2) + if playerpos ~= nil then + local dir = {x = pos.x - playerpos.x, y = pos.y - playerpos.y, z = pos.z - playerpos.z} + newnode.param2 = minetest.dir_to_facedir(dir) + minetest.log("action", "facedir: " .. newnode.param2) + end end -- Add node and update