From c421c49916a2b5d780561e6cdb0f42e1d6f71ae8 Mon Sep 17 00:00:00 2001 From: Jean-Patrick Guerrero Date: Thu, 23 Jun 2022 18:23:03 +0200 Subject: [PATCH] Fix bug with group stereotype --- src/caches.lua | 5 ++++- src/gui.lua | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/caches.lua b/src/caches.lua index 7ebbea0..2961d8d 100644 --- a/src/caches.lua +++ b/src/caches.lua @@ -25,9 +25,12 @@ end local function cache_groups(group, groups) i3.groups[group] = {} i3.groups[group].groups = groups - i3.groups[group].stereotype = get_group_stereotype(groups[1]) 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 if #items <= 1 then return end diff --git a/src/gui.lua b/src/gui.lua index dbdbd1a..f755833 100644 --- a/src/gui.lua +++ b/src/gui.lua @@ -18,7 +18,7 @@ IMPORT("S", "ES", "translate", "ItemStack", "toupper") IMPORT("get_sorting_idx", "compression_active", "compressible") IMPORT("get_bag_description", "get_detached_inv", "get_recipes") 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, ...) 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 groups = group_cache and group_cache.groups or extract_groups(name) 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 local label = groups and "\nG" or ""