Throwing the bellow code into a data.lua file should reproduce it:
Code: Select all
data:extend{{
type = "item-group",
name = "test-group",
icon = "__core__/graphics/clear.png",
order = "zzz",
}}
local group_number = 4 -- if there's just one group everything seems to be fine
local signal_number = 20
-- make sure the signals can be divided into the subgroups
while signal_number % group_number ~= 0 or signal_number <= 0 do signal_number = signal_number - 1; end
-- for naming the items
local global_index = 1
-- subgroup loop
for group_i = 1, group_number do
local subgroup = "test-subgroup-" .. group_i
data:extend{{
type = "item-subgroup",
name = subgroup,
group = "test-group",
order = "a[" .. group_i .. "]",
}}
-- signal loop
for signal_i = 1, signal_number / group_number do
data:extend{{
type = "virtual-signal", -- type = "item", is fine
name = "test-virtual-signal-" .. global_index,
localised_name = "Item " .. global_index .. " in " .. group_i,
icon = "__base__/graphics/icons/signal/signal_" .. (group_i % 10) .. ".png",
subgroup = subgroup,
stack_size = 100,
flags = {},
order = "aaa-" .. signal_i, -- if order is varying per item, some signals are not displayed at all (but sometimes they will reappear after re-opening the dialog)
}}
global_index = global_index + 1
end
end