[an error occurred while processing this directive]
[<a href="index.shtml">Package Index</a></code> | <a href="index_std.shtml">Mudlib Index</a></code> | <a href="index_eff.shtml">Effect Index</a></code>]<br><h2>File /std/basic/wearable.c</h2>
This file contains all the methods needed to make an object wearable
by a player or an npc.<p><b>See also:</b><br><a href="obj.armour.c.shtml">/obj/armour.c</a> and /obj/clothing.c
<p>Written by Pinkfish<h2>Inherits</h2>
This class inherits the following classes <a href="std.basic.condition.c.shtml">/std/basic/condition.c</a><h2>Includes</h2>
This class includes the following files <a href="include.move_failures.h.shtml">/include/move_failures.h</a> and <a href="include.clothing.h.shtml">/include/clothing.h</a><h2>Method index</h2>
<dl><ul>
<li><a href="#add_immune_to">add_immune_to</a>(mixed)<br/>
This adds a new type of damage that the object is immune to.
<li><a href="#add_wear_effect">add_wear_effect</a>(string)<br/>
This method adds a new wear effect to the current wear effect array.
<li><a href="#query_immune_to">query_immune_to</a>()<br/>
This returns the list of types of damage that the object is immune to.
<li><a href="#query_race">query_race</a>()<br/>
This method queries the race type.
<li><a href="#query_type">query_type</a>()<br/>
This method returns the current type(s) associated with the object.
<li><a href="#query_wear_effects">query_wear_effects</a>()<br/>
This method returns the list of effects to be added to the wearer when
it is worn.
<li><a href="#query_wear_remove_func">query_wear_remove_func</a>()<br/>
This method returns the current function associated with
wearing and removing the item.
<li><a href="#query_wearable">query_wearable</a>()<br/>
This method tells us if the object is wearable.
<li><a href="#query_worn_by">query_worn_by</a>()<br/>
This method returns the person who is currently wearing the object.
<li><a href="#remove_immune_to">remove_immune_to</a>(mixed)<br/>
This method removes a type of damage that the weapon is immune
to.
<li><a href="#remove_wear_remove_func">remove_wear_remove_func</a>()<br/>
Unset the wear_remove func.
<li><a href="#set_race">set_race</a>(string)<br/>
This method sets the race type that can wear this item.
<li><a href="#set_type">set_type</a>(mixed)<br/>
This method sets the type(s) which are associated with the
item.
<li><a href="#set_wear_effects">set_wear_effects</a>(string *)<br/>
This method sets the list of effects to be added to the wearer when it
is worn.
<li><a href="#set_wear_remove_func">set_wear_remove_func</a>(mixed, string)<br/>
This method sets the current function associated with wearing and
removing the item.
<li><a href="#set_worn_by">set_worn_by</a>(object)<br/>
This method sets the object as being worn by the passed in object.
</ul><h2>Public Functions</h2>
These are functions that everyone can access.<p>
.<ul><a name="add_immune_to">
add_immune_to</a><pre>
void add_immune_to(mixed args)
</pre></br>
This adds a new type of damage that the object is immune to.
The parameter can either be a string or an array of strings
being the types of damage to be immune to.
<br/><ul>
<li><b>Parameters:</b>
<br/>args - the type of damage to be immune to
<li><b>See also:</b>
<br/><a href="#remove_immune_to">remove_immune_to()</a> and <a href="#query_immune_to">query_immune_to()
</a><li><b>Example:</b>
<br/><pre>inherit "/std/basic/wearable";

void setup() {
   ...
   add_immune_to("sharp");
   ...
} /* setup() */</pre><br/><pre>
inherit "/std/basic/wearable";

void setup() {
   ...
   add_immune_to("sharp");
   ...
} /* setup() */</pre></dl>

<ul><a name="add_wear_effect">
add_wear_effect</a><pre>
void add_wear_effect(string effect)
</pre></br>
This method adds a new wear effect to the current wear effect array.  These effects will automaticly be added when worn and
removed when taken off.
<br/><ul>
<li><b>Parameters:</b>
<br/>effect - the effect to add
<li><b>See also:</b>
<br/><a href="#query_wear_effects">query_wear_effects()</a> and <a href="#set_wear_effects">set_wear_effects()
</a></dl>

<ul><a name="query_immune_to">
query_immune_to</a><pre>
string * query_immune_to()
</pre></br>
This returns the list of types of damage that the object is immune to.
<br/><ul>
<li><b>Returns:</b>
<br/>the list of damage we are immune to
<li><b>See also:</b>
<br/><a href="std.basic.condition.c.shtml">/std/basic/condition.c</a>, <a href="#add_immune_to">add_immune_to()</a> and <a href="#remove_immune_to">remove_immune_to()
</a></dl>

<ul><a name="query_race">
query_race</a><pre>
string query_race()
</pre></br>
This method queries the race type.
<br/><ul>
<li><b>Returns:</b>
<br/>race
<li><b>See also:</b>
<br/>set_race
.c</dl>

<ul><a name="query_type">
query_type</a><pre>
string query_type()
</pre></br>
This method returns the current type(s) associated with the object.
If this method returns a string then there is only one type for this
object.  If it returns a string then there is more than one
type associated with an object.  An example of something with more
than one type is a skirt, which is a dress and a shirt at the
same time.
<br/><ul>
<li><b>Returns:</b>
<br/>the current type of the item
<li><b>See also:</b>
<br/><a href="#set_type">set_type()
</a></dl>

<ul><a name="query_wear_effects">
query_wear_effects</a><pre>
string * query_wear_effects()
</pre></br>
This method returns the list of effects to be added to the wearer when
it is worn.  These effects will automaticly be added when worn and
removed when taken off.
<br/><ul>
<li><b>Returns:</b>
<br/>the list of effects to be added to the wearer when worn
<li><b>See also:</b>
<br/><a href="#set_wear_effects">set_wear_effects()</a> and <a href="#add_wear_effect">add_wear_effect()
</a></dl>

<ul><a name="query_wear_remove_func">
query_wear_remove_func</a><pre>
mixed * query_wear_remove_func()
</pre></br>
This method returns the current function associated with
wearing and removing the item.
<br/><ul>
<li><b>Returns:</b>
<br/>the current function for wearing and removing the clothing
<li><b>See also:</b>
<br/><a href="#set_wear_remove_func">set_wear_remove_func()
</a></dl>

<ul><a name="query_wearable">
query_wearable</a><pre>
int query_wearable()
</pre></br>
This method tells us if the object is wearable.
In the case of a wearable object it will always return 1.
<br/><ul>
<li><b>Returns:</b>
<br/>always returns 1

</dl>

<ul><a name="query_worn_by">
query_worn_by</a><pre>
object query_worn_by()
</pre></br>
This method returns the person who is currently wearing the object.
<br/><ul>
<li><b>Returns:</b>
<br/>the current wearer of the object
<li><b>See also:</b>
<br/><a href="#set_worn_by">set_worn_by()
</a></dl>

<ul><a name="remove_immune_to">
remove_immune_to</a><pre>
void remove_immune_to(mixed args)
</pre></br>
This method removes a type of damage that the weapon is immune
to.
<br/><ul>
<li><b>Parameters:</b>
<br/>args - the type(s) of damage to remove immunity too
<li><b>See also:</b>
<br/><a href="#add_immune_to">add_immune_to()</a> and <a href="#query_immune_to">query_immune_to()
</a></dl>

<ul><a name="remove_wear_remove_func">
remove_wear_remove_func</a><pre>
} void remove_wear_remove_func()
</pre></br>
Unset the wear_remove func.


<ul><a name="set_race">
set_race</a><pre>
void set_race(string str)
</pre></br>
This method sets the race type that can wear this item. Unless the item has
specific race requirements just leave this empty.

<br/><ul>
<li><b>Parameters:</b>
<br/>race - the race name.

</dl>

<ul><a name="set_type">
set_type</a><pre>
void set_type(mixed word)
</pre></br>
This method sets the type(s) which are associated with the
item.  If the parameter is a string then a single type is associated
with the item, if the parameter is an array then a list of types
is associated with the object.  If any of these types are not
legal and error message will be produced.
<br/><ul>
<li><b>Parameters:</b>
<br/>word - the new type(s) to set for the object
<li><b>See also:</b>
<br/><a href="#query_type">query_type()
</a></dl>

<ul><a name="set_wear_effects">
set_wear_effects</a><pre>
void set_wear_effects(string * effects)
</pre></br>
This method sets the list of effects to be added to the wearer when it
is worn.  These effects will automaticly be added when worn and
removed when taken off.
<br/><ul>
<li><b>Parameters:</b>
<br/>effects - the array of effects to be added to the wearer when worn
<li><b>See also:</b>
<br/><a href="#query_wear_effects">query_wear_effects()</a> and <a href="#add_wear_effect">add_wear_effect()
</a></dl>

<ul><a name="set_wear_remove_func">
set_wear_remove_func</a><pre>
void set_wear_remove_func(mixed file,
                          string func)
</pre></br>
This method sets the current function associated with wearing and
removing the item.  The value of this function should be choosen
carefully, using an object reference for the name will work but
it will not then be able to restored from the save file.  The same
goes for using function pointers.  It is better to use a real
file name and a string function name.
<p>
The function will be called with two arguments, the first argument will
be 0 if the object is being removed or the object which it is
being worn by if it is non-zero.  The second argument will always
be the person who was wearing the item, or is about to wear the
item.
<br/><ul>
<li><b>Parameters:</b>
<br/>file - the file to call the function on
<br/>func - the function to call
<li><b>See also:</b>
<br/><a href="#query_wear_remove_func">query_wear_remove_func()
</a><li><b>Example:</b>
<br/><pre>inherit "/std/basic/wearable";

void setup() {
   ...
   set_wear_remove_func(base_name(this_object()), "do_fluff");
   ...
} /* setup() */

void do_fluff(object ob, object player) {
   if (!ob) {
      write(capitalize(the_short()) + " is being removed.\n");
   } else {
      write(capitalize(the_short()) + " is being worn.\n");
   }
} /* do_fluff() */</pre></dl>

<ul><a name="set_worn_by">
set_worn_by</a><pre>
int set_worn_by(object thing)
</pre></br>
This method sets the object as being worn by the passed in object.
It calls all the various worn functions and sets up or removes
all the effects associated with the object.
<p>
If the object is alreadying being worn the wear_remove_function will
be called with an argument of 0.  The method taken_off will be
called on the object wearing the object for all the effects associated
with this object.
<p>
If the object is being set to be worn by someone the the wear_remove
function will be called with an argument being the person who is to
wear the object.   All of the effects associated with the
object will be added to the wearer.
<p>
This calls the method 'person_removing_item' on the effect when some
one removes the item.  This can be used to make sure the effects are
taken off when the item is removed.
<br/><ul>
<li><b>Parameters:</b>
<br/>thing - the new person to wear the object (0 for worn by no one)
<li><b>Returns:</b>
<br/>1 if successful, 0 on failure
<li><b>See also:</b>
<br/><a href="#set_wear_remove_func">set_wear_remove_func()</a> and <a href="#add_wear_effect">add_wear_effect()
</a></dl>


[an error occurred while processing this directive]

