mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 16:39:33 +01:00
Make daylight detector ignore artificial light
The daylight detector code used get_node_light(), which detects both natural and artificial light. This patch improves the code to use get_natural_light(), which was introduced with Minetest 5.4.0.
This commit is contained in:
parent
dca653651c
commit
4da5084daf
1 changed files with 6 additions and 6 deletions
|
@ -95,9 +95,9 @@ minetest.register_abm({
|
|||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local light = minetest.get_node_light(pos, nil)
|
||||
local light = minetest.get_natural_light(pos, nil)
|
||||
|
||||
if light >= 12 and minetest.get_timeofday() > 0.2 and minetest.get_timeofday() < 0.8 then
|
||||
if light >= 12 then
|
||||
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_on", param2=node.param2})
|
||||
mesecon.receptor_on(pos, mesecon.rules.pplate)
|
||||
end
|
||||
|
@ -110,7 +110,7 @@ minetest.register_abm({
|
|||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local light = minetest.get_node_light(pos, nil)
|
||||
local light = minetest.get_natural_light(pos, nil)
|
||||
|
||||
if light < 12 then
|
||||
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_off", param2=node.param2})
|
||||
|
@ -202,7 +202,7 @@ minetest.register_abm({
|
|||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local light = minetest.get_node_light(pos, nil)
|
||||
local light = minetest.get_natural_light(pos, nil)
|
||||
|
||||
if light < 12 then
|
||||
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_inverted_on", param2=node.param2})
|
||||
|
@ -217,9 +217,9 @@ minetest.register_abm({
|
|||
interval = 1,
|
||||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local light = minetest.get_node_light(pos, nil)
|
||||
local light = minetest.get_natural_light(pos, nil)
|
||||
|
||||
if light >= 12 and minetest.get_timeofday() > 0.8 and minetest.get_timeofday() < 0.2 then
|
||||
if light >= 12 then
|
||||
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_inverted_off", param2=node.param2})
|
||||
mesecon.receptor_off(pos, mesecon.rules.pplate)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue