I want to create a list with a main category, and all the objects of that category would fall under that.
E.g.
POTION = list(potion, potion, potion)
COIN = list(coin, coin, coin, coin)
However this WOULD be simple given I could just make a single associative list, but I would really like to have it flexible since there are far too many items to just manually define them.
So if I have 10 potions, I will see potion x 10, and when I select potion, it will remove one of the potions from the potion list.
Here is one of many attempts:
proc
Generate_Usable()
var/list/usable = list()
next_obj
for(var/obj/items/usable/u in m.contents)
for(var/obj/same in usable) //only add one primary branch.
world << "same = [same]"
if(same.type == u.type)
world << "already have [u] as a primary."
continue next_obj
var/list/count = list()
for(var/obj/o in m.contents)
if(u.type == o.type) //found another of the same, add it to the count
count += o
usable += u
world << "usable added another primary branch: [u.name]"
usable[u] = count
for(var/a in usable)
world << "a is [a]"
var/list_contents = usable[a]
for(var/b in usable[a])
world << " contains: [b]"
This appeared to work but it doesn't actually, since I can't take item_list[var] and use it as a list itself, since its a list inside a list... ffs.... idk... It's 5am and I literally spent all night doing this