<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/css" href="http://wiki.lostsouls.org/w/skins/common/feed.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>Man element - Revision history</title>
		<link>http://wiki.lostsouls.org/w/index.php?title=Man_element&amp;action=history</link>
		<description>Revision history for this page on the wiki</description>
		<language>en</language>
		<generator>MediaWiki 1.8.2</generator>
		<lastBuildDate>Sat, 09 May 2026 06:15:03 GMT</lastBuildDate>
		<item>
			<title>Laine at 20:17, 11 June 2007</title>
			<link>http://wiki.lostsouls.org/w/index.php?title=Man_element&amp;diff=3965&amp;oldid=prev</link>
			<description>&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Files==&lt;br /&gt;
&lt;br /&gt;
 /def/descriptor/element.c&lt;br /&gt;
 /lib/descriptors/element.h&lt;br /&gt;
 /mod/basic/identity.c&lt;br /&gt;
&lt;br /&gt;
==Description==&lt;br /&gt;
&lt;br /&gt;
Element descriptors are used by the core identity mechanics for tracking&lt;br /&gt;
the material makeup of objects and for several ancillary functions related&lt;br /&gt;
to that role.  &amp;quot;Element&amp;quot; is used here in the sense of &amp;quot;an element of a&lt;br /&gt;
thing's composition&amp;quot; rather than that of a chemical element.&lt;br /&gt;
&lt;br /&gt;
The element descriptor macros are defined in /lib/descriptors/element.h,&lt;br /&gt;
but for working with them you will usually want to #include &amp;lt;materials.h&amp;gt;&lt;br /&gt;
or &amp;lt;item.h&amp;gt;; materials.h includes element.h, and you will almost always&lt;br /&gt;
need macros from materials.h as well, while item.h (the general-purpose&lt;br /&gt;
header file for configuring items) in turn includes materials.h.&lt;br /&gt;
&lt;br /&gt;
There are several &amp;quot;types&amp;quot; of element descriptor, though the difference&lt;br /&gt;
between them is a matter of the context and manner of their use, not any&lt;br /&gt;
more fundamental attribute.  These are:&lt;br /&gt;
&lt;br /&gt;
 Finalized Element Descriptor&lt;br /&gt;
    This is a descriptor which is describing the material composition of&lt;br /&gt;
    an object and has had all its values coerced into a valid final form.&lt;br /&gt;
    The contents of query_elements() and find_elements() are finalized&lt;br /&gt;
    element descriptors, as will the return values of add_element() and&lt;br /&gt;
    find_element().  remove_element() requires a finalized element&lt;br /&gt;
    descriptor as its argument.  DO NOT directly modify the contents of&lt;br /&gt;
    &amp;quot;live&amp;quot; finalized element descriptors that are in use in objects; your&lt;br /&gt;
    changes will not be properly acknowledged, and you will cause bizarre,&lt;br /&gt;
    nearly untraceable errors via the system's caching facilities.  Use&lt;br /&gt;
    alter_element() or transmute_element() in the object for carrying out&lt;br /&gt;
    changes to finalized element descriptors.&lt;br /&gt;
&lt;br /&gt;
 Initial Element Descriptor&lt;br /&gt;
    This is an element descriptor which will be used to describe the&lt;br /&gt;
    material composition of an object but which has not yet been finalized;&lt;br /&gt;
    the argument to add_element() is usually one of these.  In an initial&lt;br /&gt;
    element descriptor, you generally specify either the Element_Volume or&lt;br /&gt;
    the Element_Mass and allow the other value to be automatically&lt;br /&gt;
    calculated according to the material type's density.  If you do&lt;br /&gt;
    specify both Element_Volume and Element_Mass, your settings will be&lt;br /&gt;
    honored, possibly resulting in an element whose density is different&lt;br /&gt;
    from the normal value for the material type and which therefore will&lt;br /&gt;
    return other than 1.0 from Material_Compression().&lt;br /&gt;
&lt;br /&gt;
 Element Proportion Descriptor&lt;br /&gt;
    An element descriptor being used to specify a relative proportion of&lt;br /&gt;
    the object's volume which will be made up of a given material.  These&lt;br /&gt;
    descriptors are normally only used during initial object configuration.&lt;br /&gt;
    The proportion to be used defaults to 1.0, and if necessary should be&lt;br /&gt;
    specified using the pseudo-field Element_Proportion, which is an alias&lt;br /&gt;
    for Element_Volume.  The proportion is a relative amount rather than an&lt;br /&gt;
    absolute volume; for example, if an object has two proportion settings,&lt;br /&gt;
    one of 1.0 and one of 0.5, that means that out of whatever volume is&lt;br /&gt;
    calculated for the object's shape, 2/3 of it will be made up of the&lt;br /&gt;
    first material and 1/3 will be made up of the second.  Any setting for&lt;br /&gt;
    Element_Mass in a proportion descriptor will be ignored, but other&lt;br /&gt;
    field settings will be carried onward to the finalized element&lt;br /&gt;
    descriptor.  Proportion descriptors always specify Element_Type,&lt;br /&gt;
    sometimes give Element_Color, Element_Part, and Element_Proportion,&lt;br /&gt;
    and rarely specify the other fields.&lt;br /&gt;
&lt;br /&gt;
 Element Search Descriptor&lt;br /&gt;
    An element descriptor being used for looking up an element in an object&lt;br /&gt;
    through the functions find_element() and find_elements().  Normally,&lt;br /&gt;
    any values given in this descriptor mean that you only want to find&lt;br /&gt;
    elements that exactly match the value you provide; however, some fields&lt;br /&gt;
    allow special values to be given for element search descriptors, with&lt;br /&gt;
    specific meanings for these alternate forms.  This described under each&lt;br /&gt;
    individual field.&lt;br /&gt;
 &lt;br /&gt;
For any function argument that is normally interpreted as an array search descriptor, as a special case you may specify a closure rather than a descriptor specification.  In this event, any descript for which your closure evaluates true will be considered a match.&lt;br /&gt;
&lt;br /&gt;
===Public Fields===&lt;br /&gt;
&lt;br /&gt;
Element_Type: The material of the element, generally specified as a&lt;br /&gt;
material macro such as Material_Gold or Material_Oak, though any of the&lt;br /&gt;
other valid ways of specifying a material may also be used.  A finalized&lt;br /&gt;
element descriptor will have an integer material code for its type field.&lt;br /&gt;
If, for some reason, an initial element descriptor does not have this&lt;br /&gt;
field, it will be set to Material_Iron as the descriptor is finalized,&lt;br /&gt;
and a warning will be issued.  In an element search descriptor, may be&lt;br /&gt;
given as an array, meaning an element will match if its type is any of&lt;br /&gt;
those listed.&lt;br /&gt;
&lt;br /&gt;
Element_Volume: The volume of the element, in balaths (liters).  A&lt;br /&gt;
finalized element descriptor will have a floating-point value for this&lt;br /&gt;
field.  As an initial element descriptor is being finalized, if&lt;br /&gt;
Element_Volume is specified and Element_Mass is not, the appropriate&lt;br /&gt;
mass will be calculated from the volume and the Element_Type's density.&lt;br /&gt;
The pseudo-field Element_Proportion, used with element proportion&lt;br /&gt;
descriptors, is an alias for this field.  &lt;br /&gt;
&lt;br /&gt;
Element_Mass: The mass of the element, in dekans (kilograms).  A finalized&lt;br /&gt;
element descriptor will have a floating-point value for this field.  As an&lt;br /&gt;
initial element descriptor is being finalized, if Element_Mass is specified&lt;br /&gt;
and Element_Volume is not, the appropriate volume will be calculated from&lt;br /&gt;
the mass and the Element_Type's density.&lt;br /&gt;
&lt;br /&gt;
Element_Color: The color of the element's material.  In a finalized element&lt;br /&gt;
descriptor, this will be a string, defaulting to the Element_Type's default&lt;br /&gt;
color.  In an element search descriptor, may be given as an array, meaning&lt;br /&gt;
an element will match if its color is any of those listed.  In an initial&lt;br /&gt;
element descriptor, this may be given as Null (-1), which will be converted&lt;br /&gt;
to a color selected randomly from those normally found in the Element_Type&lt;br /&gt;
material.&lt;br /&gt;
&lt;br /&gt;
Element_Part: The abstract 'part' of the object that the element makes up.&lt;br /&gt;
Normally specified as one of the part macros from /lib/materials.h, such&lt;br /&gt;
as Part_Bulk or Part_Coat, though any valid way of specifying one of these&lt;br /&gt;
parts may be used.  In a finalized element descriptor, this field will be&lt;br /&gt;
an integer part code, defaulting to Part_Bulk.  In an element search&lt;br /&gt;
descriptor, may be specified as an array, meaning an element will match if&lt;br /&gt;
its part is any of those listed.&lt;br /&gt;
&lt;br /&gt;
Element_Form: The form into which the element's material is structured.&lt;br /&gt;
Normally specified as one of the form macros from /lib/materials.h, such as&lt;br /&gt;
as Form_Solid or Form_Cloth, though any valid way of specifying ones of&lt;br /&gt;
these forms may be used.  In a finalized element descriptor, this field&lt;br /&gt;
will be an integer form code, defaulting to Form_Solid.  In an element&lt;br /&gt;
search descriptor, may be specified as an array, meaning an element will&lt;br /&gt;
match if its form is any of those listed.&lt;br /&gt;
&lt;br /&gt;
Element_Component: For objects with components, the component index or&lt;br /&gt;
indices which the element is associated with.  Currently this is only&lt;br /&gt;
meaningful for livings, in which component indices are limb indices.&lt;br /&gt;
Defaults to -1, meaning that the element is associated with all components&lt;br /&gt;
of the object.  May otherwise be an integer component index or an array of&lt;br /&gt;
integer component indices.  In an element search descriptor, the value of&lt;br /&gt;
({ -1 }) may be specified, meaning that the component field of an element&lt;br /&gt;
must be -1 in order to match; otherwise, a (default) value of -1 means that&lt;br /&gt;
any component value matches, and values other than -1 must match exactly.&lt;br /&gt;
&lt;br /&gt;
Element_Flags: Special flags for the element.  Flags are bitmasks which may&lt;br /&gt;
be combined by bitwise or (|).  In an element search descriptor, an array&lt;br /&gt;
with one element may be given, for example ({ Element_Flag_Independent })&lt;br /&gt;
or ({ 0 }), meaning that an element will match only if its flags exactly&lt;br /&gt;
match the value within the array; otherwise, an element will match if any&lt;br /&gt;
of its flags match those in the value specified.  The flag values and their&lt;br /&gt;
meanings are:&lt;br /&gt;
&lt;br /&gt;
    Element_Flag_Independent: Indicates that the element is not intrinsic&lt;br /&gt;
    to the core composition of the object.  The current practical meaning&lt;br /&gt;
    of this applies only to livings, where this flag means that the element&lt;br /&gt;
    will not be altered when the living's elements are recalculated due to&lt;br /&gt;
    race change, size change, or the like.  An example would be if a living&lt;br /&gt;
    were given a Part_Coat element of Material_Mud; this element would not&lt;br /&gt;
    disappear when the living changed races, and so should be given&lt;br /&gt;
    Element_Flag_Independent.  Elements with similar significance to&lt;br /&gt;
    non-living objects should also be given this flag.&lt;br /&gt;
&lt;br /&gt;
    Element_Flag_Unmergeable: Indicates that the element should not ever be&lt;br /&gt;
    merged with another element.  Normally, when elements are added to an&lt;br /&gt;
    object, the system attempts to combine those that are sufficiently&lt;br /&gt;
    similar; so, for example, if two five-dekan elements of ordinary gold&lt;br /&gt;
    were added, the system would combine these into one ten-dekan element.&lt;br /&gt;
    If for any reason you would not want the element to be combined with&lt;br /&gt;
    another, use this flag.&lt;br /&gt;
&lt;br /&gt;
    Element_Flag_Preserve_Color: Indicates that the element's color should&lt;br /&gt;
    normally be preserved through transformations.  This means that if the&lt;br /&gt;
    element is transmuted, its color will stay the same unless the&lt;br /&gt;
    transmutation specifies that colors should be overridden.  For example,&lt;br /&gt;
    if an element's color were due to something like a permanent stain that&lt;br /&gt;
    would not change if its base material were transmuted, you would want&lt;br /&gt;
    to set this flag.&lt;br /&gt;
&lt;br /&gt;
    Element_Flag_Untransmutable: Indicates that the element should never&lt;br /&gt;
    be processed by transmute_element().  Elements with this flag will be&lt;br /&gt;
    skipped when transmute_element() is called with an element search&lt;br /&gt;
    descriptor as argument, and if a finalized element descriptor with&lt;br /&gt;
    this flag is specified, the function will fail with a warning issued.&lt;br /&gt;
&lt;br /&gt;
    Element_Flag_Secondary: Indicates that the element should be considered&lt;br /&gt;
    &amp;quot;secondary&amp;quot;, which means that it will not be used for generating the&lt;br /&gt;
    host object's names.&lt;br /&gt;
&lt;br /&gt;
    Element_Flag_Blend: Indicates that the element &amp;quot;blends&amp;quot; in with the&lt;br /&gt;
    other elements present, and is not used for generating the host&lt;br /&gt;
    object's names and also does not appear in its description.  Normally&lt;br /&gt;
    the material type determines this; this flag allows it to be specified&lt;br /&gt;
    for materials that would not normally blend.&lt;br /&gt;
&lt;br /&gt;
    Element_Flag_Visible: Indicates that an element which would not&lt;br /&gt;
    normally be considered visible to observation, such as for reason of&lt;br /&gt;
    having Part_Core or Part_Infusion for its Element_Part, should be&lt;br /&gt;
    considered visible.&lt;br /&gt;
&lt;br /&gt;
    Element_Flag_Suppress_Color_Override: Indicates that if the element&lt;br /&gt;
    would normally have its color overridden by another element, this&lt;br /&gt;
    behavior should be suppressed.&lt;br /&gt;
&lt;br /&gt;
    Element_Flag_Suppress_Override_Color: Indicates that if the element&lt;br /&gt;
    would normally override the colors of other elements, this behavior&lt;br /&gt;
    should be suppressed.&lt;br /&gt;
&lt;br /&gt;
    Element_Flag_Suppress_Material_Name: Indicates that the name of the&lt;br /&gt;
    material's element should be prevented from appearing in the names&lt;br /&gt;
    generated for the object.&lt;br /&gt;
&lt;br /&gt;
    Element_Flag_Suppress_Part_Description: Indicates that description of&lt;br /&gt;
    the part and form of the element should not be included in generated&lt;br /&gt;
    names, meaning only the basic material name and color will appear.&lt;br /&gt;
&lt;br /&gt;
    Element_Flag_Suppress_Material_Blend: Indicates that if the&lt;br /&gt;
    element would normally be considered secondary because of its&lt;br /&gt;
    material's settings, this behavior should be suppressed.&lt;br /&gt;
&lt;br /&gt;
There is also a flag set, Element_Flags_Immutable, which is an alias for&lt;br /&gt;
the combination of Element_Flag_Independent, Element_Flag_Unmergeable,&lt;br /&gt;
Element_Flag_Untransmutable, and Element_Flag_Suppress_Color_Override.&lt;br /&gt;
In situations where you plain do not want an element to be played around&lt;br /&gt;
with, such as in many situations where you will be keeping track of it&lt;br /&gt;
and removing it later, it is recommended to use this pseudo-flag; not&lt;br /&gt;
only is it more convenient, but if more flags are created that you would&lt;br /&gt;
want to be present in an immutable element, they will be added to this&lt;br /&gt;
alias.&lt;br /&gt;
&lt;br /&gt;
Element_Info: This is a field for specifying arbitrary user-defined&lt;br /&gt;
information -- for example, marking an element as having been generated by&lt;br /&gt;
a specific source so it can later be removed by that source.  The data are&lt;br /&gt;
stored in a mapping, allowing different user code to share the storage&lt;br /&gt;
space.  The support functions Element_Set_Info(), Element_Query_Info(), and&lt;br /&gt;
Element_Clear_Info(), described below, are for working with this field;&lt;br /&gt;
they should be used in all situations except when specifying the element&lt;br /&gt;
initially (when it should be specified as a mapping) or when working with&lt;br /&gt;
a &amp;quot;live&amp;quot; finalized element descriptor via the function alter_element(),&lt;br /&gt;
which has its own support for changing Element_Info.  When choosing key&lt;br /&gt;
values for this field, please take care to use a specific enough namespace&lt;br /&gt;
as to ensure there will be no conflicts; for example, you might use a key&lt;br /&gt;
like &amp;quot;Project_Source_Type&amp;quot; rather than simply &amp;quot;type&amp;quot;.  Using string keys&lt;br /&gt;
is recommended but not required.  Keep in mind that most elements are&lt;br /&gt;
subject to being saved and restored, and any information you put in this&lt;br /&gt;
field which cannot be successfully serialized and deserialized (pointers&lt;br /&gt;
to cloned objects, many closures) may be lost at some point.  Also, do not&lt;br /&gt;
rely on the Element_Info field always being the same mapping pointer; it&lt;br /&gt;
may be copied at various times.&lt;br /&gt;
&lt;br /&gt;
===Internal Fields===&lt;br /&gt;
&lt;br /&gt;
Element_Tag: The tag for the descriptor system.&lt;br /&gt;
&lt;br /&gt;
===Support Functions===&lt;br /&gt;
&lt;br /&gt;
'''float Element_Density(descriptor dxr)'''&lt;br /&gt;
&lt;br /&gt;
Returns the density of the element descriptor (its mass divided by its&lt;br /&gt;
volume).&lt;br /&gt;
&lt;br /&gt;
'''float Element_Compression(descriptor dxr)'''&lt;br /&gt;
&lt;br /&gt;
Returns the compression factor of the element.  This is a matter of its&lt;br /&gt;
density relative to the normal density for its material.  For example, a&lt;br /&gt;
water element, normal density for which is 1.0, with a volume of 1.0 and&lt;br /&gt;
a mass of 2.0, would have a compression factor of 2.0, indicating that it&lt;br /&gt;
is compressed into half its normal volume.  A compression factor of 1.0&lt;br /&gt;
indicates normal density; factors below 1.0 mean that the material is at&lt;br /&gt;
less than its normal density rather than more.&lt;br /&gt;
&lt;br /&gt;
'''descriptor Element_Finalize(descriptor dxr)'''&lt;br /&gt;
&lt;br /&gt;
The process used to finalize initial element descriptors.  Intended only&lt;br /&gt;
for use by the core system.&lt;br /&gt;
&lt;br /&gt;
'''status Element_Mergeable(descriptor a, descriptor b)'''&lt;br /&gt;
&lt;br /&gt;
Determines whether two descriptors can be merged.  Intended only for use&lt;br /&gt;
by the core system.&lt;br /&gt;
&lt;br /&gt;
'''descriptor Element_Attempt_Merge(descriptor dxr, descriptor array list)'''&lt;br /&gt;
&lt;br /&gt;
Attempts to merge a descriptor into any suitable element of a list of&lt;br /&gt;
descriptors.  Intended only for use by the core system.&lt;br /&gt;
&lt;br /&gt;
'''descriptor Element_Universal(descriptor dxr)'''&lt;br /&gt;
&lt;br /&gt;
Ensures, if possible, that the specified descriptor is shared globally,&lt;br /&gt;
returning the same descriptor or one which should be used in its place.&lt;br /&gt;
&lt;br /&gt;
'''closure Element_Match(mixed spec)'''&lt;br /&gt;
&lt;br /&gt;
Interprets its argument as the specification of an element search&lt;br /&gt;
descriptor and returns a closure which will match element descriptors&lt;br /&gt;
appropriate to the search descriptor.  Intended only for use by the core&lt;br /&gt;
system.&lt;br /&gt;
&lt;br /&gt;
'''void Element_Set_Info(descriptor dxr, mixed key, mixed value)'''&lt;br /&gt;
&lt;br /&gt;
Sets the specified key within the Element_Info field to the specified&lt;br /&gt;
value.&lt;br /&gt;
&lt;br /&gt;
'''mixed Element_Query_Info(descriptor dxr, mixed key)'''&lt;br /&gt;
&lt;br /&gt;
Returns the value for the specified key within the Element_Info field.&lt;br /&gt;
&lt;br /&gt;
'''void Element_Clear_Info(descriptor dxr, mixed key)'''&lt;br /&gt;
&lt;br /&gt;
Removed the specified key from the Element_Info field.&lt;br /&gt;
&lt;br /&gt;
'''string Element_Full_Name(descriptor dxr)&lt;br /&gt;
string Element_Unknown_Full_Name(descriptor dxr)&lt;br /&gt;
string Element_Subjective_Full_Name(descriptor dxr, object who)&lt;br /&gt;
string Element_Colored_Full_Name(descriptor dxr)&lt;br /&gt;
string Element_Colored_Unknown_Full_Name(descriptor dxr)&lt;br /&gt;
string Element_Colored_Subjective_Full_Name(descriptor dxr, object who)&lt;br /&gt;
'''&lt;br /&gt;
These functions each request, from the element's material type, the&lt;br /&gt;
corresponding version of the material's full name given the color set&lt;br /&gt;
in the element descriptor.&lt;br /&gt;
&lt;br /&gt;
'''float Element_Value(descriptor dxr)&lt;br /&gt;
float Element_Unknown_Value(descriptor dxr)&lt;br /&gt;
float Element_Subjective_Value(descriptor dxr, object who)'''&lt;br /&gt;
&lt;br /&gt;
These functions each calculate, using the element's material type, the&lt;br /&gt;
corresponding version of the material's value given the color and mass&lt;br /&gt;
set in the element descriptor.&lt;br /&gt;
&lt;br /&gt;
==See Also==&lt;br /&gt;
&lt;br /&gt;
[[man descriptors|descriptors(mechanisms)]], [[man add element|add_element(lfun)]], [[man add proportion|add_proportion(lfun)]], [[man remove element|remove_element(lfun)]], [[man remove proportion|remove_proportion(lfun)]], [[man find element|find_element(lfun)]],&lt;br /&gt;
[[man find elements|find_elements(lfun)]], [[man alter element|alter_element(lfun)]], [[man transmute element|transmute_element(lfun)]]&lt;/div&gt;</description>
			<pubDate>Mon, 11 Jun 2007 20:17:06 GMT</pubDate>			<dc:creator>Laine</dc:creator>			<comments>http://wiki.lostsouls.org/Talk:Man_element</comments>		</item>
	</channel>
</rss>