summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeija <jeija@mesecons.net>2014-01-11 16:18:35 +0100
committerJeija <jeija@mesecons.net>2014-01-11 16:18:35 +0100
commit6afded8284e42c8b976d8685f537d8d54264277a (patch)
treeed5e64c6a888061f1b4a64269d9f0c292cabb1b8
parentff5e3153257ae8789d43297d1c3739e6a22cd105 (diff)
downloadmesecons-6afded8284e42c8b976d8685f537d8d54264277a.tar
mesecons-6afded8284e42c8b976d8685f537d8d54264277a.tar.gz
mesecons-6afded8284e42c8b976d8685f537d8d54264277a.tar.bz2
mesecons-6afded8284e42c8b976d8685f537d8d54264277a.tar.xz
mesecons-6afded8284e42c8b976d8685f537d8d54264277a.zip
Fix unloaded area in receptor_off, yet it was only fixed in receptor_on
-rw-r--r--mesecons/init.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/mesecons/init.lua b/mesecons/init.lua
index 4d4819c..523263d 100644
--- a/mesecons/init.lua
+++ b/mesecons/init.lua
@@ -79,7 +79,7 @@ dofile(minetest.get_modpath("mesecons").."/legacy.lua");
mesecon.queue:add_function("receptor_on", function (pos, rules)
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
local np = mesecon:addPosRule(pos, rule)
if minetest.get_node_or_nil(np) == nil then
@@ -104,11 +104,17 @@ end
mesecon.queue:add_function("receptor_off", function (pos, rules)
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
local np = mesecon:addPosRule(pos, rule)
if minetest.get_node_or_nil(np) == nil then
mesecon.queue:add_action(pos, "receptor_off", {rules})
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)
for _, rulename in ipairs(rulenames) do
if not mesecon:connected_to_receptor(np, mesecon:invertRule(rule)) then