1
0
Fork 0

[mesecons] fix warnings

doc-refactoring^2
AFCMS 2021-05-23 11:41:01 +02:00
parent ddc157acbf
commit 962ae359af
2 changed files with 5 additions and 9 deletions

View File

@ -329,7 +329,7 @@ function mesecon.get_conductor_on(node_off, rulename)
return conductor.states[tonumber(binstate,2)+1] return conductor.states[tonumber(binstate,2)+1]
end end
end end
return offstate return conductor.offstate
end end
function mesecon.get_conductor_off(node_on, rulename) function mesecon.get_conductor_off(node_on, rulename)
@ -345,7 +345,7 @@ function mesecon.get_conductor_off(node_on, rulename)
return conductor.states[tonumber(binstate,2)+1] return conductor.states[tonumber(binstate,2)+1]
end end
end end
return onstate return conductor.onstate
end end
function mesecon.conductor_get_rules(node) function mesecon.conductor_get_rules(node)
@ -391,9 +391,7 @@ function mesecon.turnon(pos, link)
local f = table.remove(frontiers, 1) local f = table.remove(frontiers, 1)
local node = get_node_force(f.pos) local node = get_node_force(f.pos)
if not node then if node and mesecon.is_conductor_off(node, f.link) then
-- Area does not exist; do nothing
elseif mesecon.is_conductor_off(node, f.link) then
local rules = mesecon.conductor_get_rules(node) local rules = mesecon.conductor_get_rules(node)
-- Call turnon on neighbors -- Call turnon on neighbors
@ -453,9 +451,7 @@ function mesecon.turnoff(pos, link)
local f = table.remove(frontiers, 1) local f = table.remove(frontiers, 1)
local node = get_node_force(f.pos) local node = get_node_force(f.pos)
if not node then if node and mesecon.is_conductor_on(node, f.link) then
-- No-op
elseif mesecon.is_conductor_on(node, f.link) then
local rules = mesecon.conductor_get_rules(node) local rules = mesecon.conductor_get_rules(node)
for _, r in pairs(mesecon.rule2meta(f.link, rules)) do for _, r in pairs(mesecon.rule2meta(f.link, rules)) do
local np = vector.add(f.pos, r) local np = vector.add(f.pos, r)

View File

@ -77,7 +77,7 @@ mesecon.on_dignode = function(pos, node)
mesecon.receptor_off(pos, mesecon.receptor_get_rules(node)) mesecon.receptor_off(pos, mesecon.receptor_get_rules(node))
end end
if minetest.get_item_group(node.name, "opaque") == 1 then if minetest.get_item_group(node.name, "opaque") == 1 then
local sources = mesecon.is_powered(pos) --local sources = mesecon.is_powered(pos)
local neighbors = mesecon.mcl_get_neighbors(pos) local neighbors = mesecon.mcl_get_neighbors(pos)
for n=1, #neighbors do for n=1, #neighbors do
local npos = neighbors[n].pos local npos = neighbors[n].pos