Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions code/game/objects/items/weapons/storage/bags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@
/obj/item/reagent_containers/food/snacks/egg,
/obj/item/reagent_containers/food/snacks/meat)

// Override grouping key to group grown items by plantname instead of just type
/obj/item/storage/bag/produce/get_item_grouping_key(obj/item/I)
if(istype(I, /obj/item/reagent_containers/food/snacks/grown))
var/obj/item/reagent_containers/food/snacks/grown/G = I
if(G.plantname)
return "[I.type]|[G.plantname]" // Use combination of type and plantname
return I.type


// -----------------------------
// Sheet Snatcher
Expand Down
7 changes: 6 additions & 1 deletion code/game/objects/items/weapons/storage/storage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@
if (itemCount)
item.maptext = "<font color='white'>[itemCount]</font>"

// Helper proc to get grouping key for items in display_contents_with_number mode
// Can be overridden by subtypes to customize grouping behavior
/obj/item/storage/proc/get_item_grouping_key(obj/item/I)
return I.type

/obj/item/storage/proc/generateHUD(datum/hud/data)
RETURN_TYPE(/atom/movable/hud_element)
var/atom/movable/hud_element/main = new("storage")
Expand Down Expand Up @@ -165,7 +170,7 @@
filtered_contents_last = new //last of x item type in storage
filtered_contents_count = new //total number of x item type in storage
for(var/obj/item/I in contents) //count items and remember last item for each type
var/item_type = I.type
var/item_type = get_item_grouping_key(I)
if (filtered_contents_count[item_type])
filtered_contents_count[item_type]++
else
Expand Down
Loading