Модуль:Prototypes/Хранилище/Предмет: различия между версиями

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


-- Обработка вложенных селекторов
-- Обработка вложенных таблиц
processNestedSelectors = function(children)
processNestedSelectors = function(children)
     local result = ''
     local result = ''
   
     for _, child in ipairs(children) do
     for _, child in ipairs(children) do
         if child.id then
         if child.id then
            -- Если есть id, то просто форматируем его как обычно
             result = result .. formatContent(child)
             result = result .. formatContent(child)
         elseif child["!type"] == "NestedSelector" and child.tableId then
         elseif child["!type"] == "NestedSelector" and child.tableId then
            -- Если тип NestedSelector с tableId, то обрабатываем таблицу
             result = result .. getTableOutput(child.tableId)
             result = result .. getTableOutput(child.tableId)
        elseif child["!type"] == "GroupSelector" then
            -- Если тип GroupSelector, выводим все id из него вместе
            local groupResult = '<div class="test">'
            for _, groupChild in ipairs(child.children) do
                if groupChild.id then
                    groupResult = groupResult .. formatContent(groupChild)
                end
            end
            groupResult = groupResult .. '</div>'
            result = result .. groupResult
         end
         end
     end
     end
     return result
     return result
end
end
Строка 94: Строка 80:


     local result = ''
     local result = ''
    -- Обработка StorageFill внутри контейнеров
     if item.StorageFill and item.StorageFill.contents then
     if item.StorageFill and item.StorageFill.contents then
         result = result .. getContentsOutput(item.StorageFill.contents)
         result = result .. getContentsOutput(item.StorageFill.contents)
Строка 106: Строка 93:
         else
         else
             result = result .. 'Таблица не найдена.'
             result = result .. 'Таблица не найдена.'
        end
        -- Обработка GroupSelector внутри контейнеров
        if containers.entity_storage then
            for _, child in ipairs(containers.entity_storage.children) do
                if child["!type"] == "GroupSelector" then
                    result = result .. '<div class="test">'
                    result = result .. getContentsOutput(child.children)
                    result = result .. '</div>'
                end
            end
         end
         end
     end
     end