mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-12-28 16:27:28 +01:00
Never postpone action_on or action_off
There is no more need for that since VoxelManip caching makes sure we always get an answer to get_node_force.
This commit is contained in:
parent
433778c2ec
commit
95fedc88bc
@ -74,17 +74,7 @@ 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 rule targets) is not loaded, keep trying and call this again later
|
-- Call turnon on all linking positions
|
||||||
for _, rule in ipairs(mesecon.flattenrules(rules)) do
|
|
||||||
local np = vector.add(pos, rule)
|
|
||||||
-- if area is not loaded, keep trying
|
|
||||||
if minetest.get_node_or_nil(np) == nil then
|
|
||||||
mesecon.queue:add_action(pos, "receptor_on", {rules}, nil, rules)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- execute action
|
|
||||||
for _, rule in ipairs(mesecon.flattenrules(rules)) do
|
for _, rule in ipairs(mesecon.flattenrules(rules)) do
|
||||||
local np = vector.add(pos, rule)
|
local np = vector.add(pos, rule)
|
||||||
local rulenames = mesecon.rules_link_rule_all(pos, rule)
|
local rulenames = mesecon.rules_link_rule_all(pos, rule)
|
||||||
@ -103,15 +93,7 @@ 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
|
-- Call turnoff on all linking positions
|
||||||
for _, rule in ipairs(mesecon.flattenrules(rules)) do
|
|
||||||
local np = vector.add(pos, rule)
|
|
||||||
if minetest.get_node_or_nil(np) == nil then
|
|
||||||
mesecon.queue:add_action(pos, "receptor_off", {rules}, nil, rules)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for _, rule in ipairs(mesecon.flattenrules(rules)) do
|
for _, rule in ipairs(mesecon.flattenrules(rules)) do
|
||||||
local np = vector.add(pos, rule)
|
local np = vector.add(pos, rule)
|
||||||
local rulenames = mesecon.rules_link_rule_all(pos, rule)
|
local rulenames = mesecon.rules_link_rule_all(pos, rule)
|
||||||
|
Loading…
Reference in New Issue
Block a user