1
0
Fork 0

Redstone: Fix internal logic a bit

This commit is contained in:
Wuzzy 2018-01-17 05:49:11 +01:00
parent af3db1ae21
commit f009e958f5
1 changed files with 3 additions and 3 deletions

View File

@ -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