commit | author | age
|
167434
|
1 |
minetest.register_abm( |
MK |
2 |
{nodenames = {"technic:solar_panel"}, |
|
3 |
interval = 1, |
|
4 |
chance = 1, |
|
5 |
action = function(pos, node, active_object_count, active_object_count_wider) |
|
6 |
|
|
7 |
local pos1={} |
|
8 |
pos1.y=pos.y+1 |
|
9 |
pos1.x=pos.x |
|
10 |
pos1.z=pos.z |
|
11 |
|
|
12 |
local light = minetest.env:get_node_light(pos1, nil) |
|
13 |
local meta = minetest.env:get_meta(pos) |
|
14 |
if light == nil then light = 0 end |
|
15 |
if light >= 12 then |
|
16 |
meta:set_string("infotext", "Solar Panel is active ") |
|
17 |
meta:set_float("active",1) |
|
18 |
else |
|
19 |
meta:set_string("infotext", "Solar Panel is inactive"); |
|
20 |
meta:set_float("active",0) |
|
21 |
end |
|
22 |
end, |
|
23 |
}) |