Echo Hollow

Gender-Bending Interactive Stories! :D

User Tools

Site Tools


libecho:classes:apparel

This is an old revision of the document!


Table of Contents

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.

The Apparel system also provides the Wardrobe and WornApparel classes, which are 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 enforces the rule of only one article of apparel per ClothingSlot (see below).

In general, you may use a Wardrobe interchangeably with a GeneralInventory when using 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.

Clothing Slots

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.

Certain ClothingSlots can cover other ClothingSlots, concealing them. This allows a Person to, for example, hide some racy underpants under their normal clothes, or a whole racy outfit under a long coat. The details of what covers what and how are below.

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.

LibEcho.Apparel.ClothingSlot

ClothingSlot is an enumeration that describes what “slots” an article of Apparel occupies on a Person when worn. Only one article of Apparel may occupy a particular ClothingSlot.

ClothingSlot.UNDERPANTS

Boxers, briefs, panties, etc.

  • Covers: Nothing.
  • Covered By: LEGS, TORSO (if long), OVER (if long).

ClothingSlot.UNDERSHIRT

Bras and such; T-shirts should use TORSO.

  • Covers: Nothing.
  • Covered By: TORSO (if not low - FIXME), OVER (if not low - FIXME).
  • (Under which is - FIXME): TORSO (if low), OVER (if low).

ClothingSlot.UNDERLEGS

Socks and hosiery.

  • Covers: Nothing.
  • Covered By: LEGS+FEET (if LEGS are long and FEET are high), OVER+FEET (if OVER is long and FEET are high).

ClothingSlot.TORSO

Shirts and tops.

  • Covers: UNDERSHIRT, UNDERPANTS (if long), NECK (if high).
  • Covered By: OVER.

ClothingSlot.LEGS

Pants, skirts, and bottoms; Socks and hosiery should use UNDERLEGS

  • Covers: UNDERPANTS, UNDERLEGS (if long and FEET slot contains something high).
  • Covered By: OVER (if long).

ClothingSlot.FEET

Shoes. Socks and hosiery should use UNDERLEGS.

  • Covers: UNDERLEGS (if high and LEGS slot contains something long).
  • Covered By: OVER (if long).

ClothingSlot.OVER

Coats and shawls.

  • Covers: TORSO, UNDERSHIRT, LEGS (if long), UNDERPANTS (if long), UNDERLEGS (if long and FEET slot contains something high), NECK (if high).
  • Covered By: Nothing.

ClothingSlot.GLOVES

Gloves.

  • Covers: FINGER, WRIST (if long).
  • Covered By: Nothing.

ClothingSlot.HEAD

Hats and helmets.

  • Covers: Ears (if long).
  • Covered By: Nothing.

ClothingSlot.EARS

Earrings. Something like earmuffs probably should use HEAD.

  • Covers: Nothing.
  • Covered By: HEAD (if long).

ClothingSlot.NECK

Necklaces and ties.

  • Covers: Nothing.
  • Covered By: TORSO (if high), OVER (if high).

ClothingSlot.WRIST

Bracelets, watches.

  • Covers: Nothing.
  • Covered By: GLOVES (if long).

ClothingSlot.FINGER

Rings.

  • Covers: Nothing.
  • Covered By: GLOVES.

ClothingSlot.???

  • FIXME Other piercing slots?
  • FIXME Should there be slots for sex toys?

Apparel

Apparel.GenericApparel provides the barebones base class from which all other Apparel types are derived. GenericApparel is generally unisex. GenericMenswear and GenericWomenswear derive from GenericApparel and provide barebones base classes for masculine and feminine apparel (currently mostly unimplemented).

Several specific apparel types are also provided, deriving from GenericApparel, GenericMenswear, and GenericWomenswear, which offer defaults for ClothingSlots, genericName, and other properties in some cases. These are the classes that you generally want to use in your defaults JS when you define objects.

Properties

Articles of Apparel may have various properties. Some specific apparel types implement some properties, as listed later on. All properties may be set in your defaults JS when you define objects. Even those provided by the specific apparel types may be overridden.

.genericName

The generic name of an object, printed when it is obvious what the item is but no details can be seen. The most obvious example would be a bra printing through a tight tshirt being referred to as just a “bra” (its genericName) rather than a “lacy purple bra”.

The specific Apparel types all implement this property, but you may override it in defaults.

  • Type: String
  • Required

.name

The specific name of the apparel, printed when the apparel can be plainly seen. “A green peacoat” or “a long floral print skirt,” for example.

  • Type: String
  • Required

.slots

An array of the ClothingSlots that the object occupies. Only one article of apparel my occupy a particular ClothingSlot at a time (see above). Setting this to an empty array will allow the article of apparel to be worn without occupying any ClothingSlots.

  • Type: Array of ClothingSlot enumerations
  • Required

.inventoryCategory

The category into which InventoryUI sorts the object. If this property is omitted, it will be sorted into the “Other” category.

  • Type: String
  • Optional

.wardrobeCategory

The category into which ApparelUI sorts the object. If this property is omitted, it will be sorted into the “Other” category.

  • Type: String
  • Optional

.long

If this property is true, the article of apparel will be considered “long” and possibly conceal more underlayers. Knee length long skirts and pants. Trenchcoats. Etc. See the section on ClothingSlots for more details.

  • Type: Boolean
  • Optional

.short

If this property is true, the article of apparel will be considered “short” and possibly conceal fewer underlayers.. Crop tops. Booty shorts. Minidresses. Etc. See the section on ClothingSlots for more details.

  • Type: Boolean
  • Optional
  • FIXME Currently unimplemented

.high

If this property is true, the article of apparel will be considered “high” and possibly conceal more underlayers.. Turtleneck shirts. High-top shoes and boots. Etc. See the section on ClothingSlots for more details.

  • Type: Boolean
  • Optional

.low

If this property is true, the article of apparel will be considered “low” and possibly conceal fewer underlayers.. Off-shoulder and swoop tops. Low-rise jeans. Etc. See the section on ClothingSlots for more details.

  • Type: Boolean
  • Optional
  • FIXME Currently unimplemented

.transparent

If this property is true, the article of apparel will reveal whatever is worn beneath it regardless of what ClothingSlots is occupies. A fishnet top or translucent wraparound, for example.

  • Type: Boolean
  • Optional

.thin

The “thin” property, when set to true, is used to denote tight-fitting articles of apparel made with thin fabric. A tight-fitting t-shirt, for example. The articles of apparel worn below will “show an outline” through this article of apparel, and will be listed with their genericName in worn apparel descriptions, without showing the specific details of the item. For example, wearing a “pink polka-dot bra” beneath a “tight red t-shirt” will list in descriptions as “a tight red t-shirt and a bra (printing through the tight red t-shirt),” rather than specifically as a “pink polka-dot bra”.

  • Type: Boolean
  • Optional

Generic Apparel Types

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).

Unless you are actually extending the library, you probably don't need to use any of these GenericApparel classes. If you are just using the library in your game, you're probably better off using the specific Apparel classes.

However, if you need to create an article of Apparel that does not easily fit into any of the specific types, one of the generic types may be useful to you.

LibEcho.Apparel.GenericApparel

  • Inherits from: PersistentObject

This is the generic Apparel type from which all other Apparel is derived. Objects that specify this type in their defaults must also explicitly provide a ClothingSlots field and all genericName properties.

LibEcho.Apparel.GenericMenswear

  • Inherits from: GenericApparel

This is a generic Apparel type that will at some point provide defaults that associate it with masculine People. Depending on the type of Transformations that are enabled, People with too much femininity might not be able to equip this type of Apparel, and/or equipping it may gradually cause the Person to transform towards being more masculine.

At the current time, however, none of this is implemented, as the Transformation mechanics are still being worked on.

As with GenericApparel, objects that specify this type in their defaults must also explicitly provide a ClothingSlots field and all genericName properties.

LibEcho.Apparel.GenericWomenswear

  • Inherits from: GenericApparel

This is a generic Apparel type that will at some point provide defaults that associate it with feminine People. Depending on the type of Transformations that are enabled, People with too much masculinity might not be able to equip this type of Apparel, and/or equipping it may gradually cause the Person to transform towards being more feminine.

At the current time, however, none of this is implemented, as the Transformation mechanics are still being worked on.

As with GenericApparel, objects that specify this type in their defaults must also explicitly provide a ClothingSlots field and all genericName properties.

Specific Apparel Types

Several specific Apparel types are provided, which ought to cover most use-cases, simplifying the structure of the defaults files. Unisex apparel has no specific masculine or feminine bent; it can be worn by anyone. Menswear and Womenswear are gender-specific clothing types and may be restricted accordingly depending on game settings and/or transformation level. Currently, all Jewelry is considered unisex, but this needs to be fixed FIXME.

LibEcho.Apparel.Unisex.Coat

Unisex short coats, jackets, etc. FIXME need to implement LongCoat.

  • Inherits from: GenericApparel
  • ClothingSlots: ClothingSlot.OVER
  • .genericName: “coat”
  • .wardrobeCategory: Other

LibEcho.Apparel.Unisex.Hat

Unisex headgear.

  • Inherits from: GenericApparel
  • ClothingSlots: ClothingSlot.HEAD
  • .genericName: “hat”
  • .wardrobeCategory: Other

LibEcho.Apparel.Unisex.Pants

Unisex long pants.

  • Inherits from: GenericApparel
  • ClothingSlots: ClothingSlot.LEGS
  • .genericName: “pair of pants”
  • .wardrobeCategory: Bottoms
  • .long: true

LibEcho.Apparel.Unisex.Shirt

Unisex shirt.

  • Inherits from: GenericApparel
  • ClothingSlots: ClothingSlot.TORSO
  • .genericName: “shirt”
  • .wardrobeCategory: Tops

LibEcho.Apparel.Unisex.Shoes

Unisex low-top shoes.

  • Inherits from: GenericApparel
  • ClothingSlots: ClothingSlot.FEET
  • .genericName: “pair of shoes”
  • .wardrobeCategory: Shoes

LibEcho.Apparel.Unisex.ShoesTall

Unisex high-top shoes and boots.

  • Inherits from: Shoes
  • .high: true

LibEcho.Apparel.Unisex.Shorts

Unisex shorts.

  • Inherits from: Pants
  • .genericName: “pair of shorts”
  • .long: false

LibEcho.Apparel.Unisex.Socks

Unisex socks.

  • Inherits from: GenericApparel
  • ClothingSlots: ClothingSlot.UNDERLEGS
  • .genericName: “pair of socks”
  • .wardrobeCategory: Underwear

LibEcho.Apparel.Menswear.Boxers

Men's boxers.

  • Inherits from: GenericMenswear
  • ClothingSlots: ClothingSlot.UNDERPANTS
  • .genericName: “pair of boxers”
  • .wardrobeCategory: Underwear

LibEcho.Apparel.Menswear.Briefs

Men's briefs.

  • Inherits from: GenericMenswear
  • ClothingSlots: ClothingSlot.UNDERPANTS
  • .genericName: “pair of briefs”
  • .wardrobeCategory: Underwear

LibEcho.Apparel.Womenswear.Bra

Women's bra.

  • Inherits from: GenericWomenswear
  • ClothingSlots: ClothingSlot.UNDERSHIRT
  • .genericName: “bra”
  • .wardrobeCategory: Underwear

LibEcho.Apparel.Womenswear.Dress

Women's short or mid-length dress (does not cover all the way down to feet).

  • Inherits from: GenericWomenswear
  • ClothingSlots: ClothingSlot.TORSO, ClothingSlot.LEGS
  • .genericName: “dress”
  • .wardrobeCategory: Dresses

LibEcho.Apparel.Womenswear.DressLong

Women's long dress (goes all the way down to feet).

  • Inherits from: Dress
  • .genericName: “long dress”
  • .long: true

LibEcho.Apparel.Womenswear.Panties

Women's panties.

  • Inherits from: GenericWomenswear
  • ClothingSlots: ClothingSlot.UNDERPANTS
  • .genericName: “pair of panties”
  • .wardrobeCategory: Underwear

LibEcho.Apparel.Womenswear.PantsWomens

Women's long pants and slacks.

  • Inherits from: GenericWomenswear
  • ClothingSlots: ClothingSlot.LEGS
  • .genericName: “pair of pants”
  • .wardrobeCategory: Bottoms
  • .long: true

LibEcho.Apparel.Womenswear.ShirtWomens

Women's shirts and blouses.

  • Inherits from: GenericWomenswear
  • ClothingSlots: ClothingSlot.TORSO
  • .genericName: “shirt”
  • .wardrobeCategory: Tops

LibEcho.Apparel.Womenswear.ShoesWomens

Women's low-top shoes.

  • Inherits from: GenericWomenswear
  • ClothingSlots: ClothingSlot.FEET
  • .genericName: “pair of shoes”
  • .wardrobeCategory: Shoes

LibEcho.Apparel.Womenswear.ShoesWomensTall

Women's high-top shoes and boots.

  • Inherits from: ShoesWomens
  • .high: true

LibEcho.Apparel.Womenswear.ShortsWomens

Women's shorts, capris, stc.

  • Inherits from: PantsWomens
  • .genericName: “pair of shorts”
  • .long: false

LibEcho.Apparel.Womenswear.Skirt

Women's short or mid-length skirt (does not cover all the way down to feet).

  • Inherits from: GenericWomenswear
  • ClothingSlots: ClothingSlot.LEGS
  • .genericName: “skirt”
  • .wardrobeCategory: Bottoms

LibEcho.Apparel.Womenswear.SkirtLong

Women's long skirt (goes all the way down to feet).

  • Inherits from: Skirt
  • .genericName: “long skirt”
  • .long: true

LibEcho.Apparel.Womenswear.Stockings

Women's stockings and hoisery.

  • Inherits from: GenericWomenswear
  • ClothingSlots: ClothingSlot.UNDERLEGS
  • .genericName: “pair of stockings”
  • .wardrobeCategory: Underwear

LibEcho.Apparel.Jewelry.Bracelet

Bracelets.

  • Inherits from: GenericApparel FIXME
  • ClothingSlots: ClothingSlot.WRIST
  • .genericName: “bracelet”
  • .wardrobeCategory: Jewelry

LibEcho.Apparel.Jewelry.Earrings

Earrings.

  • Inherits from: GenericApparel FIXME
  • ClothingSlots: ClothingSlot.EARS
  • .genericName: “pair of earrings”
  • .wardrobeCategory: Jewelry

LibEcho.Apparel.Jewelry.Necklace

Necklaces.

  • Inherits from: GenericApparel FIXME
  • ClothingSlots: ClothingSlot.NECK
  • .genericName: “necklace”
  • .wardrobeCategory: Jewelry

LibEcho.Apparel.Jewelry.Ring

Rings.

  • Inherits from: GenericApparel FIXME
  • ClothingSlots: ClothingSlot.FINGER
  • .genericName: “ring”
  • .wardrobeCategory: Jewelry

Containers

LibEcho.Apparel.Wardrobe

  • Inherits from: GeneralInventory

This class, derived from GeneralInventory, is meant to contain Apparel, although it can contain any PersistentObject}. It overrides sort() so that the contents are sorted in order of ClothingSlot value rather than alphabetically, with any non-Apparel items listed last.

FIXME There is some hacky crap in the sort implementation to ensure that dresses are listed below bottoms. Which is, well, hacky. Perhaps it would be better to first sort by ClothingSlot, and then by wardrobeCategory.

LibEcho.Apparel.WornApparel

  • Inherits from: Wardrobe

This class, derived from Wardrobe, is meant to track worn Apparel. It overrides preAdd() so that only objects of type GenericApparel (or subclasses thereof) may be added to the Inventory. The Wardrobe parent class also overrides sort() so that the contents are sorted in order of ClothingSlot value rather than alphabetically.

static WornApparel.defineCoveredBy( slot, resolverFunction )

This function is used internally to define what slots cover other slots. The only time you'll need to use it is if you are defining new ClothingSlots. FIXME It is currently in the WornApparel constructor, which is stupid. We should be building the function table in the ClothingSlots source file.

  • Type: Function
  • Returns: Nothing

.itemsConflictWith( item )

  • Type: Function
  • item: The article of apparel to check.
  • Returns: a list of worn apparel that occupies the same clothing slots as the given item.

.atSlot( slot )

  • Type: Function
  • slot: the clothing slot to check
  • Returns: The article of Apparel (if any) that occupies the given clothing slot.

.hiddenBy( item )

  • Type: Function
  • item: The article of apparel to check.
  • Returns: an array of Apparel that are concealed beneath the given item.

.hiding( item )

  • Type: Function
  • item: The article of apparel to check.
  • Returns: an array of Apparel that are concealing the given item.

.outlinedBy( item )

  • Type: Function
  • item: The article of apparel to check.
  • Returns: an array of apparel that are outlined by the given item.

.showingOutlineOf( item )

FIXME in source: Should thin items beneath other thin items not show an outline? Ie, the whole point of a thong being to not show an outline? FIXME

  • Type: Function
  • item: The article of apparel to check.
  • Returns: an array of apparel that are showing the outline of the given item.

.getHidden( filterClass=undefined, filterFunction=undefined )

This functions like GeneralInventory.get(), except it returns only the apparel that are concealed beneath other apparel.

  • Type: Function
  • filterClass: an optional filter class.
  • filterFunction: an optional filter function.
  • Returns: A list of concealed items.

.getVisible( filterClass=undefined, filterFunction=undefined )

This functions like GeneralInventory.get(), except it returns only the apparel that are visible.

  • Type: Function
  • filterClass: an optional filter class.
  • filterFunction: an optional filter function.
  • Returns: A list of visible items.

.getOutlined( filterClass=undefined, filterFunction=undefined )

This functions like GeneralInventory.get(), except it returns only the apparel that are outlined through more outer layers that are thin. FIXME Check to make sure this is working properly. ie a bra showing an outline through a tight shirt should still be concealed by a coat worn overtop.

  • Type: Function
  • filterClass: an optional filter class.
  • filterFunction: an optional filter function.
  • Returns: A list of visible items.

.toString( showAll=undefined )

Overridden. FIXME This function currently doesn't to anything beyond the implementation in GeneralInventory. It ought to be checking the viewpoint character and basing its results on that. The viewpoint character, when looking at their own WornApparel, should get a list of everything, even the concealed layers. But when looking at someone else's WornApparel, should only get a list of that which is visible and showing an outline of. It should also take an arg to force one behavior or the other.

  • Type: Function
  • showAll: if true, all contained items are printed. If false, only visible items are printed. If undefined, acts as true if this WornApparel's parent is the $viewpointCharacter, otherwise acts as false.
  • Returns: Returns: a serial-comma-separated-list of the contents' .aName fields.

.theString( showAll=undefined )

Like toString(), but using .theName instead. FIXME This needs to be implemented the same as toString() with regard to showAll.

  • Type: Function
  • showAll: if true, all contained items are printed. If false, only visible items are printed. If undefined, acts as true if this WornApparel's parent is the $viewpointCharacter, otherwise acts as false.
  • Returns: a serial-comma-separated-list of the contents' .theName fields.

The Apparel UI

LibEcho.Apparel.ApparelUI

  • Inherits from: InventoryUI

FIXME todo once the code is refactored.

.func( arg )

  • Type: Function
  • arg: desc
  • Returns: Nothing

desc

.func( arg )

  • Type: Function
  • arg: desc
  • Returns: Nothing

desc

.func( arg )

  • Type: Function
  • arg: desc
  • Returns: Nothing

desc

.func( arg )

  • Type: Function
  • arg: desc
  • Returns: Nothing

desc

libecho/classes/apparel.1653267082.txt.gz · Last modified: 2022/05/22 17:51 by lee