Initial Commit

This commit is contained in:
rubenwardy 2014-12-11 08:56:37 +00:00
parent 816b7d010d
commit de9a5e60ad
11 changed files with 334 additions and 3 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
_site
.directory

7
README.md Normal file
View File

@ -0,0 +1,7 @@
minetest_doc
============
Minetest Tutorials
Don't fork or clone, I am going to rebase all these commits into "Initial Commit"

6
_config.yml Normal file
View File

@ -0,0 +1,6 @@
name: Minetest Tutorial and Documentation
description: Simple and easy to understand tutorial book
author: rubenwardy and contributors
permalink: pretty
absolute_url: http://rubenwardy.github.io/minetest_doc
url: http://localhost:4000/minetest_doc

3
_includes/footer.html Normal file
View File

@ -0,0 +1,3 @@
</div>
</body>
</html>

14
_includes/header.html Normal file
View File

@ -0,0 +1,14 @@
<!doctype html>
<html>
<head>
<title>{% if page.title != "Minetest Tutorial" %}{{ page.title }} - {% endif %}Minetest Tutorials and Documentation</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="{{ site.url }}/static/style.css">
<link rel="stylesheet" href="{{ site.url }}/static/syntax.css">
</head>
<body>
<ul id="navbar">
<li><a href="{{ site.url }}/" class="title">Minetest Tutorials</a></li>
<li><a href="{{ site.url }}/started">1 - Getting Started</a></li>
</ul>
<div id="page">

3
_layouts/default.html Normal file
View File

@ -0,0 +1,3 @@
{% include header.html %}
{{ content }}
{% include footer.html %}

3
_layouts/index.html Normal file
View File

@ -0,0 +1,3 @@
{% include header.html %}
{{ content }}
{% include footer.html %}

View File

@ -1,4 +1,27 @@
Minetest Documentation
======================
---
title: Minetest Tutorial
permalink: index.html
layout: default
---
* [Chapter One - Getting Started](started)
Minetest Tutorials and Documentation
====================================
What is this?
-------------
This online book will teach you how to create mods in easy chapters.
The chapters will explain a concept, give examples, and set tasks for you
to complete.
This documentation was created by the Minetest community in order to help
new modders gain a foothold.
Contribution
------------
You can contribute to this project on [GitHub](https://github.com/rubenwardy/minetest_doc).
It uses Jekyll to turn Markdown into a website.
Book written by rubenwardy and contributers.\\
License: [CC-BY-NC-SA 3.0](https://creativecommons.org/licenses/by-nc-sa/3.0/)

118
started.md Normal file
View File

@ -0,0 +1,118 @@
---
title: Chapter One - Getting Started
layout: default
---
Chapter One Getting Started
=============================
Introduction
------------
In this chapter we will learn how to create a mod's folder structure,
explore the modding API that Minetest has to offer, and learn how to use
it to create simple decorative mods.
### What you will need:
* A plain text editor (eg: NotePad+, ConTEXT, or GEdit)
* OR A Lua IDE such as Eclipse.
* A copy of Minetest in the 0.4 series. (eg: 0.4.10)
### Contents
* Mod Folders
* Mod Packs
* Dependencies
* Registering a simple node
Mod Folders
-----------
Each mod has its own folder, where all its Lua code, textures, models and sounds are placed.
These folders need to be placed in a mod location, such as minetest/mods, and they can be
placed in mod packs: as explained below.
### Mod Folder Structure
Mod Name
- init.lua - the main scripting code file, which is run when the game loads.
- (optional) depends.txt - a list of mod names that needs to be loaded before this mod.
- (optional) textures/ - place images here, commonly in the format modname_itemname.png
- (optional) sounds/ - place sounds in here
- (optional) models/ - place 3d models in here
...and any other lua files to be included by init.lua
Only the init.lua file is required in a mod for it to run on game load, however the other
items are needed by some mods to perform its functionality.
Dependencies
------------
The depends text file allows you to specify what mods this mod requires to run, and what
needs to be loaded before this mod.
depends.txt
modone
modtwo
modthree?
As you can see, each mod name is on its own line. The question mark after a mod name
means that it is not required for the mod to load, but if it is present,
then it needed to be loaded before this mod. Running your mod without having the
mods with names without a question mark above, such as ``modone``, will cause your mod to
be disabled, or if an earlier version of Minetest is used,
then the game will stop with an error message.
Mod Packs
---------
Mods can be grouped into mod packs, which are folders with the file modpack.txt in it
### Mod Pack Folder Structure
Mod Name
- modone/
- modtwo/
- modthree/
- modfour/
- Modpack.txt signals that this is a mod pack, content does not matter
Example Time
------------
Are you confused? Don't worry, here is an example putting all of this together.
### Mod Folder
mymod/
- init.lua
- depends.txt
### depends.txt
default
### init.lua
{% highlight lua %}
print("This file will be run at load time!")
minetest.register_node("mymod:node",{
description = "This is a node",
tiles = {
"mymod_node.png",
"mymod_node.png",
"mymod_node.png",
"mymod_node.png",
"mymod_node.png",
"mymod_node.png"
},
groups = {cracky = 1}
})
{% endhighlight %}
Our mod has a name of "mymod". It has two files: init.lua and depends.txt.
The script prints a message and then registers a node which will be explained in the next chapter.
The depends text file adds a dependency to the default mod, which is in minetest_game.
Questions
---------
* What is the minimum that a mod folder can contain?
* What language does Minetest use in its modding capability?

89
static/style.css Normal file
View File

@ -0,0 +1,89 @@
html, body {
font-family: "Arial", sans-serif;
margin: 0;
padding: 0;
background: #333;
}
#page {
background: white;
margin: 0;
padding: 0 20px 20px 20px;
position: absolute;
left: 250px;
right: 0;
top: 0;
}
#navbar {
position: absolute;
left: 0;
width: 250px;
top: 0;
padding: 0;
margin: 0;
display: block;
list-style: none;
background: #333;
color: white;
}
#navbar li {
display: block;
margin: 0;
padding: 0;
}
#navbar li a {
display: block;
padding: 5px;
color: #ccc;
text-decoration: none;
}
#navbar li a:hover {
background: #444;
}
#navbar li a.title {
text-align: center;
font-size: 120%;
font-weight: bold;
background: #363;
color: white;
}
#navbar li a.section_title {
text-align: center;
font-size: 110%;
border-bottom: 1px solid #999;
}
code {
display: inline-block;
padding: 10px;
margin: 2px;
background: #f0f0f0;
border: 1px solid #e0e0e0;
border-radius: 2px;
white-space: pre;
}
h1 {
text-align: center;
margin: 10px 0 0 0;
}
h2 {
border-bottom: 1px solid black;
margin: 40px 0 10px 0;
display: block;
padding: 0 0 5px 0;
}
h3 {
font-size: 105%;
font-weight: bold;
margin: 20px 0 10px 0;
}

63
static/syntax.css Normal file
View File

@ -0,0 +1,63 @@
/* https://github.com/mojombo/tpw/blob/master/css/syntax.css -MIT licensed*/
.highlight { background: #ffffff; }
.highlight .c { color: #999988; font-style: italic } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { font-weight: bold } /* Keyword */
.highlight .o { font-weight: bold } /* Operator */
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #999999 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #aaaaaa } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { font-weight: bold } /* Keyword.Constant */
.highlight .kd { font-weight: bold } /* Keyword.Declaration */
.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
.highlight .kr { font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #009999 } /* Literal.Number */
.highlight .s { color: #d14 } /* Literal.String */
.highlight .na { color: #008080 } /* Name.Attribute */
.highlight .nb { color: #0086B3 } /* Name.Builtin */
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
.highlight .no { color: #008080 } /* Name.Constant */
.highlight .ni { color: #800080 } /* Name.Entity */
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
.highlight .nn { color: #555555 } /* Name.Namespace */
.highlight .nt { color: #000080 } /* Name.Tag */
.highlight .nv { color: #008080 } /* Name.Variable */
.highlight .ow { font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #009999 } /* Literal.Number.Float */
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
.highlight .sb { color: #d14 } /* Literal.String.Backtick */
.highlight .sc { color: #d14 } /* Literal.String.Char */
.highlight .sd { color: #d14 } /* Literal.String.Doc */
.highlight .s2 { color: #d14 } /* Literal.String.Double */
.highlight .se { color: #d14 } /* Literal.String.Escape */
.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
.highlight .si { color: #d14 } /* Literal.String.Interpol */
.highlight .sx { color: #d14 } /* Literal.String.Other */
.highlight .sr { color: #009926 } /* Literal.String.Regex */
.highlight .s1 { color: #d14 } /* Literal.String.Single */
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #008080 } /* Name.Variable.Class */
.highlight .vg { color: #008080 } /* Name.Variable.Global */
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */