diff options
author | Vanessa Dannenberg <vanessa.e.dannenberg@gmail.com> | 2018-09-08 12:12:15 -0400 |
---|---|---|
committer | Vanessa Dannenberg <vanessa.e.dannenberg@gmail.com> | 2018-09-08 12:12:15 -0400 |
commit | aaed0a2ea81a51f36a7eb35cb30c57ddf646fe1b (patch) | |
tree | 379775ce76eb855a3ea65906727d828d1696cece /pipeworks/wielder.lua | |
parent | ba470a69750df16eac4278c30471d813c2581202 (diff) | |
download | dreambuilder_modpack-aaed0a2ea81a51f36a7eb35cb30c57ddf646fe1b.tar dreambuilder_modpack-aaed0a2ea81a51f36a7eb35cb30c57ddf646fe1b.tar.gz dreambuilder_modpack-aaed0a2ea81a51f36a7eb35cb30c57ddf646fe1b.tar.bz2 dreambuilder_modpack-aaed0a2ea81a51f36a7eb35cb30c57ddf646fe1b.tar.xz dreambuilder_modpack-aaed0a2ea81a51f36a7eb35cb30c57ddf646fe1b.zip |
updated castles, coloredwood, digistuff, locks, mesecons,
pipeworks, steel, unified dyes, unified mesecons, and worldedit
Diffstat (limited to 'pipeworks/wielder.lua')
-rw-r--r-- | pipeworks/wielder.lua | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/pipeworks/wielder.lua b/pipeworks/wielder.lua index 98f1ef0..4a80d3e 100644 --- a/pipeworks/wielder.lua +++ b/pipeworks/wielder.lua @@ -331,12 +331,25 @@ if pipeworks.enable_node_breaker then virtplayer:set_wielded_item(wieldstack) else local under_node = minetest.get_node(pointed_thing.under) - local on_dig = (minetest.registered_nodes[under_node.name] or {on_dig=minetest.node_dig}).on_dig - -- check that the current tool is capable of destroying the target node. + local def = minetest.registered_nodes[under_node.name] + if not def then + -- do not dig an unknown node + return + end + -- check that the current tool is capable of destroying the + -- target node. -- if we can't, don't dig, and leave the wield stack unchanged. - -- note that wieldstack:get_tool_capabilities() returns hand properties if the item has none of it's own. - if can_tool_dig_node(under_node.name, wieldstack:get_tool_capabilities(), wieldstack:get_name()) then - on_dig(pointed_thing.under, under_node, virtplayer) + -- note that wieldstack:get_tool_capabilities() returns hand + -- properties if the item has none of it's own. + if can_tool_dig_node(under_node.name, + wieldstack:get_tool_capabilities(), + wieldstack:get_name()) then + def.on_dig(pointed_thing.under, under_node, virtplayer) + local sound = def.sounds and def.sounds.dug + if sound then + minetest.sound_play(sound.name, + {pos=pointed_thing.under, gain=sound.gain}) + end wieldstack = virtplayer:get_wielded_item() else --pipeworks.logger(dname.."couldn't dig node!") |