From b6dea93a18e08fda165d67effe84d0b130056a4c Mon Sep 17 00:00:00 2001 From: HKXluo Date: Wed, 22 Oct 2025 13:49:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=81=E4=BD=93=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=B7=BB=E5=8A=A0=E4=B8=80=E6=AC=A1=E8=BD=AC=E7=A7=BB?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Logistics/startup.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Logistics/startup.lua b/Logistics/startup.lua index 6841bfb..f9bcec7 100644 --- a/Logistics/startup.lua +++ b/Logistics/startup.lua @@ -92,18 +92,23 @@ local function parseFluidRequirements(input) -- Split key-value pairs for pair in content:gmatch("[^,]+") do + -- 支持JSON格式: "key":value local key, value = pair:match("[\"']?(.-)[\"']?%s*:%s*(%d+)") if key and value then requirements[key] = tonumber(value) end end else - -- Simple format: fluid:minAmount + -- 只支持等号格式: fluid=minAmount for fluid in input:gmatch("%S+") do - local name, minAmount = fluid:match("([^:]+):(%d+)") + -- 匹配等号格式: fluid_name=minAmount + local name, minAmount = fluid:match("([^=]+)=(%d+)") + + -- 如果匹配到等号格式 if name and minAmount then requirements[name] = tonumber(minAmount) else + -- 没有等号,视为只有流体名 requirements[fluid] = 0 -- No minimum requirement end end