Updated HTML docs

This commit is contained in:
Griatch 2021-05-16 00:06:01 +02:00
parent 58f5ece91b
commit 1bbc93507a
1000 changed files with 39106 additions and 33861 deletions

View file

@ -4,7 +4,8 @@
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
<title>Building a mech tutorial &#8212; Evennia 1.0-dev documentation</title>
<link rel="stylesheet" href="../_static/nature.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
@ -37,14 +38,14 @@
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="building-a-mech-tutorial">
<section id="building-a-mech-tutorial">
<h1>Building a mech tutorial<a class="headerlink" href="#building-a-mech-tutorial" title="Permalink to this headline"></a></h1>
<blockquote>
<div><p>This page was adapted from the article “Building a Giant Mech in Evennia” by Griatch, published in
Imaginary Realities Volume 6, issue 1, 2014. The original article is no longer available online,
this is a version adopted to be compatible with the latest Evennia.</p>
</div></blockquote>
<div class="section" id="creating-the-mech">
<section id="creating-the-mech">
<h2>Creating the Mech<a class="headerlink" href="#creating-the-mech" title="Permalink to this headline"></a></h2>
<p>Let us create a functioning giant mech using the Python MUD-creation system Evennia. Everyone likes
a giant mech, right? Start in-game as a character with build privileges (or the superuser).</p>
@ -102,48 +103,48 @@ moment the mech is not quite as cool as it could be.</p>
answer is that it came from the Accounts command set. This is important. Without the Account being
the one with the <code class="docutils literal notranslate"><span class="pre">&#64;ic</span></code> command, we would not have been able to get back out of our mech again.)</p>
</div></blockquote>
<div class="section" id="arming-the-mech">
<section id="arming-the-mech">
<h3>Arming the Mech<a class="headerlink" href="#arming-the-mech" title="Permalink to this headline"></a></h3>
<p>Let us make the mech a little more interesting. In our favorite text editor, we will create some new
mech-suitable commands. In Evennia, commands are defined as Python classes.</p>
<div class="highlight-python notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="c1"># in a new file mygame/commands/mechcommands.py</span>
<div class="highlight-python notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
<span class="normal"> 2</span>
<span class="normal"> 3</span>
<span class="normal"> 4</span>
<span class="normal"> 5</span>
<span class="normal"> 6</span>
<span class="normal"> 7</span>
<span class="normal"> 8</span>
<span class="normal"> 9</span>
<span class="normal">10</span>
<span class="normal">11</span>
<span class="normal">12</span>
<span class="normal">13</span>
<span class="normal">14</span>
<span class="normal">15</span>
<span class="normal">16</span>
<span class="normal">17</span>
<span class="normal">18</span>
<span class="normal">19</span>
<span class="normal">20</span>
<span class="normal">21</span>
<span class="normal">22</span>
<span class="normal">23</span>
<span class="normal">24</span>
<span class="normal">25</span>
<span class="normal">26</span>
<span class="normal">27</span>
<span class="normal">28</span>
<span class="normal">29</span>
<span class="normal">30</span>
<span class="normal">31</span>
<span class="normal">32</span>
<span class="normal">33</span>
<span class="normal">34</span>
<span class="normal">35</span>
<span class="normal">36</span>
<span class="normal">37</span>
<span class="normal">38</span></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="c1"># in a new file mygame/commands/mechcommands.py</span>
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">Command</span>
@ -195,21 +196,21 @@ that up to you to create as an exercise. You could have it print “WOOSH! The
mech launches missiles against <target>!”, for example.</p>
<p>Now we shove our commands into a command set. A <a class="reference internal" href="../Components/Command-Sets.html"><span class="doc">Command Set</span></a> (CmdSet) is a container
holding any number of commands. The command set is what we will store on the mech.</p>
<div class="highlight-python notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="c1"># in the same file mygame/commands/mechcommands.py</span>
<div class="highlight-python notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
<span class="normal"> 2</span>
<span class="normal"> 3</span>
<span class="normal"> 4</span>
<span class="normal"> 5</span>
<span class="normal"> 6</span>
<span class="normal"> 7</span>
<span class="normal"> 8</span>
<span class="normal"> 9</span>
<span class="normal">10</span>
<span class="normal">11</span>
<span class="normal">12</span>
<span class="normal">13</span>
<span class="normal">14</span>
<span class="normal">15</span></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="c1"># in the same file mygame/commands/mechcommands.py</span>
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">CmdSet</span>
<span class="kn">from</span> <span class="nn">evennia</span> <span class="kn">import</span> <span class="n">default_cmds</span>
@ -251,9 +252,9 @@ mech, what else do you need?</p>
<div><p>Note: Youll find that the mechs commands are available to you by just standing in the same
location (not just by puppeting it). Well solve this with a <em>lock</em> in the next section.</p>
</div></blockquote>
</div>
</div>
<div class="section" id="making-a-mech-production-line">
</section>
</section>
<section id="making-a-mech-production-line">
<h2>Making a Mech production line<a class="headerlink" href="#making-a-mech-production-line" title="Permalink to this headline"></a></h2>
<p>What weve done so far is just to make a normal Object, describe it and put some commands on it.
This is great for testing. The way we added it, the MechCmdSet will even go away if we reload the
@ -261,22 +262,22 @@ server. Now we want to make the mech an actual object “type” so we can creat
extra steps. For this we need to create a new Typeclass.</p>
<p>A <a class="reference internal" href="../Components/Typeclasses.html"><span class="doc">Typeclass</span></a> is a near-normal Python class that stores its existence to the database
behind the scenes. A Typeclass is created in a normal Python source file:</p>
<div class="highlight-python notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16</pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="c1"># in the new file mygame/typeclasses/mech.py</span>
<div class="highlight-python notranslate"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
<span class="normal"> 2</span>
<span class="normal"> 3</span>
<span class="normal"> 4</span>
<span class="normal"> 5</span>
<span class="normal"> 6</span>
<span class="normal"> 7</span>
<span class="normal"> 8</span>
<span class="normal"> 9</span>
<span class="normal">10</span>
<span class="normal">11</span>
<span class="normal">12</span>
<span class="normal">13</span>
<span class="normal">14</span>
<span class="normal">15</span>
<span class="normal">16</span></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span class="c1"># in the new file mygame/typeclasses/mech.py</span>
<span class="kn">from</span> <span class="nn">typeclasses.objects</span> <span class="kn">import</span> <span class="n">Object</span>
<span class="kn">from</span> <span class="nn">commands.mechcommands</span> <span class="kn">import</span> <span class="n">MechCmdSet</span>
@ -314,8 +315,8 @@ the <code class="docutils literal notranslate"><span class="pre">typeclasses</sp
</pre></div>
</div>
<p>to take it on a test drive.</p>
</div>
<div class="section" id="future-mechs">
</section>
<section id="future-mechs">
<h2>Future Mechs<a class="headerlink" href="#future-mechs" title="Permalink to this headline"></a></h2>
<p>To expand on this you could add more commands to the mech and remove others. Maybe the mech
shouldnt work just like a Character after all. Maybe it makes loud noises every time it passes from
@ -328,8 +329,8 @@ Character (since any Object can move inside another). In that case the “inside
could be the “cockpit”. The cockpit would have the <code class="docutils literal notranslate"><span class="pre">MechCommandSet</span></code> stored on itself and all the
shooting goodness would be made available to you only when you enter it.</p>
<p>And of course you could put more guns on it. And make it fly.</p>
</div>
</div>
</section>
</section>
<div class="clearer"></div>