Redstone: Make is_powered respect spread

This commit is contained in:
Wuzzy 2018-01-17 20:20:08 +01:00
parent ec49459eb4
commit e85a16f70a
1 changed files with 15 additions and 2 deletions

View File

@ -545,9 +545,22 @@ function mesecon.is_powered(pos, rule, depth, sourcepos, home_pos)
if (mesecon.is_conductor_on (nn, mesecon.invertRule(rname))
or mesecon.is_receptor_on (nn.name)) then
if not vector.equals(home_pos, np) then
local rulez = mesecon.get_any_outputrules(nn)
local ds_tmp = false
for r=1, #rulez do
if vector.equals(mesecon.invertRule(rname), rulez[r]) then
if rulez[r].spread then
ds_tmp = true
end
end
end
if depth == 0 or ds_tmp then
table.insert(sourcepos, np)
if ds_tmp then
direct_source = true
end
end
end
elseif depth == 0 and minetest.get_item_group(nn.name, "opaque") == 1 then
local more_sourcepos = mesecon.is_powered(np, nil, depth + 1, sourcepos, home_pos)
if more_sourcepos and #more_sourcepos > 0 then