forked from minetest-mods/mesecons
Fix unloaded area in receptor_off, yet it was only fixed in receptor_on
This commit is contained in:
parent
ff5e315325
commit
6afded8284
@ -79,7 +79,7 @@ dofile(minetest.get_modpath("mesecons").."/legacy.lua");
|
|||||||
mesecon.queue:add_function("receptor_on", function (pos, rules)
|
mesecon.queue:add_function("receptor_on", function (pos, rules)
|
||||||
rules = rules or mesecon.rules.default
|
rules = rules or mesecon.rules.default
|
||||||
|
|
||||||
-- if area (any of the neighbors) is not loaded, keep trying and call this again later
|
-- if area (any of the rule targets) is not loaded, keep trying and call this again later
|
||||||
for _, rule in ipairs(mesecon:flattenrules(rules)) do
|
for _, rule in ipairs(mesecon:flattenrules(rules)) do
|
||||||
local np = mesecon:addPosRule(pos, rule)
|
local np = mesecon:addPosRule(pos, rule)
|
||||||
if minetest.get_node_or_nil(np) == nil then
|
if minetest.get_node_or_nil(np) == nil then
|
||||||
@ -104,11 +104,17 @@ end
|
|||||||
|
|
||||||
mesecon.queue:add_function("receptor_off", function (pos, rules)
|
mesecon.queue:add_function("receptor_off", function (pos, rules)
|
||||||
rules = rules or mesecon.rules.default
|
rules = rules or mesecon.rules.default
|
||||||
|
|
||||||
|
-- if area (any of the rule targets) is not loaded, keep trying and call this again later
|
||||||
for _, rule in ipairs(mesecon:flattenrules(rules)) do
|
for _, rule in ipairs(mesecon:flattenrules(rules)) do
|
||||||
local np = mesecon:addPosRule(pos, rule)
|
local np = mesecon:addPosRule(pos, rule)
|
||||||
if minetest.get_node_or_nil(np) == nil then
|
if minetest.get_node_or_nil(np) == nil then
|
||||||
mesecon.queue:add_action(pos, "receptor_off", {rules})
|
mesecon.queue:add_action(pos, "receptor_off", {rules})
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for _, rule in ipairs(mesecon:flattenrules(rules)) do
|
||||||
|
local np = mesecon:addPosRule(pos, rule)
|
||||||
local rulenames = mesecon:rules_link_rule_all(pos, rule)
|
local rulenames = mesecon:rules_link_rule_all(pos, rule)
|
||||||
for _, rulename in ipairs(rulenames) do
|
for _, rulename in ipairs(rulenames) do
|
||||||
if not mesecon:connected_to_receptor(np, mesecon:invertRule(rule)) then
|
if not mesecon:connected_to_receptor(np, mesecon:invertRule(rule)) then
|
||||||
|
Loading…
Reference in New Issue
Block a user