mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-11-28 13:53:45 +01:00
Redstone: Fix internal logic a bit
This commit is contained in:
parent
af3db1ae21
commit
f009e958f5
@ -537,7 +537,7 @@ function mesecon.is_powered(pos, rule, depth, sourcepos, home_pos)
|
|||||||
sourcepos = {}
|
sourcepos = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
local function power_walk(pos, sourcepos, rulenames, rule, depth)
|
local function power_walk(pos, home_pos, sourcepos, rulenames, rule, depth)
|
||||||
local direct_source = false
|
local direct_source = false
|
||||||
for _, rname in ipairs(rulenames) do
|
for _, rname in ipairs(rulenames) do
|
||||||
local np = vector.add(pos, rname)
|
local np = vector.add(pos, rname)
|
||||||
@ -562,11 +562,11 @@ function mesecon.is_powered(pos, rule, depth, sourcepos, home_pos)
|
|||||||
if not rule then
|
if not rule then
|
||||||
for _, rule in ipairs(mesecon.flattenrules(rules)) do
|
for _, rule in ipairs(mesecon.flattenrules(rules)) do
|
||||||
local rulenames = mesecon.rules_link_rule_all_inverted(pos, rule)
|
local rulenames = mesecon.rules_link_rule_all_inverted(pos, rule)
|
||||||
sourcepos, direct_source = power_walk(pos, sourcepos, rulenames, rule, depth)
|
sourcepos, direct_source = power_walk(pos, home_pos, sourcepos, rulenames, rule, depth)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local rulenames = mesecon.rules_link_rule_all_inverted(pos, rule)
|
local rulenames = mesecon.rules_link_rule_all_inverted(pos, rule)
|
||||||
sourcepos, direct_source = power_walk(pos, sourcepos, rulenames, rule, depth)
|
sourcepos, direct_source = power_walk(pos, home_pos, sourcepos, rulenames, rule, depth)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Return FALSE if not powered, return list of sources if is powered
|
-- Return FALSE if not powered, return list of sources if is powered
|
||||||
|
Loading…
Reference in New Issue
Block a user