mob/Entered(var/obj/groupable/O)
for(var/obj/groupable/G in src)
if(istype(G.type,O.type))
O.amount += G.amount
del(G)
O.NewAmount(O)
There is the grouping part, and here is the other stuff...
obj
groupable
var/amount = 1
herb
icon = 'flowers.dmi'
icon_state = "herb"
verb/Get()
set src in oview(1)
src.loc = usr
proc/NewAmount(obj/groupable/O)
O.suffix = "x [O.amount]"
I've tried doing object grouping other ways but they've had a problem that made it so if I only picked up an item with an amount var of 1, it didn't count it, it only deleted the obj.
Well, anyways, the problem with this one is that it is not grouping them at all, it is just simply adding the objs to my contents, noting else. What could I do to ix it?
The first argument to istype() is an atom, not a type path. The second argument is a type path.
Also, I have a more versatile method for stacking objects right here, if you want to use it:
Stackable objects just have their maxStackSize set higher than 1. You can remove one item from a stack by just deleting it, which will remove a single item from a stack. A recursive loop would be required to remove all the items in the stack.