mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-08-21 05:24:11 +02:00
Only skip conductors with flat rules in turnon/off
This commit is contained in:
parent
e15c55c066
commit
9323445182
@ -384,9 +384,10 @@ function mesecon.turnon(pos, link)
|
|||||||
if not node then
|
if not node then
|
||||||
-- Area does not exist; do nothing
|
-- Area does not exist; do nothing
|
||||||
pos_can_be_skipped[minetest.hash_node_position(f.pos)] = true
|
pos_can_be_skipped[minetest.hash_node_position(f.pos)] = true
|
||||||
elseif mesecon.is_conductor_off(node, f.link) then
|
elseif mesecon.is_conductor(node.name) then
|
||||||
local rules = mesecon.conductor_get_rules(node)
|
local rules = mesecon.conductor_get_rules(node)
|
||||||
|
|
||||||
|
if mesecon.is_conductor_off(node, f.link) then
|
||||||
-- Call turnon on neighbors
|
-- Call turnon on neighbors
|
||||||
for _, r in ipairs(mesecon.rule2meta(f.link, rules)) do
|
for _, r in ipairs(mesecon.rule2meta(f.link, rules)) do
|
||||||
local np = vector.add(f.pos, r)
|
local np = vector.add(f.pos, r)
|
||||||
@ -398,7 +399,12 @@ function mesecon.turnon(pos, link)
|
|||||||
end
|
end
|
||||||
|
|
||||||
mesecon.swap_node_force(f.pos, mesecon.get_conductor_on(node, f.link))
|
mesecon.swap_node_force(f.pos, mesecon.get_conductor_on(node, f.link))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Only conductors with flat rules can be reliably skipped later
|
||||||
|
if not rules[1] or rules[1].x then
|
||||||
pos_can_be_skipped[minetest.hash_node_position(f.pos)] = true
|
pos_can_be_skipped[minetest.hash_node_position(f.pos)] = true
|
||||||
|
end
|
||||||
elseif mesecon.is_effector(node.name) then
|
elseif mesecon.is_effector(node.name) then
|
||||||
mesecon.changesignal(f.pos, node, f.link, mesecon.state.on, depth)
|
mesecon.changesignal(f.pos, node, f.link, mesecon.state.on, depth)
|
||||||
if mesecon.is_effector_off(node.name) then
|
if mesecon.is_effector_off(node.name) then
|
||||||
@ -440,8 +446,10 @@ function mesecon.turnoff(pos, link)
|
|||||||
if not node then
|
if not node then
|
||||||
-- Area does not exist; do nothing
|
-- Area does not exist; do nothing
|
||||||
pos_can_be_skipped[minetest.hash_node_position(f.pos)] = true
|
pos_can_be_skipped[minetest.hash_node_position(f.pos)] = true
|
||||||
elseif mesecon.is_conductor_on(node, f.link) then
|
elseif mesecon.is_conductor(node.name) then
|
||||||
local rules = mesecon.conductor_get_rules(node)
|
local rules = mesecon.conductor_get_rules(node)
|
||||||
|
|
||||||
|
if mesecon.is_conductor_on(node, f.link) then
|
||||||
for _, r in ipairs(mesecon.rule2meta(f.link, rules)) do
|
for _, r in ipairs(mesecon.rule2meta(f.link, rules)) do
|
||||||
local np = vector.add(f.pos, r)
|
local np = vector.add(f.pos, r)
|
||||||
|
|
||||||
@ -463,7 +471,12 @@ function mesecon.turnoff(pos, link)
|
|||||||
end
|
end
|
||||||
|
|
||||||
mesecon.swap_node_force(f.pos, mesecon.get_conductor_off(node, f.link))
|
mesecon.swap_node_force(f.pos, mesecon.get_conductor_off(node, f.link))
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Only conductors with flat rules can be reliably skipped later
|
||||||
|
if not rules[1] or rules[1].x then
|
||||||
pos_can_be_skipped[minetest.hash_node_position(f.pos)] = true
|
pos_can_be_skipped[minetest.hash_node_position(f.pos)] = true
|
||||||
|
end
|
||||||
elseif mesecon.is_effector(node.name) then
|
elseif mesecon.is_effector(node.name) then
|
||||||
table.insert(signals, {
|
table.insert(signals, {
|
||||||
pos = f.pos,
|
pos = f.pos,
|
||||||
|
Loading…
Reference in New Issue
Block a user