From de9a5e60adda2af60067bf13ba41aa3861a14445 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Thu, 11 Dec 2014 08:56:37 +0000 Subject: [PATCH] Initial Commit --- .gitignore | 2 + README.md | 7 +++ _config.yml | 6 +++ _includes/footer.html | 3 ++ _includes/header.html | 14 +++++ _layouts/default.html | 3 ++ _layouts/index.html | 3 ++ index.md | 29 +++++++++-- started.md | 118 ++++++++++++++++++++++++++++++++++++++++++ static/style.css | 89 +++++++++++++++++++++++++++++++ static/syntax.css | 63 ++++++++++++++++++++++ 11 files changed, 334 insertions(+), 3 deletions(-) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 _config.yml create mode 100644 _includes/footer.html create mode 100644 _includes/header.html create mode 100644 _layouts/default.html create mode 100644 _layouts/index.html create mode 100644 started.md create mode 100644 static/style.css create mode 100644 static/syntax.css diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..924f80b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +_site +.directory diff --git a/README.md b/README.md new file mode 100644 index 0000000..dda256d --- /dev/null +++ b/README.md @@ -0,0 +1,7 @@ +minetest_doc +============ + +Minetest Tutorials + + +Don't fork or clone, I am going to rebase all these commits into "Initial Commit" diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000..c5dd807 --- /dev/null +++ b/_config.yml @@ -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 diff --git a/_includes/footer.html b/_includes/footer.html new file mode 100644 index 0000000..faf65ca --- /dev/null +++ b/_includes/footer.html @@ -0,0 +1,3 @@ + + + diff --git a/_includes/header.html b/_includes/header.html new file mode 100644 index 0000000..08e39a7 --- /dev/null +++ b/_includes/header.html @@ -0,0 +1,14 @@ + + + + {% if page.title != "Minetest Tutorial" %}{{ page.title }} - {% endif %}Minetest Tutorials and Documentation + + + + + + +
diff --git a/_layouts/default.html b/_layouts/default.html new file mode 100644 index 0000000..4f0db4c --- /dev/null +++ b/_layouts/default.html @@ -0,0 +1,3 @@ +{% include header.html %} +{{ content }} +{% include footer.html %} diff --git a/_layouts/index.html b/_layouts/index.html new file mode 100644 index 0000000..4f0db4c --- /dev/null +++ b/_layouts/index.html @@ -0,0 +1,3 @@ +{% include header.html %} +{{ content }} +{% include footer.html %} diff --git a/index.md b/index.md index c1fd7e5..5edb4dd 100644 --- a/index.md +++ b/index.md @@ -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/) diff --git a/started.md b/started.md new file mode 100644 index 0000000..200dc63 --- /dev/null +++ b/started.md @@ -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? + diff --git a/static/style.css b/static/style.css new file mode 100644 index 0000000..edc067d --- /dev/null +++ b/static/style.css @@ -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; +} diff --git a/static/syntax.css b/static/syntax.css new file mode 100644 index 0000000..9426b6f --- /dev/null +++ b/static/syntax.css @@ -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 */ +