From 0c3b39738b578a8e21a316fe0b70bbc1d3b029e9 Mon Sep 17 00:00:00 2001 From: Johannes Lundberg Date: Thu, 8 Oct 2020 18:52:29 -0700 Subject: [PATCH] Scanner: Always update state and not only on change so that adjecent nodes placed after state change also are updated --- mesecons_scanner/init.lua | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/mesecons_scanner/init.lua b/mesecons_scanner/init.lua index 107d421..fbbff99 100644 --- a/mesecons_scanner/init.lua +++ b/mesecons_scanner/init.lua @@ -241,18 +241,16 @@ mesecon.register_node("mesecons_scanner:mesecon_scanner", { end meta:set_int("current", count) - -- Update if there's a change + -- Update node + local output_string = (output and "on") or "off" + set_receptor(pos, output, {scanner_get_output_rules(node)}) + mesecon.setstate(pos, node, output_string) + + -- Save the new state + meta:set_string("output", output_string) + + -- Send digiline message on change if old_output ~= output then - local output_string = (output and "on") or "off" - - -- Save the new state - meta:set_string("output", output_string) - - -- Update node - set_receptor(pos, output, {scanner_get_output_rules(node)}) - mesecon.setstate(pos, node, output_string) - - -- Send digiline message if digilines_enabled and meta:get_string("channel") ~= "" then digilines.receptor_send(pos, digilines.rules.default, meta:get_string("channel"),