Модуль:Песочница/Pok: различия между версиями
Pok (обсуждение | вклад) Нет описания правки Метка: ручная отмена |
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[#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 | 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[#result + 1] = getTableOutput(containers.entity_storage.tableId, visited) | ||
end | end | ||
end | end | ||
-- Обработка storagebase | -- Обработка storagebase (аналогично entity_storage) | ||
if containers.storagebase | if containers.storagebase then | ||
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 | ||