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

Нет описания правки
Метка: ручная отмена
Нет описания правки
Строка 148: Строка 148:
     if not item then return '' end
     if not item then return '' end


     local result = ""
     local result = {}


     -- Обработка StorageFill
     -- Обработка 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 + 1] = getContentsOutput(item.StorageFill.contents)
 
     -- Обработка EntityTableContainerFill
     -- Обработка EntityTableContainerFill
     elseif item.EntityTableContainerFill and item.EntityTableContainerFill.containers then
     elseif item.EntityTableContainerFill and item.EntityTableContainerFill.containers then
Строка 159: Строка 160:
         -- Обработка entity_storage
         -- Обработка entity_storage
         if containers.entity_storage then
         if containers.entity_storage then
            -- Если есть просто элементы с id, то форматируем их как обычные предметы
             if containers.entity_storage.children then
             if containers.entity_storage.children then
                 result = result .. processNestedSelectors(containers.entity_storage.children, visited)
                 for _, child in ipairs(containers.entity_storage.children) do
                    if child.id then
                        result[#result + 1] = formatContent(child) -- Теперь одиночные id не игнорируются
                    elseif child["!type"] == "GroupSelector" then
                        result[#result + 1] = handleGroupSelector(child, visited)
                    elseif child["!type"] == "AllSelector" then
                        result[#result + 1] = processNestedSelectors(child.children, visited)
                    end
                end
             end
             end
            -- Если есть таблица, то загружаем её
             if containers.entity_storage.tableId then
             if containers.entity_storage.tableId then
                 result = result .. getTableOutput(containers.entity_storage.tableId, visited)
                 result[#result + 1] = getTableOutput(containers.entity_storage.tableId, visited)
             end
             end
         end
         end


         -- Обработка storagebase
         -- Обработка storagebase (аналогично entity_storage)
         if containers.storagebase and containers.storagebase.tableId then
         if containers.storagebase then
            result = result .. getTableOutput(containers.storagebase.tableId, visited)
            if containers.storagebase.children then
                for _, child in ipairs(containers.storagebase.children) do
                    if child.id then
                        result[#result + 1] = formatContent(child)
                    elseif child["!type"] == "GroupSelector" then
                        result[#result + 1] = handleGroupSelector(child, visited)
                    elseif child["!type"] == "AllSelector" then
                        result[#result + 1] = processNestedSelectors(child.children, visited)
                    end
                end
            end
 
            if containers.storagebase.tableId then
                result[#result + 1] = getTableOutput(containers.storagebase.tableId, visited)
            end
         end
         end
     end
     end


     return result
     return table.concat(result)
end
end