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

мНет описания правки
мНет описания правки
Строка 87: Строка 87:
             local children = containers.entity_storage.children
             local children = containers.entity_storage.children
             if children then
             if children then
                local groupSelectors = {}
                 for _, child in ipairs(children) do
                 for _, child in ipairs(children) do
                     if child.tableId then
                     if child["!type"] == "GroupSelector" then
                        local weight = child.weight or "default"
                        groupSelectors[weight] = groupSelectors[weight] or {}
                        table.insert(groupSelectors[weight], child.children)
                    elseif child.tableId then
                         result = result .. getTableOutput(child.tableId)
                         result = result .. getTableOutput(child.tableId)
                     elseif child.id then
                     elseif child.id then
                         result = result .. formatContent(child)
                         result = result .. formatContent(child)
                    elseif child["!type"] == "GroupSelector" then
                        result = result .. '<div class="together">'
                        result = result .. getContentsOutput(child.children)
                        result = result .. '</div>'
                     end
                     end
                end
                for weight, groups in pairs(groupSelectors) do
                    result = result .. string.format('<div class="together" id="%s">', weight)
                    for _, group in ipairs(groups) do
                        result = result .. getContentsOutput(group)
                    end
                    result = result .. '</div>'
                 end
                 end
             end
             end