From dd1921c03a39325dc82c718e0711aa3bc834cabe Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 8 Aug 2012 12:16:28 +0200 Subject: [PATCH] Add mesecon:nodeupdate Function --- mesecons/internal_api.lua | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mesecons/internal_api.lua b/mesecons/internal_api.lua index d6c3e55..f14749c 100644 --- a/mesecons/internal_api.lua +++ b/mesecons/internal_api.lua @@ -384,6 +384,14 @@ function mesecon:check_if_turnon(pos) return false end +function mesecon:updatenode(pos) + if mesecon:connected_to_pwr_src(pos) then + mesecon:turnon(pos, 0, 0, 0) + else + mesecon:turnoff(pos, 0, 0, 0) + end +end + minetest.register_on_placenode(function(pos, newnode, placer) if mesecon:check_if_turnon(pos) then if mesecon:is_conductor_off(newnode.name) then