Модуль:Prototypes/Машина/Станок: различия между версиями
Pok (обсуждение | вклад) мНет описания правки |
Pok (обсуждение | вклад) Нет описания правки |
||
| Строка 159: | Строка 159: | ||
end | end | ||
-- Обработка emagStaticRecipes | |||
if lathe.EmagLatheRecipes and lathe.EmagLatheRecipes.emagStaticRecipes then | |||
for _, recipeId in ipairs(lathe.EmagLatheRecipes.emagStaticRecipes) do | |||
local recipe = getRecipeDetails(recipeId) | |||
if recipe then | |||
table.insert(recipes, { | |||
result = recipe.result, | |||
completetime = recipe.completetime, | |||
materials = recipe.materials, | |||
discipline = "Static", | |||
tier = 0, | |||
isEmag = true | |||
}) | |||
end | |||
end | |||
end | |||
-- Обработка emagDynamicRecipes | |||
if lathe.EmagLatheRecipes and lathe.EmagLatheRecipes.emagDynamicRecipes then | |||
for _, recipeId in ipairs(lathe.EmagLatheRecipes.emagDynamicRecipes) do | |||
local recipe = getRecipeDetails(recipeId) | |||
if recipe then | |||
local researchInfo = findInResearch(recipeId) | |||
if researchInfo then | |||
table.insert(recipes, { | |||
result = recipe.result, | |||
completetime = recipe.completetime, | |||
materials = recipe.materials, | |||
discipline = researchInfo.discipline, | |||
tier = researchInfo.tier, | |||
researchName = researchInfo.name, | |||
isEmag = true | |||
}) | |||
else | |||
table.insert(recipes, { | |||
result = recipe.result, | |||
completetime = recipe.completetime, | |||
materials = recipe.materials, | |||
discipline = "Unknown", | |||
tier = 0, | |||
isEmag = true | |||
}) | |||
end | |||
end | |||
end | |||
end | |||
-- Сортируем рецепты | |||
sortRecipesByPriority(recipes) | |||
-- Вывод рецептов | |||
for _, recipe in ipairs(recipes) do | |||
output = output .. '{{Шаблон:Prototypes/Машина/Станок|product=' .. recipe.result | |||
output = output .. '|complete-time=' .. format_seconds_to_short_string(recipe.completetime) | |||
output = output .. '|materials=' | |||
if next(recipe.materials) then | |||
for material, amount in pairs(recipe.materials) do | |||
output = output .. '<li>' .. material .. ': ' .. amount .. '</li>' | |||
end | |||
else | |||
output = output .. 'Нет данных о материалах' | |||
end | |||
-- Информация об исследовании | |||
if recipe.discipline ~= "Static" and recipe.discipline ~= "Unknown" then | |||
output = output .. '|info=Исследование: ' .. recipe.discipline .. ' - ' .. recipe.researchName | |||
output = output .. ' (Уровень: ' .. recipe.tier .. ')' | |||
end | |||
-- Пометка EMAG | |||
if recipe.isEmag then | |||
output = output .. '<div>Пометка: EMAG</div>' | |||
end | |||
output = output .. '}}' | |||
end | |||
return mw.getCurrentFrame():preprocess(output) | return mw.getCurrentFrame():preprocess(output) | ||