21.xhtml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!--
  3. h t t :: / / t /
  4. h t t :: // // t //
  5. h ttttt ttttt ppppp sssss // // y y sssss ttttt //
  6. hhhh t t p p s // // y y s t //
  7. h hh t t ppppp sssss // // yyyyy sssss t //
  8. h h t t p s :: / / y .. s t .. /
  9. h h t t p sssss :: / / yyyyy .. sssss t .. /
  10. <https://y.st./>
  11. Copyright © 2015 Alex Yst <mailto:copyright@y.st>
  12. This program is free software: you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation, either version 3 of the License, or
  15. (at your option) any later version.
  16. This program is distributed in the hope that it will be useful,
  17. but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. GNU General Public License for more details.
  20. You should have received a copy of the GNU General Public License
  21. along with this program. If not, see <https://www.gnu.org./licenses/>.
  22. -->
  23. <!DOCTYPE html>
  24. <html xmlns="http://www.w3.org/1999/xhtml">
  25. <head>
  26. <base href="https://y.st./en/weblog/2015/03-March/21.xhtml" />
  27. <title>Work on minetyst_game begins &lt;https://y.st./en/weblog/2015/03-March/21.xhtml&gt;</title>
  28. <link rel="icon" type="image/png" href="/link/CC_BY-SA_4.0/y.st./icon.png" />
  29. <link rel="stylesheet" type="text/css" href="/link/basic.css" />
  30. <link rel="stylesheet" type="text/css" href="/link/site-specific.css" />
  31. <script type="text/javascript" src="/script/javascript.js" />
  32. <meta name="viewport" content="width=device-width" />
  33. </head>
  34. <body>
  35. <nav>
  36. <p>
  37. <a href="/en/">Home</a> |
  38. <a href="/en/a/about.xhtml">About</a> |
  39. <a href="/en/a/contact.xhtml">Contact</a> |
  40. <a href="/a/canary.txt">Canary</a> |
  41. <a href="/en/URI_research/"><abbr title="Uniform Resource Identifier">URI</abbr> research</a> |
  42. <a href="/en/opinion/">Opinions</a> |
  43. <a href="/en/coursework/">Coursework</a> |
  44. <a href="/en/law/">Law</a> |
  45. <a href="/en/a/links.xhtml">Links</a> |
  46. <a href="/en/weblog/2015/03-March/21.xhtml.asc">{this page}.asc</a>
  47. </p>
  48. <hr/>
  49. <p>
  50. Weblog index:
  51. <a href="/en/weblog/"><abbr title="American Standard Code for Information Interchange">ASCII</abbr> calendars</a> |
  52. <a href="/en/weblog/index_ol_ascending.xhtml">Ascending list</a> |
  53. <a href="/en/weblog/index_ol_descending.xhtml">Descending list</a>
  54. </p>
  55. <hr/>
  56. <p>
  57. Jump to entry:
  58. <a href="/en/weblog/2015/03-March/07.xhtml">&lt;&lt;First</a>
  59. <a rel="prev" href="/en/weblog/2015/03-March/20.xhtml">&lt;Previous</a>
  60. <a rel="next" href="/en/weblog/2015/03-March/22.xhtml">Next&gt;</a>
  61. <a href="/en/weblog/latest.xhtml">Latest&gt;&gt;</a>
  62. </p>
  63. <hr/>
  64. </nav>
  65. <header>
  66. <h1>Work on minetyst_game begins</h1>
  67. <p>Day 00014: Saturday, 2015 March 21</p>
  68. </header>
  69. </p>
  70. It&apos;s far too easy to die and lose everything on the <a href="https://forum.minetest.net/viewtopic.php?f=10&amp;t=10539">just test</a> server.
  71. I died several times, losing everything I owned each time, and never once made it to the location I planned to set up my home.
  72. It doesn&apos;t help that hoards of monsters come out at night or that you can&apos;t save your place with the <code>/sethome</code> command.
  73. I&apos;ve decided to switch servers, and am now playing on the <a href="http://linuxgaming.us/">LinuxGaming.us</a> server.
  74. This new server both allows you to set a home warp point and is (as far as I can tell) monster-free.
  75. I&apos;m not sure if this is an intentional feature or a bug, but I was able to add protection to the area I am going to build my base in from the spawn area, despite my home being quite distant.
  76. I still haven&apos;t made it to the area yet though, as playing the game for extended periods of time overheats my laptop.
  77. </p>
  78. </p>
  79. I started work on minetyst_game, by which I mean I built a script related to the game that will not actually be a part of it.
  80. The Minetest engine contains a number of references to nodes that are to be defined in the Lua modules, but there is no documentation on any of them.
  81. Furthermore, these nodes aren&apos;t even all defined in minetest_game like they should be.
  82. This script searches through the source code to locate the nodes the engine calls for so I can be sure to define them.
  83. This isn&apos;t the first time I&apos;ve written this script, but I don&apos;t have a copy from before my recent data loss indecent.
  84. Normally, I write this script in Python, but this time, I mixed it up a little and used <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> instead.
  85. I thought it would be harder to use <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> for this particular job, but it turned out to actually be easier.
  86. Tomorrow, I will probably look over the output of the script and will maybe start work on mutilating minetest_game to form minetyst_game.
  87. I don&apos;t have a place to put code at the moment, so I&apos;ll just drop it here for now.
  88. </p>
  89. <code><span class="PHP-T_OPEN_TAG">&lt;?php<br/>
  90. </span><span class="PHP-T_COMMENT">#&#160;&#160;&#160;&#160;Minetest C++ Source Code Node Finder<br/>
  91. </span><span class="PHP-T_COMMENT">#&#160;&#160;&#160;&#160;Copyright © 2015 Alex Yst &lt;mailto:copyright@y.st&gt;<br/>
  92. </span><span class="PHP-T_WHITESPACE"><br/>
  93. </span><span class="PHP-T_COMMENT">#&#160;&#160;&#160;&#160;This program is free software: you can redistribute it and/or modify<br/>
  94. </span><span class="PHP-T_COMMENT">#&#160;&#160;&#160;&#160;it under the terms of the GNU General Public License as published by<br/>
  95. </span><span class="PHP-T_COMMENT">#&#160;&#160;&#160;&#160;the Free Software Foundation, either version 3 of the License, or<br/>
  96. </span><span class="PHP-T_COMMENT">#&#160;&#160;&#160;&#160;(at your option) any later version.<br/>
  97. </span><span class="PHP-T_WHITESPACE"><br/>
  98. </span><span class="PHP-T_COMMENT">#&#160;&#160;&#160;&#160;This program is distributed in the hope that it will be useful,<br/>
  99. </span><span class="PHP-T_COMMENT">#&#160;&#160;&#160;&#160;but WITHOUT ANY WARRANTY; without even the implied warranty of<br/>
  100. </span><span class="PHP-T_COMMENT">#&#160;&#160;&#160;&#160;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br/>
  101. </span><span class="PHP-T_COMMENT">#&#160;&#160;&#160;&#160;GNU General Public License for more details.<br/>
  102. </span><span class="PHP-T_WHITESPACE"><br/>
  103. </span><span class="PHP-T_COMMENT">#&#160;&#160;&#160;&#160;You should have received a copy of the GNU General Public License<br/>
  104. </span><span class="PHP-T_COMMENT">#&#160;&#160;&#160;&#160;along with this program. If not, see &lt;http://www.gnu.org./licenses/&gt;.<br/>
  105. </span><span class="PHP-T_VARIABLE">$regexp</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T">=</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_CONSTANT_ENCAPSED_STRING">&apos;{-&gt;set\([0-9a-fx]+, &quot;([^&quot;]*)&quot;\)|-&gt;getId\(&quot;([^&quot;]*)&quot;\)}&apos;</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
  106. </span><span class="PHP-T_VARIABLE">$dir</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T">=</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_STRING">dir</span><span class="PHP-T">(</span><span class="PHP-T_CONSTANT_ENCAPSED_STRING">&apos;.&apos;</span><span class="PHP-T">)</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
  107. </span><span class="PHP-T_WHILE">while</span><span class="PHP-T">(</span><span class="PHP-T_STRING">false</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_IS_NOT_IDENTICAL">!==</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T">(</span><span class="PHP-T_VARIABLE">$file</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T">=</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_VARIABLE">$dir</span><span class="PHP-T_OBJECT_OPERATOR">-&gt;</span><span class="PHP-T_STRING">read</span><span class="PHP-T">(</span><span class="PHP-T">)</span><span class="PHP-T">)</span><span class="PHP-T">)</span><span class="PHP-T">:</span><span class="PHP-T_WHITESPACE"><br/>
  108. &#160;&#160;&#160;&#160;</span><span class="PHP-T_IF">if</span><span class="PHP-T">(</span><span class="PHP-T">!</span><span class="PHP-T_STRING">is_dir</span><span class="PHP-T">(</span><span class="PHP-T_VARIABLE">$file</span><span class="PHP-T">)</span><span class="PHP-T">)</span><span class="PHP-T">:</span><span class="PHP-T_WHITESPACE"><br/>
  109. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="PHP-T_STRING">preg_match_all</span><span class="PHP-T">(</span><span class="PHP-T_VARIABLE">$regexp</span><span class="PHP-T">,</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_STRING">file_get_contents</span><span class="PHP-T">(</span><span class="PHP-T_VARIABLE">$file</span><span class="PHP-T">)</span><span class="PHP-T">,</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_VARIABLE">$array</span><span class="PHP-T">)</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
  110. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="PHP-T_FOREACH">foreach</span><span class="PHP-T">(</span><span class="PHP-T_VARIABLE">$array</span><span class="PHP-T">[</span><span class="PHP-T_LNUMBER">0</span><span class="PHP-T">]</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_AS">as</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_VARIABLE">$key</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_DOUBLE_ARROW">=&gt;</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_VARIABLE">$value</span><span class="PHP-T">)</span><span class="PHP-T">:</span><span class="PHP-T_WHITESPACE"><br/>
  111. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="PHP-T_IF">if</span><span class="PHP-T">(</span><span class="PHP-T_VARIABLE">$array</span><span class="PHP-T">[</span><span class="PHP-T_LNUMBER">1</span><span class="PHP-T">]</span><span class="PHP-T">[</span><span class="PHP-T_VARIABLE">$key</span><span class="PHP-T">]</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_IS_NOT_EQUAL">!=</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_CONSTANT_ENCAPSED_STRING">&apos;&apos;</span><span class="PHP-T">)</span><span class="PHP-T">:</span><span class="PHP-T_WHITESPACE"><br/>
  112. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="PHP-T_VARIABLE">$nodes</span><span class="PHP-T">[</span><span class="PHP-T_VARIABLE">$array</span><span class="PHP-T">[</span><span class="PHP-T_LNUMBER">1</span><span class="PHP-T">]</span><span class="PHP-T">[</span><span class="PHP-T_VARIABLE">$key</span><span class="PHP-T">]</span><span class="PHP-T">]</span><span class="PHP-T">[</span><span class="PHP-T_VARIABLE">$file</span><span class="PHP-T">]</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T">=</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_STRING">true</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
  113. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="PHP-T_ENDIF">endif</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
  114. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="PHP-T_IF">if</span><span class="PHP-T">(</span><span class="PHP-T_VARIABLE">$array</span><span class="PHP-T">[</span><span class="PHP-T_LNUMBER">2</span><span class="PHP-T">]</span><span class="PHP-T">[</span><span class="PHP-T_VARIABLE">$key</span><span class="PHP-T">]</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_IS_NOT_EQUAL">!=</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_CONSTANT_ENCAPSED_STRING">&apos;&apos;</span><span class="PHP-T">)</span><span class="PHP-T">:</span><span class="PHP-T_WHITESPACE"><br/>
  115. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="PHP-T_VARIABLE">$nodes</span><span class="PHP-T">[</span><span class="PHP-T_VARIABLE">$array</span><span class="PHP-T">[</span><span class="PHP-T_LNUMBER">2</span><span class="PHP-T">]</span><span class="PHP-T">[</span><span class="PHP-T_VARIABLE">$key</span><span class="PHP-T">]</span><span class="PHP-T">]</span><span class="PHP-T">[</span><span class="PHP-T_VARIABLE">$file</span><span class="PHP-T">]</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T">=</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_STRING">true</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
  116. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="PHP-T_ENDIF">endif</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
  117. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="PHP-T_ENDFOREACH">endforeach</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
  118. &#160;&#160;&#160;&#160;</span><span class="PHP-T_ENDIF">endif</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
  119. </span><span class="PHP-T_ENDWHILE">endwhile</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
  120. </span><span class="PHP-T_STRING">ksort</span><span class="PHP-T">(</span><span class="PHP-T_VARIABLE">$nodes</span><span class="PHP-T">)</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
  121. </span><span class="PHP-T_FOREACH">foreach</span><span class="PHP-T">(</span><span class="PHP-T_VARIABLE">$nodes</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_AS">as</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_VARIABLE">$node</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_DOUBLE_ARROW">=&gt;</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_VARIABLE">$nodearray</span><span class="PHP-T">)</span><span class="PHP-T">:</span><span class="PHP-T_WHITESPACE"><br/>
  122. &#160;&#160;&#160;&#160;</span><span class="PHP-T_ECHO">echo</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_CONSTANT_ENCAPSED_STRING">&apos;-- &apos;</span><span class="PHP-T">,</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_VARIABLE">$node</span><span class="PHP-T">,</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_CONSTANT_ENCAPSED_STRING">&quot;\n&quot;</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
  123. &#160;&#160;&#160;&#160;</span><span class="PHP-T_STRING">ksort</span><span class="PHP-T">(</span><span class="PHP-T_VARIABLE">$nodearray</span><span class="PHP-T">)</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
  124. &#160;&#160;&#160;&#160;</span><span class="PHP-T_FOREACH">foreach</span><span class="PHP-T">(</span><span class="PHP-T_VARIABLE">$nodearray</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_AS">as</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_VARIABLE">$filename</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_DOUBLE_ARROW">=&gt;</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_VARIABLE">$true</span><span class="PHP-T">)</span><span class="PHP-T">:</span><span class="PHP-T_WHITESPACE"><br/>
  125. &#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;</span><span class="PHP-T_ECHO">echo</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_CONSTANT_ENCAPSED_STRING">&apos;-- -- &apos;</span><span class="PHP-T">,</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_VARIABLE">$filename</span><span class="PHP-T">,</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_CONSTANT_ENCAPSED_STRING">&quot;\n&quot;</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
  126. &#160;&#160;&#160;&#160;</span><span class="PHP-T_ENDFOREACH">endforeach</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
  127. </span><span class="PHP-T_ENDFOREACH">endforeach</span><span class="PHP-T">;</span></code>
  128. </p>
  129. The <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> <code>highlight_string()</code> function outputs a mess.
  130. Tomorrow I will attempt to create a function that uses <code>highlight_string()</code> to do most of the leg work but outputs cleaner markup.
  131. Specifically, I&apos;ll remove the output of <code>&amp;nbsp;</code> as it is not a valid <abbr title="Extensible Markup Language">XML</abbr> entity and remove the use of the <code>style</code> attribute, as it is a messy way to color text that would be much better dealt with in an actual style sheet.
  132. </p>
  133. </p>
  134. My <a href="/a/canary.txt">canary</a> still sings the tune of freedom and transparency.
  135. </p>
  136. <hr/>
  137. <p>
  138. Copyright © 2015 Alex Yst;
  139. You may modify and/or redistribute this document under the terms of the <a rel="license" href="/license/gpl-3.0-standalone.xhtml"><abbr title="GNU&apos;s Not Unix">GNU</abbr> <abbr title="General Public License version Three or later">GPLv3+</abbr></a>.
  140. If for some reason you would prefer to modify and/or distribute this document under other free copyleft terms, please ask me via email.
  141. My address is in the source comments near the top of this document.
  142. This license also applies to embedded content such as images.
  143. For more information on that, see <a href="/en/a/licensing.xhtml">licensing</a>.
  144. </p>
  145. <p>
  146. <abbr title="World Wide Web Consortium">W3C</abbr> standards are important.
  147. This document conforms to the <a href="https://validator.w3.org./nu/?doc=https%3A%2F%2Fy.st.%2Fen%2Fweblog%2F2015%2F03-March%2F21.xhtml"><abbr title="Extensible Hypertext Markup Language">XHTML</abbr> 5.1</a> specification and uses style sheets that conform to the <a href="http://jigsaw.w3.org./css-validator/validator?uri=https%3A%2F%2Fy.st.%2Fen%2Fweblog%2F2015%2F03-March%2F21.xhtml"><abbr title="Cascading Style Sheets">CSS</abbr>3</a> specification.
  148. </p>
  149. </body>
  150. </html>