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

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


function p.main(frame)
function p.main(frame)
local tierColor = tierColors[tech.tier] or "#FFFFFF"
local disciplineName = disciplineMapping[tech.discipline] or "Неизвестная дисциплина"
     -- Подключение CSS
     -- Подключение CSS
     local cssLink = frame:extensionTag('templatestyles', '', {
     local cssLink = frame:extensionTag('templatestyles', '', {
Строка 39: Строка 36:
         local out = cssLink .. '<div class="research-group">'
         local out = cssLink .. '<div class="research-group">'


        -- Поиск исследования по ID
-- Поиск исследования по ID
        local tech = nil
local tech = nil
        for _, research in ipairs(dataCache) do
for _, research in ipairs(dataCache) do
            if research.technology and research.technology.id == researchId then
    if research.technology and research.technology.id == researchId then
                tech = research.technology
        tech = research.technology
                break
        break
            end
    end
        end
end
 
        if not tech then
if not tech then
            out = out .. '<div style="color:red;">Исследование с ID "' .. researchId .. '" не найдено.</div>'
    out = out .. '<div style="color:red;">Исследование с ID "' .. researchId .. '" не найдено.</div>'
        else
else
            local tierColor = tierColors[tech.tier] or "#FFFFFF"
    local tierColor = tierColors[tech.tier] or "#FFFFFF"
    local disciplineName = disciplineMapping[tech.discipline] or "Неизвестная дисциплина"
             local iconPath = icon ~= "" and icon or (tech.icon and tech.icon.sprite or nil)
             local iconPath = icon ~= "" and icon or (tech.icon and tech.icon.sprite or nil)