From 478809867649fa04e7aa040dda3c3176c62b2b22 Mon Sep 17 00:00:00 2001
From: rubenwardy
If you see a deficiency in the API, feel free to attempt to add the functionality in the engine and API. You can send such improvements as -source code patches to celeron55@gmail.com.
+source code patches to celeron55@gmail.com.If you have any difficulty in understanding this, please read Programming in Lua.
RUN_IN_PLACE=1
(Windows release, local build)$path_user
:<build directory>
<build directory>
RUN_IN_PLACE=1
(Windows release, local build)$path_user
:
$path_share
RUN_IN_PLACE=0
: (Linux release)$path_share
/usr/share/minetest
<install directory>/minetest-0.4.x
RUN_IN_PLACE=0
: (Linux release)$path_share
$path_user
:$HOME/.minetest
C:/users/<user>/AppData/minetest
(maybe)$path_user
:
init.lua
scripts in a shared environment.
Games are looked up from:
$path_share/games/gameid/
$path_user/games/gameid/
$path_share/games/gameid/
$path_user/games/gameid/
where gameid
is unique to each game.
The game directory contains the file game.conf
, which contains these fields:
Generic:
$path_share/games/gameid/mods/
$path_share/mods/
$path_user/games/gameid/mods/
$path_user/mods/
(User-installed mods)$worldpath/worldmods/
$path_share/games/gameid/mods/
$path_share/mods/
$path_user/games/gameid/mods/
$path_user/mods/
(User-installed mods)$worldpath/worldmods/
In a run-in-place version (e.g. the distributed windows version):
minetest-0.4.x/games/gameid/mods/
minetest-0.4.x/mods/
(User-installed mods)minetest-0.4.x/worlds/worldname/worldmods/
minetest-0.4.x/games/gameid/mods/
minetest-0.4.x/mods/
(User-installed mods)minetest-0.4.x/worlds/worldname/worldmods/
On an installed version on Linux:
/usr/share/minetest/games/gameid/mods/
$HOME/.minetest/mods/
(User-installed mods)$HOME/.minetest/worlds/worldname/worldmods
/usr/share/minetest/games/gameid/mods/
$HOME/.minetest/mods/
(User-installed mods)$HOME/.minetest/worlds/worldname/worldmods
It is possible to include a game in a world; in this case, no mods or
@@ -524,8 +524,8 @@ the mod name foomod
, a texture could be called:
Textures are referred to by their complete name, or alternatively by stripping out the file extension:
There are various texture modifiers that can be used
@@ -544,8 +544,8 @@ texture is overlaid over cobble.png
.
[crack:<n>:<p>
<n>
= animation frame count<p>
= current animation frame<n>
= animation frame count<p>
= current animation frameDraw a step of the crack animation on the texture.
Example:
@@ -553,11 +553,11 @@ texture is overlaid overcobble.png
.
[combine:<w>x<h>:<x1>,<y1>=<file1>:<x2>,<y2>=<file2>
<w>
= width<h>
= height<x1>
/<x2>
= x positions<y1>
/<y1>
= y positions<file1>
/<file2>
= textures to combine<w>
= width<h>
= height<x1>
/<x2>
= x positions<y1>
/<y1>
= y positions<file1>
/<file2>
= textures to combineCreate a texture of size <w>
times <h>
and blit <file1>
to (<x1>
,<y1>
)
and blit <file2>
to (<x2>
,<y2>
).
<file2>
to (<x2>
,<y2>
[transform<t>
<t>
= transformation(s) to apply<t>
= transformation(s) to applyRotates and/or flips the image.
<t>
can be a number (between 0 and 7) or a transform name.
@@ -613,8 +613,8 @@ Rotations are counter-clockwise.
[verticalframe:<t>:<n>
<t>
= animation frame count<n>
= current animation frame<t>
= animation frame count<n>
= current animation frameCrops the texture to a frame of a vertical animation.
Example:
@@ -642,11 +642,11 @@ is chosen randomly from the matching sounds.When playing the sound foomod_foosound
, the sound is chosen randomly
from the available ones of the following files:
foomod_foosound.ogg
foomod_foosound.0.ogg
foomod_foosound.1.ogg
foomod_foosound.ogg
foomod_foosound.0.ogg
foomod_foosound.1.ogg
foomod_foosound.9.ogg
foomod_foosound.9.ogg
Examples of sound parameter tables:
-- Play location-less on all clients
@@ -675,94 +675,94 @@ from the available ones of the following files:
SimpleSoundSpec
- e.g.
""
-- e.g.
"default_place_node"
+- #e.g.
"default_place_node"
- e.g.
{}
-- e.g.
{name="default_place_node"}
-- e.g.
{name="default_place_node", gain=1.0}
+- #e.g.
{name="default_place_node"}
+- #e.g.
{name="default_place_node", gain=1.0}
Registered definitions of stuff
Anything added using certain minetest.register_*
functions get added to
the global minetest.registered_*
tables.
--
+
- #
minetest.register_entity(name, prototype table)
-- added to
minetest.registered_entities[name]
+- #added to
minetest.registered_entities[name]
--
+
- #
minetest.register_node(name, node definition)
--
+
- #
minetest.register_tool(name, item definition)
-- added to
minetest.registered_items[name]
+- #added to
minetest.registered_items[name]
--
+
- #
minetest.register_craftitem(name, item definition)
-- added to
minetest.registered_items[name]
+- #added to
minetest.registered_items[name]
--
+
- #
minetest.register_biome(biome definition)
--
+
- #
minetest.register_ore(ore definition)
--
+
- #
minetest.register_decoration(decoration definition)
- returns an integer uniquely identifying the registered decoration
-- added to
minetest.registered_decorations
with the key of decoration.name
-- if
decoration.name
is nil, the key is the returned ID
+- #added to
minetest.registered_decorations
with the key of decoration.name
+- #if
decoration.name
is nil, the key is the returned ID
--
+
- #
minetest.register_schematic(schematic definition)
- returns an integer uniquely identifying the registered schematic
-- added to
minetest.registered_schematic
with the key of schematic.name
-- if
schematic.name
is nil, the key is the returned ID
+- #added to
minetest.registered_schematic
with the key of schematic.name
+- #if
schematic.name
is nil, the key is the returned ID
- if the schematic is loaded from a file, schematic.name is set to the filename
- if the function is called when loading the mod, and schematic.name is a relative path,
- then the current mod path will be prepended to the schematic filename
--
+
- #
minetest.clear_registered_biomes()
- clears all biomes currently registered
--
+
- #
minetest.clear_registered_ores()
- clears all ores currently registered
--
+
- #
minetest.clear_registered_decorations()
- clears all decorations currently registered
--
+
- #
minetest.clear_registered_schematics()
- clears all schematics currently registered
@@ -851,23 +851,23 @@ collision_box = {
There are a bunch of different looking node types.
Look for examples in games/minimal
or games/minetest_game
.
-normal
-airlike
-liquid
-flowingliquid
-glasslike
-glasslike_framed
-glasslike_framed_optional
-allfaces
-allfaces_optional
-torchlike
-signlike
-plantlike
-firelike
-fencelike
-raillike
-nodebox
-- See below. (Experimental!)
-mesh
-- use models for nodes
+- #
normal
+- #
airlike
+- #
liquid
+- #
flowingliquid
+- #
glasslike
+- #
glasslike_framed
+- #
glasslike_framed_optional
+- #
allfaces
+- #
allfaces_optional
+- #
torchlike
+- #
signlike
+- #
plantlike
+- #
firelike
+- #
fencelike
+- #
raillike
+- #
nodebox
-- See below. (Experimental!)
+- #
mesh
-- use models for nodes
*_optional
drawtypes need less rendering time if deactivated (always client side).
Node boxes
@@ -1049,16 +1049,16 @@ structures, such as trees, cave spikes, rocks, and so on.
Minetest Schematic file (.mts
) or through raw data supplied through Lua,
in the form of a table. This table specifies the following fields:
-- The
size
field is a 3D vector containing the dimensions of the provided schematic. (required)
-- The
yslice_prob
field is a table of {ypos, prob} which sets the ypos
th vertical slice
+ - #The
size
field is a 3D vector containing the dimensions of the provided schematic. (required)
+- #The
yslice_prob
field is a table of {ypos, prob} which sets the ypos
th vertical slice
of the schematic to have a prob / 256 * 100
chance of occuring. (default: 255)
-- The
data
field is a flat table of MapNode tables making up the schematic,
+ - #The
data
field is a flat table of MapNode tables making up the schematic,
in the order of [z [y [x]]]
. (required)
Each MapNode table contains:
-name
: the name of the map node to place (required)
-prob
(alias param1
): the probability of this node being placed (default: 255)
-param2
: the raw param2 value of the node being placed onto the map (default: 0)
-force_place
: boolean representing if the node should forcibly overwrite any
+- #
name
: the name of the map node to place (required)
+- #
prob
(alias param1
): the probability of this node being placed (default: 255)
+- #
param2
: the raw param2 value of the node being placed onto the map (default: 0)
+- #
force_place
: boolean representing if the node should forcibly overwrite any
previous contents (default: false)
About probability values:
@@ -1072,10 +1072,10 @@ in the form of a table. This table specifies the following fields:
Currently supported flags: place_center_x
, place_center_y
, place_center_z
,
force_placement
.
-place_center_x
: Placement of this decoration is centered along the X axis.
-place_center_y
: Placement of this decoration is centered along the Y axis.
-place_center_z
: Placement of this decoration is centered along the Z axis.
-force_placement
: Schematic nodes other than "ignore" will replace existing nodes.
+- #
place_center_x
: Placement of this decoration is centered along the X axis.
+- #
place_center_y
: Placement of this decoration is centered along the Y axis.
+- #
place_center_z
: Placement of this decoration is centered along the Z axis.
+- #
force_placement
: Schematic nodes other than "ignore" will replace existing nodes.
HUD element types
The position field is used for all element types.
@@ -1099,49 +1099,49 @@ in the experimental stages.
image
Displays an image on the HUD.
-scale
: The scale of the image, with 1 being the original texture size.
+- #
scale
: The scale of the image, with 1 being the original texture size.
Only the X coordinate scale is used (positive values).
Negative values represent that percentage of the screen it
should take; e.g. x=-100
means 100% (width).
-text
: The name of the texture that is displayed.
-alignment
: The alignment of the image.
-offset
: offset in pixels from position.
+- #
text
: The name of the texture that is displayed.
+- #
alignment
: The alignment of the image.
+- #
offset
: offset in pixels from position.
text
Displays text on the HUD.
-scale
: Defines the bounding rectangle of the text.
+- #
scale
: Defines the bounding rectangle of the text.
A value such as {x=100, y=100}
should work.
-text
: The text to be displayed in the HUD element.
-number
: An integer containing the RGB value of the color used to draw the text.
+- #
text
: The text to be displayed in the HUD element.
+- #
number
: An integer containing the RGB value of the color used to draw the text.
Specify 0xFFFFFF
for white text, 0xFF0000
for red, and so on.
-alignment
: The alignment of the text.
-offset
: offset in pixels from position.
+- #
alignment
: The alignment of the text.
+- #
offset
: offset in pixels from position.
statbar
Displays a horizontal bar made up of half-images.
-text
: The name of the texture that is used.
-number
: The number of half-textures that are displayed.
+- #
text
: The name of the texture that is used.
+- #
number
: The number of half-textures that are displayed.
If odd, will end with a vertically center-split texture.
-direction
-offset
: offset in pixels from position.
-size
: If used, will force full-image size to this value (override texture pack image size)
+- #
direction
+- #
offset
: offset in pixels from position.
+- #
size
: If used, will force full-image size to this value (override texture pack image size)
inventory
-text
: The name of the inventory list to be displayed.
-number
: Number of items in the inventory to be displayed.
-item
: Position of item that is selected.
-direction
+- #
text
: The name of the inventory list to be displayed.
+- #
number
: Number of items in the inventory to be displayed.
+- #
item
: Position of item that is selected.
+- #
direction
waypoint
Displays distance to selected world position.
-name
: The name of the waypoint.
-text
: Distance suffix. Can be blank.
-number:
An integer containing the RGB value of the color used to draw the text.
-world_pos
: World position of the waypoint.
+- #
name
: The name of the waypoint.
+- #
text
: Distance suffix. Can be blank.
+- #
number:
An integer containing the RGB value of the color used to draw the text.
+- #
world_pos
: World position of the waypoint.
Representations of simple things
Position/vector
@@ -1150,9 +1150,9 @@ in the experimental stages.
For helper functions see "Vector helpers".
pointed_thing
-{type="nothing"}
-{type="node", under=pos, above=pos}
-{type="object", ref=ObjectRef}
+- #
{type="nothing"}
+- #
{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
@@ -1182,10 +1182,10 @@ is present, mapped to a boolean of any value, the specified flag is unset.
Item types
There are three kinds of items: nodes, tools and craftitems.
-- Node (
register_node
): A node from the world.
-- Tool (
register_tool
): A tool/weapon that can dig and damage
+ - #Node (
register_node
): A node from the world.
+- #Tool (
register_tool
): A tool/weapon that can dig and damage
things according to tool_capabilities
.
-- Craftitem (
register_craftitem
): A miscellaneous item.
+- #Craftitem (
register_craftitem
): A miscellaneous item.
Item formats
Items and item stacks can exist in three formats: Serializes, table format
@@ -1193,9 +1193,9 @@ and ItemStack
.
Serialized
This is called "stackstring" or "itemstring":
-- e.g.
'default:dirt 5'
-- e.g.
'default:pick_wood 21323'
-- e.g.
'default:apple'
+- #e.g.
'default:dirt 5'
+- #e.g.
'default:pick_wood 21323'
+- #e.g.
'default:apple'
Table format
Examples:
@@ -1270,43 +1270,43 @@ effective towards.
immortal
: Disables the group damage system for an entitylevel
: Can be used to give an additional sense of progression in the game.immortal
: Disables the group damage system for an entitylevel
: Can be used to give an additional sense of progression in the game.0
is something that is directly accessible at the start of gameplay0
is something that is directly accessible at the start of gameplaydig_immediate
: (player can always pick up node without tool wear)2
: node is removed without tool wear after 0.5 seconds or so
+dig_immediate
: (player can always pick up node without tool wear)
disable_jump
: Player (and possibly other things) cannot jump from nodefall_damage_add_percent
: damage speed = speed * (1 + value/100)
bouncy
: value is bounce speed in percentfalling_node
: if there is no walkable block under the node it will fallattached_node
: if the node under it is not a walkable block the node will be
+disable_jump
: Player (and possibly other things) cannot jump from nodefall_damage_add_percent
: damage speed = speed * (1 + value/100)
bouncy
: value is bounce speed in percentfalling_node
: if there is no walkable block under the node it will fallattached_node
: if the node under it is not a walkable block the node will be
dropped as an item. If the node is wallmounted the wallmounted direction is
checked.soil
: saplings will grow on nodes in this groupconnect_to_raillike
: makes nodes of raillike drawtype with same group value
+soil
: saplings will grow on nodes in this groupconnect_to_raillike
: makes nodes of raillike drawtype with same group value
connect to each othercrumbly
: dirt, sandcracky
: tough but crackable stuff like stone.snappy
: something that can be cut using fine tools; e.g. leaves, small
+crumbly
: dirt, sandcracky
: tough but crackable stuff like stone.snappy
: something that can be cut using fine tools; e.g. leaves, small
plants, wire, sheets of metalchoppy
: something that can be cut using force; e.g. trees, wooden planksfleshy
: Living things like animals and the player. This could imply
+choppy
: something that can be cut using force; e.g. trees, wooden planksfleshy
: Living things like animals and the player. This could imply
some blood effects when hitting.explody
: Especially prone to explosionsoddly_breakable_by_hand
:
+explody
: Especially prone to explosionsoddly_breakable_by_hand
:
Can be added to nodes that shouldn't logically be breakable by the
hand but are. Somewhat similar to dig_immediate
, but times are more
like {[1]=3.50,[2]=2.00,[3]=0.70}
and this does not override the
@@ -1341,9 +1341,9 @@ groups to enable interaction with tools.
0
, 1
, 2
or 3
)0
, 1
, 2
or 3
)3^leveldiff
.
uses=10, leveldiff=0
: actual uses: 10uses=10, leveldiff=1
: actual uses: 30uses=10, leveldiff=2
: actual uses: 90uses=10, leveldiff=0
: actual uses: 10uses=10, leveldiff=1
: actual uses: 30uses=10, leveldiff=2
: actual uses: 90Tells what is the maximum level of a node of this group that the tool will @@ -1393,8 +1393,8 @@ Unless there is a matching group that enables digging otherwise.
This makes the tool be able to dig nodes that fulfil both of these:
crumbly
grouplevel
group less or equal to 2
crumbly
grouplevel
group less or equal to 2
Table of resulting digging times:
crumbly 0 1 2 3 4 <- level
@@ -1413,10 +1413,10 @@ level diff: 2 1 0 -1 -2
Notes:
crumbly==0
, the node is not diggable.crumbly==3
, the level difference digging time divider kicks in and makes
+crumbly==0
, the node is not diggable.crumbly==3
, the level difference digging time divider kicks in and makes
easy nodes to be quickly breakable.level > 2
, the node is not diggable, because it's level > maxlevel
level > 2
, the node is not diggable, because it's level > maxlevel
Damage calculation:
@@ -1443,11 +1443,11 @@ a non-tool item, so that it can do something else than take damage.This should never be called directly, because damage is usually not handled by the entity itself.
puncher
is the object performing the punch. Can be nil
. Should never be
+puncher
is the object performing the punch. Can be nil
. Should never be
accessed unless absolutely required, to encourage interoperability.time_from_last_punch
is time from last punch (by puncher
) or nil
.tool_capabilities
can be nil
.direction
is a unit vector, pointing from the source of the punch to
+time_from_last_punch
is time from last punch (by puncher
) or nil
.tool_capabilities
can be nil
.direction
is a unit vector, pointing from the source of the punch to
the punched object.To punch an entity/object in Lua, call:
@@ -1456,7 +1456,7 @@ the entity itself.direction
equals nil
and puncher
does not equal nil
,
+direction
equals nil
and puncher
does not equal nil
,
direction
will be automatically filled in based on the location of puncher
.size[<W>,<H>,<fixed_size>]
fixed_size
: true
/false
(optional)invsize[<W>,<H>;]
fixed_size
: true
/false
(optional)invsize[<W>,<H>;]
list[<inventory location>;<list name>;<X>,<Y>;<W>,<H>;]
listring[]
listring[<inventory location>;<list name>]
listring[<inventory location>;<list name>]
listcolors[<slot_bg_normal>;<slot_bg_hover>]
ColorString
ColorString
listcolors[<slot_bg_normal>;<slot_bg_hover>;<slot_border>]
ColorString
ColorString
listcolors[<slot_bg_normal>;<slot_bg_hover>;<slot_border>;<tooltip_bgcolor>;<tooltip_fontcolor>]
ColorString
ColorString
tooltip[<gui_element_name>;<tooltip_text>;<bgcolor>,<fontcolor>]
<bgcolor>
tooltip background color as ColorString
(optional)<fontcolor>
tooltip font color as ColorString
(optional)<bgcolor>
tooltip background color as ColorString
(optional)<fontcolor>
tooltip font color as ColorString
(optional)image[<X>,<Y>;<W>,<H>;<texture name>]
bgcolor[<color>;<fullscreen>]
ColorString
true
, the background color is drawn fullscreen (does not effect the size of the formspec)ColorString
true
, the background color is drawn fullscreen (does not effect the size of the formspec)background[<X>,<Y>;<W>,<H>;<texture name>]
true
the background is clipped to formspec size
+true
the background is clipped to formspec size
(x
and y
are used as offset values, w
and h
are ignored)pwdfield[<X>,<Y>;<W>,<H>;<name>;<label>]
x
and y
position the field relative to the top left of the menuw
and h
are the size of the fieldh
x
and y
position the field relative to the top left of the menuw
and h
are the size of the fieldh
name
is the name of the field as returned in fields to on_receive_fields
label
, if not blank, will be text printed on the top left above the fieldname
is the name of the field as returned in fields to on_receive_fields
label
, if not blank, will be text printed on the top left above the fieldfield[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]
x
and y
position the field relative to the top left of the menuw
and h
are the size of the fieldh
x
and y
position the field relative to the top left of the menuw
and h
are the size of the fieldh
name
is the name of the field as returned in fields to on_receive_fields
label
, if not blank, will be text printed on the top left above the fielddefault
is the default value of the fielddefault
may contain variable references such as ${text}'
which
+name
is the name of the field as returned in fields to on_receive_fields
label
, if not blank, will be text printed on the top left above the fielddefault
is the default value of the fielddefault
may contain variable references such as ${text}'
which
will fill the value from the metadata value text
size[]
elementsize[]
elementtextarea[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]
label[<X>,<Y>;<label>]
x
and y
work as per fieldlabel
is the text on the labelx
and y
work as per fieldlabel
is the text on the labelvertlabel[<X>,<Y>;<label>]
x
and y
work as per fieldlabel
is the text on the labelx
and y
work as per fieldlabel
is the text on the labelbutton[<X>,<Y>;<W>,<H>;<name>;<label>]
x
, y
and name
work as per fieldw
and h
are the size of the buttonlabel
is the text on the buttonx
, y
and name
work as per fieldw
and h
are the size of the buttonlabel
is the text on the buttonimage_button[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>]
x
, y
, w
, h
, and name
work as per buttontexture name
is the filename of an imagex
, y
, w
, h
, and name
work as per buttontexture name
is the filename of an imageimage_button[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>;<noclip>;<drawborder>;<pressed texture name>]
x
, y
, w
, h
, and name
work as per buttontexture name
is the filename of an imagex
, y
, w
, h
, and name
work as per buttontexture name
is the filename of an imagenoclip=true
means the image button doesn't need to be within specified formsizedrawborder
: draw button border or notpressed texture name
is the filename of an image on pressed statenoclip=true
means the image button doesn't need to be within specified formsizedrawborder
: draw button border or notpressed texture name
is the filename of an image on pressed stateitem_image_button[<X>,<Y>;<W>,<H>;<item name>;<name>;<label>]
x
, y
, w
, h
, name
and label
work as per buttonitem name
is the registered name of an item/node,
+x
, y
, w
, h
, name
and label
work as per buttonitem name
is the registered name of an item/node,
tooltip will be made out of its description
to override it use tooltip elementtextlist[<X>,<Y>;<W>,<H>;<name>;<listelem 1>,<listelem 2>,...,<listelem n>]
x
and y
position the itemlist relative to the top left of the menuw
and h
are the size of the itemlistname
fieldname sent to server on doubleclick value is current selected elementlistelements
can be prepended by #color in hexadecimal format RRGGBB (only),x
and y
position the itemlist relative to the top left of the menuw
and h
are the size of the itemlistname
fieldname sent to server on doubleclick value is current selected elementlistelements
can be prepended by #color in hexadecimal format RRGGBB (only),textlist[<X>,<Y>;<W>,<H>;<name>;<listelem 1>,<listelem 2>,...,<listelem n>;<selected idx>;<transparent>]
x
and y
position the item list relative to the top left of the menuw
and h
are the size of the item listname
fieldname sent to server on doubleclick value is current selected elementlistelements
can be prepended by #RRGGBB (only) in hexadecimal formatx
and y
position the item list relative to the top left of the menuw
and h
are the size of the item listname
fieldname sent to server on doubleclick value is current selected elementlistelements
can be prepended by #RRGGBB (only) in hexadecimal formattrue
/false
: draw transparent backgroundminetest.explode_textlist_event
(main menu: engine.explode_textlist_event
)true
/false
: draw transparent backgroundminetest.explode_textlist_event
(main menu: engine.explode_textlist_event
)tabheader[<X>,<Y>;<name>;<caption 1>,<caption 2>,...,<caption n>;<current_tab>;<transparent>;<draw_border>]
x
and y
position the itemlist relative to the top left of the menuname
fieldname data is transferred to Luacaption 1
...: name shown on top of tabcurrent_tab
: index of selected tab 1...transparent
(optional): show transparentdraw_border
(optional): draw borderx
and y
position the itemlist relative to the top left of the menuname
fieldname data is transferred to Luacaption 1
...: name shown on top of tabcurrent_tab
: index of selected tab 1...transparent
(optional): show transparentdraw_border
(optional): draw borderbox[<X>,<Y>;<W>,<H>;<color>]
x
and y
position the box relative to the top left of the menuw
and h
are the size of boxcolor
is color specified as a ColorString
x
and y
position the box relative to the top left of the menuw
and h
are the size of boxcolor
is color specified as a ColorString
dropdown[<X>,<Y>;<W>;<name>;<item 1>,<item 2>, ...,<item n>;<selected idx>]
x
and y
position of dropdownx
and y
position of dropdowncheckbox[<X>,<Y>;<name>;<label>;<selected>;<tooltip>]
x
and y
: position of checkboxname
fieldname data is transferred to Lualabel
to be shown left of checkboxselected
(optional): true
/false
tooltip
(optional)x
and y
: position of checkboxname
fieldname data is transferred to Lualabel
to be shown left of checkboxselected
(optional): true
/false
tooltip
(optional)scrollbar[<X>,<Y>;<W>,<H>;<orientation>;<name>;<value>]
x
and y
: position of trackbarw
and h
: width and heightorientation
: vertical
/horizontal
x
and y
: position of trackbarw
and h
: width and heightorientation
: vertical
/horizontal
0
-1000
)minetest.explode_scrollbar_event
(main menu: engine.explode_scrollbar_event
)0
-1000
)minetest.explode_scrollbar_event
(main menu: engine.explode_scrollbar_event
)table[<X>,<Y>;<W>,<H>;<name>;<cell 1>,<cell 2>,...,<cell n>;<selected idx>]
tableoptions[]
tablecolumns[]
x
and y
: position the itemlist relative to the top left of the menuw
and h
are the size of the itemlistname
: fieldname sent to server on row select or doubleclickcell 1
...cell n
: cell contents given in row-major orderselected idx
: index of row to be selected within table (first row = 1
)minetest.explode_table_event
(main menu: engine.explode_table_event
)tableoptions[]
tablecolumns[]
x
and y
: position the itemlist relative to the top left of the menuw
and h
are the size of the itemlistname
: fieldname sent to server on row select or doubleclickcell 1
...cell n
: cell contents given in row-major orderselected idx
: index of row to be selected within table (first row = 1
)minetest.explode_table_event
(main menu: engine.explode_table_event
)tableoptions[<opt 1>;<opt 2>;...]
table[]
color=#RRGGBB
ColorString
), defaults to #FFFFFF
table[]
color=#RRGGBB
ColorString
), defaults to #FFFFFF
background=#RRGGBB
ColorString
), defaults to #000000
background=#RRGGBB
ColorString
), defaults to #000000
border=<true/false>
true
)border=<true/false>
true
)highlight=#RRGGBB
ColorString
), defaults to #466432
highlight=#RRGGBB
ColorString
), defaults to #466432
highlight_text=#RRGGBB
ColorString
), defaults to #FFFFFF
highlight_text=#RRGGBB
ColorString
), defaults to #FFFFFF
opendepth=<value>
depth < value
are open (default value = 0
)opendepth=<value>
depth < value
are open (default value = 0
)tablecolumns[<type 1>,<opt 1a>,<opt 1b>,...;<type 2>,<opt 2a>,<opt 2b>;...]
table[]
text
, image
, color
, indent
, tree
text
: show cell contents as textimage
: cell contents are an image index, use column options to define imagescolo
: cell contents are a ColorString and define color of following cellindent
: cell contents are a number and define indentation of following celltree
: same as indent, but user can open and close subtrees (treeview-like)table[]
text
, image
, color
, indent
, tree
text
: show cell contents as textimage
: cell contents are an image index, use column options to define imagescolo
: cell contents are a ColorString and define color of following cellindent
: cell contents are a number and define indentation of following celltree
: same as indent, but user can open and close subtrees (treeview-like)align=<value>
text
and image
: content alignment within cells.
+align=<value>
text
and image
: content alignment within cells.
Available values: left
(default), center
, right
, inline
width=<value>
text
and image
: minimum width in em (default: 0
)indent
and tree
: indent width in em (default: 1.5
)width=<value>
padding=<value>
: padding left of the column, in em (default 0.5
).
+padding=<value>
: padding left of the column, in em (default 0.5
).
Exception: defaults to 0 for indent columnstooltip=<value>
: tooltip text (default: empty)image
column options:0=<value>
sets image for image index 01=<value>
sets image for image index 12=<value>
sets image for image index 2tooltip=<value>
: tooltip text (default: empty)image
column options:
color
column options:span=<value>
: number of following columns to affect (default: infinite)color
column options:span=<value>
: number of following columns to affect (default: infinite)"context"
: Selected node metadata (deprecated: "current_name"
)"current_player"
: Player to whom the menu is shown"player:<name>"
: Any player"nodemeta:<X>,<Y>,<Z>"
: Any node metadata"detached:<name>"
: A detached inventory"context"
: Selected node metadata (deprecated: "current_name"
)"current_player"
: Player to whom the menu is shown"player:<name>"
: Any player"nodemeta:<X>,<Y>,<Z>"
: Any node metadata"detached:<name>"
: A detached inventoryColorString
#RGB
defines a color in hexadecimal format.
colorspec = "green"
vector.new([x[, y, z]])
: returns a vector.
x
is a table or the x
position.x
is a table or the x
position.vector.direction(p1, p2)
: returns a vector
vector.distance(p1, p2)
: returns a numbervector.length(v)
: returns a numbervector.normalize(v)
: returns a vectorvector.round(v)
: returns a vectorvector.apply(v, func)
: returns a vectorvector.equals(v1, v2)
: returns a booleanvector.distance(p1, p2)
: returns a numbervector.length(v)
: returns a numbervector.normalize(v)
: returns a vectorvector.round(v)
: returns a vectorvector.apply(v, func)
: returns a vectorvector.equals(v1, v2)
: returns a booleanFor the following functions x
can be either a vector or a number:
vector.add(v, x)
: returns a vectorvector.subtract(v, x)
: returns a vectorvector.multiply(v, x)
: returns a scaled vector or Schur productvector.divide(v, x)
: returns a scaled vector or Schur quotientvector.add(v, x)
: returns a vectorvector.subtract(v, x)
: returns a vectorvector.multiply(v, x)
: returns a scaled vector or Schur productvector.divide(v, x)
: returns a scaled vector or Schur quotientdump2(obj, name="_", dumped={})
dump2(obj, name="_", dumped={})
dump(obj, dumped={})
dump(obj, dumped={})
math.hypot(x, y)
math.hypot(x, y)
math.sign(x, tolerance)
math.sign(x, tolerance)
0
when the absolute value is within the tolerance (default: 0
)max_splits
is negative, do not limit splits.sep_is_pattern
specifies if separator is a plain string or a pattern (regex).string:split("a,b", ",") == {"a","b"}
string:trim()
string.trim("\n \t\tfoo bar\t ") == "foo bar"
string:trim()
string.trim("\n \t\tfoo bar\t ") == "foo bar"
minetest.pos_to_string({x=X,y=Y,z=Z})
: returns "(X,Y,Z)"
minetest.pos_to_string({x=X,y=Y,z=Z})
: returns "(X,Y,Z)"
minetest.string_to_pos(string)
: returns a positionnil
if the string can't be parsed to a position.minetest.string_to_pos(string)
: returns a positionnil
if the string can't be parsed to a position.minetest.string_to_area("(X1, Y1, Z1) (X2, Y2, Z2)")
: returns two positionsminetest.string_to_area("(X1, Y1, Z1) (X2, Y2, Z2)")
: returns two positionsminetest.formspec_escape(string)
: returns a stringminetest.formspec_escape(string)
: returns a stringminetest.is_yes(arg)
arg
can be interpreted as yesminetest.is_yes(arg)
arg
can be interpreted as yesminetest.get_us_time()
minetest.get_us_time()
table.copy(table)
: returns a table
minetest
namespace referenceminetest.get_current_modname()
: returns the currently loading mod's name, when we are loading a modminetest.get_modpath(modname)
: returns e.g. "/home/user/.minetest/usermods/modname"
.lua
modules or static data from modminetest.get_current_modname()
: returns the currently loading mod's name, when we are loading a modminetest.get_modpath(modname)
: returns e.g. "/home/user/.minetest/usermods/modname"
.lua
modules or static data from modminetest.get_modnames()
: returns a list of installed modsminetest.get_modnames()
: returns a list of installed modsminetest.get_worldpath()
: returns e.g. "/home/user/.minetest/world"
minetest.get_worldpath()
: returns e.g. "/home/user/.minetest/world"
minetest.is_singleplayer()
minetest.features
{foo=true, bar=true}
minetest.is_singleplayer()
minetest.features
{foo=true, bar=true}
minetest.has_feature(arg)
: returns boolean, missing_features
arg
: string or table in format {foo=true, bar=true}
missing_features
: {foo=true, bar=true}
minetest.has_feature(arg)
: returns boolean, missing_features
minetest.get_player_information(player_name)
: returns a table containing
+minetest.get_player_information(player_name)
: returns a table containing
information about player. Example return value:
{
address = "127.0.0.1", -- IP address of client
@@ -2016,10 +2016,10 @@ or string form, a ColorString (defined above):
}
minetest.mkdir(path)
: returns success.path
, creating parent directories
+minetest.mkdir(path)
: returns success.path
, creating parent directories
if they don't exist.minetest.get_dir_list(path, [is_dir])
: returns list of entry namesminetest.get_dir_list(path, [is_dir])
: returns list of entry namesminetest.debug(...)
minetest.log(table.concat({...}, "\t"))
minetest.debug(...)
minetest.log(table.concat({...}, "\t"))
minetest.log([level,] text)
level
is one of "none"
, "error"
, "warning"
, "action"
,
+minetest.log([level,] text)
level
is one of "none"
, "error"
, "warning"
, "action"
,
"info"
, or "verbose"
. Default is "none"
.Call these functions only at load time!
minetest.register_entity(name, prototype table)
minetest.register_abm(abm definition)
minetest.register_node(name, node definition)
minetest.register_tool(name, item definition)
minetest.register_craftitem(name, item definition)
minetest.register_alias(name, convert_to)
minetest.register_craft(recipe)
minetest.register_ore(ore definition)
minetest.register_decoration(decoration definition)
minetest.register_entity(name, prototype table)
minetest.register_abm(abm definition)
minetest.register_node(name, node definition)
minetest.register_tool(name, item definition)
minetest.register_craftitem(name, item definition)
minetest.register_alias(name, convert_to)
minetest.register_craft(recipe)
minetest.register_ore(ore definition)
minetest.register_decoration(decoration definition)
minetest.override_item(name, redefinition)
minetest.override_item("default:mese", {light_source=LIGHT_MAX})
minetest.override_item("default:mese", {light_source=LIGHT_MAX})
minetest.clear_registered_ores()
minetest.clear_registered_decorations()
minetest.clear_registered_decorations()
Call these functions only at load time!
minetest.register_globalstep(func(dtime))
minetest.register_globalstep(func(dtime))
minetest.register_on_shutdown(func())
minetest.register_on_shutdown(func())
minetest.register_on_placenode(func(pos, newnode, placer, oldnode, itemstack, pointed_thing))
minetest.register_on_placenode(func(pos, newnode, placer, oldnode, itemstack, pointed_thing))
minetest.register_on_dignode(func(pos, oldnode, digger))
minetest.register_on_dignode(func(pos, oldnode, digger))
on_destruct
or after_dig_node
in node definition
+on_destruct
or after_dig_node
in node definition
whenever possibleminetest.register_on_punchnode(func(pos, node, puncher, pointed_thing))
minetest.register_on_punchnode(func(pos, node, puncher, pointed_thing))
minetest.register_on_generated(func(minp, maxp, blockseed))
minetest.register_on_generated(func(minp, maxp, blockseed))
minetest.register_on_newplayer(func(ObjectRef))
minetest.register_on_newplayer(func(ObjectRef))
minetest.register_on_dieplayer(func(ObjectRef))
minetest.register_on_dieplayer(func(ObjectRef))
minetest.register_on_punchplayer(func(player, hitter, time_from_last_punch, tool_capabilities, dir, damage))
minetest.register_on_punchplayer(func(player, hitter, time_from_last_punch, tool_capabilities, dir, damage))
player
- ObjectRef - Player that was punchedhitter
- ObjectRef - Player that hittime_from_last_punch
: Meant for disallowing spamming of clicks (can be nil)tool_capabilities
: capability table of used tool (can be nil)dir
: unit vector of direction of punch. Always defined. Points from
+player
- ObjectRef - Player that was punchedhitter
- ObjectRef - Player that hittime_from_last_punch
: Meant for disallowing spamming of clicks (can be nil)tool_capabilities
: capability table of used tool (can be nil)dir
: unit vector of direction of punch. Always defined. Points from
the puncher to the punched.damage
- number that represents the damage calculated by the enginetrue
to prevent the default damage mechanismdamage
- number that represents the damage calculated by the enginetrue
to prevent the default damage mechanismminetest.register_on_player_hpchange(func(player, hp_change), modifier)
minetest.register_on_player_hpchange(func(player, hp_change), modifier)
player
: ObjectRef of the playerhp_change
: the amount of change. Negative when it is damage.modifier
: when true, the function should return the actual hp_change.
+player
: ObjectRef of the playerhp_change
: the amount of change. Negative when it is damage.modifier
: when true, the function should return the actual hp_change.
Note: modifiers only get a temporary hp_change that can be modified by later modifiers.
modifiers can return true as a second argument to stop the execution of further functions.minetest.register_on_respawnplayer(func(ObjectRef))
minetest.register_on_respawnplayer(func(ObjectRef))
minetest.register_on_prejoinplayer(func(name, ip))
minetest.register_on_prejoinplayer(func(name, ip))
minetest.register_on_joinplayer(func(ObjectRef))
minetest.register_on_joinplayer(func(ObjectRef))
minetest.register_on_leaveplayer(func(ObjectRef))
minetest.register_on_leaveplayer(func(ObjectRef))
minetest.register_on_cheat(func(ObjectRef, cheat))
minetest.register_on_cheat(func(ObjectRef, cheat))
cheat
: {type=<cheat_type>}
, where <cheat_type>
is one of:
minetest.register_on_chat_message(func(name, message))
minetest.register_on_chat_message(func(name, message))
true
to mark the message as handled, which means that it will not be sent to other playerstrue
to mark the message as handled, which means that it will not be sent to other playersminetest.register_on_player_receive_fields(func(player, formname, fields))
minetest.register_on_player_receive_fields(func(player, formname, fields))
true
, remaining functions are not calledtrue
, remaining functions are not calledminetest.register_on_craft(func(itemstack, player, old_craft_grid, craft_inv))
player
crafts somethingitemstack
is the outputold_craft_grid
contains the recipe (Note: the one in the inventory is cleared)craft_inv
is the inventory with the crafting gridItemStack
, to replace the output, or nil
, to not modify itminetest.register_on_craft(func(itemstack, player, old_craft_grid, craft_inv))
minetest.register_craft_predict(func(itemstack, player, old_craft_grid, craft_inv))
minetest.register_craft_predict(func(itemstack, player, old_craft_grid, craft_inv))
minetest.register_on_protection_violation(func(pos, name))
builtin
and mods when a player violates protection at a position
+minetest.register_on_protection_violation(func(pos, name))
builtin
and mods when a player violates protection at a position
(eg, digs a node or punches a protected entity).minetest.record_protection_violation
minetest.record_protection_violation
minetest.register_on_item_eat(func(hp_change, replace_with_item, itemstack, user, pointed_thing))
minetest.item_eat
true
or itemstack
to cancel the default item eat response (i.e.: hp increase)minetest.register_on_item_eat(func(hp_change, replace_with_item, itemstack, user, pointed_thing))
minetest.register_chatcommand(cmd, chatcommand definition)
minetest.register_privilege(name, definition)
definition
: "description text"
definition
: { description = "description text", give_to_singleplayer = boolean, -- default: true }
minetest.register_chatcommand(cmd, chatcommand definition)
minetest.register_privilege(name, definition)
minetest.register_authentication_handler(handler)
minetest.builtin_auth_handler
in builtin.lua
for referenceminetest.register_authentication_handler(handler)
minetest.builtin_auth_handler
in builtin.lua
for referenceminetest.setting_set(name, value)
minetest.setting_set(name, value)
="{}#
.\n"""
.\n"""
.minetest.setting_get(name)
: returns string or nil
minetest.setting_setbool(name, value)
setting_set
for restrictions.minetest.setting_get(name)
: returns string or nil
minetest.setting_setbool(name, value)
setting_set
for restrictions.minetest.setting_getbool(name)
: returns boolean or nil
minetest.setting_get_pos(name)
: returns position or nilminetest.setting_save()
, returns nil
, save all settings to config fileminetest.setting_getbool(name)
: returns boolean or nil
minetest.setting_get_pos(name)
: returns position or nilminetest.setting_save()
, returns nil
, save all settings to config fileminetest.notify_authentication_modified(name)
minetest.notify_authentication_modified(name)
name=nil
.name=nil
.minetest.get_password_hash(name, raw_password)
minetest.get_password_hash(name, raw_password)
minetest.string_to_privs(str)
: returns {priv1=true,...}
minetest.privs_to_string(privs)
: returns "priv1,priv2,..."
minetest.string_to_privs(str)
: returns {priv1=true,...}
minetest.privs_to_string(privs)
: returns "priv1,priv2,..."
minetest.set_player_password(name, password_hash)
minetest.set_player_privs(name, {priv1=true,...})
minetest.get_player_privs(name) -> {priv1=true,...}
minetest.auth_reload()
minetest.check_player_privs(player_or_name, ...)
: returns bool, missing_privs
minetest.set_player_password(name, password_hash)
minetest.set_player_privs(name, {priv1=true,...})
minetest.get_player_privs(name) -> {priv1=true,...}
minetest.auth_reload()
minetest.check_player_privs(player_or_name, ...)
: returns bool, missing_privs
player_or_name
: Either a Player object or the name of a player.player_or_name
: Either a Player object or the name of a player....
is either a list of strings, e.g. "priva", "privb"
or
a table, e.g. { priva = true, privb = true }
.minetest.get_player_ip(name)
: returns an IP address stringminetest.get_player_ip(name)
: returns an IP address stringminetest.set_player_password
, minetest_set_player_privs
, minetest_get_player_privs
and minetest.auth_reload
call the authetification handler.
minetest.chat_send_all(text)
minetest.chat_send_player(name, text)
minetest.chat_send_all(text)
minetest.chat_send_player(name, text)
minetest.set_node(pos, node)
minetest.add_node(pos, node): alias set_node(pos, node)
node = {name="foo", param1=0, param2=0}
)minetest.set_node(pos, node)
minetest.add_node(pos, node): alias set_node(pos, node)
node = {name="foo", param1=0, param2=0}
)minetest.swap_node(pos, node
minetest.swap_node(pos, node
minetest.remove_node(pos)
set_node(pos, "air")
minetest.remove_node(pos)
set_node(pos, "air")
minetest.get_node(pos)
{name="ignore", ...}
for unloaded areaminetest.get_node(pos)
{name="ignore", ...}
for unloaded areaminetest.get_node_or_nil(pos)
nil
for unloaded areaminetest.get_node_or_nil(pos)
nil
for unloaded areaminetest.get_node_light(pos, timeofday)
minetest.get_node_light(pos, timeofday)
pos
: The position where to measure the light.timeofday
: nil
for current time, 0
for night, 0.5
for day0
and 15
or nil
pos
: The position where to measure the light.timeofday
: nil
for current time, 0
for night, 0.5
for day0
and 15
or nil
minetest.place_node(pos, node)
minetest.place_node(pos, node)
minetest.dig_node(pos)
minetest.dig_node(pos)
true
if successful, false
on failure (e.g. protected location)true
if successful, false
on failure (e.g. protected location)minetest.punch_node(pos)
minetest.find_nodes_with_meta(pos1, pos2)
minetest.get_meta(pos)
NodeMetaRef
at that positionminetest.get_meta(pos)
NodeMetaRef
at that positionminetest.get_node_timer(pos)
NodeTimerRef
NodeTimerRef
minetest.add_entity(pos, name)
: Spawn Lua-defined entity at position
ObjectRef
, or nil
if failedObjectRef
, or nil
if failedminetest.add_item(pos, item)
: Spawn itemObjectRef
, or nil
if failedminetest.add_item(pos, item)
: Spawn itemObjectRef
, or nil
if failedminetest.get_player_by_name(name)
: Get an ObjectRef
to a playerminetest.get_objects_inside_radius(pos, radius)
radius
: using an euclidean metricminetest.get_player_by_name(name)
: Get an ObjectRef
to a playerminetest.get_objects_inside_radius(pos, radius)
radius
: using an euclidean metricminetest.set_timeofday(val)
val
is between 0
and 1
; 0
for midnight, 0.5
for middayminetest.set_timeofday(val)
val
is between 0
and 1
; 0
for midnight, 0.5
for middayminetest.get_timeofday()
minetest.get_gametime()
: returns the time, in seconds, since the world was createdminetest.find_node_near(pos, radius, nodenames)
: returns pos or nil
radius
: using a maximum metricnodenames
: e.g. {"ignore", "group:tree"}
or "default:dirt"
minetest.get_timeofday()
minetest.get_gametime()
: returns the time, in seconds, since the world was createdminetest.find_node_near(pos, radius, nodenames)
: returns pos or nil
minetest.find_nodes_in_area(minp, maxp, nodenames)
: returns a list of positionsminetest.find_nodes_in_area(minp, maxp, nodenames)
: returns a list of positionsnodenames
: e.g. {"ignore", "group:tree"}
or "default:dirt"
nodenames
: e.g. {"ignore", "group:tree"}
or "default:dirt"
minetest.find_nodes_in_area_under_air(minp, maxp, nodenames)
: returns a list of positionsminetest.find_nodes_in_area_under_air(minp, maxp, nodenames)
: returns a list of positionsnodenames
: e.g. {"ignore", "group:tree"}
or "default:dirt"
nodenames
: e.g. {"ignore", "group:tree"}
or "default:dirt"
minetest.get_perlin(noiseparams)
minetest.get_perlin(seeddiff, octaves, persistence, scale)
int(worldseed)+seeddiff
)minetest.get_perlin(noiseparams)
minetest.get_perlin(seeddiff, octaves, persistence, scale)
int(worldseed)+seeddiff
)minetest.get_voxel_manip([pos1, pos2])
minetest.get_voxel_manip([pos1, pos2])
minetest.set_gen_notify(flags, {deco_ids})
minetest.set_gen_notify(flags, {deco_ids})
flags
is a flag field with the available flags: dungeon
, temple
, cave_begin
,
+flags
is a flag field with the available flags: dungeon
, temple
, cave_begin
,
cave_end
, large_cave_begin
, large_cave_end
, decoration
get_gen_notify()
: returns a flagstring and a table with the deco_idsminetest.get_mapgen_object(objectname)
get_gen_notify()
: returns a flagstring and a table with the deco_idsminetest.get_mapgen_object(objectname)
minetest.get_biome_id(biome_name)
minetest.get_biome_id(biome_name)
minetest.get_mapgen_params()
Returns mapgen parameters, a table containing
+minetest.get_mapgen_params()
Returns mapgen parameters, a table containing
mgname
, seed
, chunksize
, water_level
, and flags
.minetest.set_mapgen_params(MapgenParams)
minetest.set_mapgen_params(MapgenParams)
on_mapgen_init
mgname
, seed
, water_level
,
+mgname
, seed
, water_level
,
and flags
.flags
contains a comma-delimited string of flags to set,
+flags
contains a comma-delimited string of flags to set,
or if the prefix "no"
is attached, clears instead.flags
is in the same format and has the same options as mg_flags
in minetest.conf
flags
is in the same format and has the same options as mg_flags
in minetest.conf
minetest.set_noiseparams(name, noiseparams, set_default)
name
to the noiseparams table specified in noiseparams
.set_default
is an optional boolean (default: true
) that specifies whether the setting
+minetest.set_noiseparams(name, noiseparams, set_default)
minetest.get_noiseparams(name)
: returns a table of the noiseparams for nameminetest.generate_ores(vm, pos1, pos2)
vm
and in the area from pos1
to pos2
.pos1
and pos2
are optional and default to mapchunk minp and maxp.minetest.get_noiseparams(name)
: returns a table of the noiseparams for nameminetest.generate_ores(vm, pos1, pos2)
minetest.generate_decorations(vm, pos1, pos2)
vm
and in the area from pos1
to pos2
.pos1
and pos2
are optional and default to mapchunk minp and maxp.minetest.generate_decorations(vm, pos1, pos2)
minetest.clear_objects()
minetest.clear_objects()
minetest.emerge_area(pos1, pos2, [callback], [param])
pos1
to pos2
, inclusive, to be asynchronouslyminetest.emerge_area(pos1, pos2, [callback], [param])
pos1
to pos2
, inclusive, to be asynchronouslycallback
is a valid Lua function, this will be called for each block emerged.callback
is a valid Lua function, this will be called for each block emerged.function EmergeAreaCallback(blockpos, action, calls_remaining, param)
function EmergeAreaCallback(blockpos, action, calls_remaining, param)
blockpos
is the block coordinates of the block that had been emergedblockpos
is the block coordinates of the block that had been emergedaction
could be one of the following constant values:action
could be one of the following constant values:core.EMERGE_CANCELLED
, core.EMERGE_ERRORED
, core.EMERGE_FROM_MEMORY
,core.EMERGE_FROM_DISK
, core.EMERGE_GENERATED
core.EMERGE_CANCELLED
, core.EMERGE_ERRORED
, core.EMERGE_FROM_MEMORY
,core.EMERGE_FROM_DISK
, core.EMERGE_GENERATED
calls_remaining
is the number of callbacks to be expected after this onecalls_remaining
is the number of callbacks to be expected after this oneparam
is the user-defined parameter passed to emerge_area (or nil if theparam
is the user-defined parameter passed to emerge_area (or nil if theminetest.delete_area(pos1, pos2)
minetest.delete_area(pos1, pos2)
minetest.line_of_sight(pos1, pos2, stepsize)
: returns boolean, pos
pos1
and pos2
false
pos1
: First positionpos2
: Second positionstepsize
: smaller gives more accurate results but requires more computing
+minetest.line_of_sight(pos1, pos2, stepsize)
: returns boolean, pos
minetest.find_path(pos1,pos2,searchdistance,max_jump,max_drop,algorithm)
minetest.find_path(pos1,pos2,searchdistance,max_jump,max_drop,algorithm)
pos1
to pos2
or nil
pos1
: start positionpos2
: end positionsearchdistance
: number of blocks to search in each direction using a maximum metricmax_jump
: maximum height difference to consider walkablemax_drop
: maximum height difference to consider droppablealgorithm
: One of "A*_noprefetch"
(default), "A*"
, "Dijkstra"
pos1
to pos2
or nil
pos1
: start positionpos2
: end positionsearchdistance
: number of blocks to search in each direction using a maximum metricmax_jump
: maximum height difference to consider walkablemax_drop
: maximum height difference to consider droppablealgorithm
: One of "A*_noprefetch"
(default), "A*"
, "Dijkstra"
minetest.spawn_tree (pos, {treedef})
pos
with definition in treedef
tableminetest.spawn_tree (pos, {treedef})
pos
with definition in treedef
tableminetest.transforming_liquid_add(pos)
minetest.transforming_liquid_add(pos)
minetest.get_node_max_level(pos)
minetest.get_node_max_level(pos)
minetest.get_node_level(pos)
minetest.get_node_level(pos)
minetest.set_node_level(pos, level)
level
equals 1
totallevel > maxlevel
, returns rest (total-max
).minetest.set_node_level(pos, level)
minetest.add_node_level(pos, level)
level
equals 1
totallevel > maxlevel
, returns rest (total-max
)minetest.add_node_level(pos, level)
minetest.auth_reload
call the authetification handler.
minetest.get_inventory(location)
: returns an InvRef
location
= e.g.{type="player", name="celeron55"}
{type="node", pos={x=, y=, z=}}
{type="detached", name="creative"}
location
= e.g.
minetest.create_detached_inventory(name, callbacks)
: returns an InvRef
minetest.create_detached_inventory(name, callbacks)
: returns an InvRef
minetest.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing)
:
+minetest.do_item_eat(hp_change, replace_with_item, itemstack, user, pointed_thing)
:
returns left over ItemStackminetest.item_eat
and minetest.register_on_item_eat
minetest.item_eat
and minetest.register_on_item_eat
minetest.show_formspec(playername, formname, formspec)
playername
: name of player to show formspecformname
: name passed to on_player_receive_fields
callbacks.
+minetest.show_formspec(playername, formname, formspec)
minetest.formspec_escape(string)
: returns a stringminetest.formspec_escape(string)
: returns a stringminetest.explode_table_event(string)
: returns a table{type="CHG", row=1, column=2}
type
is one of:"INV"
: no row selected)"CHG"
: selected)"DCL"
: double-clickminetest.explode_table_event(string)
: returns a table
minetest.explode_textlist_event(string)
: returns a table