diff options
author | Perttu Ahola <celeron55@gmail.com> | 2012-07-21 21:23:15 +0300 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-07-21 21:23:15 +0300 |
commit | 0b612539318a688ad24b66392bf39aedf8a01f62 (patch) | |
tree | e3f48eb66d599767e8310851ae2e29335bd3fa6a /builtin | |
parent | a2738dec591e9a399e613b9161a7e3ea98674180 (diff) | |
download | minetest-0b612539318a688ad24b66392bf39aedf8a01f62.tar.gz minetest-0b612539318a688ad24b66392bf39aedf8a01f62.tar.bz2 minetest-0b612539318a688ad24b66392bf39aedf8a01f62.zip |
Actually fix facedir-rotated nodes placed using minetest.env:place_node()
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/item.lua | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/builtin/item.lua b/builtin/item.lua index 756c1de6a..5cd28303a 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 - 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) + elseif def.paramtype2 == 'facedir' then + local placer_pos = placer:getpos() + if placer_pos then + local dir = {x = pos.x - placer_pos.x, y = pos.y - placer_pos.y, z = pos.z - placer_pos.z} + newnode.param2 = minetest.dir_to_facedir(dir) + minetest.log("action", "facedir: " .. newnode.param2) + end end -- Add node and update |