wrong voltage on comparator
This commit is contained in:
parent
59f2df265c
commit
fa824a3c72
|
@ -179,7 +179,8 @@ local function comparator_desired_on(pos, node)
|
||||||
if back_rule then
|
if back_rule then
|
||||||
local back_pos = vector.add(pos, back_rule)
|
local back_pos = vector.add(pos, back_rule)
|
||||||
--local _, vo_back = mesecon.is_power_on(back_pos)
|
--local _, vo_back = mesecon.is_power_on(back_pos)
|
||||||
local _, _, vo_back = mesecon.is_powered(back_pos)
|
--local _, _, vo_back = mesecon.is_powered(back_pos)
|
||||||
|
local _, _, vo_back = mesecon.is_powered(pos, back_rule)
|
||||||
|
|
||||||
|
|
||||||
local vo_coin = container_inventory_nonempty(back_pos)
|
local vo_coin = container_inventory_nonempty(back_pos)
|
||||||
|
@ -189,7 +190,7 @@ local function comparator_desired_on(pos, node)
|
||||||
voltage = math.max(vo_back, vo_coin, vo_sso)
|
voltage = math.max(vo_back, vo_coin, vo_sso)
|
||||||
end
|
end
|
||||||
|
|
||||||
--minetest.log("action", mesecon.postostring(pos) .. "-->" .. "comparator_desired_on1.voltage= " .. voltage .. "state="..tostring(state))
|
minetest.log("action", mesecon.postostring(pos) .. "-->" .. "comparator_desired_on1.voltage= " .. voltage)
|
||||||
|
|
||||||
-- if back input is off, we don't need to check side inputs
|
-- if back input is off, we don't need to check side inputs
|
||||||
if voltage<1 then return false, 0 end
|
if voltage<1 then return false, 0 end
|
||||||
|
@ -204,15 +205,15 @@ local function comparator_desired_on(pos, node)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--minetest.log("action", mesecon.postostring(pos) .. "-->" .. "comparator_desired_on2.voltage= " .. voltage .. "state="..tostring(state))
|
minetest.log("action", mesecon.postostring(pos) .. "-->" .. "comparator_desired_on2.voltage= " .. voltage)
|
||||||
|
|
||||||
if mode == "comp" then
|
if mode == "comp" then
|
||||||
-- Comparators in comparison mode
|
-- Comparators in comparison mode
|
||||||
if side_voltage > voltage then
|
if side_voltage > voltage then
|
||||||
--minetest.log("action", mesecon.postostring(pos) .. "-->" .. "comparator_desired_on3.voltage= " .. voltage .. "state="..tostring(state))
|
minetest.log("action", mesecon.postostring(pos) .. "-->" .. "comparator_desired_on3.voltage= " .. voltage)
|
||||||
return false, 0
|
return false, 0
|
||||||
else
|
else
|
||||||
--minetest.log("action", mesecon.postostring(pos) .. "-->" .. "comparator_desired_on4.voltage= " .. voltage .. "state="..tostring(state))
|
minetest.log("action", mesecon.postostring(pos) .. "-->" .. "comparator_desired_on4.voltage= " .. voltage)
|
||||||
return true, voltage
|
return true, voltage
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -85,7 +85,7 @@ function mesecon.on_placenode(pos, node)
|
||||||
for n=1, #neighbors do
|
for n=1, #neighbors do
|
||||||
local npos = neighbors[n].pos
|
local npos = neighbors[n].pos
|
||||||
local nnode = minetest.get_node(npos)
|
local nnode = minetest.get_node(npos)
|
||||||
minetest.log("action", mesecon.postostring(pos) .. "-->" .. " on_placenode.is_powered" .. "name="..nnode.name .. " effon="..tostring(mesecon.is_effector_on(nnode.name)).." redtorch="..tostring(minetest.get_item_group(nnode.name, "redstone_torch")))
|
minetest.log("action", mesecon.postostring(pos) .. "-->" .. " on_placenode.is_powered" .. "name="..nnode.name .. " effoff="..tostring(mesecon.is_effector_off(nnode.name)).." redtorch="..tostring(minetest.get_item_group(nnode.name, "redstone_torch")))
|
||||||
if mesecon.is_conductor_off(nnode) then
|
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
|
-- Redstone torch is a special case and must be ignored
|
||||||
|
|
Loading…
Reference in New Issue