Handle nil placer as it might occur when using minetest.env:place_node. (Uberi)
authordarkrose <lisa@ltmnet.com>
Fri, 20 Jul 2012 17:12:38 +0000 (03:12 +1000)
committerPerttu Ahola <celeron55@gmail.com>
Fri, 20 Jul 2012 23:27:46 +0000 (02:27 +0300)
builtin/item.lua

index f85bd7223ee6c4dc043c57b48391008ffe98c9f8..756c1de6a58bf7e72ae87e0cd2ca78b8fc6e5d3a 100644 (file)
@@ -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)