Модуль:Prototypes/Машина/Станок: различия между версиями

мНет описания правки
мНет описания правки
Строка 112: Строка 112:
     local sortedResearch = sortResearch(researchData)
     local sortedResearch = sortResearch(researchData)


    -- Обработка staticRecipes
    if lathe.Lathe.staticRecipes then
        output = output .. '<li><strong>Static Recipes:</strong></li>'
        for _, recipeId in ipairs(lathe.Lathe.staticRecipes) do
            local recipe = getRecipeDetails(recipeId)
            if recipe then
                output = output .. '<li>' .. recipe.result
                output = output .. ' (Время изготовления: ' .. format_seconds_to_short_string(recipe.completetime) .. ')'
                output = output .. '<ul>'
                for material, amount in pairs(recipe.materials) do
                    output = output .. '<li>' .. material .. ': ' .. amount .. '</li>'
                end
                output = output .. '</ul>'
                output = output .. '</li>'
            end
        end
    end
    -- Обработка dynamicRecipes
    if lathe.Lathe.dynamicRecipes then
        output = output .. '<li><strong>Dynamic Recipes:</strong></li>'
        for _, recipeId in ipairs(lathe.Lathe.dynamicRecipes) do
            local recipe = getRecipeDetails(recipeId)
            if recipe then
                local researchInfo = findInResearch(recipeId)
                if researchInfo then
                    output = output .. '<li>' .. recipe.result
                    output = output .. ' (Время изготовления: ' .. format_seconds_to_short_string(recipe.completetime) .. ')'
                    output = output .. '<ul>'
                    for material, amount in pairs(recipe.materials) do
                        output = output .. '<li>' .. material .. ': ' .. amount .. '</li>'
                    end
                    output = output .. '</ul>'
                    output = output .. '<div>Исследование: ' .. researchInfo.discipline .. ' - ' .. researchInfo.name
                    output = output .. ' (Уровень: ' .. researchInfo.tier .. ')</div>'
                    output = output .. '</li>'
                else
                    output = output .. '<li>' .. recipe.result
                    output = output .. ' (Время изготовления: ' .. format_seconds_to_short_string(recipe.completetime) .. ')'
                    output = output .. '<ul>'
                    for material, amount in pairs(recipe.materials) do
                        output = output .. '<li>' .. material .. ': ' .. amount .. '</li>'
                    end
                    output = output .. '</ul>'
                    output = output .. '</li>'
                end
            end
        end
    end
    -- Вывод исследований по дисциплинам и тирам
    output = output .. '<li><strong>Исследования:</strong></li>'
     for discipline, researches in pairs(sortedResearch) do
     for discipline, researches in pairs(sortedResearch) do
         output = output .. '<li><strong>' .. discipline .. ':</strong></li>'
         output = output .. '<li><strong>' .. discipline .. ':</strong></li>'