forked from Mineclonia/Mineclonia
Edited version of the daylightsensorfix
This is the edited version of my fix for the daylightsensor
This commit is contained in:
parent
93a0879b40
commit
9a83fab1b6
|
@ -96,8 +96,8 @@ minetest.register_abm({
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local light = minetest.get_node_light(pos, nil)
|
local light = minetest.get_node_light(pos, nil)
|
||||||
|
local time = minetest.get_timeofday()*24000
|
||||||
if light >= 12 and minetest.get_timeofday() > 0.2 and minetest.get_timeofday() < 0.8 then
|
if light >= minetest.LIGHT_MAX and time > 6000 and time < 18000 then
|
||||||
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_on", param2=node.param2})
|
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_on", param2=node.param2})
|
||||||
mesecon.receptor_on(pos, mesecon.rules.pplate)
|
mesecon.receptor_on(pos, mesecon.rules.pplate)
|
||||||
end
|
end
|
||||||
|
@ -111,10 +111,16 @@ minetest.register_abm({
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local light = minetest.get_node_light(pos, nil)
|
local light = minetest.get_node_light(pos, nil)
|
||||||
|
local time = minetest.get_timeofday()*24000
|
||||||
|
|
||||||
if light < 12 then
|
if light <= minetest.LIGHT_MAX and time > 18000 then
|
||||||
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_off", param2=node.param2})
|
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_off", param2=node.param2})
|
||||||
mesecon.receptor_off(pos, mesecon.rules.pplate)
|
mesecon.receptor_off(pos, mesecon.rules.pplate)
|
||||||
|
else
|
||||||
|
if light <= minetest.LIGHT_MAX and time < 6000 then
|
||||||
|
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_off", param2=node.param2})
|
||||||
|
mesecon.receptor_off(pos, mesecon.rules.pplate)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
@ -203,10 +209,16 @@ minetest.register_abm({
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local light = minetest.get_node_light(pos, nil)
|
local light = minetest.get_node_light(pos, nil)
|
||||||
|
local time = minetest.get_timeofday()*24000
|
||||||
|
|
||||||
if light < 12 then
|
if light < minetest.LIGHT_MAX and time > 18000 then
|
||||||
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_inverted_on", param2=node.param2})
|
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_inverted_on", param2=node.param2})
|
||||||
mesecon.receptor_on(pos, mesecon.rules.pplate)
|
mesecon.receptor_on(pos, mesecon.rules.pplate)
|
||||||
|
else
|
||||||
|
if light <= minetest.LIGHT_MAX and time < 6000 then
|
||||||
|
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_inverted_on", param2=node.param2})
|
||||||
|
mesecon.receptor_on(pos, mesecon.rules.pplate)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
@ -218,8 +230,9 @@ minetest.register_abm({
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||||
local light = minetest.get_node_light(pos, nil)
|
local light = minetest.get_node_light(pos, nil)
|
||||||
|
local time = minetest.get_timeofday()*24000
|
||||||
|
|
||||||
if light >= 12 and minetest.get_timeofday() > 0.8 and minetest.get_timeofday() < 0.2 then
|
if light >= minetest.LIGHT_MAX and time > 6000 and time < 18000 then
|
||||||
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_inverted_off", param2=node.param2})
|
minetest.set_node(pos, {name="mesecons_solarpanel:solar_panel_inverted_off", param2=node.param2})
|
||||||
mesecon.receptor_off(pos, mesecon.rules.pplate)
|
mesecon.receptor_off(pos, mesecon.rules.pplate)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue