summaryrefslogtreecommitdiff
path: root/solar.lua
diff options
context:
space:
mode:
authorMaciej Kasatkin <mk@realbadangel.pl>2012-08-21 07:18:33 +0200
committerMaciej Kasatkin <mk@realbadangel.pl>2012-08-21 07:18:33 +0200
commit167434085cf62f133aaeaeadd7f9eb80d946189f (patch)
treed254f645952432b49b494574abf0a5a59571abb8 /solar.lua
upload
Diffstat (limited to 'solar.lua')
-rw-r--r--solar.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/solar.lua b/solar.lua
new file mode 100644
index 0000000..2d397f9
--- /dev/null
+++ b/solar.lua
@@ -0,0 +1,23 @@
+minetest.register_abm(
+ {nodenames = {"technic:solar_panel"},
+ interval = 1,
+ chance = 1,
+ action = function(pos, node, active_object_count, active_object_count_wider)
+
+ local pos1={}
+ pos1.y=pos.y+1
+ pos1.x=pos.x
+ pos1.z=pos.z
+
+ local light = minetest.env:get_node_light(pos1, nil)
+ local meta = minetest.env:get_meta(pos)
+ if light == nil then light = 0 end
+ if light >= 12 then
+ meta:set_string("infotext", "Solar Panel is active ")
+ meta:set_float("active",1)
+ else
+ meta:set_string("infotext", "Solar Panel is inactive");
+ meta:set_float("active",0)
+ end
+ end,
+}) \ No newline at end of file