mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-11-05 06:53:44 +01:00
Minor cleanup, use addPosRule
This commit is contained in:
parent
c76c274cc0
commit
2c4a46a557
@ -79,10 +79,7 @@ function mesecon:receptor_on(pos, rules)
|
||||
rules = rules or mesecon.rules.default
|
||||
|
||||
for _, rule in ipairs(rules) do
|
||||
local np = {
|
||||
x = pos.x + rule.x,
|
||||
y = pos.y + rule.y,
|
||||
z = pos.z + rule.z}
|
||||
local np = mesecon:addPosRule(pos, rule)
|
||||
if mesecon:rules_link(pos, np, rules) then
|
||||
mesecon:turnon(np, pos)
|
||||
end
|
||||
@ -93,10 +90,7 @@ function mesecon:receptor_off(pos, rules)
|
||||
rules = rules or mesecon.rules.default
|
||||
|
||||
for _, rule in ipairs(rules) do
|
||||
local np = {
|
||||
x = pos.x + rule.x,
|
||||
y = pos.y + rule.y,
|
||||
z = pos.z + rule.z}
|
||||
local np = mesecon:addPosRule(pos, rule)
|
||||
if mesecon:rules_link(pos, np, rules) and not mesecon:connected_to_receptor(np) then
|
||||
mesecon:turnoff(np, pos)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user