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

мНет описания правки
мНет описания правки
Строка 87: Строка 87:
         local roleLoadoutData = findById(gearRoleLoadout, roleLoadoutId)
         local roleLoadoutData = findById(gearRoleLoadout, roleLoadoutId)
         if roleLoadoutData then
         if roleLoadoutData then
            local groups = roleLoadoutData.groups
             for _, groupId in ipairs(roleLoadoutData.groups or {}) do
            if type(groups) ~= "table" then
                groups = { groups }
            end
             for _, groupId in ipairs(groups) do
                 if groupId ~= "Trinkets" then  -- исключаем Trinkets
                 if groupId ~= "Trinkets" then  -- исключаем Trinkets
                     local groupFound = nil
                     local groupFound = nil
Строка 101: Строка 97:
                     end
                     end
                     if groupFound then
                     if groupFound then
                         for _, loadoutID in ipairs(groupFound.loadouts or {}) do
                         if type(groupFound.loadouts) == "table" then
                            for _, loadout in ipairs(gearloadout) do
                            for _, loadoutID in ipairs(groupFound.loadouts) do
                                if loadout.id == loadoutID then
                                for _, loadout in ipairs(gearloadout) do
                                    if loadout.equipment and loadout.equipment[slot] then
                                    if loadout.id == loadoutID then
                                        itemId = loadout.equipment[slot]
                                        if loadout.equipment and loadout.equipment[slot] then
                                        sourceGear = loadout
                                            itemId = loadout.equipment[slot]
                                         break
                                            sourceGear = loadout
                                            break
                                         end
                                     end
                                     end
                                 end
                                 end
                                if itemId ~= "" then break end
                             end
                             end
                            if itemId ~= "" then break end
                         end
                         end
                     end
                     end