* More information at <http://www.minetest.net/>
* Developer Wiki: <http://dev.minetest.net/>
+
+
+
Introduction
-------------
+============
+
Content and functionality can be added to Minetest using Lua scripting
in run-time loaded mods.
* Linux: `$HOME/.minetest`
* Windows: `C:/users/<user>/AppData/minetest` (maybe)
+
+
+
Games
------
+=====
+
Games are looked up from:
* `$path_share/games/gameid/`
images named like `$identifier.$n.png`, with an ascending number $n starting
with 1, and a random image will be chosen from the provided ones.
+
+
+
+Mods
+====
+
Mod load path
-------------
Generic:
empty, except for lines starting with `#`, which are comments.
Mod directory structure
-------------------------
+-----------------------
mods
|-- modname
The `:` prefix can also be used for maintaining backwards compatibility.
+
+
+
Aliases
--------
+=======
+
Aliases can be added by using `minetest.register_alias(name, convert_to)` or
`minetest.register_alias_force(name, convert_to)`.
"mapgen_mossycobble"
"mapgen_stair_desert_stone"
+
+
+
Textures
---------
+========
+
Mods should generally prefix their textures with `modname_`, e.g. given
the mod name `foomod`, a texture could be called:
palette = "default_foilage.png",
})
+
+
+
Sounds
-------
+======
+
Only Ogg Vorbis files are supported.
For positional playing of sounds, only single-channel (mono) files are
* e.g. `{name = "default_place_node", gain = 1.0}`
* e.g. `{name = "default_place_node", gain = 1.0, pitch = 1.0}`
+
+
+
Registered definitions of stuff
--------------------------------
+===============================
+
Anything added using certain `minetest.register_*` functions get added to
the global `minetest.registered_*` tables.
return minetest.registered_items[name].groups[group]
end
+
+
+
Nodes
------
+=====
+
Nodes are the bulk data of the world: cubes and other things that take the
space of a cube. Huge amounts of them are handled efficiently, but they
are quite static.
+
+HUD
+===
+
HUD element types
-----------------
The position field is used for all element types.
text.
* `world_pos`: World position of the waypoint.
+
+
+
Representations of simple things
---------------------------------
+================================
### Position/vector
* `{type="node", under=pos, above=pos}`
* `{type="object", ref=ObjectRef}`
+
+
+
Flag Specifier Format
----------------------
+=====================
+
Flags using the standardized flag specifier format can be specified in either
of two ways, by string or table.
since, by default, no schematic attributes are set.
+
+
+
Items
------
+=====
### Item types
There are three kinds of items: nodes, tools and craftitems.
these formats.
+
+
Groups
-------
+======
+
In a number of places, there is a group table. Groups define the
properties of a thing (item, node, armor of entity, capabilities of
tool) in such a way that the engine and other mods can can interact with
cannot dig other groups; thus it is important to use a standard bunch of
groups to enable interaction with tools.
+
+
+
+Tools
+=====
+
#### Tools definition
Tools define:
easy nodes to be quickly breakable.
* At `level > 2`, the node is not diggable, because it's `level > maxlevel`
+
+
+
Entity damage mechanism
------------------------
+=======================
+
Damage calculation:
damage = 0
* If `direction` equals `nil` and `puncher` does not equal `nil`, `direction`
will be automatically filled in based on the location of `puncher`.
+
+
+
+Metadata
+========
+
Node Metadata
-------------
The instance of a node in the world normally only contains the three values
meta:set_string("key", "value")
print(dump(meta:to_table()))
+
+
+
Formspec
---------
+========
+
Formspec defines a menu. Currently not much else than inventories are
supported. It is a string, with a somewhat strange format.
**Note**: do _not_ use a element name starting with `key_`; those names are
reserved to pass key press events to formspec!
+
+
+
+Inventory
+=========
+
Inventory locations
-------------------
* `"context"`: Selected node metadata (deprecated: `"current_name"`)
* `craftpreview`: list containing the craft output
* `hand`: list containing an override for the empty hand
+
+
+
+Colours
+=======
+
`ColorString`
-------------
`#RGB` defines a color in hexadecimal format.
or string form, a ColorString (defined above):
`colorspec = "green"`
+
+
+
Escape sequences
-----------------
+================
+
Most text can contain escape sequences, that can for example color the text.
There are a few exceptions: tab headers, dropdowns and vertical labels can't.
The following functions provide escape sequences:
* `minetest.strip_colors(str)`
* Removes all color escape sequences.
+
+
+
Spatial Vectors
----------------
+===============
+
For the following functions, `v`, `v1`, `v2` are vectors,
`p1`, `p2` are positions:
* `vector.divide(v, x)`:
* Returns a scaled vector or Schur quotient.
+
+
+
Helper functions
-----------------
+================
+
* `dump2(obj, name, dumped)`: returns a string which makes `obj`
human-readable, handles reference loops.
* `obj`: arbitrary variable
position.
* returns the exact position on the surface of a pointed node
+
+
+
Translations
-------------
+============
Texts can be translated client-side with the help of `minetest.translate` and
translation files.
`minetest.translate`, but is in translation files.
* `@n` acts as a literal newline as well.
+
+
+
Perlin noise
-------------
+============
+
Perlin noise creates a continuously-varying value depending on the input values.
Usually in Minetest the input values are either 2D or 3D co-ordinates in nodes.
The result is used during map generation to create the terrain shape, vary heat
For 2D noise the Z component of `spread` is still defined but is ignored.
A single noise parameter table can be used for 2D or 3D noise.
+
+
+
+Ores
+====
+
Ore types
---------
These tell in what manner the ore is generated.
difference in noise displacement values. This flag has no effect for ore types
other than `puff`.
+
+
+
Decoration types
-----------------
+================
+
The varying types of decorations that can be placed.
### `simple`
This decoration type is intended to be used for multi-node sized discrete
structures, such as trees, cave spikes, rocks, and so on.
+
+
+
+Schematics
+==========
+
Schematic specifier
--------------------
A schematic specifier identifies a schematic by either a filename to a
* `force_placement`: Schematic nodes other than "ignore" will replace existing
nodes.
+
+
+
Lua Voxel Manipulator
----------------------
+=====================
+
### About VoxelManip
VoxelManip is a scripting interface to the internal 'Map Voxel Manipulator'
facility. The purpose of this object is for fast, low-level, bulk access to
`[z [y [x]]]`.
* `iterp(minp, maxp)`: same as above, except takes a vector
+
+
+
Mapgen objects
---------------
+==============
+
A mapgen object is a construct used in map generation. Mapgen objects can be
used by an `on_generate` callback to speed up operations by avoiding
unnecessary recalculations, these can be retrieved using the
Decorations have a key in the format of `"decoration#id"`, where `id` is the
numeric unique decoration ID.
+
+
+
Registered entities
--------------------
+===================
+
* Functions receive a "luaentity" as `self`:
* It has the member `.name`, which is the registered name `("mod:thing")`
* It has the member `.object`, which is an `ObjectRef` pointing to the
* Should return a string that will be passed to `on_activate` when
the object is instantiated the next time.
+
+
+
L-system trees
---------------
+==============
### Tree definition
minetest.spawn_tree(pos,apple_tree)
-`minetest` namespace reference
-------------------------------
+
+
+'minetest' namespace reference
+==============================
### Utilities
* List of registered decoration definitions.
+
+
Class reference
----------------
+===============
+
+Sorted alphabetically.
### `AreaStore`
A fast access data structure to store areas, and find areas near a given
* All methods in MetaDataRef
+
+
Definition tables
------------------
+=================
### Object Properties