Pass pointed_thing to after_place_node
authorShadowNinja <shadowninja@minetest.net>
Tue, 7 Jan 2014 02:15:44 +0000 (21:15 -0500)
committerShadowNinja <shadowninja@minetest.net>
Tue, 7 Jan 2014 02:25:10 +0000 (21:25 -0500)
builtin/item.lua
doc/lua_api.txt

index 0df0335d91df61205676ec991772e24405b45356..35ad9e6e46295abc0eb1c53433e797b5f505e061 100644 (file)
@@ -272,7 +272,13 @@ function minetest.item_place_node(itemstack, placer, pointed_thing, param2)
        if def.after_place_node then
                -- Copy place_to because callback can modify it
                local place_to_copy = {x=place_to.x, y=place_to.y, z=place_to.z}
-               if def.after_place_node(place_to_copy, placer, itemstack) then
+               local pointed_thing_copy = {
+                       type = pointed_thing.type,
+                       under = pointed_thing.under,
+                       above = pointed_thing.above
+               }
+               if def.after_place_node(place_to_copy, placer, itemstack,
+                               pointed_thing_copy) then
                        take_item = false
                end
        end
index 2eec0b95825cd27d3dac99ab29d1425a1e176c2f..dda9f7bcd73b65dab2ba5965126b4273f68ced96 100644 (file)
@@ -2188,7 +2188,7 @@ Node definition (register_node)
     ^ Node destructor; always called after removing node
     ^ default: nil
 
-    after_place_node = func(pos, placer, itemstack),
+    after_place_node = func(pos, placer, itemstack, pointed_thing),
     ^ Called after constructing node when node was placed using
       minetest.item_place_node / minetest.place_node
     ^ If return true no item is taken from itemstack