Модуль:Prototypes/Роль/Лодаут: различия между версиями

мНет описания правки
мНет описания правки
Строка 55: Строка 55:
                 end
                 end
                 if loadout and loadout.equipment then
                 if loadout and loadout.equipment then
                     local eqValue = loadout.equipment[searchKey]
                     local skipLoadout = false
                    if eqValue then
                    if loadout.effects then
                        local extraInfo = ""
                        for _, effect in ipairs(loadout.effects) do
                        if loadout.effects then
                            if effect.proto == "EffectSpeciesVox" then
                            for _, effect in ipairs(loadout.effects) do
                                skipLoadout = true
                                if effect["!type"] == "GroupLoadoutEffect" then
                                break
                                    local proto = effect.proto
                            end
                                    if proto then
                        end
                                        for _, candidate in ipairs(gearloadout) do
                    end
                                            if candidate.id == proto then
                    if not skipLoadout then
                                                if candidate.effects then
                        local eqValue = loadout.equipment[searchKey]
                                                    for _, eff in ipairs(candidate.effects) do
                        if eqValue then
                                                        if eff["!type"] == "JobRequirementLoadoutEffect" and eff.requirement then
                            local extraInfo = ""
                                                            local req = eff.requirement
                            if loadout.effects then
                                                            if req["!type"] == "DepartmentTimeRequirement" and req.department and req.time then
                                for _, effect in ipairs(loadout.effects) do
                                                                extraInfo = extraInfo .. "<b>{{ucfirst:{{#invoke:Ftl|main|translation|department-" .. req.department .. "}}}}</b>: " .. req.time .. "<br>"
                                    if effect["!type"] == "GroupLoadoutEffect" then
                                                            elseif req["!type"] == "RoleTimeRequirement" and req.role and req.time then
                                        local proto = effect.proto
                                                                extraInfo = extraInfo .. "<b>{{ucfirst:{{#invoke:Ftl|main|translation|" .. req.role .. "}}}}</b>: " .. req.time .. "<br>"
                                        if proto then
                                            for _, candidate in ipairs(gearloadout) do
                                                if candidate.id == proto then
                                                    if candidate.effects then
                                                        for _, eff in ipairs(candidate.effects) do
                                                            if eff["!type"] == "JobRequirementLoadoutEffect" and eff.requirement then
                                                                local req = eff.requirement
                                                                if req["!type"] == "DepartmentTimeRequirement" and req.department and req.time then
                                                                    extraInfo = extraInfo .. "<b>{{ucfirst:{{#invoke:Ftl|main|translation|department-" .. req.department .. "}}}}</b>: " .. req.time .. "<br>"
                                                                elseif req["!type"] == "RoleTimeRequirement" and req.role and req.time then
                                                                    extraInfo = extraInfo .. "<b>{{ucfirst:{{#invoke:Ftl|main|translation|" .. req.role .. "}}}}</b>: " .. req.time .. "<br>"
                                                                end
                                                             end
                                                             end
                                                         end
                                                         end
                                                     end
                                                     end
                                                    break
                                                 end
                                                 end
                                                break
                                             end
                                             end
                                         end
                                         end
Строка 83: Строка 94:
                                 end
                                 end
                             end
                             end
                            local infoOutput = ""
                            if extraInfo ~= "" then
                                infoOutput = '<div class="роль-лодаут__time">{{AltTooltip|[[Файл:Small_watch.png|link=]]|' .. extraInfo .. '}}</div>'
                            end
                            table.insert(results, infoOutput .. '{{#invoke:Prototypes/Предмет/Содержание|image|' .. eqValue .. '}} [[File:Slot.png|64px|link=]]')
                         end
                         end
                        local infoOutput = ""
                        if extraInfo ~= "" then
                            infoOutput = '<div class="роль-лодаут__time">{{AltTooltip|[[Файл:Small_watch.png|link=]]|' .. extraInfo .. '}}</div>'
                        end
                        table.insert(results, infoOutput .. '{{#invoke:Prototypes/Предмет/Содержание|image|' .. eqValue .. '}} [[File:Slot.png|64px|link=]]')
                     end
                     end
                 end
                 end