-- From "Fooluaintblack" on the TechnicalFactorio discord: -- > Caught up with a friend and we adjusted Halke's index script to create a series -- > of CCs with items, in item ID order, with their stack size as their signal -- > values. The script changes include: -- > -reorganised, whitespace, removed "count" as its redundant with "index" -- > -overwrite the selected CC instead of creating a new one beside it -- > -spot at the top to add signal names to exclude. You'll see magic lamp, -- > pushbutton, and textplates are excluded. Textplate string includes wildcards -- > to capture all signals that start with "textplate" -- -- /c local map={} local excludedItems = {"magic%-lamp", "pushbutton", "textplate%-.+"} function createStackSizeCcs() cc = game.player.selected index = 0 for _, item in pairs(game.item_prototypes) do if isIncluded(item) then if index > 0 and index % 20 == 0 then cc = createCc(cc) end addSignal(cc, index % 20 + 1, item) index = index + 1 end end end function addSignal(combinator, index, item) combinator.get_control_behavior().set_signal(index, { signal = { type = "item", name = item.name }, count = item.stack_size }) end function createCc(prev) return game.player.surface.create_entity({ name = "constant-combinator", force = game.forces.player, position = { x = prev.position.x + 1, y = prev.position.y } }) end function isIncluded(item) if item.has_flag("hidden") then return false end for _, pattern in ipairs(excludedItems) do if string.find(item.name, pattern) then return false end end return true end createStackSizeCcs()