Fix issue #182 (TA4 autocrafter recipe)

This commit is contained in:
Joachim Stolberg 2025-01-10 19:31:21 +01:00
parent 1bf0a4c175
commit fcb583c062

View File

@ -242,26 +242,27 @@ local function determine_recipe_items(pos, input)
local num, idx local num, idx
if input and type(input) == "string" then -- Lua controller if input and type(input) == "string" then -- Lua controller
-- Test if "<node-number>.<recipe-number>" input -- Test if "<node-number>.<recipe-number>"
num, idx = unpack(string.split(input, ".", false, 1)) if string.find(input, "%d+%.%d+") then
elseif input and type(input) == "table" then -- Beduino num, idx = unpack(string.split(input, ".", false, 1))
if input[3] == 0 then -- TA3 Terminal Basic elseif input and type(input) == "table" then -- Beduino
num = tostring(input[1]) if input[3] == 0 then -- TA3 Terminal Basic
idx = tostring(input[2]) num = tostring(input[1])
else -- 16 bit Beduino controller idx = tostring(input[2])
num = tostring(input[1] * 65536 + input[2]) else -- 16 bit Beduino controller
idx = tostring(input[3]) num = tostring(input[1] * 65536 + input[2])
idx = tostring(input[3])
end
end
if num and idx then
input = get_input_from_recipeblock(pos, num, idx)
end end
end end
if input and type(input) == "string" then
if num and idx then -- "<item>,<item>,..." input
input = get_input_from_recipeblock(pos, num, idx) local items = string.split(input, ",", true, 8)
if input then if items and type(items) == "table" and next(items) then
-- "<item>,<item>,..." input return items
local items = string.split(input, ",", true, 8)
if items and type(items) == "table" and next(items) then
return items
end
end end
end end
end end