diff options
author | darkrose <lisa@ltmnet.com> | 2012-06-03 20:02:10 +1000 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2012-06-03 22:31:02 +0300 |
commit | a149c6ecde66a89bd1080bddf8848a19115a79d4 (patch) | |
tree | 7bf35ef5ae14ff2977e0bf34241ff3d5c51112e0 /builtin | |
parent | 3f18e9a2dabb06808131eb639caeff46116c8c27 (diff) | |
download | minetest-a149c6ecde66a89bd1080bddf8848a19115a79d4.tar.gz minetest-a149c6ecde66a89bd1080bddf8848a19115a79d4.tar.bz2 minetest-a149c6ecde66a89bd1080bddf8848a19115a79d4.zip |
Add can_dig callback
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/item.lua | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/item.lua b/builtin/item.lua index c4bd24204..3d545eece 100644 --- a/builtin/item.lua +++ b/builtin/item.lua @@ -229,7 +229,7 @@ function minetest.node_dig(pos, node, digger) minetest.debug("node_dig") local def = ItemStack({name=node.name}):get_definition() - if not def.diggable then + if not def.diggable or (def.can_dig and not def.can_dig(pos,digger)) then minetest.debug("not diggable") minetest.log("info", digger:get_player_name() .. " tried to dig " .. node.name .. " which is not diggable " @@ -345,6 +345,7 @@ minetest.nodedef_default = { on_place = redef_wrapper(minetest, 'item_place'), -- minetest.item_place on_drop = redef_wrapper(minetest, 'item_drop'), -- minetest.item_drop on_use = nil, + can_dig = nil, on_punch = redef_wrapper(minetest, 'node_punch'), -- minetest.node_punch on_dig = redef_wrapper(minetest, 'node_dig'), -- minetest.node_dig |