diff options
Diffstat (limited to 'pipeworks')
-rw-r--r-- | pipeworks/README | 2 | ||||
-rw-r--r-- | pipeworks/item_transport.lua | 6 | ||||
-rw-r--r-- | pipeworks/wielder.lua | 23 |
3 files changed, 23 insertions, 8 deletions
diff --git a/pipeworks/README b/pipeworks/README index 7a34618..8b74b76 100644 --- a/pipeworks/README +++ b/pipeworks/README @@ -1,7 +1,7 @@ This mod uses nodeboxes to supply a complete set of 3D pipes and tubes, along devices that work with them. -See https://github.com/VanessaE/pipeworks/wiki/ for detailed information about usage of this mod. +See https://gitlab.com/VanessaE/pipeworks/wikis/ for detailed information about usage of this mod. Unlike the previous version of this mod, these pipes are rounded, and when placed, they'll automatically join together as needed. Pipes can go vertically diff --git a/pipeworks/item_transport.lua b/pipeworks/item_transport.lua index 388e2e7..d3a13c5 100644 --- a/pipeworks/item_transport.lua +++ b/pipeworks/item_transport.lua @@ -350,8 +350,10 @@ luaentity.register_entity("pipeworks:tubed_item", { -- compatible with Minetest 0.4.13. -- Using item_drop here makes Minetest 0.4.13 crash. local dropped_item = minetest.add_item(self.start_pos, stack) - dropped_item:set_velocity(vector.multiply(velocity, 5)) - self:remove() + if dropped_item then + dropped_item:set_velocity(vector.multiply(velocity, 5)) + self:remove() + end return else velocity = vector.multiply(velocity, -1) 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!") |