Handle nil placer as it might occur when using minetest.env:place_node. (Uberi)

master
darkrose 2012-07-21 03:12:38 +10:00 committed by Perttu Ahola
parent dece3a3600
commit f21af8da9c
1 changed files with 1 additions and 1 deletions

View 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)