summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authordarkrose <lisa@ltmnet.com>2012-07-21 03:12:38 +1000
committerPerttu Ahola <celeron55@gmail.com>2012-07-21 02:27:46 +0300
commitf21af8da9c1ca72b720fc8c2249baa349af84a47 (patch)
tree0fdfc5f107399d765f42c3f1b17825d593f64b29 /builtin
parentdece3a3600b7fe8ca4e0d7312f7ef455a7a2214a (diff)
downloadminetest-f21af8da9c1ca72b720fc8c2249baa349af84a47.tar.gz
minetest-f21af8da9c1ca72b720fc8c2249baa349af84a47.tar.bz2
minetest-f21af8da9c1ca72b720fc8c2249baa349af84a47.zip
Handle nil placer as it might occur when using minetest.env:place_node. (Uberi)
Diffstat (limited to 'builtin')
-rw-r--r--builtin/item.lua2
1 files changed, 1 insertions, 1 deletions
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)