diff --git a/README.md b/README.md
index 04f010a..b26067e 100644
--- a/README.md
+++ b/README.md
@@ -11,15 +11,15 @@ You can contribute to this project on GitHub.
It uses Jekyll to turn Markdown into a website.
Book written by rubenwardy and contributers.
-License: CC-BY-NC-SA 3.0
+License: CC-BY-SA 3.0
Contributing
------------
You don't need to run jekyll, you can just edit and create files in
chapters. In fact, you don't even need to do markdown, send me a word document
-and I can convert it into the correct formatting. It is the writing which is the hard
-bit, not the formatting.
+and I can convert it into the correct formatting.
+It is the writing which is the hard bit, not the formatting.
Running as a Website
--------------------
diff --git a/_config.yml b/_config.yml
index 8d1808b..ea78d59 100644
--- a/_config.yml
+++ b/_config.yml
@@ -1,5 +1,4 @@
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
diff --git a/_includes/header.html b/_includes/header.html
index 1473ceb..7f7e4f7 100644
--- a/_includes/header.html
+++ b/_includes/header.html
@@ -8,8 +8,11 @@
{{ page.title }}
diff --git a/book_index.md b/book_index.md
new file mode 100644
index 0000000..65238d8
--- /dev/null
+++ b/book_index.md
@@ -0,0 +1,26 @@
+---
+title: Index
+permalink: book_index.html
+layout: default
+root: ../
+---
+
+## C
+* Craft item
+ * [Registering Nodes and Items]({{ page.root }}chapters/nodes_items_crafting.html#registering-a-craftitem)
+
+## F
+* Food
+ * [Registering Nodes and Items]({{ page.root }}chapters/nodes_items_crafting.html#foods)
+
+## I
+* Item String
+ * [Registering Nodes and Items]({{ page.root }}chapters/nodes_items_crafting.html#item-strings)
+
+## N
+* Name
+ * [Registering Nodes and Items]({{ page.root }}chapters/nodes_items_crafting.html#item-strings)
+* Nodes
+ * [Registering Nodes and Items]({{ page.root }}chapters/nodes_items_crafting.html#registering-a-basic-node)
+* Node boxes
+ * [Registering Nodes and Items]({{ page.root }}chapters/nodes_items_crafting.html#node-boxes)
diff --git a/chapters/folders.md b/chapters/folders.md
index bdf3a7e..eefaa97 100644
--- a/chapters/folders.md
+++ b/chapters/folders.md
@@ -1,7 +1,6 @@
---
title: Folder Structure
layout: default
-permalink: folders/index.html
root: ../
---
@@ -11,16 +10,9 @@ Introduction
In this chapter we will learn how the basic structure of a mod's folder.
This is essential for creating 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
+* Dependencies
* Mod Packs
-* Dependencies
-* Registering a simple node
Mod Folders
-----------
@@ -110,4 +102,3 @@ minetest.register_node("mymod:node",{
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.
-
diff --git a/chapters/nodes_items_crafting.md b/chapters/nodes_items_crafting.md
new file mode 100644
index 0000000..1fe77fa
--- /dev/null
+++ b/chapters/nodes_items_crafting.md
@@ -0,0 +1,218 @@
+---
+title: Nodes, Items and Crafting
+layout: default
+root: ../
+---
+
+Introduction
+------------
+
+In this chapter we will learn how to register a new node or craftitem,
+and create craft recipes.
+
+* Item Names
+* Registering a Craftitem
+* Registering a Node
+* Drawtypes
+
+Item Strings
+------------
+
+Each item, whether that be a node, craftitem, tool or entity, has an item string.\\
+This is oftenly refered to as just name or registered name.
+A string in programming terms is a piece of text.
+
+ modname:itemname
+
+The modname is the name of the folder your mod is in.
+You may call the itemname any thing you like, however it should be relevant to what the item is,
+and it can't be already registered.
+
+### Overriding
+
+Overriding allows you to:
+
+* Create an item in another mod's namespace.
+* Override an existing item.
+
+To override, you prefix the item string with a colon, ``:``.
+Declaring an item as ``:default:dirt`` will override the default:dirt in the default mod.
+
+Textures
+--------
+
+Normally textures have a resolution of 16x16, but they can be in the order of 2: 16, 32, 64, 128, etc.
+
+Textures should be placed in textures/. Their name should match ``modname_itemname.png``.\\
+JPEGs are supported, but PNGs are recommended for non-realistic textures.
+
+Registering a Craftitem
+-----------------------
+
+Craftitems are the simplist item in Minetest. Craftitems cannot be placed in the world.
+They are used in recipes to create other items, or they can be used be the player, such as food.
+
+{% highlight lua %}
+minetest.register_craftitem("mymod:diamond_fragments", {
+ description = "Alien Diamond Fragments",
+ inventory_image = "mymod_diamond_fragments.png"
+})
+{% endhighlight %}
+
+Definitions are usually made up of an [item string](#item-strings) to identify the definition,
+and a definition table.
+
+### Foods
+
+Foods are items that cure health. To create a food item, you need to define the on_use property like this:
+
+{% highlight lua %}
+minetest.register_craftitem("mymod:mudpie", {
+ description = "Alien Mud Pie",
+ inventory_image = "myfood_mudpie.png",
+ on_use = minetest.item_eat(20)
+})
+{% endhighlight %}
+
+The number supplied to the minetest.item_eat function is the number of hit points that are healed by this food.
+Two hit points make one heart, and because there are 10 hearts there are 20 hitpoints.
+Hitpoints don't have to be integers (whole numbers), they can be decimals.
+
+
+Registering a basic node
+------------------------
+
+In Minetest, a node is an item that you can place.
+Most nodes are 1m x 1m x 1m cubes, however the shape doesn't
+have to be a cube - as we will explore later.
+
+Let's get onto it. A node's definition table is very similar to a craftitem's
+definition table, however you need to set the textures for the faces of the cube.
+
+{% highlight lua %}
+minetest.register_node("mymod:diamond", {
+ description = "Alien Diamond",
+ tiles = {"mymod_diamond.png"},
+ is_ground_content = true,
+ groups = {cracky=3, stone=1}
+})
+{% endhighlight %}
+
+Let's ignore ``groups`` for now, and take a look at the tiles.
+The ``tiles`` property is a table of texture names the node will use.
+When there is only one texture, this texture is used on every side.
+
+What if you would like a different texture for each side?
+Well, you give a table of 6 texture names, in this order:\\
+up (+Y), down (-Y), right (+X), left (-X), back (+Z), front (-Z).
+(+Y, -Y, +X, -X, +Z, -Z)
+
+Remember: +Y is upwards in Minetest, along with most video games.
+A plus direction means that it is facing positive co-ordinates,
+a negative direction means that it is facing negative co-ordinates.
+
+{% highlight lua %}
+minetest.register_node("mymod:diamond", {
+ description = "Alien Diamond",
+ tiles = {
+ "mymod_diamond_up.png",
+ "mymod_diamond_down.png",
+ "mymod_diamond_right.png",
+ "mymod_diamond_left.png",
+ "mymod_diamond_back.png",
+ "mymod_diamond_front.png"
+ },
+ is_ground_content = true,
+ groups = {cracky = 3},
+ drop = "mymod:diamond_fragments"
+ -- ^ Rather than dropping diamond, drop mymod:diamond_fragments
+})
+{% endhighlight %}
+
+Crafting
+--------
+
+There are several different types of crafting,
+identified by the ``type`` property.
+
+* shaped - Ingredients must be in the correct position.
+* shapeless - It doesn't matter where the ingredients are,
+ just that there is the right amount.
+* cooking - Recipes for the furnace to use.
+* tool_repair - Used to allow the repairing of tools.
+
+Craft recipes do not use Item Strings.
+
+### Shaped
+
+Shaped recipes are the normal recipes - the ingredients have to be in the
+right place.
+For example, when you are making a pickaxe the ingredients have to be in the
+right place for it to work.
+
+{% highlight lua %}
+minetest.register_craft({
+ output = "mymod:diamond_chair",
+ recipe = {
+ {"mymod:diamond_fragments", "", ""},
+ {"mymod:diamond_fragments", "mymod:diamond_fragments", ""},
+ {"mymod:diamond_fragments", "mymod:diamond_fragments, ""}
+ }
+})
+{% endhighlight %}
+
+This is pretty self-explanatory. You don't need to define the type, as
+shaped crafts are default.
+
+If you notice, there is a blank column at the far end.
+This means that the craft must always be exactly that.
+In most cases, such as the door recipe, you don't care if the ingredients
+are always in an exact place, you just want them correct relative to each
+other. In order to do this, delete any empty rows and columns.
+In the above case, their is an empty last column, which, when removed,
+allows the recipe to be crafted if it was all moved one place to the right.
+
+{% highlight lua %}
+minetest.register_craft({
+ output = "mymod:diamond_chair",
+ recipe = {
+ {"mymod:diamond_fragments", ""},
+ {"mymod:diamond_fragments", "mymod:diamond_fragments",
+ {"mymod:diamond_fragments", "mymod:diamond_fragments}
+ }
+})
+{% endhighlight %}
+
+(Explainations of more crafting types are coming soon)
+
+Groups
+------
+
+Items can be members of many groups, and groups may have many members.
+Groups are usually identified using ``group:group_name``
+There are several reason you use groups.
+
+Groups can be used in crafting recipes to allow interchangeability
+of ingredients. For example, you may use group:wood to allow any wood
+item to be used in the recipe.
+
+### Dig types
+
+Let's look at our above ``mymod:diamond`` definition. You'll notice this line:
+
+{% highlight lua %}
+groups = {cracky = 3}
+{% endhighlight %}
+
+Cracky is a digtype. Dig types specify what type of the material the node is
+physically, and what tools are best to destroy it.
+
+| Group | Description |
+|-------------------------|----------------------------------------------------------------------------------------------|
+| crumbly | dirt, sand |
+| cracky | tough but crackable stuff like stone. |
+| snappy | something that can be cut using fine tools; e.g. leaves, smallplants, wire, sheets of metal |
+| choppy | something that can be cut using force; e.g. trees, wooden planks |
+| fleshy | Living things like animals and the player. This could imply some blood effects when hitting. |
+| explody | Especially prone to explosions |
+| oddly_breakable_by_hand | Torches, etc, quick to dig |
diff --git a/index.md b/index.md
index 275717e..151c3e0 100644
--- a/index.md
+++ b/index.md
@@ -14,6 +14,13 @@ to complete.
This documentation was created by the Minetest community in order to help
new modders gain a foothold.
+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)
+
Contribution
------------
diff --git a/static/style.css b/static/style.css
index 4b66ba1..3369ea5 100644
--- a/static/style.css
+++ b/static/style.css
@@ -5,6 +5,11 @@ html, body {
background: #333;
}
+a {
+ color: blue;
+ text-decoration: underline;
+}
+
#page {
background: white;
margin: 0;
@@ -34,6 +39,12 @@ html, body {
padding: 0;
}
+#navbar li hr {
+ height: 1px;
+ background: #666;
+ border: none;
+}
+
#navbar li a {
display: block;
padding: 5px;
diff --git a/static/syntax.css b/static/syntax.css
index 9426b6f..6fed4d9 100644
--- a/static/syntax.css
+++ b/static/syntax.css
@@ -1,63 +1,63 @@
-/* https://github.com/mojombo/tpw/blob/master/css/syntax.css -MIT licensed*/
+/* https://raw.githubusercontent.com/richleland/pygments-css/master/friendly.css */
-.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 .hll { background-color: #ffffcc }
+.highlight .c { color: #60a0b0; font-style: italic } /* Comment */
+.highlight .err { border: 1px solid #FF0000 } /* Error */
+.highlight .k { color: #007020; font-weight: bold } /* Keyword */
+.highlight .o { color: #666666 } /* Operator */
+.highlight .cm { color: #60a0b0; font-style: italic } /* Comment.Multiline */
+.highlight .cp { color: #007020 } /* Comment.Preproc */
+.highlight .c1 { color: #60a0b0; font-style: italic } /* Comment.Single */
+.highlight .cs { color: #60a0b0; background-color: #fff0f0 } /* Comment.Special */
+.highlight .gd { color: #A00000 } /* Generic.Deleted */
.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 .gr { color: #FF0000 } /* Generic.Error */
+.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
+.highlight .gi { color: #00A000 } /* Generic.Inserted */
+.highlight .go { color: #808080 } /* Generic.Output */
+.highlight .gp { color: #c65d09; font-weight: bold } /* 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 .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
+.highlight .gt { color: #0040D0 } /* Generic.Traceback */
+.highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
+.highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
+.highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
+.highlight .kp { color: #007020 } /* Keyword.Pseudo */
+.highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
+.highlight .kt { color: #902000 } /* Keyword.Type */
+.highlight .m { color: #40a070 } /* Literal.Number */
+.highlight .s { color: #4070a0 } /* Literal.String */
+.highlight .na { color: #4070a0 } /* Name.Attribute */
+.highlight .nb { color: #007020 } /* Name.Builtin */
+.highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
+.highlight .no { color: #60add5 } /* Name.Constant */
+.highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */
+.highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */
+.highlight .ne { color: #007020 } /* Name.Exception */
+.highlight .nf { color: #06287e } /* Name.Function */
+.highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
+.highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
+.highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
+.highlight .nv { color: #bb60d5 } /* Name.Variable */
+.highlight .ow { color: #007020; 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 */
-
+.highlight .mf { color: #40a070 } /* Literal.Number.Float */
+.highlight .mh { color: #40a070 } /* Literal.Number.Hex */
+.highlight .mi { color: #40a070 } /* Literal.Number.Integer */
+.highlight .mo { color: #40a070 } /* Literal.Number.Oct */
+.highlight .sb { color: #4070a0 } /* Literal.String.Backtick */
+.highlight .sc { color: #4070a0 } /* Literal.String.Char */
+.highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
+.highlight .s2 { color: #4070a0 } /* Literal.String.Double */
+.highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
+.highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */
+.highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
+.highlight .sx { color: #c65d09 } /* Literal.String.Other */
+.highlight .sr { color: #235388 } /* Literal.String.Regex */
+.highlight .s1 { color: #4070a0 } /* Literal.String.Single */
+.highlight .ss { color: #517918 } /* Literal.String.Symbol */
+.highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
+.highlight .vc { color: #bb60d5 } /* Name.Variable.Class */
+.highlight .vg { color: #bb60d5 } /* Name.Variable.Global */
+.highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
+.highlight .il { color: #40a070 } /* Literal.Number.Integer.Long */