1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2024-12-27 11:20:26 +01:00

also accept strings of tags in digilines and lua

fixes #116
This commit is contained in:
OgelGames 2024-03-07 14:56:19 +11:00
parent 6c66a2f43c
commit ce263da6d5
3 changed files with 5 additions and 5 deletions

View File

@ -201,7 +201,7 @@ local function punch_filter(data, filtpos, filtnode, msg)
set_filter_formspec(data, filtmeta) set_filter_formspec(data, filtmeta)
end end
if type(msg.tags) == "table" then if type(msg.tags) == "table" or type(msg.tags) == "string" then
item_tags = pipeworks.sanitize_tags(msg.tags) item_tags = pipeworks.sanitize_tags(msg.tags)
elseif type(msg.tag) == "string" then elseif type(msg.tag) == "string" then
item_tags = pipeworks.sanitize_tags({msg.tag}) item_tags = pipeworks.sanitize_tags({msg.tag})

View File

@ -388,7 +388,7 @@ luaentity.register_entity("pipeworks:tubed_item", {
end end
local found_next, new_velocity, multimode = go_next(self.start_pos, velocity, stack, self.owner, tags) -- todo: color local found_next, new_velocity, multimode = go_next(self.start_pos, velocity, stack, self.owner, tags) -- todo: color
if pipeworks.enable_item_tags then if pipeworks.enable_item_tags then
self.tags = #tags > 0 and pipeworks.sanitize_tags(tags) or nil self.tags = #tags > 0 and tags or nil
end end
local rev_vel = vector.multiply(velocity, -1) local rev_vel = vector.multiply(velocity, -1)
local rev_dir = vector.direction(self.start_pos,vector.add(self.start_pos,rev_vel)) local rev_dir = vector.direction(self.start_pos,vector.add(self.start_pos,rev_vel))

View File

@ -972,10 +972,10 @@ for white = 0, 1 do
elseif type(msg) == "table" then elseif type(msg) == "table" then
if pipeworks.enable_item_tags then if pipeworks.enable_item_tags then
local new_tags local new_tags
if type(msg.tags) == "table" then if type(msg.tags) == "table" or type(msg.tags) == "string" then
new_tags = msg.tags new_tags = pipeworks.sanitize_tags(msg.tags)
elseif type(msg.tag) == "string" then elseif type(msg.tag) == "string" then
new_tags = {msg.tag} new_tags = pipeworks.sanitize_tags({msg.tag})
end end
if new_tags then if new_tags then
for i=1, math.max(#tags, #new_tags) do for i=1, math.max(#tags, #new_tags) do