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

мНет описания правки
мНет описания правки
Строка 56: Строка 56:
             local tierColor = tierColors[tech.tier] or "#FFFFFF"
             local tierColor = tierColors[tech.tier] or "#FFFFFF"
             local iconPath = tech.icon and tech.icon.sprite or nil
             local iconPath = tech.icon and tech.icon.sprite or nil
            -- Формирование строки prerequisites
            local prerequisitesStr = ""
            if tech.technologyPrerequisites and #tech.technologyPrerequisites > 0 then
                prerequisitesStr = '<ul>'
                for _, prerequisite in ipairs(tech.technologyPrerequisites) do
                    if prerequisite and prerequisite ~= "" then
                        prerequisitesStr = prerequisitesStr .. '<li>{{#invoke:Entity Lookup|createimagetooltip|Файл:'
                            .. prerequisite .. '.png|' .. prerequisite
                            .. '|Мета=32x32px,link=}}'
                            .. prerequisite .. '</li>'
                    end
                end
                prerequisitesStr = prerequisitesStr .. '</ul>'
            end
            -- Формирование строки unlocks
            local unlocksStr = ""
            if tech.recipeUnlocks and #tech.recipeUnlocks > 0 then
                unlocksStr = '<ul>'
                for _, recipe in ipairs(tech.recipeUnlocks) do
                    if recipe and recipe ~= "" then
                        unlocksStr = unlocksStr .. '<li>{{#invoke:Entity Lookup|createimagetooltip|Файл:'
                            .. recipe .. '.png|' .. recipe
                            .. '|Мета=32x32px,link=}} {{#invoke:Entity Lookup|getname|'
                            .. recipe .. '}}</li>'
                    end
                end
                unlocksStr = unlocksStr .. '</ul>'
            end


             -- Используем шаблон для отображения блока исследования
             -- Используем шаблон для отображения блока исследования
Строка 69: Строка 99:
                     disciplineName = disciplineName,
                     disciplineName = disciplineName,
                     cost = tech.cost,
                     cost = tech.cost,
                     prerequisites = tech.technologyPrerequisites and table.concat(tech.technologyPrerequisites, ",") or "",
                     prerequisites = prerequisitesStr,
                     unlocks = tech.recipeUnlocks and table.concat(tech.recipeUnlocks, ",") or ""
                     unlocks = unlocksStr
                 }
                 }
             })
             })
         end
         end


        out = out .. '</div>'
         return out
         return out
     else
     else