From 192b9eca4fa5fd2075711fff5bdc1f06aad2e018 Mon Sep 17 00:00:00 2001 From: Jeija Date: Mon, 10 Dec 2012 21:14:03 +0100 Subject: Fix crash when digging unknown nodes --- mesecons/wires.lua | 14 ++++++-------- 1 file 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} -- cgit v1.2.3