Core Help Root: Objects: Collective


A collective is an object representing a pile of other objects. In many ways it acts just like a real pile. You can put things into a pile and take objects out of a pile as if it were a container. If you look at a pile you will see the contents. A pile must contain at least two objects; if objects are removed from a pile leaving only zero or one objects inside, the pile disappears leaving behind the last object (if any). If a pile is put into another pile, the contents of both piles are combined into a single bigger pile.

Any located object (descendant of $located) can be put into a pile, except for characters (descendants of $user). The collective tries to name itself to match the contents by checking for a method .classification in the contents. The collective looks for a .classification method on each object in its contents. The .classification method is expected to return a list of strings specifying classifications of the object, from most specific to most general.

Thus, an object may have a hierarchy of classifications, e.g. "a broadsword" might be classed as "broadsword", "sword", and "weapon". The collective tries to find the most specific classification that fits all of the contents. Any object which does not have a .classification method is assumed to be a "thing". Thus, by default a collective containing an assortment of objects is named "a pile of things". A pile containing "a shortsword" and "a broadsword" might be named "a pile of swords", and a pile containing "a shortsword" and "a sharp dagger" might be named "a pile of weapons", assuming that all of the objects have a hierarchy of classifications defined on them.

Every time an object is added to or removed from a pile, it checks the contents to rename itself. Note that the collective assumes that the names returned by .classification are in singular form, and converts the chosen classification into plural form when renaming itself. If $group_lib is installed, the collective will add a quantifying adjective to its name dependant on the number of objects contained inside, e.g. "a small pile..." or "a huge pile...".

Collectives are owned by a standard owner character, to handle the quota. Collectives can be readily created or destroyed at need with the pile and scatter commands.


Colors | Trie | List Library | has_text | mutex | Heap | Weather System | Math Library | Integer | Data Lib | Object Lib | Help Node | Code Lib | Generic Map | Scrabble | World Time | Time | Robot | Native Function Reference | Complex Number Library | Bytecode Docs | motd | Mail List | Float | Collective | libraries | social_ui


the Cold Dark