evennia/docs/2.x/Contribs/Contrib-Clothing.html
Evennia docbuilder action e535f5782a Updated HTML docs.
2023-10-19 20:22:27 +00:00

287 lines
No EOL
15 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<title>Clothing &#8212; Evennia 2.x documentation</title>
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script id="documentation_options" data-url_root="../" src="../_static/documentation_options.js"></script>
<script src="../_static/jquery.js"></script>
<script src="../_static/underscore.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/language_data.js"></script>
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Containers" href="Contrib-Containers.html" />
<link rel="prev" title="Barter system" href="Contrib-Barter.html" />
</head><body>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="Contrib-Containers.html" title="Containers"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="Contrib-Barter.html" title="Barter system"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 2.x</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="Contribs-Overview.html" accesskey="U">Contribs</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Clothing</a></li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../index.html">
<img class="logo" src="../_static/evennia_logo.png" alt="Logo"/>
</a></p>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
<h3><a href="../index.html">Table of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">Clothing</a><ul>
<li><a class="reference internal" href="#installation">Installation</a></li>
<li><a class="reference internal" href="#usage">Usage</a></li>
<li><a class="reference internal" href="#configuration">Configuration</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="Contrib-Barter.html"
title="previous chapter">Barter system</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="Contrib-Containers.html"
title="next chapter">Containers</a></p>
<div role="note" aria-label="source link">
<!--h3>This Page</h3-->
<ul class="this-page-menu">
<li><a href="../_sources/Contribs/Contrib-Clothing.md.txt"
rel="nofollow">Show Page Source</a></li>
</ul>
</div><h3>Links</h3>
<ul>
<li><a href="https://www.evennia.com/docs/latest/index.html">Documentation Top</a> </li>
<li><a href="https://www.evennia.com">Evennia Home</a> </li>
<li><a href="https://github.com/evennia/evennia">Github</a> </li>
<li><a href="http://games.evennia.com">Game Index</a> </li>
<li>
<a href="https://discord.gg/AJJpcRUhtF">Discord</a> -
<a href="https://github.com/evennia/evennia/discussions">Discussions</a> -
<a href="https://evennia.blogspot.com/">Blog</a>
</li>
</ul>
<h3>Doc Versions</h3>
<ul>
<li><a href="Contrib-Clothing.html">2.x (main branch)</a></li>
<ul>
<li><a href="../1.3.0/index.html">1.3.0 (v1.3.0 branch)</a></li>
<li><a href="../0.9.5/index.html">0.9.5 (v0.9.5 branch)</a></li>
</ul>
</div>
</div>
<div class="bodywrapper">
<div class="body" role="main">
<section class="tex2jax_ignore mathjax_ignore" id="clothing">
<h1>Clothing<a class="headerlink" href="#clothing" title="Permalink to this headline"></a></h1>
<p>Contribution by Tim Ashley Jenkins, 2017</p>
<p>Provides a typeclass and commands for wearable clothing. These
look of these clothes are appended to the characters description when worn.</p>
<p>Clothing items, when worn, are added to the characters description
in a list. For example, if wearing the following clothing items:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>a thin and delicate necklace
a pair of regular ol&#39; shoes
one nice hat
a very pretty dress
</pre></div>
</div>
<p>Would result in this added description:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Tim is wearing one nice hat, a thin and delicate necklace,
a very pretty dress and a pair of regular ol&#39; shoes.
</pre></div>
</div>
<section id="installation">
<h2>Installation<a class="headerlink" href="#installation" title="Permalink to this headline"></a></h2>
<p>To install, import this module and have your default character
inherit from ClothedCharacter in your games <a class="reference external" href="http://characters.py">characters.py</a> file:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span>
<span class="kn">from</span> <span class="nn">evennia.contrib.game_systems.clothing</span> <span class="kn">import</span> <span class="n">ClothedCharacter</span>
<span class="k">class</span> <span class="nc">Character</span><span class="p">(</span><span class="n">ClothedCharacter</span><span class="p">):</span>
</pre></div>
</div>
<p>And then add <code class="docutils literal notranslate"><span class="pre">ClothedCharacterCmdSet</span></code> in your character set in
<code class="docutils literal notranslate"><span class="pre">mygame/commands/default_cmdsets.py</span></code>:</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span>
<span class="kn">from</span> <span class="nn">evennia.contrib.game_systems.clothing</span> <span class="kn">import</span> <span class="n">ClothedCharacterCmdSet</span> <span class="c1"># &lt;--</span>
<span class="k">class</span> <span class="nc">CharacterCmdSet</span><span class="p">(</span><span class="n">default_cmds</span><span class="o">.</span><span class="n">CharacterCmdSet</span><span class="p">):</span>
<span class="c1"># ...</span>
<span class="n">at_cmdset_creation</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">at_cmdset_creation</span><span class="p">()</span>
<span class="c1"># ...</span>
<span class="bp">self</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">ClothedCharacterCmdSet</span><span class="p">)</span> <span class="c1"># &lt;--</span>
</pre></div>
</div>
</section>
<section id="usage">
<h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline"></a></h2>
<p>Once installed, you can use the default builder commands to create clothes
with which to test the system:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>create a pretty shirt : evennia.contrib.game_systems.clothing.ContribClothing
set shirt/clothing_type = &#39;top&#39;
wear shirt
</pre></div>
</div>
<p>A characters description may look like this:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Superuser(#1)
This is User #1.
Superuser is wearing one nice hat, a thin and delicate necklace,
a very pretty dress and a pair of regular ol&#39; shoes.
</pre></div>
</div>
<p>Characters can also specify the style of wear for their clothing - I.E.
to wear a scarf tied into a tight knot around the neck or draped
loosely across the shoulders - to add an easy avenue of customization.
For example, after entering:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>wear scarf draped loosely across the shoulders
</pre></div>
</div>
<p>The garment appears like so in the description:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>Superuser(#1)
This is User #1.
Superuser is wearing a fanciful-looking scarf draped loosely
across the shoulders.
</pre></div>
</div>
<p>Items of clothing can be used to cover other items, and many options
are provided to define your own clothing types and their limits and
behaviors. For example, to have undergarments automatically covered
by outerwear, or to put a limit on the number of each type of item
that can be worn. The system as-is is fairly freeform - you
can cover any garment with almost any other, for example - but it
can easily be made more restrictive, and can even be tied into a
system for armor or other equipment.</p>
</section>
<section id="configuration">
<h2>Configuration<a class="headerlink" href="#configuration" title="Permalink to this headline"></a></h2>
<p>The contrib has several optional configurations which you can define in your <code class="docutils literal notranslate"><span class="pre">settings.py</span></code>
Here are the settings and their default values.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="c1"># Maximum character length of &#39;wear style&#39; strings, or None for unlimited.</span>
<span class="n">CLOTHING_WEARSTYLE_MAXLENGTH</span> <span class="o">=</span> <span class="mi">50</span>
<span class="c1"># The order in which clothing types appear on the description.</span>
<span class="c1"># Untyped clothing or clothing with a type not in this list goes last.</span>
<span class="n">CLOTHING_TYPE_ORDERED</span> <span class="o">=</span> <span class="p">[</span>
<span class="s2">&quot;hat&quot;</span><span class="p">,</span>
<span class="s2">&quot;jewelry&quot;</span><span class="p">,</span>
<span class="s2">&quot;top&quot;</span><span class="p">,</span>
<span class="s2">&quot;undershirt&quot;</span><span class="p">,</span>
<span class="s2">&quot;gloves&quot;</span><span class="p">,</span>
<span class="s2">&quot;fullbody&quot;</span><span class="p">,</span>
<span class="s2">&quot;bottom&quot;</span><span class="p">,</span>
<span class="s2">&quot;underpants&quot;</span><span class="p">,</span>
<span class="s2">&quot;socks&quot;</span><span class="p">,</span>
<span class="s2">&quot;shoes&quot;</span><span class="p">,</span>
<span class="s2">&quot;accessory&quot;</span><span class="p">,</span>
<span class="p">]</span>
<span class="c1"># The maximum number of clothing items that can be worn, or None for unlimited.</span>
<span class="n">CLOTHING_OVERALL_LIMIT</span> <span class="o">=</span> <span class="mi">20</span>
<span class="c1"># The maximum number for specific clothing types that can be worn.</span>
<span class="c1"># If the clothing item has no type or is not specified here, the only maximum is the overall limit.</span>
<span class="n">CLOTHING_TYPE_LIMIT</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;hat&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">&quot;gloves&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">&quot;socks&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">,</span> <span class="s2">&quot;shoes&quot;</span><span class="p">:</span> <span class="mi">1</span><span class="p">}</span>
<span class="c1"># What types of clothes will automatically cover what other types of clothes when worn.</span>
<span class="c1"># Note that clothing only gets auto-covered if it&#39;s already being worn. It&#39;s perfectly possible</span>
<span class="c1"># to have your underpants showing if you put them on after your pants!</span>
<span class="n">CLOTHING_TYPE_AUTOCOVER</span> <span class="o">=</span> <span class="p">{</span>
<span class="s2">&quot;top&quot;</span><span class="p">:</span> <span class="p">[</span><span class="s2">&quot;undershirt&quot;</span><span class="p">],</span>
<span class="s2">&quot;bottom&quot;</span><span class="p">:</span> <span class="p">[</span><span class="s2">&quot;underpants&quot;</span><span class="p">],</span>
<span class="s2">&quot;fullbody&quot;</span><span class="p">:</span> <span class="p">[</span><span class="s2">&quot;undershirt&quot;</span><span class="p">,</span> <span class="s2">&quot;underpants&quot;</span><span class="p">],</span>
<span class="s2">&quot;shoes&quot;</span><span class="p">:</span> <span class="p">[</span><span class="s2">&quot;socks&quot;</span><span class="p">],</span>
<span class="p">}</span>
<span class="c1"># Any types of clothes that can&#39;t be used to cover other clothes at all.</span>
<span class="n">CLOTHING_TYPE_CANT_COVER_WITH</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;jewelry&quot;</span><span class="p">]</span>
</pre></div>
</div>
<hr class="docutils" />
<p><small>This document page is generated from <code class="docutils literal notranslate"><span class="pre">evennia/contrib/game_systems/clothing/README.md</span></code>. Changes to this
file will be overwritten, so edit that file rather than this one.</small></p>
</section>
</section>
</div>
</div>
</div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="Contrib-Containers.html" title="Containers"
>next</a> |</li>
<li class="right" >
<a href="Contrib-Barter.html" title="Barter system"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="../index.html">Evennia 2.x</a> &#187;</li>
<li class="nav-item nav-item-1"><a href="Contribs-Overview.html" >Contribs</a> &#187;</li>
<li class="nav-item nav-item-this"><a href="">Clothing</a></li>
</ul>
</div>
<div class="footer" role="contentinfo">
&#169; Copyright 2023, The Evennia developer community.
Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> 3.2.1.
</div>
</body>
</html>