修复流体无法添加一次转移数量的bug

This commit is contained in:
HKXluo
2025-10-22 13:49:49 +08:00
parent 9893c2dada
commit b6dea93a18

View File

@@ -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