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

мНет описания правки
Нет описания правки
Строка 86: Строка 86:


-- Блок необходимых исследований
-- Блок необходимых исследований
if tech.technologyPrerequisites and #tech.technologyPrerequisites > 0 then
out = out .. '<div class="research__technologies-prerequisites">Необходимые исследования:'
out = out .. '<ul>'
for _, prerequisite in ipairs(tech.technologyPrerequisites) do
out = out .. frame:preprocess('<li>{{#invoke:Entity Lookup|getname|' .. prerequisite .. '}}</li>')
end
out = out .. '</ul>'
out = out .. '</div>'
end
-- Блок открываемых рецептов
if tech.recipeUnlocks and #tech.recipeUnlocks > 0 then
if tech.recipeUnlocks and #tech.recipeUnlocks > 0 then
out = out .. '<div class="research__technologies-unlocks">Разблокирует:'
    out = out .. '<div class="research__technologies-unlocks">Разблокирует:'
out = out .. '<ul>'
    out = out .. '<ul>'
 
for _, recipe in ipairs(tech.recipeUnlocks) do
    for _, recipe in ipairs(tech.recipeUnlocks) do
out = out .. frame:preprocess('<li>{{#invoke:Entity Lookup|getname|' .. recipe .. '}}</li>')
        -- Проверяем, что recipe не пустой и валидный
end
        if recipe and recipe ~= "" then
out = out .. '</ul>'
            out = out .. frame:preprocess('<li>{{#invoke:Entity Lookup|createimagetooltip|Файл:'
out = out .. '</div>'
                .. recipe .. '.png|' .. recipe
                .. '|Мета=32x32px,link=}} {{#invoke:Entity Lookup|getname|'  
                .. recipe .. '}}</li>')
        else
            out = out .. '<li style="color:red;">Ошибка: некорректный рецепт.</li>'
        end
    end
    out = out .. '</ul>'
    out = out .. '</div>'
end
end
 
out = out .. '</div>'
out = out .. '</div>'
end
end