In response to Deadron
As a lib, I would also suggest adding a remove from inventory function, since many projects would probably use that as well.

I have used an almost identical system in my projects, but have to check similarity a bit more stringently since I also allowed for some runtime modifications of objects. (Don't want the red futzs stacking with the blue!) I also found it handy to do grouping on dropped objects (ie on a turf) as well.
In response to Jmurph
Jmurph wrote:
As a lib, I would also suggest adding a remove from inventory function, since many projects would probably use that as well.

That would be related this part of the posted code:

    proc/SubtractFromStack(amount = 1)
var/count = StackCount()
SetStackCount(count - amount)


I probably have code I didn't post that accesses this...if I get around to a library, all that would be included and/or documented.


I have used an almost identical system in my projects, but have to check similarity a bit more stringently since I also allowed for some runtime modifications of objects. (Don't want the red futzs stacking with the blue!)

Customization of objects is definitely an issue when you are using stacking to reduce item count...games that allow the item creator to personalize the item with their name and/or a message run into this, since the item can no longer stack.

As a general rule, for a game where object limits may come into play, I'd recommend avoiding customization of items or differentiation by color/etc unless it's particularly important to the gameplay.
Page: 1 2