Модуль:Песочница/Pok: различия между версиями

мНет описания правки
мНет описания правки
Строка 218: Строка 218:
-- Функция для формирования строки рецепта
-- Функция для формирования строки рецепта
-----------------------------------------------------------
-----------------------------------------------------------
local function formatRecipe(recipe, timeMultiplier, materialUseMultiplier)
local function formatRecipe(recipe, timeMultiplier, materialUseMultiplier, itemMode)
     local out = ""
     local out = ""
     local scaledTime = recipe.completetime * timeMultiplier
     local scaledTime = recipe.completetime * timeMultiplier
     out = out .. '{{Шаблон:Prototypes/Машина/Станок|product=' .. recipe.result
     out = out .. '{{Шаблон:Prototypes/Машина/Станок|product=' .. recipe.result
    if itemMode then
        out = out .. '|no-product=1'
    end
     out = out .. '|complete-time={{#invoke:Code/Формат/Время|main|seconds|' .. scaledTime .. '}}|materials='
     out = out .. '|complete-time={{#invoke:Code/Формат/Время|main|seconds|' .. scaledTime .. '}}|materials='


Строка 256: Строка 259:


-----------------------------------------------------------
-----------------------------------------------------------
-- Основная функция
-- Функция для поиска и вывода рецептов по ID станка
-----------------------------------------------------------
-----------------------------------------------------------
function p.lathe(frame)
function p.lathe(frame)
Строка 296: Строка 299:
     end
     end


     local out = '{| class="wikitable"\n! Станок ID\n! Рецепт\n'
     local out = '{| class="wikitable"' .. "\n! Станок ID\n! Рецепт\n"
     local foundAny = false
     local foundAny = false


Строка 307: Строка 310:
             if recipe.result == itemId then
             if recipe.result == itemId then
                 foundAny = true
                 foundAny = true
                 out = out .. '|-\n'
                 out = out .. '|-' .. "\n"
                 out = out .. '| ' .. lathe.id .. '\n'
                 out = out .. '| ' .. lathe.id .. "\n"
                 out = out .. '| ' .. formatRecipe(recipe, timeMultiplier, materialUseMultiplier) .. '\n'
                 out = out .. '| ' .. formatRecipe(recipe, timeMultiplier, materialUseMultiplier, true) .. "\n"
             end
             end
         end
         end