opaque blocks does not power on wires
This commit is contained in:
parent
71f71798bf
commit
fa760f4704
|
@ -406,7 +406,7 @@ function mesecon.turnon(pos, link, voltage)
|
|||
|
||||
|
||||
--if node and mesecon.is_conductor_off(node, f.link) then
|
||||
if node and mesecon.is_conductor(node.name) then
|
||||
if node and mesecon.is_conductor(node.name) and (f.link.spread==nil and true or f.link.spread) then
|
||||
|
||||
|
||||
local rules = mesecon.conductor_get_rules(node)
|
||||
|
@ -721,12 +721,12 @@ function mesecon.is_powered(pos, rule, depth, sourcepos, home_pos)
|
|||
if depth == 0 or spread_tmp then
|
||||
|
||||
local meta = minetest.get_meta(np)
|
||||
--minetest.log("action", np.x .. "/" .. np.y .. "/" .. np.z .. "-->" .. "is_powered.voltage0=" .. voltage)
|
||||
--minetest.log("action", mesecon.postostring(np) .. "-->" .. "is_powered.voltage0=" .. voltage)
|
||||
voltage = math.max(voltage, meta:get_string("mesecon_voltage")~="" and meta:get_int("mesecon_voltage") or 15)
|
||||
|
||||
--minetest.log("action", np.x .. "/" .. np.y .. "/" .. np.z .. "-->" .. "is_powered.voltage1=" .. meta:get_string("mesecon_voltage"))
|
||||
--minetest.log("action", np.x .. "/" .. np.y .. "/" .. np.z .. "-->" .. "is_powered.voltage2=" .. (meta:get_string("mesecon_voltage")~="" and meta:get_int("mesecon_voltage") or 15))
|
||||
--minetest.log("action", np.x .. "/" .. np.y .. "/" .. np.z .. "-->" .. "is_powered.voltage3=" .. voltage)
|
||||
--minetest.log("action", mesecon.postostring(np) .. "-->" .. "is_powered.voltage1=" .. meta:get_string("mesecon_voltage"))
|
||||
--minetest.log("action", mesecon.postostring(np) .. "-->" .. "is_powered.voltage2=" .. (meta:get_string("mesecon_voltage")~="" and meta:get_int("mesecon_voltage") or 15))
|
||||
--minetest.log("action", mesecon.postostring(np) .. "-->" .. "is_powered.voltage3=" .. voltage)
|
||||
|
||||
insert(sourcepos, np)
|
||||
if spread_tmp then
|
||||
|
@ -734,7 +734,8 @@ function mesecon.is_powered(pos, rule, depth, sourcepos, home_pos)
|
|||
end
|
||||
end
|
||||
end
|
||||
elseif depth == 0 and minetest.get_item_group(nn.name, "opaque") == 1 then
|
||||
elseif depth == 0 and minetest.get_item_group(nn.name, "opaque") == 1 and not pos.conductor then
|
||||
--minetest.log("action", mesecon.postostring(np) .. "-->" .. "is_powered.elseif.is_conductor=" .. tostring(mesecon.is_conductor(pos)))
|
||||
local more_sourcepos, more_spread, more_voltage = mesecon.is_powered(np, nil, depth + 1, sourcepos, home_pos)
|
||||
if more_sourcepos and #more_sourcepos > 0 and more_voltage>=1 then
|
||||
mesecon.mergetable(sourcepos, more_sourcepos)
|
||||
|
|
|
@ -21,6 +21,7 @@ function mesecon.on_placenode(pos, node)
|
|||
-- Conductors: Send turnon signal when powered or replace by respective offstate conductor
|
||||
-- if placed conductor is an onstate one
|
||||
if mesecon.is_conductor(node.name) then
|
||||
pos.conductor=true
|
||||
local sources, _, voltage = mesecon.is_powered(pos)
|
||||
minetest.log("action", mesecon.postostring(pos) .. "-->" .. "on_placenode.voltage=" .. voltage)
|
||||
minetest.log("action", mesecon.postostring(pos) .. "-->" .. "on_placenode.sources=" .. mesecon.tabletostring(sources))
|
||||
|
@ -82,7 +83,7 @@ function mesecon.on_placenode(pos, node)
|
|||
local npos = neighbors[n].pos
|
||||
local nnode = minetest.get_node(npos)
|
||||
if mesecon.is_conductor_off(nnode) then
|
||||
mesecon.receptor_on(npos, mesecon.conductor_get_rules(nnode))
|
||||
--mesecon.receptor_on(npos, mesecon.conductor_get_rules(nnode))
|
||||
-- Redstone torch is a special case and must be ignored
|
||||
elseif mesecon.is_effector_on(nnode.name) and minetest.get_item_group(nnode.name, "redstone_torch") == 0 then
|
||||
mesecon.changesignal(npos, nnode, neighbors[n].link, mesecon.state.on, 1)
|
||||
|
|
Loading…
Reference in New Issue