ID:1841820
 
(See the best response by Nadrew.)
As title says. What gives?
The contents variable belongs to atoms, you can define it yourself easily enough for your own datums though.
If i define something as "/atom/storage" is it almost effectively the same as "/datum/storage"? What are the key differences between an atom and a datum?

The idea is just that you can attach a storage-container to any object or turf that holds a bunch of storage-procs without having to actually define the storage procs globally, or individually for every object that holds a storage.

Originally, stuff was held in storage like: /obj/item/storage

which had a bunch of procedures for handling storage.

But if something was like:
/obj/structure/

you'd have to redefine all the storage procedures.

instead, i've made datum/storage and attach it to any object that should have a storage.

the storage really only needs to use contents and loc...
Best response
Basically what happens when you work your way down the inheritance tree you inherit more and more variables and procs. Datums themselves are the parent of everything, they have less pre-defined stuff than any other type, but everything inherits those few things.

Datums have the 'type', 'parent_type', 'tag' and 'vars' variables, which everything you define as a datum or a child of it will hold. Plus the procs 'New()', 'Del()', 'Write()', 'Read()', and 'Topic()'

The next step down is the atom, which is the super-type for areas, turfs, objs, and mobs. Atoms are things that are generally going to 'exist' in your game, as some form of physical aspect of a map or inventory, this is where your various interaction variables and procs are defined, mouse actions, density, visibility, etc... plus stuff like contents and groups.

Then you move to /atom/movable, which contains /obj, and /mob, since /turf and /area don't actually do any moving, this is where stuff like Move() is defined.

Next you get into the actual /area, /turf, /obj, and /mob types which have stuff specific to only those things are defined.

The 'parent_type' variable lets you change the parent of any given type so you can for instance have

Storage
parent_type = /atom


And /Storage will have all the stuff associated with /atoms, including the contents variable.

The difference comes in what you need the thing to do, if you only need it as a data container, you use a datum, if you want the benefits that come with interaction you want an atom, if you want something that travels you want a movable, etc...