Grouping Snippet

by Spuzzum
This is a snippet on how to create objects that can be grouped in a user's inventory.
ID:223590
 
If you create objs of the type /obj/groupable, then you whenever you pick up those items, they will be grouped into groups of 'max_group' items.

If you don't specify a 'max_group' variable, then there will be an unlimited amount of items that can be grouped together.

Note that when you want to delete a groupable item, subtract 1 from its 'num' var and then call PoolItems(). The format is described to you in the snippet.


This snippet assumes you have a /obj/get() and a /obj/drop() verb, but it doesn't use them. If you don't have those verbs, just add "verb/" (without quotes) in front of each of the verbs inside the code.


Remember, a snippet is focused more on giving a functional method of implementing something. If you don't understand how it works, then you shouldn't be using it yet. =)