summaryrefslogtreecommitdiff
path: root/node_breaker.lua
diff options
context:
space:
mode:
authorNovatux <nathanael.courant@laposte.net>2014-06-21 08:29:41 +0200
committerNovatux <nathanael.courant@laposte.net>2014-06-21 08:29:41 +0200
commit5a5bb3bf1287e3d046c7eabc28409549845b7fef (patch)
tree75834dd79a7603fedc1778c07030e67c6f63c202 /node_breaker.lua
parenta31a9d573f6402bd80cb402cce6eeac0c48b7c4a (diff)
downloadpipeworks-5a5bb3bf1287e3d046c7eabc28409549845b7fef.tar
pipeworks-5a5bb3bf1287e3d046c7eabc28409549845b7fef.tar.gz
pipeworks-5a5bb3bf1287e3d046c7eabc28409549845b7fef.tar.bz2
pipeworks-5a5bb3bf1287e3d046c7eabc28409549845b7fef.tar.xz
pipeworks-5a5bb3bf1287e3d046c7eabc28409549845b7fef.zip
Fix crash with legacy nodebreakers
Diffstat (limited to 'node_breaker.lua')
-rw-r--r--node_breaker.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/node_breaker.lua b/node_breaker.lua
index 21c5194..a25ca32 100644
--- a/node_breaker.lua
+++ b/node_breaker.lua
@@ -271,9 +271,11 @@ minetest.register_node("pipeworks:nodebreaker_off", {
minetest.get_meta(pos):set_string("owner", placer:get_player_name())
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
- local stack = oldmetadata.inventory.pick[1]
- if not stack:is_empty() then
- minetest.add_item(pos, stack)
+ if oldmetadata.inventory.pick then
+ local stack = oldmetadata.inventory.pick[1]
+ if not stack:is_empty() then
+ minetest.add_item(pos, stack)
+ end
end
pipeworks.scan_for_tube_objects(pos, oldnode, oldmetadata, digger)
end,
@@ -369,9 +371,11 @@ minetest.register_node("pipeworks:nodebreaker_on", {
minetest.get_meta(pos):set_string("owner", placer:get_player_name())
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
- local stack = oldmetadata.inventory.pick[1]
- if not stack:is_empty() then
- minetest.add_item(pos, stack)
+ if oldmetadata.inventory.pick then
+ local stack = oldmetadata.inventory.pick[1]
+ if not stack:is_empty() then
+ minetest.add_item(pos, stack)
+ end
end
pipeworks.scan_for_tube_objects(pos, oldnode, oldmetadata, digger)
end,