Fix bug with group stereotype

This commit is contained in:
Jean-Patrick Guerrero 2022-06-23 18:23:03 +02:00
parent 3dfcd95c6f
commit c421c49916
2 changed files with 6 additions and 3 deletions

View File

@ -25,9 +25,12 @@ end
local function cache_groups(group, groups) local function cache_groups(group, groups)
i3.groups[group] = {} i3.groups[group] = {}
i3.groups[group].groups = groups i3.groups[group].groups = groups
i3.groups[group].stereotype = get_group_stereotype(groups[1])
i3.groups[group].items = groups_to_items(groups) i3.groups[group].items = groups_to_items(groups)
if #groups == 1 then
i3.groups[group].stereotype = get_group_stereotype(groups[1])
end
local items = i3.groups[group].items local items = i3.groups[group].items
if #items <= 1 then return end if #items <= 1 then return end

View File

@ -18,7 +18,7 @@ IMPORT("S", "ES", "translate", "ItemStack", "toupper")
IMPORT("get_sorting_idx", "compression_active", "compressible") IMPORT("get_sorting_idx", "compression_active", "compressible")
IMPORT("get_bag_description", "get_detached_inv", "get_recipes") IMPORT("get_bag_description", "get_detached_inv", "get_recipes")
IMPORT("maxn", "sort", "concat", "copy", "insert", "remove", "unpack") IMPORT("maxn", "sort", "concat", "copy", "insert", "remove", "unpack")
IMPORT("get_group_stereotype", "extract_groups", "groups_to_items", "is_group", "item_has_groups", "get_group") IMPORT("extract_groups", "groups_to_items", "is_group", "item_has_groups", "get_group")
local function fmt(elem, ...) local function fmt(elem, ...)
if not fs_elements[elem] then if not fs_elements[elem] then
@ -998,7 +998,7 @@ local function get_grid_fs(fs, data, rcp, is_recipe)
if is_group(name) then if is_group(name) then
groups = group_cache and group_cache.groups or extract_groups(name) groups = group_cache and group_cache.groups or extract_groups(name)
name = group_cache and (group_cache.stereotype or group_cache.items[1]) or name = group_cache and (group_cache.stereotype or group_cache.items[1]) or
get_group_stereotype(groups[1]) or groups_to_items(groups)[1] groups_to_items(groups)[1]
end end
local label = groups and "\nG" or "" local label = groups and "\nG" or ""