Storage datums
What is a storage datum?A storage datum is something that can be added to any atom to give it storage functionality, being able to hold things of type Atom level procs, for things like attacking a storage with an item, close to the level of signal usage, are used to make this work. Looking to add storage to an atom?For the simplest case, just call
This creates a very simple storage, with default parameters. More initialized variables to change the storage can found in the storage datum code file. As for how storage interacts with an atom's item interaction procs, such as it's Storage datums will also try updating the atom's icon upon an item being removed from or added to the storage, so if you would like to have the atom's icon change with the number of items stored, all you will have to do is override When should a new storage datum type be created?A new storage datum type should be created when a type is needed that rewrites how adding and removing contents to a linked item works, or a significant change is needed that warrants a new type. Ex. See Lower level things and practices to note
ExamplesOne cool case of storage datums is giving storage to clothing items. An example is below:
This would create give the space suit item three storage slot that can hold small items and that when clicked when worn would allow one to use the storage without taking the item off. | |
/datum/storage | a datum for atoms that allows holdable storage of items in a hud |
---|