Updated HTML docs.

This commit is contained in:
Evennia docbuilder action 2025-02-15 16:40:00 +00:00
parent 8df2d2cfda
commit 5d5b8be778
28 changed files with 91 additions and 91 deletions

View file

@ -242,8 +242,8 @@ utilities that will be useful later. We will also learn how to write <em>tests</
</pre></div>
</div>
<p>Above, the <code class="docutils literal notranslate"><span class="pre">Ability</span></code> class holds some basic properties of a character sheet.</p>
<p>The <code class="docutils literal notranslate"><span class="pre">ABILITY_REVERSE_MAP</span></code> is a convenient map to go the other way — if in some command we were to enter the string cha, we could use this mapping to directly convert your input to the correct <code class="docutils literal notranslate"><span class="pre">Ability</span></code>. For example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ability = ABILITY_REVERSE_MAP.get(your_input)
<p>The <code class="docutils literal notranslate"><span class="pre">ABILITY_REVERSE_MAP</span></code> is a convenient map to convert a string to an Enum. The most common use of this would be in a Command; the Player dont know anything about Enums, they can only send strings. So wed only get the string “cha”. Using this <code class="docutils literal notranslate"><span class="pre">ABILITY_REVERSE_MAP</span></code> we can conveniently convert this input to an <code class="docutils literal notranslate"><span class="pre">Ability.CHA</span></code> Enum you can then pass around in code</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>ability = ABILITY_REVERSE_MAP.get(user_input)
</pre></div>
</div>
</section>