From e85a16f70a8b14c3851c1d87e9b009daade011ef Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 17 Jan 2018 20:20:08 +0100 Subject: [PATCH] Redstone: Make is_powered respect spread --- mods/ITEMS/REDSTONE/mesecons/internal.lua | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons/internal.lua b/mods/ITEMS/REDSTONE/mesecons/internal.lua index de8d9b5aff..9461b72a5c 100644 --- a/mods/ITEMS/REDSTONE/mesecons/internal.lua +++ b/mods/ITEMS/REDSTONE/mesecons/internal.lua @@ -545,8 +545,21 @@ 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 - table.insert(sourcepos, np) - direct_source = true + 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)