Add tag levels (multitag) support.

Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
Slava Zanko 2024-02-27 21:03:32 +01:00
parent 62fc37cbbd
commit e4be0e516a
1 changed files with 5 additions and 1 deletions

View File

@ -12,6 +12,10 @@ local safe_tags = function(tags)
return tags:sub(1, length_limit * 6)
end
local function escape(s)
return (s:gsub('[%-%.%+%[%]%(%)%$%^%%%?%*]', '%%%1'))
end
local update_formspec = function(pos)
local meta = minetest.get_meta(pos)
local buttons_formspec = ""
@ -85,7 +89,7 @@ pipeworks.register_tube(tube_name, {
if not is_empty then
for tag in string.gmatch(tags, "[^,]+") do
tag = pipeworks.safe_tag(tag)
if tag and tag == stack_tag then
if tag and (tag == stack_tag or stack_tag:find(("^%s%%."):format(escape(tag)))) then
foundn = foundn + 1
found[foundn] = vect
end