Echo Hollow

Because Pr0n is the Highest Form of Art.

User Tools

Site Tools


libecho:classes:start

This is an old revision of the document!


LibEcho Class Reference

I was originally doing this automagically with JSDoc, but it made the source code a mess. So here it all is redone by hand in markdown.

I do my best to keep this up-to-date, but the source code is the ultimate reference.

This file is meant to be dry technical documentation of the class implementation for reference purposes. For a more friendly treatise on using the library, please see the Tutorial.

LibEcho.Apparel

Apparel in LibEcho is defined as anything that a Person can wear. This includes clothing, jewelry, and perhaps even naughty toys in some cases.

An article of Apparel may occupy one or more ClothingSlots. This prevents a character from wearing a dozen coats at the same time, for example. A shirt would occupy ClothingSlot.TORSO and a pair of pants would occupy ClothingSlot.LEGS. A dress would occupy both ClothingSlot.TORSO and ClothingSlot.LEGS. The ClothingSlots occupied by an article of clothing are baked into the GenericApparel subclasses, but you may derive your own subclasses to define new types of Apparel, or override the default ClothingSlots in your object defaults JS file.

When a Person wears a particular article of Apparel, any currently worn articles that occupy the same ClothingSlots are removed. This prevents the player from equipping, say, 10 pairs of underpants at the same time.

In general, you probably needn't ever worry about ClothingSlots. If you just define your specific articles of Apparel using the various Apparel subclasses, all of the ClothingSlot magic will be taken care of for you well, magically.

A couple of generic Apparel types are provided. GenericApparel provides a bare-bones Apparel implementation from which which all other Apparel types are derived. GenericMenswear and GenericWomenswear provide implementations which reference the potential wearer's femininity stat to determine whether or not they can be worn, and provide some default adjustments to that stat (currently unimplemented).

Additionally, several specific Apparel types are provided, which ought to cover most use-cases, simplifying the structure of the defaults files.

The Apparel system also provides the Wardrobe and WornApparel classes, which is a special subclasses of GeneralInventory that only deal with Apparel. Wardrobe is a lightly modified GeneralInventory that modifies the sorting implementation to make it more clothing-specific (although it can still contain any PersistentObject, non Apparel objects will all be lumped into the “Other” category). WornApparel is used by the Person classes to track what a Person is wearing, and provides the auto-removal functionality mentioned above.

In general, you may use a Wardrobe interchangeably with a GeneralInventory with the InventoryUI macro. For the wearing and removing of Apparel by a Person, however, a modified version (ApparelUI) is provided. The left-hand inventory provided to ApparelUI should always be a Person (not a WornApparel, but the higher-level Person object that is dressing/undressing). The right-hand inventory should always be a Wardrobe.

FIXME: Document how WornApparel and Wardrobe interact as far as items technically remaining in the Wardrobe while they are worn by a Person.

libecho/classes/start.1653006155.txt.gz · Last modified: 2022/05/19 17:22 by lee