I am playing around with Yuoki's mods, Mobile Factory Erya, and some of 5Dims mods. They add some assemblers and chem plants. This function will add Tiberium science to all applicable prototypes:
local function addScienceIfNeeded(prototype)
local basics_chem = {
chemistry = true
}
local basics_asm = {
crafting = true,
["basic-crafting"] = true,
["advanced-crafting"] = true,
}
local categories = prototype.crafting_categories or {}
for k, v in pairs(categories) do
if v == "basic-tiberium-science" or v == "tiberium-science" then return end
if basics_chem[v] then basics_chem[v] = nil end
if basics_asm[v] then basics_asm[v] = nil end
end
if table_size(basics_chem) == 0 then
table.insert(categories, "basic-tiberium-science")
table.insert(categories, "tiberium-science")
elseif table_size(basics_asm) == 0 then
table.insert(categories, "basic-tiberium-science")
end
end
I added it in data-updates, and call it below the existing two add functions (starting with for _, assembler in pairs(TibBasicScience) do).
Another suggestion: the science table is set up with names as values. LSLib probably protects against adding a crafting category twice by accident, but if the TibScience tables were instead ["prototype-name"] = true, then one could use any logic to add the machines, without having to be concerned with it being present multiple times in the table (as may happen with table.insert()).
The above function could be tweaked of course, to add prototype names to the TibScience tables, instead of modifying the prototype itself