diff options
author | Jeija <norrepli@gmail.com> | 2012-12-10 21:14:03 +0100 |
---|---|---|
committer | Jeija <norrepli@gmail.com> | 2012-12-10 21:14:03 +0100 |
commit | 192b9eca4fa5fd2075711fff5bdc1f06aad2e018 (patch) | |
tree | 256801718b1bf6a011a126233cd445ef3b3cec00 | |
parent | 59a39204a9dc5ccc108bb2e51421fc7821ffeaa1 (diff) | |
download | mesecons-192b9eca4fa5fd2075711fff5bdc1f06aad2e018.tar mesecons-192b9eca4fa5fd2075711fff5bdc1f06aad2e018.tar.gz mesecons-192b9eca4fa5fd2075711fff5bdc1f06aad2e018.tar.bz2 mesecons-192b9eca4fa5fd2075711fff5bdc1f06aad2e018.tar.xz mesecons-192b9eca4fa5fd2075711fff5bdc1f06aad2e018.zip |
Fix crash when digging unknown nodes
-rw-r--r-- | mesecons/wires.lua | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/mesecons/wires.lua b/mesecons/wires.lua index 3f4e345..bea84dd 100644 --- a/mesecons/wires.lua +++ b/mesecons/wires.lua @@ -191,17 +191,15 @@ end end end -minetest.register_on_placenode(function(pos, node) - if minetest.registered_nodes[node.name].mesecons then +local update_on_place_dig = function (pos, node) + if minetest.registered_nodes[node.name] + and minetest.registered_nodes[node.name].mesecons then mesecon:update_autoconnect(pos) end -end) +end -minetest.register_on_dignode(function(pos, node) - if minetest.registered_nodes[node.name].mesecons then - mesecon:update_autoconnect(pos) - end -end) +minetest.register_on_placenode(update_on_place_dig) +minetest.register_on_dignode(update_on_place_dig) function mesecon:update_autoconnect(pos, secondcall, replace_old) local xppos = {x=pos.x+1, y=pos.y, z=pos.z} |