summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNovatux <nathanael.courant@laposte.net>2014-05-25 22:24:08 +0200
committerNovatux <nathanael.courant@laposte.net>2014-05-25 22:24:42 +0200
commit476a60b848e6776574b86da2daa8889f2c787d7b (patch)
tree1951ef86b08ba08c22b0f6e1341c1354179c6a4f
parentec8796f8d38474a13ddd01a8402417e19003bc65 (diff)
downloadpipeworks-476a60b848e6776574b86da2daa8889f2c787d7b.tar
pipeworks-476a60b848e6776574b86da2daa8889f2c787d7b.tar.gz
pipeworks-476a60b848e6776574b86da2daa8889f2c787d7b.tar.bz2
pipeworks-476a60b848e6776574b86da2daa8889f2c787d7b.tar.xz
pipeworks-476a60b848e6776574b86da2daa8889f2c787d7b.zip
Fix #66
-rw-r--r--node_breaker.lua11
1 files changed, 7 insertions, 4 deletions
diff --git a/node_breaker.lua b/node_breaker.lua
index d43a541..b9267f4 100644
--- a/node_breaker.lua
+++ b/node_breaker.lua
@@ -147,9 +147,13 @@ local function break_node (pos, facedir)
setpos = delay(),
set_hp = delay(),
set_properties = delay(),
- set_wielded_item = function(stack)
- inv:add_item("main", stack)
- inv:set_stack(pick_inv, 1, ItemStack(""))
+ set_wielded_item = function(self, stack)
+ if stack:get_name() == pick:get_name() then
+ inv:set_stack(pick_inv, 1, stack)
+ else
+ inv:add_item("main", stack)
+ inv:set_stack(pick_inv, 1, ItemStack(""))
+ end
end,
set_animation = delay(),
set_attach = delay(),
@@ -160,7 +164,6 @@ local function break_node (pos, facedir)
if pick_inv == "pick" and minetest.registered_items[pick:get_name()] and minetest.registered_items[pick:get_name()].on_use then
local pos_under, pos_above = {x = pos.x - vel.x, y = pos.y - vel.y, z = pos.z - vel.z}, {x = pos.x - 2*vel.x, y = pos.y - 2*vel.y, z = pos.z - 2*vel.z}
local pointed_thing = {type="node", under=pos_under, above=pos_above}
- --print(dump(minetest.get_node(pos_under)))
inv:set_stack(pick_inv, 1, minetest.registered_items[pick:get_name()].on_use(pick, digger, pointed_thing) or pick)
else
minetest.node_dig(front, node, digger)