forked from minetest-mods/mesecons
Actionqueue tweaks
This commit is contained in:
parent
1a492feb7a
commit
c8ef37f522
@ -12,7 +12,6 @@ function mesecon.queue:add_action(pos, func, params, time, overwritecheck, prior
|
|||||||
-- Create Action Table:
|
-- Create Action Table:
|
||||||
time = time or 0 -- time <= 0 --> execute, time > 0 --> wait time until execution
|
time = time or 0 -- time <= 0 --> execute, time > 0 --> wait time until execution
|
||||||
priority = priority or 1
|
priority = priority or 1
|
||||||
overwritecheck = overwritecheck or {}
|
|
||||||
action = { pos=mesecon:tablecopy(pos),
|
action = { pos=mesecon:tablecopy(pos),
|
||||||
func=func,
|
func=func,
|
||||||
params=mesecon:tablecopy(params),
|
params=mesecon:tablecopy(params),
|
||||||
|
@ -82,6 +82,7 @@ mesecon.queue:add_function("receptor_on", function (pos, rules)
|
|||||||
-- if area (any of the rule targets) 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 area is not loaded, keep trying
|
||||||
if minetest.get_node_or_nil(np) == nil then
|
if minetest.get_node_or_nil(np) == nil then
|
||||||
mesecon.queue:add_action(pos, "receptor_on", {rules})
|
mesecon.queue:add_action(pos, "receptor_on", {rules})
|
||||||
return
|
return
|
||||||
@ -110,6 +111,7 @@ mesecon.queue:add_function("receptor_off", function (pos, rules)
|
|||||||
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})
|
||||||
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user