Compare commits

..

1 Commits

Author SHA1 Message Date
chmodsayshello 9a83fab1b6 Edited version of the daylightsensorfix
This is the edited version of my fix for the daylightsensor
2021-12-29 22:01:34 +01:00
3 changed files with 23 additions and 11 deletions

View File

@ -21,7 +21,7 @@ The basic digging time groups determine by which tools a node can be dug.
* `swordy=1`: Diggable by sword (any material), and this node is *not* a cobweb * `swordy=1`: Diggable by sword (any material), and this node is *not* a cobweb
* `swordy_cobweb=1`: Diggable by sword (any material), and this node is a cobweb * `swordy_cobweb=1`: Diggable by sword (any material), and this node is a cobweb
* `shearsy=1`: Diggable by shears, and this node is *not* wool * `shearsy=1`: Diggable by shears, and this node is *not* wool
* `shearsy_wool=1`: Diggable by shears, and this node is wool * `shearsy=wool=1`: Diggable by shears, and this node is wool
* `handy=1`: Breakable by hand and this node gives it useful drop when dug by hand. All nodes which are breakable by pickaxe, axe, shovel, sword or shears are also automatically breakable by hand, but not neccess * `handy=1`: Breakable by hand and this node gives it useful drop when dug by hand. All nodes which are breakable by pickaxe, axe, shovel, sword or shears are also automatically breakable by hand, but not neccess
* `creative_breakable=1`: Block is breakable by hand in creative mode. This group is implied if the node belongs to any other digging group * `creative_breakable=1`: Block is breakable by hand in creative mode. This group is implied if the node belongs to any other digging group

View File

@ -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

View File

@ -388,11 +388,12 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
{ x=0, y=0, z=-1 }, { x=0, y=0, z=-1 },
{ x=0, y=0, z=1 }, { x=0, y=0, z=1 },
} }
local floorpos, floor
for n=#neighbors, 1, -1 do for n=#neighbors, 1, -1 do
local offset = neighbors[n] local offset = neighbors[n]
local blockpos = vector.add(stempos, offset) local blockpos = vector.add(stempos, offset)
local floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z } floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z }
local floor = minetest.get_node(floorpos) floor = minetest.get_node(floorpos)
local block = minetest.get_node(blockpos) local block = minetest.get_node(blockpos)
local soilgroup = minetest.get_item_group(floor.name, "soil") local soilgroup = minetest.get_item_group(floor.name, "soil")
if not ((minetest.get_item_group(floor.name, "grass_block") == 1 or floor.name=="mcl_core:dirt" or soilgroup == 2 or soilgroup == 3) and block.name == "air") then if not ((minetest.get_item_group(floor.name, "grass_block") == 1 or floor.name=="mcl_core:dirt" or soilgroup == 2 or soilgroup == 3) and block.name == "air") then
@ -406,8 +407,6 @@ function mcl_farming:add_gourd(full_unconnected_stem, connected_stem_basename, s
local r = math.random(1, #neighbors) local r = math.random(1, #neighbors)
local offset = neighbors[r] local offset = neighbors[r]
local blockpos = vector.add(stempos, offset) local blockpos = vector.add(stempos, offset)
local floorpos = { x=blockpos.x, y=blockpos.y-1, z=blockpos.z }
local floor = minetest.get_node(floorpos)
local p2 local p2
if offset.x == 1 then if offset.x == 1 then
minetest.set_node(stempos, {name=connected_stem_names[1]}) minetest.set_node(stempos, {name=connected_stem_names[1]})