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

мНет описания правки
Нет описания правки
Строка 155: Строка 155:
     local foundComponents, foundPrototypes = {}, {}
     local foundComponents, foundPrototypes = {}, {}
     local compList = componentDefs[id]
     local compList = componentDefs[id]
     if type(compList) == "table" then for _, v in ipairs(compList) do if type(v) == "string" then foundComponents[v] = true end end end
     if type(compList) == "table" then
     local protoList = prototypeDefs[id]
        for _, v in ipairs(compList) do
     if type(protoList) == "table" then for _, v in ipairs(protoList) do if type(v) == "string" then foundPrototypes[v] = true end end end
            if type(v) == "string" then
                foundComponents[v] = true
            end
        end
    end
 
     local protoEntry = prototypeDefs[id]
     if type(protoEntry) == "table" then
        for protoName, _ in pairs(protoEntry) do
            if type(protoName) == "string" then
                foundPrototypes[protoName] = true
            end
        end
    end
     for name in string.gmatch(id, "[^,]+") do
     for name in string.gmatch(id, "[^,]+") do
         local n = trim(name)
         local n = trim(name)
         if n ~= "" then
         if n ~= "" then
             if componentDefs[n] ~= nil then foundComponents[n] = true end
             if componentDefs[n] ~= nil then foundComponents[n] = true end
            if prototypeDefs[n] ~= nil then foundPrototypes[n] = true end
             if componentDefs[n] == nil and prototypeDefs[n] == nil then foundComponents[n] = true end
             if componentDefs[n] == nil and prototypeDefs[n] == nil then foundComponents[n] = true end
         end
         end