123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <?xml version="1.0" encoding="utf-8"?>
- <!--
-
- h t t :: / / t /
- h t t :: // // t //
- h ttttt ttttt ppppp sssss // // y y sssss ttttt //
- hhhh t t p p s // // y y s t //
- h hh t t ppppp sssss // // yyyyy sssss t //
- h h t t p s :: / / y .. s t .. /
- h h t t p sssss :: / / yyyyy .. sssss t .. /
-
- <https://y.st./>
- Copyright © 2015 Alex Yst <mailto:copyright@y.st>
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <https://www.gnu.org./licenses/>.
- -->
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <base href="https://y.st./en/weblog/2015/03-March/21.xhtml" />
- <title>Work on minetyst_game begins <https://y.st./en/weblog/2015/03-March/21.xhtml></title>
- <link rel="icon" type="image/png" href="/link/CC_BY-SA_4.0/y.st./icon.png" />
- <link rel="stylesheet" type="text/css" href="/link/basic.css" />
- <link rel="stylesheet" type="text/css" href="/link/site-specific.css" />
- <script type="text/javascript" src="/script/javascript.js" />
- <meta name="viewport" content="width=device-width" />
- </head>
- <body>
- <nav>
- <p>
- <a href="/en/">Home</a> |
- <a href="/en/a/about.xhtml">About</a> |
- <a href="/en/a/contact.xhtml">Contact</a> |
- <a href="/a/canary.txt">Canary</a> |
- <a href="/en/URI_research/"><abbr title="Uniform Resource Identifier">URI</abbr> research</a> |
- <a href="/en/opinion/">Opinions</a> |
- <a href="/en/coursework/">Coursework</a> |
- <a href="/en/law/">Law</a> |
- <a href="/en/a/links.xhtml">Links</a> |
- <a href="/en/weblog/2015/03-March/21.xhtml.asc">{this page}.asc</a>
- </p>
- <hr/>
- <p>
- Weblog index:
- <a href="/en/weblog/"><abbr title="American Standard Code for Information Interchange">ASCII</abbr> calendars</a> |
- <a href="/en/weblog/index_ol_ascending.xhtml">Ascending list</a> |
- <a href="/en/weblog/index_ol_descending.xhtml">Descending list</a>
- </p>
- <hr/>
- <p>
- Jump to entry:
- <a href="/en/weblog/2015/03-March/07.xhtml"><<First</a>
- <a rel="prev" href="/en/weblog/2015/03-March/20.xhtml"><Previous</a>
- <a rel="next" href="/en/weblog/2015/03-March/22.xhtml">Next></a>
- <a href="/en/weblog/latest.xhtml">Latest>></a>
- </p>
- <hr/>
- </nav>
- <header>
- <h1>Work on minetyst_game begins</h1>
- <p>Day 00014: Saturday, 2015 March 21</p>
- </header>
- </p>
- It's far too easy to die and lose everything on the <a href="https://forum.minetest.net/viewtopic.php?f=10&t=10539">just test</a> server.
- 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.
- It doesn't help that hoards of monsters come out at night or that you can't save your place with the <code>/sethome</code> command.
- I've decided to switch servers, and am now playing on the <a href="http://linuxgaming.us/">LinuxGaming.us</a> server.
- This new server both allows you to set a home warp point and is (as far as I can tell) monster-free.
- I'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.
- I still haven't made it to the area yet though, as playing the game for extended periods of time overheats my laptop.
- </p>
- </p>
- 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.
- 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.
- Furthermore, these nodes aren't even all defined in minetest_game like they should be.
- This script searches through the source code to locate the nodes the engine calls for so I can be sure to define them.
- This isn't the first time I've written this script, but I don't have a copy from before my recent data loss indecent.
- 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.
- 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.
- Tomorrow, I will probably look over the output of the script and will maybe start work on mutilating minetest_game to form minetyst_game.
- I don't have a place to put code at the moment, so I'll just drop it here for now.
- </p>
- <code><span class="PHP-T_OPEN_TAG"><?php<br/>
- </span><span class="PHP-T_COMMENT">#    Minetest C++ Source Code Node Finder<br/>
- </span><span class="PHP-T_COMMENT">#    Copyright © 2015 Alex Yst <mailto:copyright@y.st><br/>
- </span><span class="PHP-T_WHITESPACE"><br/>
- </span><span class="PHP-T_COMMENT">#    This program is free software: you can redistribute it and/or modify<br/>
- </span><span class="PHP-T_COMMENT">#    it under the terms of the GNU General Public License as published by<br/>
- </span><span class="PHP-T_COMMENT">#    the Free Software Foundation, either version 3 of the License, or<br/>
- </span><span class="PHP-T_COMMENT">#    (at your option) any later version.<br/>
- </span><span class="PHP-T_WHITESPACE"><br/>
- </span><span class="PHP-T_COMMENT">#    This program is distributed in the hope that it will be useful,<br/>
- </span><span class="PHP-T_COMMENT">#    but WITHOUT ANY WARRANTY; without even the implied warranty of<br/>
- </span><span class="PHP-T_COMMENT">#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br/>
- </span><span class="PHP-T_COMMENT">#    GNU General Public License for more details.<br/>
- </span><span class="PHP-T_WHITESPACE"><br/>
- </span><span class="PHP-T_COMMENT">#    You should have received a copy of the GNU General Public License<br/>
- </span><span class="PHP-T_COMMENT">#    along with this program. If not, see <http://www.gnu.org./licenses/>.<br/>
- </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">'{->set\([0-9a-fx]+, "([^"]*)"\)|->getId\("([^"]*)"\)}'</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
- </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">'.'</span><span class="PHP-T">)</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
- </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">-></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/>
-     </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/>
-         </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/>
-         </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">=></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/>
-             </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">''</span><span class="PHP-T">)</span><span class="PHP-T">:</span><span class="PHP-T_WHITESPACE"><br/>
-                 </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/>
-             </span><span class="PHP-T_ENDIF">endif</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
-             </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">''</span><span class="PHP-T">)</span><span class="PHP-T">:</span><span class="PHP-T_WHITESPACE"><br/>
-                 </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/>
-             </span><span class="PHP-T_ENDIF">endif</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
-         </span><span class="PHP-T_ENDFOREACH">endforeach</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
-     </span><span class="PHP-T_ENDIF">endif</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
- </span><span class="PHP-T_ENDWHILE">endwhile</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
- </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/>
- </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">=></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/>
-     </span><span class="PHP-T_ECHO">echo</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_CONSTANT_ENCAPSED_STRING">'-- '</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">"\n"</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
-     </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/>
-     </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">=></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/>
-         </span><span class="PHP-T_ECHO">echo</span><span class="PHP-T_WHITESPACE"> </span><span class="PHP-T_CONSTANT_ENCAPSED_STRING">'-- -- '</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">"\n"</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
-     </span><span class="PHP-T_ENDFOREACH">endforeach</span><span class="PHP-T">;</span><span class="PHP-T_WHITESPACE"><br/>
- </span><span class="PHP-T_ENDFOREACH">endforeach</span><span class="PHP-T">;</span></code>
- </p>
- The <abbr title="PHP: Hypertext Preprocessor">PHP</abbr> <code>highlight_string()</code> function outputs a mess.
- 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.
- Specifically, I'll remove the output of <code>&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.
- </p>
- </p>
- My <a href="/a/canary.txt">canary</a> still sings the tune of freedom and transparency.
- </p>
- <hr/>
- <p>
- Copyright © 2015 Alex Yst;
- 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's Not Unix">GNU</abbr> <abbr title="General Public License version Three or later">GPLv3+</abbr></a>.
- If for some reason you would prefer to modify and/or distribute this document under other free copyleft terms, please ask me via email.
- My address is in the source comments near the top of this document.
- This license also applies to embedded content such as images.
- For more information on that, see <a href="/en/a/licensing.xhtml">licensing</a>.
- </p>
- <p>
- <abbr title="World Wide Web Consortium">W3C</abbr> standards are important.
- 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.
- </p>
- </body>
- </html>
|