diff --git a/chapters/abms.md b/chapters/abms.md index e9da473..b4c62e4 100644 --- a/chapters/abms.md +++ b/chapters/abms.md @@ -4,8 +4,7 @@ layout: default root: ../ --- -Introduction ------------- +## Introduction In this chapter we will learn how to create an **A**ctive **B**lock **M**odifier (**ABM**). An active block modifier allows you to run code on certain nodes at certain @@ -16,8 +15,7 @@ massive amounts of lag. Use them lightly. * Special Growing Grass * Your Turn -Special Growing Grass ---------------------- +## Special Growing Grass We are now going to make a mod (yay!). It will add a type of grass called alien grass - it grows near water on grassy @@ -50,8 +48,7 @@ blocks above grass blocks - you should check there is space by doing minetest.ge That's really all there is to ABMs. Specifying a neighbor is optional, so is chance. -Your Turn ---------- +## Your Turn * **Midas touch**: Make water turn to gold blocks with a 1 in 100 chance, every 5 seconds. * **Decay**: Make wood turn into dirt when water is a neighbor. diff --git a/chapters/folders.md b/chapters/folders.md index 07f519c..be89f95 100644 --- a/chapters/folders.md +++ b/chapters/folders.md @@ -4,8 +4,7 @@ layout: default root: ../ --- -Introduction ------------- +## Introduction In this chapter we will learn the basic structure of a mod's folder. This is an essential skill when creating mods. @@ -14,8 +13,7 @@ This is an essential skill when creating mods. * Dependencies * Mod Packs -Mod Folders ------------ +## Mod Folders ![Find the mod's folder]({{ page.root }}/static/folder_modfolder.jpg) @@ -40,8 +38,7 @@ in needs to be called the same as the mod name. 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 their functionality. -Dependencies ------------- +## 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. @@ -60,8 +57,7 @@ However, if the mod is not installed, the current one still loads. This is in contrast to normal dependencies, which will cause the current mod not to work if the mod is not installed. -Mod Packs ---------- +## Mod Packs Modpacks allow multiple mods to be packaged together, and move together. They are useful if you want to supply multiple mods to a player but don't @@ -75,8 +71,7 @@ want to make them download each one individually. - modfour/ - modpack.txt – signals that this is a mod pack, content does not matter -Example Time ------------- +## Example Time Are you confused? Don't worry, here is an example putting all of this together. diff --git a/chapters/formspecs.md b/chapters/formspecs.md index ae981ce..fab5313 100644 --- a/chapters/formspecs.md +++ b/chapters/formspecs.md @@ -4,8 +4,7 @@ layout: default root: ../ --- -Introduction ------------- +## Introduction
Furnace Inventory @@ -28,8 +27,7 @@ tend to disrupt game play. * Contexts * Node Meta Formspecs -Formspec Syntax ---------------- +## Formspec Syntax Formspecs have a rather weird syntax. They consist of a series of tags which are in the following form: @@ -68,8 +66,7 @@ You should look in [lua_api.txt](https://github.com/minetest/minetest/blob/maste for a list of all possible elements, just search for "Formspec". It is near line 1019, at time of writing. -Displaying Formspecs --------------------- +## Displaying Formspecs Here is a generalized way to show a formspec @@ -114,8 +111,7 @@ Note: the .. is used to join two strings together. The following two lines are e "foo" .. "bar" {% endhighlight %} -Callbacks ---------- +## Callbacks Let's expand on the above example. @@ -177,8 +173,7 @@ for a clicked button. } {% endhighlight %} -Contexts --------- +## Contexts In quite a lot of cases you want your minetest.show_formspec to give information to the callback which you don't want to have to send to the client. Information @@ -240,8 +235,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) end) {% endhighlight %} -Node Meta Formspecs -------------------- +## Node Meta Formspecs minetest.show_formspec is not the only way to show a formspec, you can also add formspecs to a node's meta data. This is used on nodes such as chests to diff --git a/chapters/hud.md b/chapters/hud.md index f86b5e0..06d6a7a 100644 --- a/chapters/hud.md +++ b/chapters/hud.md @@ -11,8 +11,7 @@ root: ../ Be aware that you may need to update your mods if the API is changed. -Introduction ------------- +## Introduction Heads Up Display (HUD) elements allow you to show text, images, and other graphical elements. @@ -24,8 +23,7 @@ HUD doesn't accept user input. For that, you should use a [Formspec](formspecs.h * Image Elements * Other Elements -Basic Interface ---------------- +## Basic Interface HUD elements are created using a player object. You can get the player object from a username like this: @@ -64,8 +62,7 @@ You can also delete the element: player:hud_remove(idx) {% endhighlight %} -Positioning ------------ +## Positioning Screens come in different sizes, and HUD elements need to work well on all sizes. You locate an element using a combination of a position and an offset. @@ -80,8 +77,7 @@ co-ordinates (0 * width + 10, 0 * height + 10). Please note that offset scales to DPI and a user defined factor. -Text Elements -------------- +## Text Elements A text element is the simplest form of a HUD element.\\ Here is our earlier example, but with comments to explain each part: @@ -112,8 +108,7 @@ local idx = player:hud_add({ }) {% endhighlight %} -Image Elements --------------- +## Image Elements Displays an image on the HUD. @@ -122,7 +117,6 @@ Negative values represent that percentage of the screen it should take; e.g. x=- Use `text` to specify the name of the texture. -Other Elements --------------- +## Other Elements Have a look at [lua_api.txt]({{ page.root }}lua_api.html#hud-element-types) for a complete list of HUD elements. diff --git a/chapters/lua.md b/chapters/lua.md index fd4e281..1cdd1bd 100644 --- a/chapters/lua.md +++ b/chapters/lua.md @@ -4,8 +4,7 @@ layout: default root: ../ --- -Introduction ------------- +## Introduction In this chapter we will talk about scripting in Lua, the tools required, and go over some techniques which you will probably find useful. @@ -16,8 +15,7 @@ and go over some techniques which you will probably find useful. * Local and Global * Including other Lua Scripts -Programming ------------ +## Programming Teaching you how to program is beyond the scope of this book. @@ -31,8 +29,7 @@ learning the problem solving techniques required to program.\\ Programming is all about breaking down problems into steps a computer can manage.\\ Scratch is **designed to teach children** how to program, it isn't a serious programming language. -Tools ------ +## Tools A text editor with code highlighting is sufficient for writing scripts in Lua. Code highlighting gives different colors to different words and characters @@ -80,8 +77,7 @@ One such IDE is Eclipse with the Koneki Lua plugin: * Start Minetest. * Enter the game to startup Lua. -Local and Global ----------------- +## Local and Global Whether a variable is local or global determines where it can be written to or read to. A local variable is only accessible from where it is defined. Here are some examples: @@ -168,8 +164,7 @@ end mymod.foo("foobar") {% endhighlight %} -Including other Lua Scripts ---------------------------- +## Including other Lua Scripts You can include Lua scripts from your mod, or another mod like this: diff --git a/chapters/node_drawtypes.md b/chapters/node_drawtypes.md index 5fe0be2..065cddb 100644 --- a/chapters/node_drawtypes.md +++ b/chapters/node_drawtypes.md @@ -11,8 +11,7 @@ root: ../ and placeholder images are being used. -Introduction ------------- +## Introduction In this chapter we explain all the different types of node drawtypes there are. @@ -44,8 +43,7 @@ This article is not complete yet. These drawtypes are missing: * Raillike * Mesh -Normal ------- +## Normal
Normal Drawtype @@ -77,8 +75,7 @@ minetest.register_node("mymod:diamond", { {% endhighlight %} -Airlike -------- +## Airlike These nodes are see through, and thus have no textures. @@ -86,11 +83,11 @@ These nodes are see through, and thus have no textures. minetest.register_node("myair:air", { description = "MyAir (you hacker you!)", drawtype = "airlike", - - paramtype = "light", + + paramtype = "light", -- ^ Allows light to propagate through the node with the -- light value falling by 1 per node. - + sunlight_propagates = true, -- Sunlight shines through walkable = false, -- Would make the player collide with the air node pointable = false, -- You can't select the node @@ -98,15 +95,14 @@ minetest.register_node("myair:air", { buildable_to = true, -- Nodes can be replace this node. -- (you can place a node and remove the air node -- that used to be there) - + air_equivalent = true, drop = "", groups = {not_in_creative_inventory=1} }) {% endhighlight %} -Liquid ------- +## Liquid
Liquid Drawtype @@ -126,7 +122,7 @@ minetest.register_node("default:water_source", { inventory_image = minetest.inventorycube("default_water.png"), -- ^ this is required to stop the inventory image from being animated - + tiles = { { name = "default_water_source_animated.png", @@ -138,7 +134,7 @@ minetest.register_node("default:water_source", { } } }, - + special_tiles = { -- New-style water source material (mostly unused) { @@ -183,8 +179,7 @@ minetest.register_node("default:water_source", { See default:water_flowing in the default mod in minetest_game, it is mostly the same as the above example -Glasslike ---------- +## Glasslike
Glasslike Drawtype @@ -216,11 +211,10 @@ minetest.register_node("default:obsidian_glass", { }) {% endhighlight %} -Glasslike_Framed ----------------- +## Glasslike_Framed -This makes the node's edge go around the whole thing, rather than individual nodes, -like the following: +This makes the node's edge go around the whole thing with a 3D effect, rather +than individual nodes, like the following:
Glasslike_framed's Edges @@ -233,14 +227,14 @@ like the following: minetest.register_node("default:glass", { description = "Glass", drawtype = "glasslike_framed", - + tiles = {"default_glass.png", "default_glass_detail.png"}, inventory_image = minetest.inventorycube("default_glass.png"), - + paramtype = "light", sunlight_propagates = true, -- Sunlight can shine through block is_ground_content = false, -- Stops caves from being generated over this node. - + groups = {cracky = 3, oddly_breakable_by_hand = 3}, sounds = default.node_sound_glass_defaults() }) @@ -250,8 +244,7 @@ minetest.register_node("default:glass", { "optional" drawtypes need less rendering time if deactivated on the client's side. -Allfaces --------- +## Allfaces
Allfaces drawtype @@ -298,7 +291,7 @@ minetest.register_node("foobar:torch", { inventory_image = "foobar_torch_floor.png", wield_image = "default_torch_floor.png", light_source = LIGHT_MAX-1, - + -- Determines how the torch is selected, ie: the wire box around it. -- each value is { x1, y1, z1, x2, y2, z2 } -- (x1, y1, y1) is the bottom front left corner @@ -313,8 +306,7 @@ minetest.register_node("foobar:torch", { }) {% endhighlight %} -Nodebox -------- +## Nodebox
Nodebox drawtype diff --git a/chapters/nodes_items_crafting.md b/chapters/nodes_items_crafting.md index d489f5d..1c8ce1d 100644 --- a/chapters/nodes_items_crafting.md +++ b/chapters/nodes_items_crafting.md @@ -4,8 +4,7 @@ layout: default root: ../ --- -Introduction ------------- +## Introduction In this chapter we will learn how to register a new node or craftitem, and create craft recipes. @@ -18,8 +17,7 @@ and create craft recipes. * Crafting * Groups -Item Strings ------------- +## Item Strings Each item, whether that be a node, craftitem, tool or entity, has an item string.\\ This is sometimes referred to as registered name or just name. @@ -41,8 +39,7 @@ Overriding allows you to: 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 --------- +## Textures Textures are usually 16 by 16 pixels. They can be any resolution, but it is recommended that they are in the order of 2 (eg, 16, 32, 64, 128, etc), @@ -51,8 +48,7 @@ as other resolutions may not be supported correctly on older devices. Textures should be placed in textures/. Their name should match ``modname_itemname.png``.\\ JPEGs are supported, but they do not support transparency and are generally bad quality at low resolutions. -Registering a Craftitem ------------------------ +## Registering a Craftitem Craftitems are the simplest items 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. @@ -107,7 +103,7 @@ minetest.register_craftitem("mymod:mudpie", { minetest.chat_send_player(user:get_player_name(), "You ate an alien mud pie!") -- Support for hunger mods using minetest.register_on_item_eat - for _, callback in pairs(minetest.registered_on_item_eats) do + for _ , callback in pairs(minetest.registered_on_item_eats) do local result = callback(hp_change, replace_with_item, itemstack, user, pointed_thing) if result then return result @@ -126,8 +122,7 @@ minetest.register_craftitem("mymod:mudpie", { If you are creating a hunger mod, or if you are affecting foods outside of your mod, you should consider using minetest.register_on_item_eat -Registering a basic node ------------------------- +## 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 @@ -178,8 +173,7 @@ minetest.register_node("mymod:diamond", { The is_ground_content attribute allows caves to be generated over the stone. -Crafting --------- +## Crafting There are several different types of crafting, identified by the ``type`` property. @@ -235,8 +229,7 @@ minetest.register_craft({ (Explainations of more crafting types are coming soon) -Groups ------- +## Groups Items can be members of many groups, and groups may have many members. Groups are usually identified using ``group:group_name`` diff --git a/chapters/player_physics.md b/chapters/player_physics.md index 920ed98..9a0c45b 100644 --- a/chapters/player_physics.md +++ b/chapters/player_physics.md @@ -4,8 +4,7 @@ layout: default root: ../ --- -Introduction ------------- +## Introduction Player physics can be modified using physics overrides. Physics overrides can set the walking speed, jump speed and gravity constants. Physics overrides are set on a player @@ -15,8 +14,7 @@ as strong. * Basic Interface * Your Turn -Basic Interface ---------------- +## Basic Interface Here is an example which adds an antigravity command, which puts the caller in low G: @@ -57,8 +55,7 @@ Please be warned that mods that override the physics of a player tend to be incompatible with each other. When setting an override, it overwrites and override that has been set before, by your or anyone else's mod. -Your Turn ---------- +## Your Turn * **sonic**: Set the speed multiplayer to a high value (at least 6) when a player joins the game. * **super bounce**: Increase the jump value so that the player can jump up 20 meters (1 meter is 1 block). diff --git a/chapters/releasing.md b/chapters/releasing.md index 56a82d4..5ac3563 100644 --- a/chapters/releasing.md +++ b/chapters/releasing.md @@ -4,8 +4,7 @@ layout: default root: ../ --- -Introduction ------------- +## Introduction In this chapter we will find out how to publish a mod so that other users can use it. @@ -19,8 +18,7 @@ In this chapter we will find out how to publish a mod so that other users can us * Is there another mod that does the same thing? If so, how does yours differ or improve on it? * Is your mod useful? -License Choices ---------------- +## License Choices You need to specify a license for your mod. **Public domain is not a valid licence**, as the definition varies in different countries. @@ -71,8 +69,7 @@ These licenses allows anyone to do what they want with your mod. Modify, redistribute, sell, leave out attribution. They can be used for both code and art. -Packaging ---------- +## Packaging There are some files that we recommend you include in your mod when you release it. @@ -182,11 +179,10 @@ Click browse and select the zipped file. I suggest that you enter the version of
-Forum Topic ------------ +## Forum Topic You can now create a forum topic. You should create it in -the ["WIP Mods"](https://forum.minetest.net/viewforum.php?f=9) (Work In Progress) +the ["WIP Mods"](https://forum.minetest.net/viewforum.php?f=9) (Work In Progress) forum.\\ When you consider your mod no longer a work in progress, you can [request that it be moved](https://forum.minetest.net/viewtopic.php?f=11&t=10418) @@ -233,7 +229,7 @@ Here is an example. The Minetest forum uses bbcode for formating. For further information or help see: [url]http://wiki.minetest.com/wiki/Installing_Mods[/url] - + If you modify the above example for your mod topic, remember to change "modfldername" to the name of the folder your mod should be in.