From d440fae38bb90630106bd0a9f07def67bc3a2b76 Mon Sep 17 00:00:00 2001 From: The4codeblocks <72419529+The4codeblocks@users.noreply.github.com> Date: Sun, 15 Feb 2026 03:48:04 -0500 Subject: [PATCH 1/6] matching filter spec --- filter-injector.lua | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/filter-injector.lua b/filter-injector.lua index 0448950..9197fef 100644 --- a/filter-injector.lua +++ b/filter-injector.lua @@ -133,6 +133,7 @@ local function punch_filter(data, filtpos, filtnode, msg) local slotseq_mode local exmatch_mode + local matching_mode local item_tags = pipeworks.sanitize_tags(filtmeta:get_string("item_tags")) local filters = {} @@ -176,6 +177,14 @@ local function punch_filter(data, filtpos, filtnode, msg) exmatch_mode = exmatch and 1 or 0 end + local matching = msg.matching + local t_matching = type(matching) + if t_matching == "number" and (matching == 0 or matching == 1) then + matching_mode = matching + elseif t_exmatch == "boolean" then + matching_mode = matching and 1 or 0 + end + local slotseq_index = msg.slotseq_index if type(slotseq_index) == "number" then -- This should allow any valid index, but I'm not completely sure what @@ -194,7 +203,11 @@ local function punch_filter(data, filtpos, filtnode, msg) filtmeta:set_int("exmatch_mode", exmatch_mode) end - if slotseq_mode ~= nil or exmatch_mode ~= nil then + if matching_mode ~= nil then + filtmeta:set_int("matching_mode", matching_mode) + end + + if slotseq_mode ~= nil or exmatch_mode ~= nil or matching_mode ~= nil then set_filter_formspec(data, filtmeta) end @@ -244,6 +257,10 @@ local function punch_filter(data, filtpos, filtnode, msg) exmatch_mode = filtmeta:get_int("exmatch_mode") end + if matching_mode == nil then + matching_mode = filtmeta:get_int("matching_mode") + end + local frominv if fromtube.return_input_invref then frominv = fromtube.return_input_invref(frompos, fromnode, dir, owner) @@ -325,6 +342,7 @@ local function punch_filter(data, filtpos, filtnode, msg) end -- stupid lack of continue statements grumble if doRemove > 0 then + if matching_mode then filterfor.name = stack:get_name() end if slotseq_mode == 2 then local nextpos = spos + 1 if nextpos > frominv:get_size(frominvname) then From 01159eb3deff4dd6cfe57ce065ffa3a5790b5537 Mon Sep 17 00:00:00 2001 From: The4codeblocks <72419529+The4codeblocks@users.noreply.github.com> Date: Sun, 15 Feb 2026 03:51:05 -0500 Subject: [PATCH 2/6] Fix conditional check for matching_mode --- filter-injector.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filter-injector.lua b/filter-injector.lua index 9197fef..ac94d96 100644 --- a/filter-injector.lua +++ b/filter-injector.lua @@ -342,7 +342,7 @@ local function punch_filter(data, filtpos, filtnode, msg) end -- stupid lack of continue statements grumble if doRemove > 0 then - if matching_mode then filterfor.name = stack:get_name() end + if matching_mode == 1 then filterfor.name = stack:get_name() end if slotseq_mode == 2 then local nextpos = spos + 1 if nextpos > frominv:get_size(frominvname) then From b6ce18f2aa54896e9580167184462cad9bee8eec Mon Sep 17 00:00:00 2001 From: The4codeblocks <72419529+The4codeblocks@users.noreply.github.com> Date: Sun, 15 Feb 2026 07:27:40 -0500 Subject: [PATCH 3/6] relocate "matching" filter --- filter-injector.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/filter-injector.lua b/filter-injector.lua index ac94d96..0e64214 100644 --- a/filter-injector.lua +++ b/filter-injector.lua @@ -280,11 +280,20 @@ local function punch_filter(data, filtpos, filtnode, msg) local matches if filterfor == "" then matches = stack:get_name() ~= "" + if (not fname) and matching_mode == 1 then + filterfor = {name = stack:get_name()} + end else local fname = filterfor.name local fgroup = filterfor.group local fwear = filterfor.wear local fmetadata = filterfor.metadata + + if (not fname) and matching_mode == 1 then + fname = stack:get_name() + filterfor.name = fname + end + matches = (not fname -- If there's a name filter, or stack:get_name() == fname) -- it must match. @@ -342,7 +351,6 @@ local function punch_filter(data, filtpos, filtnode, msg) end -- stupid lack of continue statements grumble if doRemove > 0 then - if matching_mode == 1 then filterfor.name = stack:get_name() end if slotseq_mode == 2 then local nextpos = spos + 1 if nextpos > frominv:get_size(frominvname) then From a07615872b62d1d917b9138ff838e65ae46ac73f Mon Sep 17 00:00:00 2001 From: The4codeblocks <72419529+The4codeblocks@users.noreply.github.com> Date: Tue, 17 Feb 2026 17:08:31 -0500 Subject: [PATCH 4/6] shut luacheck up (it was valid though) --- filter-injector.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/filter-injector.lua b/filter-injector.lua index 0e64214..ef376b9 100644 --- a/filter-injector.lua +++ b/filter-injector.lua @@ -280,7 +280,7 @@ local function punch_filter(data, filtpos, filtnode, msg) local matches if filterfor == "" then matches = stack:get_name() ~= "" - if (not fname) and matching_mode == 1 then + if matching_mode == 1 then filterfor = {name = stack:get_name()} end else @@ -288,12 +288,12 @@ local function punch_filter(data, filtpos, filtnode, msg) local fgroup = filterfor.group local fwear = filterfor.wear local fmetadata = filterfor.metadata - + if (not fname) and matching_mode == 1 then fname = stack:get_name() filterfor.name = fname end - + matches = (not fname -- If there's a name filter, or stack:get_name() == fname) -- it must match. From d90fbdec703b49b45d10da0a60411105a5b800cd Mon Sep 17 00:00:00 2001 From: The4spaceconsts Date: Thu, 4 Jun 2026 06:07:08 -0500 Subject: [PATCH 5/6] dividing mode, fix boolean version of matching digiline field --- filter-injector.lua | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/filter-injector.lua b/filter-injector.lua index ef376b9..e75fdcd 100644 --- a/filter-injector.lua +++ b/filter-injector.lua @@ -134,6 +134,7 @@ local function punch_filter(data, filtpos, filtnode, msg) local slotseq_mode local exmatch_mode local matching_mode + local dividing_mode local item_tags = pipeworks.sanitize_tags(filtmeta:get_string("item_tags")) local filters = {} @@ -181,10 +182,19 @@ local function punch_filter(data, filtpos, filtnode, msg) local t_matching = type(matching) if t_matching == "number" and (matching == 0 or matching == 1) then matching_mode = matching - elseif t_exmatch == "boolean" then + elseif t_matching == "boolean" then matching_mode = matching and 1 or 0 end + local dividing = msg.dividing + local t_dividing = type(dividing) + if t_dividing == "number" and (dividing == 0 or dividing == 1) then + dividing_mode = dividing + elseif t_matching == "boolean" then + dividing_mode = dividing and 1 or 0 + end + + local slotseq_index = msg.slotseq_index if type(slotseq_index) == "number" then -- This should allow any valid index, but I'm not completely sure what @@ -207,7 +217,11 @@ local function punch_filter(data, filtpos, filtnode, msg) filtmeta:set_int("matching_mode", matching_mode) end - if slotseq_mode ~= nil or exmatch_mode ~= nil or matching_mode ~= nil then + if dividing_mode ~= nil then + filtmeta:set_int("dividing_mode", dividing_mode) + end + + if slotseq_mode ~= nil or exmatch_mode ~= nil then set_filter_formspec(data, filtmeta) end @@ -261,6 +275,10 @@ local function punch_filter(data, filtpos, filtnode, msg) matching_mode = filtmeta:get_int("matching_mode") end + if dividing_mode == nil then + dividing_mode = filtmeta:get_int("dividing_mode") + end + local frominv if fromtube.return_input_invref then frominv = fromtube.return_input_invref(frompos, fromnode, dir, owner) @@ -397,7 +415,7 @@ local function punch_filter(data, filtpos, filtnode, msg) table.insert(taken_stacks, taken) end end - if #taken_stacks > 1 then + if dividing_mode ~= 1 and #taken_stacks > 1 then -- merge stacks if possible to reduce items in tubes local merged = {} for _,a in ipairs(taken_stacks) do From 96bc7a5463a0091f385f7f8290f4aeb8a1efd9ac Mon Sep 17 00:00:00 2001 From: The4spaceconsts Date: Thu, 4 Jun 2026 06:10:23 -0500 Subject: [PATCH 6/6] shut luacheck up --- filter-injector.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/filter-injector.lua b/filter-injector.lua index e75fdcd..b936dd3 100644 --- a/filter-injector.lua +++ b/filter-injector.lua @@ -193,7 +193,7 @@ local function punch_filter(data, filtpos, filtnode, msg) elseif t_matching == "boolean" then dividing_mode = dividing and 1 or 0 end - + local slotseq_index = msg.slotseq_index if type(slotseq_index) == "number" then