=================
GitHub Repo: https://github.com/minetest/minetest_game
+
Introduction
------------
* [#ABC] refers to a section in this document
* [pos] refers to a position table `{x = -5, y = 0, z = 200}`
+
Bucket API
----------
The filled bucket item is returned to the player that uses an empty bucket pointing to the given liquid source.
When punching with an empty bucket pointing to an entity or a non-liquid node, the on_punch of the entity or node will be triggered.
+
Beds API
--------
}
}
+
Bones API
---------
e.g. `table.insert(bones.player_inventory_lists, "backpack")`
+
Creative API
------------
page. Mods can use it to add additional formspec elements onto the default
creative inventory formspec to be drawn after each update.
+
Chests API
----------
groups = {choppy = 2, oddly_breakable_by_hand = 2},
protected = false, -- If true, only placer can modify chest.
+
Doors API
---------
The doors mod allows modders to register custom doors and trapdoors.
+`doors.registered_doors[name] = Door definition`
+ * Table of registered doors, indexed by door name
+
+`doors.registered_trapdoors[name] = Trapdoor definition`
+ * Table of registered trap doors, indexed by trap door name
+
`doors.register_door(name, def)`
* Registers new door
has the permissions needed to open this door. If omitted then no
permission checks are performed.
+`doors.door_toggle(pos, node, clicker)`
+
+ * Toggle door open or shut
+ * `pos` Position of the door
+ * `node` Node definition
+ * `clicker` Player definition for the player that clicked on the door
+
### Door definition
description = "Door description",
inventory_image = "mod_door_inv.png",
groups = {choppy = 2},
tiles = {"mod_door.png"}, -- UV map.
+ -- The front and back of the door must be identical in appearence as they swap on
+ -- open/close.
recipe = craftrecipe,
sounds = default.node_sound_wood_defaults(), -- optional
sound_open = sound play for open door, -- optional
sound_close = sound play for close door, -- optional
protected = false, -- If true, only placer can open the door (locked for others)
+ on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
+ -- optional function containing the on_rightclick callback, defaults to a doors.door_toggle-wrapper
### Trapdoor definition
inventory_image = "mod_trapdoor_inv.png",
groups = {choppy = 2},
tile_front = "doors_trapdoor.png", -- the texture for the front and back of the trapdoor
- tile_side = "doors_trapdoor_side.png", -- the tiles of the four side parts of the trapdoor
+ tile_side = "doors_trapdoor_side.png",
+ -- The texture for the four sides of the trapdoor.
+ -- The texture should have the trapdoor side drawn twice, in the lowest and highest
+ -- 1/8ths of the texture, both upright. The area between is not used.
+ -- The lower 1/8th will be used for the closed trapdoor, the higher 1/8th will be used
+ -- for the open trapdoor.
sounds = default.node_sound_wood_defaults(), -- optional
sound_open = sound play for open door, -- optional
sound_close = sound play for close door, -- optional
protected = false, -- If true, only placer can open the door (locked for others)
+ on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
+ -- function containing the on_rightclick callback
+ on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
+ -- function containing the on_rightclick callback
### Fence gate definition
material = "default:wood",
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults(), -- optional
+ on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
+ -- function containing the on_rightclick callback
+
Dungeon Loot API
----------------
name = "item:name",
chance = 0.5,
-- ^ chance value from 0.0 to 1.0 that the item will appear in the chest when chosen
- -- due to an extra step in the selection process, 0.5 does not(!) mean that
+ -- Due to an extra step in the selection process, 0.5 does not(!) mean that
-- on average every second chest will have this item
count = {1, 4},
-- ^ table with minimum and maximum amounts of this item
-- optional, defaults to no height restrictions
types = {"desert"},
-- ^ table with types of dungeons this item can be found in
- -- supported types: "normal" (the cobble/mossycobble one), "sandstone", "desert"
+ -- supported types: "normal" (the cobble/mossycobble one), "sandstone"
+ -- "desert" and "ice"
-- optional, defaults to no type restrictions
+
Fence API
---------
groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2},
sounds = default.node_sound_wood_defaults(),
+
Walls API
---------
^ mat = "default:stone". Used to auto-generate crafting recipe.
^ sounds = sounds: see [#Default sounds]
+
Farming API
-----------
{
description = "", -- Description of seed item
+ harvest_description = "", -- Description of harvest item
+ -- (optional, derived automatically if not provided)
inventory_image = "unknown_item.png", -- Image to be used as seed's wield- and inventory image
steps = 8, -- How many steps the plant has to grow, until it can be harvested
-- ^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber)
maxlight = default.LIGHT_MAX -- Maximum light to grow
}
+
Fire API
--------
+Add group flammable when registering a node to make fire seek for it.
+Add it to an item to make it burn up when dropped in lava or fire.
New node def property:
`on_burn(pos)`
**Pages**
* sfinv.set_page(player, pagename) - changes the page
+* sfinv.get_page(player) - get the current page name. Will never return nil
* sfinv.get_homepage_name(player) - get the page name of the first page to show to a player
* sfinv.register_page(name, def) - register a page, see section below
* sfinv.override_page(name, def) - overrides fields of an page registered with register_page.
return table.concat(tmp, "")
end
+
Stairs API
----------
The stairs API lets you register stairs and slabs and ensures that they are registered the same way as those
delivered with Minetest Game, to keep them compatible with other mods.
-`stairs.register_stair(subname, recipeitem, groups, images, description, sounds)`
+`stairs.register_stair(subname, recipeitem, groups, images, description, sounds, worldaligntex)`
- * Registers a stair.
+ * Registers a stair
* `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname"
* `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil`
- * `groups`: see [Known damage and digging time defining groups]
- * `images`: see [Tile definition]
- * `description`: used for the description field in the stair's definition
- * `sounds`: see [#Default sounds]
+ * `groups`: See [Known damage and digging time defining groups]
+ * `images`: See [Tile definition]
+ * `description`: Used for the description field in the stair's definition
+ * `sounds`: See [#Default sounds]
+ * `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition]
-`stairs.register_slab(subname, recipeitem, groups, images, description, sounds)`
+`stairs.register_slab(subname, recipeitem, groups, images, description, sounds, worldaligntex)`
- * Registers a slabs
- * `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname"
+ * Registers a slab
+ * `subname`: Basically the material name (e.g. cobble) used for the slab name. Nodename pattern: "stairs:slab_subname"
* `recipeitem`: Item used in the craft recipe, e.g. "default:cobble"
- * `groups`: see [Known damage and digging time defining groups]
- * `images`: see [Tile definition]
- * `description`: used for the description field in the stair's definition
- * `sounds`: see [#Default sounds]
+ * `groups`: See [Known damage and digging time defining groups]
+ * `images`: See [Tile definition]
+ * `description`: Used for the description field in the slab's definition
+ * `sounds`: See [#Default sounds]
+ * `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition]
-`stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds)`
+`stairs.register_stair_inner(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description)`
+
+ * Registers an inner corner stair
+ * `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_inner_subname"
+ * `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil`
+ * `groups`: See [Known damage and digging time defining groups]
+ * `images`: See [Tile definition]
+ * `description`: Used for the description field in the stair's definition with "Inner" prepended
+ * `sounds`: See [#Default sounds]
+ * `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition]
+ * `full_description`: Overrides the description, bypassing string concatenation. This is useful for translation. (optional)
- * A wrapper for stairs.register_stair and stairs.register_slab
+`stairs.register_stair_outer(subname, recipeitem, groups, images, description, sounds, worldaligntex, full_description)`
+
+ * Registers an outer corner stair
+ * `subname`: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_outer_subname"
+ * `recipeitem`: Item used in the craft recipe, e.g. "default:cobble", may be `nil`
+ * `groups`: See [Known damage and digging time defining groups]
+ * `images`: See [Tile definition]
+ * `description`: Used for the description field in the stair's definition with "Outer" prepended
+ * `sounds`: See [#Default sounds]
+ * `worldaligntex`: A bool to set all textures world-aligned. Default false. See [Tile definition]
+ * `full_description`: Overrides the description, bypassing string concatenation. This is useful for translation. (optional)
+
+`stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds, worldaligntex)`
+
+ * A wrapper for stairs.register_stair, stairs.register_slab, stairs.register_stair_inner, stairs.register_stair_outer
* Uses almost the same arguments as stairs.register_stair
- * `desc_stair`: Description for stair node
+ * `desc_stair`: Description for stair nodes. For corner stairs 'Inner' or 'Outer' will be prefixed
* `desc_slab`: Description for slab node
+
Xpanes API
----------
### Pane definition
{
- textures = {"texture for sides", (unused), "texture for top and bottom"}, -- More tiles aren't supported
+ textures = {
+ "texture for front and back",
+ (unused),
+ "texture for the 4 edges"
+ }, -- More tiles aren't supported
groups = {group = rating}, -- Uses the known node groups, see [Known damage and digging time defining groups]
sounds = SoundSpec, -- See [#Default sounds]
recipe = {{"","","","","","","","",""}}, -- Recipe field only
use_texture_alpha = true, -- Optional boolean (default: `false`) for colored glass panes
}
+
Raillike definitions
--------------------
* `default.node_sound_glass_defaults()`
* `default.node_sound_metal_defaults()`
+
Default constants
-----------------
Dyes
----
-To make recipes that will work with any dye ever made by anybody, define
-them based on groups. You can select any group of groups, based on your need for
-amount of colors.
-
-### Color groups
-
-Base color groups:
-
- * `basecolor_white`
- * `basecolor_grey`
- * `basecolor_black`
- * `basecolor_red`
- * `basecolor_yellow`
- * `basecolor_green`
- * `basecolor_cyan`
- * `basecolor_blue`
- * `basecolor_magenta`
-
-Extended color groups ( * means also base color )
-
- * `excolor_white` *
- * `excolor_lightgrey`
- * `excolor_grey` *
- * `excolor_darkgrey`
- * `excolor_black` *
- * `excolor_red` *
- * `excolor_orange`
- * `excolor_yellow` *
- * `excolor_lime`
- * `excolor_green` *
- * `excolor_aqua`
- * `excolor_cyan` *
- * `excolor_sky_blue`
- * `excolor_blue` *
- * `excolor_violet`
- * `excolor_magenta` *
- * `excolor_red_violet`
-
-The whole unifieddyes palette as groups:
-
- * `unicolor_<excolor>`
-
-For the following, no white/grey/black is allowed:
-
- * `unicolor_medium_<excolor>`
- * `unicolor_dark_<excolor>`
- * `unicolor_light_<excolor>`
- * `unicolor_<excolor>_s50`
- * `unicolor_medium_<excolor>_s50`
- * `unicolor_dark_<excolor>_s50`
-
-Example of one shapeless recipe using a color group:
+Minetest Game dyes are registered with:
+
+ groups = {dye = 1, color_<color> = 1},
+
+To make recipes that will work with dyes from many mods, define them using the
+dye group and the color groups.
+
+Dye color groups:
+
+ * `color_white`
+ * `color_grey`
+ * `color_dark_grey`
+ * `color_black`
+ * `color_red`
+ * `color_pink`
+ * `color_orange`
+ * `color_brown`
+ * `color_yellow`
+ * `color_green`
+ * `color_dark_green`
+ * `color_blue`
+ * `color_cyan`
+ * `color_violet`
+ * `color_magenta`
+
+Example of one shapeless recipe using the dye group and a color group:
minetest.register_craft({
type = "shapeless",
- output = '<mod>:item_yellow',
- recipe = {'<mod>:item_no_color', 'group:basecolor_yellow'},
+ output = "<mod>:item_yellow",
+ recipe = {"<mod>:item_no_color", "group:dye,color_yellow"},
})
-### Color lists
-
- * `dye.basecolors` are an array containing the names of available base colors
-
- * `dye.excolors` are an array containing the names of the available extended colors
Trees
-----
* `default.grow_acacia_bush(pos)`
* Grows an acaia bush at pos
+ * `default.grow_pine_bush(pos)`
+ * Grows a pine bush at pos
+
+ * `default.grow_blueberry_bush(pos)`
+ * Grows a blueberry bush at pos
+
+
Carts
-----
likely be called many times per second, so the function needs
to make sure that the event is handled properly.
+
Key API
-------