summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2012-08-08 12:16:28 +0200
committersfan5 <sfan5@live.de>2012-08-08 12:16:28 +0200
commitdd1921c03a39325dc82c718e0711aa3bc834cabe (patch)
tree0faa6c452c9328c5f8557f49f0c1b5a0b2e69e71
parent55e74c04ed0bcccd4b5cbd02e625202598ab0f65 (diff)
downloadmesecons-dd1921c03a39325dc82c718e0711aa3bc834cabe.tar
mesecons-dd1921c03a39325dc82c718e0711aa3bc834cabe.tar.gz
mesecons-dd1921c03a39325dc82c718e0711aa3bc834cabe.tar.bz2
mesecons-dd1921c03a39325dc82c718e0711aa3bc834cabe.tar.xz
mesecons-dd1921c03a39325dc82c718e0711aa3bc834cabe.zip
Add mesecon:nodeupdate Function
-rw-r--r--mesecons/internal_api.lua8
1 files changed, 8 insertions, 0 deletions
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