summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesecons/init.lua8
-rw-r--r--mesecons/internal.lua6
2 files changed, 10 insertions, 4 deletions
diff --git a/mesecons/init.lua b/mesecons/init.lua
index 6b36e69..944a86a 100644
--- a/mesecons/init.lua
+++ b/mesecons/init.lua
@@ -70,6 +70,8 @@ dofile(minetest.get_modpath("mesecons").."/internal.lua");
-- these are the only functions you need to remember
mesecon.queue:add_function("receptor_on", function (pos, rules)
+ mesecon.vm_begin()
+
rules = rules or mesecon.rules.default
-- if area (any of the rule targets) is not loaded, keep trying and call this again later
@@ -90,6 +92,8 @@ mesecon.queue:add_function("receptor_on", function (pos, rules)
mesecon.turnon(np, rulename)
end
end
+
+ mesecon.vm_commit()
end)
function mesecon.receptor_on(pos, rules)
@@ -97,6 +101,8 @@ function mesecon.receptor_on(pos, rules)
end
mesecon.queue:add_function("receptor_off", function (pos, rules)
+ mesecon.vm_begin()
+
rules = rules or mesecon.rules.default
-- if area (any of the rule targets) is not loaded, keep trying and call this again later
@@ -119,6 +125,8 @@ mesecon.queue:add_function("receptor_off", function (pos, rules)
end
end
end
+
+ mesecon.vm_commit()
end)
function mesecon.receptor_off(pos, rules)
diff --git a/mesecons/internal.lua b/mesecons/internal.lua
index 4ef2b18..e11de4f 100644
--- a/mesecons/internal.lua
+++ b/mesecons/internal.lua
@@ -405,8 +405,7 @@ function mesecon.turnon(pos, link)
end
if success then
- minetest.swap_node(f.pos, {name = mesecon.get_conductor_on(node, f.link),
- param2 = node.param2})
+ mesecon.swap_node_force(f.pos, mesecon.get_conductor_on(node, f.link))
for npos, links in pairs(neighborlinks) do
-- links = all links to node, l = each single link
@@ -465,8 +464,7 @@ function mesecon.turnoff(pos, link)
end
if success then
- minetest.swap_node(f.pos, {name = mesecon.get_conductor_off(node, f.link),
- param2 = node.param2})
+ mesecon.swap_node_force(f.pos, mesecon.get_conductor_off(node, f.link))
for npos, links in pairs(neighborlinks) do
-- links = all links to node, l = each single link