@@ -4,8 +4,6 @@ Minetest Lua Modding API Reference
4
4
* Developer Wiki: <http://dev.minetest.net/>
5
5
6
6
7
-
8
-
9
7
Introduction
10
8
============
11
9
@@ -34,14 +32,10 @@ the `init.lua` scripts in a shared environment.
34
32
Paths
35
33
-----
36
34
* `RUN_IN_PLACE=1` (Windows release, local build)
37
- * `$path_user`:
38
- * Linux: `<build directory>`
39
- * Windows: `<build directory>`
40
- * `$path_share`
41
- * Linux: `<build directory>`
42
- * Windows: `<build directory>`
35
+ * `$path_user`: `<build directory>`
36
+ * `$path_share`: `<build directory>`
43
37
* `RUN_IN_PLACE=0`: (Linux release)
44
- * `$path_share`
38
+ * `$path_share`:
45
39
* Linux: `/usr/share/minetest`
46
40
* Windows: `<install directory>/minetest-0.4.x`
47
41
* `$path_user`:
@@ -79,7 +73,8 @@ The game directory can contain the following files:
79
73
texturepack, overriding mod textures.
80
74
Any server texturepack will override mod textures and the game texturepack.
81
75
82
- ### Menu images
76
+ Menu images
77
+ -----------
83
78
84
79
Games can provide custom main menu images. They are put inside a `menu`
85
80
directory inside the game directory.
@@ -129,7 +124,7 @@ This happens if the following directory exists:
129
124
130
125
$world/game/
131
126
132
- Mods should be then be placed in:
127
+ Mods should then be placed in:
133
128
134
129
$world/game/mods/
135
130
@@ -143,20 +138,20 @@ Mod directory structure
143
138
-----------------------
144
139
145
140
mods
146
- |-- modname
147
- | |-- mod.conf
148
- | |-- screenshot.png
149
- | |-- settingtypes.txt
150
- | |-- init.lua
151
- | |-- models
152
- | |-- textures
153
- | | |-- modname_stuff.png
154
- | | `-- modname_something_else.png
155
- | |-- sounds
156
- | |-- media
157
- | |-- locale
158
- | `-- <custom data>
159
- `-- another
141
+ ├── modname
142
+ │ ├── mod.conf
143
+ │ ├── screenshot.png
144
+ │ ├── settingtypes.txt
145
+ │ ├── init.lua
146
+ │ ├── models
147
+ │ ├── textures
148
+ │ │ ├── modname_stuff.png
149
+ │ │ └── modname_something_else.png
150
+ │ ├── sounds
151
+ │ ├── media
152
+ │ ├── locale
153
+ │ └── <custom data>
154
+ └── another
160
155
161
156
### modname
162
157
The location of this directory can be fetched by using
@@ -284,65 +279,64 @@ of the game's nodes are to be used by the core mapgens. For example:
284
279
285
280
### Aliases needed for all mapgens except Mapgen v6
286
281
287
- Base terrain:
288
-
289
- "mapgen_stone"
290
- "mapgen_water_source"
291
- "mapgen_river_water_source"
282
+ #### Base terrain
283
+ * mapgen_stone
284
+ * mapgen_water_source
285
+ * mapgen_river_water_source
292
286
293
- Caves:
294
-
295
- "mapgen_lava_source"
296
-
297
- Dungeons:
287
+ #### Caves
288
+ * mapgen_lava_source
298
289
290
+ #### Dungeons
299
291
Only needed for registered biomes where 'node_stone' is stone:
300
- "mapgen_cobble"
301
- "mapgen_stair_cobble"
302
- "mapgen_mossycobble"
303
- Only needed for registered biomes where 'node_stone' is desert stone:
304
- "mapgen_desert_stone"
305
- "mapgen_stair_desert_stone"
306
- Only needed for registered biomes where 'node_stone' is sandstone:
307
- "mapgen_sandstone"
308
- "mapgen_sandstonebrick"
309
- "mapgen_stair_sandstone_block"
310
292
311
- ### Aliases needed for Mapgen v6
293
+ * mapgen_cobble
294
+ * mapgen_stair_cobble
295
+ * mapgen_mossycobble
312
296
313
- Terrain and biomes:
297
+ Only needed for registered biomes where 'node_stone' is desert stone :
314
298
315
- "mapgen_stone"
316
- "mapgen_water_source"
317
- "mapgen_lava_source"
318
- "mapgen_dirt"
319
- "mapgen_dirt_with_grass"
320
- "mapgen_sand"
321
- "mapgen_gravel"
322
- "mapgen_desert_stone"
323
- "mapgen_desert_sand"
324
- "mapgen_dirt_with_snow"
325
- "mapgen_snowblock"
326
- "mapgen_snow"
327
- "mapgen_ice"
299
+ * mapgen_desert_stone
300
+ * mapgen_stair_desert_stone
328
301
329
- Flora :
302
+ Only needed for registered biomes where 'node_stone' is sandstone :
330
303
331
- "mapgen_tree"
332
- "mapgen_leaves"
333
- "mapgen_apple"
334
- "mapgen_jungletree"
335
- "mapgen_jungleleaves"
336
- "mapgen_junglegrass"
337
- "mapgen_pine_tree"
338
- "mapgen_pine_needles"
304
+ * mapgen_sandstone
305
+ * mapgen_sandstonebrick
306
+ * mapgen_stair_sandstone_block
339
307
340
- Dungeons:
308
+ ### Aliases needed for Mapgen v6
341
309
342
- "mapgen_cobble"
343
- "mapgen_stair_cobble"
344
- "mapgen_mossycobble"
345
- "mapgen_stair_desert_stone"
310
+ #### Terrain and biomes
311
+ * mapgen_stone
312
+ * mapgen_water_source
313
+ * mapgen_lava_source
314
+ * mapgen_dirt
315
+ * mapgen_dirt_with_grass
316
+ * mapgen_sand
317
+ * mapgen_gravel
318
+ * mapgen_desert_stone
319
+ * mapgen_desert_sand
320
+ * mapgen_dirt_with_snow
321
+ * mapgen_snowblock
322
+ * mapgen_snow
323
+ * mapgen_ice
324
+
325
+ #### Flora
326
+ * mapgen_tree
327
+ * mapgen_leaves
328
+ * mapgen_apple
329
+ * mapgen_jungletree
330
+ * mapgen_jungleleaves
331
+ * mapgen_junglegrass
332
+ * mapgen_pine_tree
333
+ * mapgen_pine_needles
334
+
335
+ #### Dungeons
336
+ * mapgen_cobble
337
+ * mapgen_stair_cobble
338
+ * mapgen_mossycobble
339
+ * mapgen_stair_desert_stone
346
340
347
341
348
342
@@ -404,6 +398,7 @@ on top of `cobble.png`.
404
398
* `[cracko:<t>:<n>:<p>`
405
399
406
400
Parameters:
401
+
407
402
* `<t>` = tile count (in each direction)
408
403
* `<n>` = animation frame count
409
404
* `<p>` = current animation frame
@@ -537,7 +532,6 @@ The mask is applied using binary AND.
537
532
Retrieves a tile at position x,y from the base image
538
533
which it assumes to be a tilesheet with dimensions w,h.
539
534
540
-
541
535
#### `[colorize:<color>:<ratio>`
542
536
Colorize the textures with the given color.
543
537
`<color>` is specified as a `ColorString`.
@@ -573,12 +567,12 @@ the same texture, in different colors, each in a new node/item definition.
573
567
When you register an item or node, set its `color` field (which accepts a
574
568
`ColorSpec`) to the desired color.
575
569
576
- An `ItemStack`s static color can be overwritten by the `color` metadata
570
+ An `ItemStack`' s static color can be overwritten by the `color` metadata
577
571
field. If you set that field to a `ColorString`, that color will be used.
578
572
579
573
#### Tile color
580
574
Each tile may have an individual static color, which overwrites every
581
- other coloring methods . To disable the coloring of a face,
575
+ other coloring method . To disable the coloring of a face,
582
576
set its color to white (because multiplying with white does nothing).
583
577
You can set the `color` property of the tiles in the node's definition
584
578
if the tile is in table format.
@@ -808,7 +802,8 @@ Examples of sound parameter tables:
808
802
Looped sounds must either be connected to an object or played locationless to
809
803
one player using `to_player = name,`
810
804
811
- ### `SimpleSoundSpec`
805
+ `SimpleSoundSpec`
806
+ -----------------
812
807
* e.g. `""`
813
808
* e.g. `"default_place_node"`
814
809
* e.g. `{}`
@@ -819,10 +814,10 @@ one player using `to_player = name,`
819
814
820
815
821
816
822
- Registered definitions of stuff
823
- ===============================
817
+ Registered definitions
818
+ ======================
824
819
825
- Anything added using certain `minetest.register_*` functions get added to
820
+ Anything added using certain `minetest.register_*` functions gets added to
826
821
the global `minetest.registered_*` tables.
827
822
828
823
* `minetest.register_entity(name, prototype table)`
@@ -919,11 +914,11 @@ Nodes are the bulk data of the world: cubes and other things that take the
919
914
space of a cube. Huge amounts of them are handled efficiently, but they
920
915
are quite static.
921
916
922
- The definition of a node is stored and can be accessed by name in
917
+ The definition of a node is stored and can be accessed by using
923
918
924
919
minetest.registered_nodes[node.name]
925
920
926
- See "Registered definitions of stuff ".
921
+ See "Registered definitions".
927
922
928
923
Nodes are passed by value between Lua and the engine.
929
924
They are represented by a table:
@@ -1270,13 +1265,15 @@ Displays distance to selected world position.
1270
1265
Representations of simple things
1271
1266
================================
1272
1267
1273
- ### Position/vector
1268
+ Position/vector
1269
+ ---------------
1274
1270
1275
1271
{x=num, y=num, z=num}
1276
1272
1277
1273
For helper functions see "Spatial Vectors".
1278
1274
1279
- ### `pointed_thing`
1275
+ `pointed_thing`
1276
+ ---------------
1280
1277
* `{type="nothing"}`
1281
1278
* `{type="node", under=pos, above=pos}`
1282
1279
* `{type="object", ref=ObjectRef}`
@@ -1324,15 +1321,17 @@ since, by default, no schematic attributes are set.
1324
1321
Items
1325
1322
=====
1326
1323
1327
- ### Item types
1324
+ Item types
1325
+ ----------
1328
1326
There are three kinds of items: nodes, tools and craftitems.
1329
1327
1330
1328
* Node (`register_node`): A node from the world.
1331
1329
* Tool (`register_tool`): A tool/weapon that can dig and damage
1332
1330
things according to `tool_capabilities`.
1333
1331
* Craftitem (`register_craftitem`): A miscellaneous item.
1334
1332
1335
- ### Amount and wear
1333
+ Amount and wear
1334
+ ---------------
1336
1335
All item stacks have an amount between 0 to 65535. It is 1 by
1337
1336
default. Tool item stacks can not have an amount greater than 1.
1338
1337
@@ -1341,11 +1340,12 @@ value 0 is the default and used is for unworn tools. The values
1341
1340
1 to 65535 are used for worn tools, where a higher value stands for
1342
1341
a higher wear. Non-tools always have a wear value of 0.
1343
1342
1344
- ### Item formats
1343
+ Item formats
1344
+ ------------
1345
1345
Items and item stacks can exist in three formats: Serializes, table format
1346
1346
and `ItemStack`.
1347
1347
1348
- #### Serialized
1348
+ ### Serialized
1349
1349
This is called "stackstring" or "itemstring". It is a simple string with
1350
1350
1-3 components: the full item identifier, an optional amount and an optional
1351
1351
wear value. Syntax:
@@ -1359,7 +1359,7 @@ Examples:
1359
1359
* `'default:pick_stone'`: a new stone pickaxe
1360
1360
* `'default:pick_wood 1 21323'`: a wooden pickaxe, ca. 1/3 worn out
1361
1361
1362
- #### Table format
1362
+ ### Table format
1363
1363
Examples:
1364
1364
1365
1365
5 dirt nodes:
@@ -1374,7 +1374,7 @@ An apple:
1374
1374
1375
1375
{name="default:apple", count=1, wear=0, metadata=""}
1376
1376
1377
- #### `ItemStack`
1377
+ ### `ItemStack`
1378
1378
A native C++ format with many helper methods. Useful for converting
1379
1379
between formats. See the Class reference section for details.
1380
1380
@@ -1392,7 +1392,8 @@ properties of a thing (item, node, armor of entity, capabilities of
1392
1392
tool) in such a way that the engine and other mods can can interact with
1393
1393
the thing without actually knowing what the thing is.
1394
1394
1395
- ### Usage
1395
+ Usage
1396
+ -----
1396
1397
Groups are stored in a table, having the group names with keys and the
1397
1398
group ratings as values. For example:
1398
1399
@@ -1412,26 +1413,31 @@ You can read the rating of a group for an item or a node by using
1412
1413
1413
1414
minetest.get_item_group(itemname, groupname)
1414
1415
1415
- ### Groups of items
1416
+ Groups of items
1417
+ ---------------
1416
1418
Groups of items can define what kind of an item it is (e.g. wool).
1417
1419
1418
- ### Groups of nodes
1420
+ Groups of nodes
1421
+ ---------------
1419
1422
In addition to the general item things, groups are used to define whether
1420
1423
a node is destroyable and how long it takes to destroy by a tool.
1421
1424
1422
- ### Groups of entities
1425
+ Groups of entities
1426
+ ------------------
1423
1427
For entities, groups are, as of now, used only for calculating damage.
1424
1428
The rating is the percentage of damage caused by tools with this damage group.
1425
1429
See "Entity damage mechanism".
1426
1430
1427
1431
object.get_armor_groups() --> a group-rating table (e.g. {fleshy=100})
1428
1432
object.set_armor_groups({fleshy=30, cracky=80})
1429
1433
1430
- ### Groups of tools
1434
+ Groups of tools
1435
+ ---------------
1431
1436
Groups in tools define which groups of nodes and entities they are
1432
1437
effective towards.
1433
1438
1434
- ### Groups in crafting recipes
1439
+ Groups in crafting recipes
1440
+ --------------------------
1435
1441
An example: Make meat soup from any meat, any water and any bowl:
1436
1442
1437
1443
{
@@ -1452,7 +1458,8 @@ Another example: Make red wool from white wool and red dye:
1452
1458
recipe = {'wool:white', 'group:dye,basecolor_red'},
1453
1459
}
1454
1460
1455
- ### Special groups
1461
+ Special groups
1462
+ --------------
1456
1463
* `immortal`: Disables the group damage system for an entity
1457
1464
* `punch_operable`: For entities; disables the regular damage mechanism for
1458
1465
players punching it by hand or a non-tool item, so that it can do something
@@ -1480,7 +1487,8 @@ Another example: Make red wool from white wool and red dye:
1480
1487
Slipperiness rises steadily with `slippery` value, starting at 1.
1481
1488
1482
1489
1483
- ### Known damage and digging time defining groups
1490
+ Known damage and digging time defining groups
1491
+ ---------------------------------------------
1484
1492
* `crumbly`: dirt, sand
1485
1493
* `cracky`: tough but crackable stuff like stone.
1486
1494
* `snappy`: something that can be cut using fine tools; e.g. leaves, small
@@ -1496,7 +1504,8 @@ Another example: Make red wool from white wool and red dye:
1496
1504
speed of a tool if the tool can dig at a faster speed than this
1497
1505
suggests for the hand.
1498
1506
1499
- ### Examples of custom groups
1507
+ Examples of custom groups
1508
+ -------------------------
1500
1509
Item groups are often used for defining, well, _groups of items_.
1501
1510
1502
1511
* `meat`: any meat-kind of a thing (rating might define the size or healing
@@ -1510,7 +1519,8 @@ Item groups are often used for defining, well, _groups of items_.
1510
1519
* `weapon`: any weapon
1511
1520
* `heavy`: anything considerably heavy
1512
1521
1513
- ### Digging time calculation specifics
1522
+ Digging time calculation specifics
1523
+ ----------------------------------
1514
1524
Groups such as `crumbly`, `cracky` and `snappy` are used for this
1515
1525
purpose. Rating is `1`, `2` or `3`. A higher rating for such a group implies
1516
1526
faster digging time.
@@ -1531,7 +1541,8 @@ groups to enable interaction with tools.
1531
1541
Tools
1532
1542
=====
1533
1543
1534
- #### Tools definition
1544
+ Tools definition
1545
+ ----------------
1535
1546
Tools define:
1536
1547
1537
1548
* Full punch interval
@@ -1542,19 +1553,22 @@ Tools define:
1542
1553
* Digging times
1543
1554
* Damage groups
1544
1555
1545
- #### Full punch interval
1556
+ ### Full punch interval
1557
+
1546
1558
When used as a weapon, the tool will do full damage if this time is spent
1547
1559
between punches. If e.g. half the time is spent, the tool will do half
1548
1560
damage.
1549
1561
1550
- #### Maximum drop level
1562
+ ### Maximum drop level
1563
+
1551
1564
Suggests the maximum level of node, when dug with the tool, that will drop
1552
1565
it's useful item. (e.g. iron ore to drop a lump of iron).
1553
1566
1554
1567
This is not automated; it is the responsibility of the node definition
1555
1568
to implement this.
1556
1569
1557
- #### Uses
1570
+ ### Uses
1571
+
1558
1572
Determines how many uses the tool has when it is used for digging a node,
1559
1573
of this group, of the maximum level. For lower leveled nodes, the use count
1560
1574
is multiplied by `3^leveldiff`.
@@ -1563,11 +1577,13 @@ is multiplied by `3^leveldiff`.
1563
1577
* `uses=10, leveldiff=1`: actual uses: 30
1564
1578
* `uses=10, leveldiff=2`: actual uses: 90
1565
1579
1566
- #### Maximum level
1580
+ ### Maximum level
1581
+
1567
1582
Tells what is the maximum level of a node of this group that the tool will
1568
1583
be able to dig.
1569
1584
1570
- #### Digging times
1585
+ ### Digging times
1586
+
1571
1587
List of digging times for different ratings of the group, for nodes of the
1572
1588
maximum level.
1573
1589
@@ -1580,10 +1596,12 @@ If the result digging time is 0, a delay of 0.15 seconds is added between
1580
1596
digging nodes; If the player releases LMB after digging, this delay is set to 0,
1581
1597
i.e. players can more quickly click the nodes away instead of holding LMB.
1582
1598
1583
- #### Damage groups
1599
+ ### Damage groups
1600
+
1584
1601
List of damage for groups of entities. See "Entity damage mechanism".
1585
1602
1586
- #### Example definition of the capabilities of a tool
1603
+ Example definition of the capabilities of a tool
1604
+ ------------------------------------------------
1587
1605
1588
1606
tool_capabilities = {
1589
1607
full_punch_interval=1.5,
@@ -1763,38 +1781,40 @@ WARNING: Minetest allows you to add elements to every single formspec instance
1763
1781
using player:set_formspec_prepend(), which may be the reason backgrounds are
1764
1782
appearing when you don't expect them to. See `no_prepend[]`
1765
1783
1766
- ### Examples
1784
+ Examples
1785
+ --------
1767
1786
1768
- #### Chest
1787
+ ### Chest
1769
1788
1770
1789
size[8,9]
1771
1790
list[context;main;0,0;8,4;]
1772
1791
list[current_player;main;0,5;8,4;]
1773
1792
1774
- #### Furnace
1793
+ ### Furnace
1775
1794
1776
1795
size[8,9]
1777
1796
list[context;fuel;2,3;1,1;]
1778
1797
list[context;src;2,1;1,1;]
1779
1798
list[context;dst;5,1;2,2;]
1780
1799
list[current_player;main;0,5;8,4;]
1781
1800
1782
- #### Minecraft-like player inventory
1801
+ ### Minecraft-like player inventory
1783
1802
1784
1803
size[8,7.5]
1785
1804
image[1,0.6;1,2;player.png]
1786
1805
list[current_player;main;0,3.5;8,4;]
1787
1806
list[current_player;craft;3,0;3,3;]
1788
1807
list[current_player;craftpreview;7,1;1,1;]
1789
1808
1790
- ### Elements
1809
+ Elements
1810
+ --------
1791
1811
1792
- #### `size[<W>,<H>,<fixed_size>]`
1812
+ ### `size[<W>,<H>,<fixed_size>]`
1793
1813
* Define the size of the menu in inventory slots
1794
1814
* `fixed_size`: `true`/`false` (optional)
1795
1815
* deprecated: `invsize[<W>,<H>;]`
1796
1816
1797
- #### `position[<X>,<Y>]`
1817
+ ### `position[<X>,<Y>]`
1798
1818
* Must be used after `size` element.
1799
1819
* Defines the position on the game window of the formspec's `anchor` point.
1800
1820
* For X and Y, 0.0 and 1.0 represent opposite edges of the game window,
@@ -1803,7 +1823,7 @@ appearing when you don't expect them to. See `no_prepend[]`
1803
1823
* [1.0, 1.0] sets the position to the bottom right of the game window.
1804
1824
* Defaults to the center of the game window [0.5, 0.5].
1805
1825
1806
- #### `anchor[<X>,<Y>]`
1826
+ ### `anchor[<X>,<Y>]`
1807
1827
* Must be used after both `size` and `position` (if present) elements.
1808
1828
* Defines the location of the anchor point within the formspec.
1809
1829
* For X and Y, 0.0 and 1.0 represent opposite edges of the formspec,
@@ -1815,87 +1835,87 @@ appearing when you don't expect them to. See `no_prepend[]`
1815
1835
* `position` and `anchor` elements need suitable values to avoid a formspec
1816
1836
extending off the game window due to particular game window sizes.
1817
1837
1818
- #### `no_prepend[]`
1838
+ ### `no_prepend[]`
1819
1839
* Must be used after the `size`, `position`, and `anchor` elements (if present).
1820
1840
* Disables player:set_formspec_prepend() from applying to this formspec.
1821
1841
1822
- #### `container[<X>,<Y>]`
1842
+ ### `container[<X>,<Y>]`
1823
1843
* Start of a container block, moves all physical elements in the container by
1824
1844
(X, Y).
1825
1845
* Must have matching `container_end`
1826
1846
* Containers can be nested, in which case the offsets are added
1827
1847
(child containers are relative to parent containers)
1828
1848
1829
- #### `container_end[]`
1849
+ ### `container_end[]`
1830
1850
* End of a container, following elements are no longer relative to this
1831
1851
container.
1832
1852
1833
- #### `list[<inventory location>;<list name>;<X>,<Y>;<W>,<H>;]`
1853
+ ### `list[<inventory location>;<list name>;<X>,<Y>;<W>,<H>;]`
1834
1854
* Show an inventory list
1835
1855
1836
- #### `list[<inventory location>;<list name>;<X>,<Y>;<W>,<H>;<starting item index>]`
1856
+ ### `list[<inventory location>;<list name>;<X>,<Y>;<W>,<H>;<starting item index>]`
1837
1857
* Show an inventory list
1838
1858
1839
- #### `listring[<inventory location>;<list name>]`
1859
+ ### `listring[<inventory location>;<list name>]`
1840
1860
* Allows to create a ring of inventory lists
1841
1861
* Shift-clicking on items in one element of the ring
1842
1862
will send them to the next inventory list inside the ring
1843
1863
* The first occurrence of an element inside the ring will
1844
1864
determine the inventory where items will be sent to
1845
1865
1846
- #### `listring[]`
1866
+ ### `listring[]`
1847
1867
* Shorthand for doing `listring[<inventory location>;<list name>]`
1848
1868
for the last two inventory lists added by list[...]
1849
1869
1850
- #### `listcolors[<slot_bg_normal>;<slot_bg_hover>]`
1870
+ ### `listcolors[<slot_bg_normal>;<slot_bg_hover>]`
1851
1871
* Sets background color of slots as `ColorString`
1852
1872
* Sets background color of slots on mouse hovering
1853
1873
1854
- #### `listcolors[<slot_bg_normal>;<slot_bg_hover>;<slot_border>]`
1874
+ ### `listcolors[<slot_bg_normal>;<slot_bg_hover>;<slot_border>]`
1855
1875
* Sets background color of slots as `ColorString`
1856
1876
* Sets background color of slots on mouse hovering
1857
1877
* Sets color of slots border
1858
1878
1859
- #### `listcolors[<slot_bg_normal>;<slot_bg_hover>;<slot_border>;<tooltip_bgcolor>;<tooltip_fontcolor>]`
1879
+ ### `listcolors[<slot_bg_normal>;<slot_bg_hover>;<slot_border>;<tooltip_bgcolor>;<tooltip_fontcolor>]`
1860
1880
* Sets background color of slots as `ColorString`
1861
1881
* Sets background color of slots on mouse hovering
1862
1882
* Sets color of slots border
1863
1883
* Sets default background color of tooltips
1864
1884
* Sets default font color of tooltips
1865
1885
1866
- #### `tooltip[<gui_element_name>;<tooltip_text>;<bgcolor>;<fontcolor>]`
1886
+ ### `tooltip[<gui_element_name>;<tooltip_text>;<bgcolor>;<fontcolor>]`
1867
1887
* Adds tooltip for an element
1868
1888
* `<bgcolor>` tooltip background color as `ColorString` (optional)
1869
1889
* `<fontcolor>` tooltip font color as `ColorString` (optional)
1870
1890
1871
- #### `image[<X>,<Y>;<W>,<H>;<texture name>]`
1891
+ ### `image[<X>,<Y>;<W>,<H>;<texture name>]`
1872
1892
* Show an image
1873
1893
* Position and size units are inventory slots
1874
1894
1875
- #### `item_image[<X>,<Y>;<W>,<H>;<item name>]`
1895
+ ### `item_image[<X>,<Y>;<W>,<H>;<item name>]`
1876
1896
* Show an inventory image of registered item/node
1877
1897
* Position and size units are inventory slots
1878
1898
1879
- #### `bgcolor[<color>;<fullscreen>]`
1899
+ ### `bgcolor[<color>;<fullscreen>]`
1880
1900
* Sets background color of formspec as `ColorString`
1881
1901
* If `true`, the background color is drawn fullscreen (does not effect the size
1882
1902
of the formspec).
1883
1903
1884
- #### `background[<X>,<Y>;<W>,<H>;<texture name>]`
1904
+ ### `background[<X>,<Y>;<W>,<H>;<texture name>]`
1885
1905
* Use a background. Inventory rectangles are not drawn then.
1886
1906
* Position and size units are inventory slots
1887
1907
* Example for formspec 8x4 in 16x resolution: image shall be sized
1888
1908
8 times 16px times 4 times 16px.
1889
1909
1890
- #### `background[<X>,<Y>;<W>,<H>;<texture name>;<auto_clip>]`
1910
+ ### `background[<X>,<Y>;<W>,<H>;<texture name>;<auto_clip>]`
1891
1911
* Use a background. Inventory rectangles are not drawn then.
1892
1912
* Position and size units are inventory slots
1893
1913
* Example for formspec 8x4 in 16x resolution:
1894
1914
image shall be sized 8 times 16px times 4 times 16px
1895
1915
* If `true` the background is clipped to formspec size
1896
1916
(`x` and `y` are used as offset values, `w` and `h` are ignored)
1897
1917
1898
- #### `pwdfield[<X>,<Y>;<W>,<H>;<name>;<label>]`
1918
+ ### `pwdfield[<X>,<Y>;<W>,<H>;<name>;<label>]`
1899
1919
* Textual password style field; will be sent to server when a button is clicked
1900
1920
* When enter is pressed in field, fields.key_enter_field will be sent with the
1901
1921
name of this field.
@@ -1907,7 +1927,7 @@ appearing when you don't expect them to. See `no_prepend[]`
1907
1927
* `label`, if not blank, will be text printed on the top left above the field
1908
1928
* See field_close_on_enter to stop enter closing the formspec
1909
1929
1910
- #### `field[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]`
1930
+ ### `field[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]`
1911
1931
* Textual field; will be sent to server when a button is clicked
1912
1932
* When enter is pressed in field, `fields.key_enter_field` will be sent with
1913
1933
the name of this field.
@@ -1923,7 +1943,7 @@ appearing when you don't expect them to. See `no_prepend[]`
1923
1943
* **Note**: no extra text or more than a single variable is supported ATM.
1924
1944
* See `field_close_on_enter` to stop enter closing the formspec
1925
1945
1926
- #### `field[<name>;<label>;<default>]`
1946
+ ### `field[<name>;<label>;<default>]`
1927
1947
* As above, but without position/size units
1928
1948
* When enter is pressed in field, `fields.key_enter_field` will be sent with
1929
1949
the name of this field.
@@ -1932,42 +1952,42 @@ appearing when you don't expect them to. See `no_prepend[]`
1932
1952
* A "Proceed" button will be added automatically
1933
1953
* See `field_close_on_enter` to stop enter closing the formspec
1934
1954
1935
- #### `field_close_on_enter[<name>;<close_on_enter>]`
1955
+ ### `field_close_on_enter[<name>;<close_on_enter>]`
1936
1956
* <name> is the name of the field
1937
1957
* if <close_on_enter> is false, pressing enter in the field will submit the
1938
1958
form but not close it.
1939
1959
* defaults to true when not specified (ie: no tag for a field)
1940
1960
1941
- #### `textarea[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]`
1961
+ ### `textarea[<X>,<Y>;<W>,<H>;<name>;<label>;<default>]`
1942
1962
* Same as fields above, but with multi-line input
1943
1963
* if the text overflows a vertical scrollbar is added
1944
1964
* if the name is empty the textarea is readonly, the label is not displayed.
1945
1965
1946
- #### `label[<X>,<Y>;<label>]`
1966
+ ### `label[<X>,<Y>;<label>]`
1947
1967
* `x` and `y` work as per field
1948
1968
* `label` is the text on the label
1949
1969
* Position and size units are inventory slots
1950
1970
1951
- #### `vertlabel[<X>,<Y>;<label>]`
1971
+ ### `vertlabel[<X>,<Y>;<label>]`
1952
1972
* Textual label drawn vertically
1953
1973
* `x` and `y` work as per field
1954
1974
* `label` is the text on the label
1955
1975
* Position and size units are inventory slots
1956
1976
1957
- #### `button[<X>,<Y>;<W>,<H>;<name>;<label>]`
1977
+ ### `button[<X>,<Y>;<W>,<H>;<name>;<label>]`
1958
1978
* Clickable button. When clicked, fields will be sent.
1959
1979
* `x`, `y` and `name` work as per field
1960
1980
* `w` and `h` are the size of the button
1961
1981
* Fixed button height. It will be vertically centred on `h`
1962
1982
* `label` is the text on the button
1963
1983
* Position and size units are inventory slots
1964
1984
1965
- #### `image_button[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>]`
1985
+ ### `image_button[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>]`
1966
1986
* `x`, `y`, `w`, `h`, and `name` work as per button
1967
1987
* `texture name` is the filename of an image
1968
1988
* Position and size units are inventory slots
1969
1989
1970
- #### `image_button[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>;<noclip>;<drawborder>;<pressed texture name>]`
1990
+ ### `image_button[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>;<noclip>;<drawborder>;<pressed texture name>]`
1971
1991
* `x`, `y`, `w`, `h`, and `name` work as per button
1972
1992
* `texture name` is the filename of an image
1973
1993
* Position and size units are inventory slots
@@ -1976,20 +1996,20 @@ appearing when you don't expect them to. See `no_prepend[]`
1976
1996
* `drawborder`: draw button border or not
1977
1997
* `pressed texture name` is the filename of an image on pressed state
1978
1998
1979
- #### `item_image_button[<X>,<Y>;<W>,<H>;<item name>;<name>;<label>]`
1999
+ ### `item_image_button[<X>,<Y>;<W>,<H>;<item name>;<name>;<label>]`
1980
2000
* `x`, `y`, `w`, `h`, `name` and `label` work as per button
1981
2001
* `item name` is the registered name of an item/node,
1982
2002
tooltip will be made out of its description
1983
2003
to override it use tooltip element
1984
2004
* Position and size units are inventory slots
1985
2005
1986
- #### `button_exit[<X>,<Y>;<W>,<H>;<name>;<label>]`
2006
+ ### `button_exit[<X>,<Y>;<W>,<H>;<name>;<label>]`
1987
2007
* When clicked, fields will be sent and the form will quit.
1988
2008
1989
- #### `image_button_exit[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>]`
2009
+ ### `image_button_exit[<X>,<Y>;<W>,<H>;<texture name>;<name>;<label>]`
1990
2010
* When clicked, fields will be sent and the form will quit.
1991
2011
1992
- #### `textlist[<X>,<Y>;<W>,<H>;<name>;<listelem 1>,<listelem 2>,...,<listelem n>]`
2012
+ ### `textlist[<X>,<Y>;<W>,<H>;<name>;<listelem 1>,<listelem 2>,...,<listelem n>]`
1993
2013
* Scrollable item list showing arbitrary text elements
1994
2014
* `x` and `y` position the itemlist relative to the top left of the menu
1995
2015
* `w` and `h` are the size of the itemlist
@@ -1999,7 +2019,7 @@ appearing when you don't expect them to. See `no_prepend[]`
1999
2019
(only).
2000
2020
* if you want a listelement to start with "#" write "##".
2001
2021
2002
- #### `textlist[<X>,<Y>;<W>,<H>;<name>;<listelem 1>,<listelem 2>,...,<listelem n>;<selected idx>;<transparent>]`
2022
+ ### `textlist[<X>,<Y>;<W>,<H>;<name>;<listelem 1>,<listelem 2>,...,<listelem n>;<selected idx>;<transparent>]`
2003
2023
* Scrollable itemlist showing arbitrary text elements
2004
2024
* `x` and `y` position the item list relative to the top left of the menu
2005
2025
* `w` and `h` are the size of the item list
@@ -2012,7 +2032,7 @@ appearing when you don't expect them to. See `no_prepend[]`
2012
2032
* See also `minetest.explode_textlist_event`
2013
2033
(main menu: `core.explode_textlist_event`).
2014
2034
2015
- #### `tabheader[<X>,<Y>;<name>;<caption 1>,<caption 2>,...,<caption n>;<current_tab>;<transparent>;<draw_border>]`
2035
+ ### `tabheader[<X>,<Y>;<name>;<caption 1>,<caption 2>,...,<caption n>;<current_tab>;<transparent>;<draw_border>]`
2016
2036
* Show a tab**header** at specific position (ignores formsize)
2017
2037
* `x` and `y` position the itemlist relative to the top left of the menu
2018
2038
* `name` fieldname data is transferred to Lua
@@ -2021,14 +2041,14 @@ appearing when you don't expect them to. See `no_prepend[]`
2021
2041
* `transparent` (optional): show transparent
2022
2042
* `draw_border` (optional): draw border
2023
2043
2024
- #### `box[<X>,<Y>;<W>,<H>;<color>]`
2044
+ ### `box[<X>,<Y>;<W>,<H>;<color>]`
2025
2045
* Simple colored box
2026
2046
* `x` and `y` position the box relative to the top left of the menu
2027
2047
* `w` and `h` are the size of box
2028
2048
* `color` is color specified as a `ColorString`.
2029
2049
If the alpha component is left blank, the box will be semitransparent.
2030
2050
2031
- #### `dropdown[<X>,<Y>;<W>;<name>;<item 1>,<item 2>, ...,<item n>;<selected idx>]`
2051
+ ### `dropdown[<X>,<Y>;<W>;<name>;<item 1>,<item 2>, ...,<item n>;<selected idx>]`
2032
2052
* Show a dropdown field
2033
2053
* **Important note**: There are two different operation modes:
2034
2054
1. handle directly on change (only changed dropdown is submitted)
@@ -2039,14 +2059,14 @@ appearing when you don't expect them to. See `no_prepend[]`
2039
2059
* Items to be shown in dropdown
2040
2060
* Index of currently selected dropdown item
2041
2061
2042
- #### `checkbox[<X>,<Y>;<name>;<label>;<selected>]`
2062
+ ### `checkbox[<X>,<Y>;<name>;<label>;<selected>]`
2043
2063
* Show a checkbox
2044
2064
* `x` and `y`: position of checkbox
2045
2065
* `name` fieldname data is transferred to Lua
2046
2066
* `label` to be shown left of checkbox
2047
2067
* `selected` (optional): `true`/`false`
2048
2068
2049
- #### `scrollbar[<X>,<Y>;<W>,<H>;<orientation>;<name>;<value>]`
2069
+ ### `scrollbar[<X>,<Y>;<W>,<H>;<orientation>;<name>;<value>]`
2050
2070
* Show a scrollbar
2051
2071
* There are two ways to use it:
2052
2072
1. handle the changed event (only changed scrollbar is available)
@@ -2059,7 +2079,7 @@ appearing when you don't expect them to. See `no_prepend[]`
2059
2079
* See also `minetest.explode_scrollbar_event`
2060
2080
(main menu: `core.explode_scrollbar_event`).
2061
2081
2062
- #### `table[<X>,<Y>;<W>,<H>;<name>;<cell 1>,<cell 2>,...,<cell n>;<selected idx>]`
2082
+ ### `table[<X>,<Y>;<W>,<H>;<name>;<cell 1>,<cell 2>,...,<cell n>;<selected idx>]`
2063
2083
* Show scrollable table using options defined by the previous `tableoptions[]`
2064
2084
* Displays cells as defined by the previous `tablecolumns[]`
2065
2085
* `x` and `y`: position the itemlist relative to the top left of the menu
@@ -2070,7 +2090,7 @@ appearing when you don't expect them to. See `no_prepend[]`
2070
2090
* See also `minetest.explode_table_event`
2071
2091
(main menu: `core.explode_table_event`).
2072
2092
2073
- #### `tableoptions[<opt 1>;<opt 2>;...]`
2093
+ ### `tableoptions[<opt 1>;<opt 2>;...]`
2074
2094
* Sets options for `table[]`
2075
2095
* `color=#RRGGBB`
2076
2096
* default text color (`ColorString`), defaults to `#FFFFFF`
@@ -2086,7 +2106,7 @@ appearing when you don't expect them to. See `no_prepend[]`
2086
2106
* all subtrees up to `depth < value` are open (default value = `0`)
2087
2107
* only useful when there is a column of type "tree"
2088
2108
2089
- #### `tablecolumns[<type 1>,<opt 1a>,<opt 1b>,...;<type 2>,<opt 2a>,<opt 2b>;...]`
2109
+ ### `tablecolumns[<type 1>,<opt 1a>,<opt 1b>,...;<type 2>,<opt 2a>,<opt 2b>;...]`
2090
2110
* Sets columns for `table[]`
2091
2111
* Types: `text`, `image`, `color`, `indent`, `tree`
2092
2112
* `text`: show cell contents as text
@@ -2145,8 +2165,8 @@ Player Inventory lists
2145
2165
2146
2166
2147
2167
2148
- Colours
2149
- =======
2168
+ Colors
2169
+ ======
2150
2170
2151
2171
`ColorString`
2152
2172
-------------
@@ -2326,7 +2346,8 @@ Translations
2326
2346
Texts can be translated client-side with the help of `minetest.translate` and
2327
2347
translation files.
2328
2348
2329
- ### Translating a string
2349
+ Translating a string
2350
+ --------------------
2330
2351
Two functions are provided to translate strings: `minetest.translate` and
2331
2352
`minetest.get_translator`.
2332
2353
@@ -2368,7 +2389,8 @@ Two functions are provided to translate strings: `minetest.translate` and
2368
2389
2369
2390
this will be displayed as "Laine Rouge" on clients with a French locale.
2370
2391
2371
- ### Operations on translated strings
2392
+ Operations on translated strings
2393
+ --------------------------------
2372
2394
2373
2395
The output of `minetest.translate` is a string, with escape sequences adding
2374
2396
additional information to that string so that it can be translated on the
@@ -2379,7 +2401,8 @@ expected manner. However, string concatenation will still work as expected
2379
2401
sentences by breaking them into parts; arguments should be used instead), and
2380
2402
operations such as `minetest.colorize` which are also concatenation.
2381
2403
2382
- ### Translation file format
2404
+ Translation file format
2405
+ -----------------------
2383
2406
A translation file has the suffix `.[lang].tr`, where `[lang]` is the language
2384
2407
it corresponds to. It must be put into the `locale` subdirectory of the mod.
2385
2408
The file should be a text file, with the following format:
@@ -2393,7 +2416,8 @@ The file should be a text file, with the following format:
2393
2416
There must be no extraneous whitespace around the `=` or at the beginning or
2394
2417
the end of the line.
2395
2418
2396
- ### Escapes
2419
+ Escapes
2420
+ -------
2397
2421
Strings that need to be translated can contain several escapes, preceded by `@`.
2398
2422
2399
2423
* `@@` acts as a literal `@`.
@@ -2421,7 +2445,8 @@ The result is used during map generation to create the terrain shape, vary heat
2421
2445
and humidity to distribute biomes, vary the density of decorations or vary the
2422
2446
structure of ores.
2423
2447
2424
- ### Structure of perlin noise
2448
+ Structure of perlin noise
2449
+ -------------------------
2425
2450
An 'octave' is a simple noise generator that outputs a value between -1 and 1.
2426
2451
The smooth wavy noise it generates has a single characteristic scale, almost
2427
2452
like a 'wavelength', so on its own does not create fine detail.
@@ -2703,15 +2728,17 @@ Decoration types
2703
2728
2704
2729
The varying types of decorations that can be placed.
2705
2730
2706
- ### `simple`
2731
+ `simple`
2732
+ --------
2707
2733
Creates a 1 times `H` times 1 column of a specified node (or a random node from
2708
2734
a list, if a decoration list is specified). Can specify a certain node it must
2709
2735
spawn next to, such as water or lava, for example. Can also generate a
2710
2736
decoration of random height between a specified lower and upper bound.
2711
2737
This type of decoration is intended for placement of grass, flowers, cacti,
2712
2738
papyri, waterlilies and so on.
2713
2739
2714
- ### `schematic`
2740
+ `schematic`
2741
+ -----------
2715
2742
Copies a box of `MapNodes` from a specified schematic file (or raw description).
2716
2743
Can specify a probability of a node randomly appearing when placed.
2717
2744
This decoration type is intended to be used for multi-node sized discrete
@@ -2774,7 +2801,8 @@ Currently supported flags: `place_center_x`, `place_center_y`, `place_center_z`,
2774
2801
Lua Voxel Manipulator
2775
2802
=====================
2776
2803
2777
- ### About VoxelManip
2804
+ About VoxelManip
2805
+ ----------------
2778
2806
VoxelManip is a scripting interface to the internal 'Map Voxel Manipulator'
2779
2807
facility. The purpose of this object is for fast, low-level, bulk access to
2780
2808
reading and writing Map content. As such, setting map nodes through VoxelManip
@@ -2798,7 +2826,8 @@ usage.
2798
2826
A recent simple test of setting cubic areas showed that `minetest.set_node()`
2799
2827
is faster than a VoxelManip for a 3x3x3 node cube or smaller.
2800
2828
2801
- ### Using VoxelManip
2829
+ Using VoxelManip
2830
+ ----------------
2802
2831
A VoxelManip object can be created any time using either:
2803
2832
`VoxelManip([p1, p2])`, or `minetest.get_voxel_manip([p1, p2])`.
2804
2833
@@ -2851,7 +2880,7 @@ Once the internal VoxelManip state has been modified to your liking, the
2851
2880
changes can be committed back to the map by calling `VoxelManip:write_to_map()`
2852
2881
2853
2882
2854
- #### Flat array format
2883
+ ### Flat array format
2855
2884
Let
2856
2885
`Nx = p2.X - p1.X + 1`,
2857
2886
`Ny = p2.Y - p1.Y + 1`, and
@@ -2885,7 +2914,7 @@ Note that this is the same "flat 3D array" format as
2885
2914
VoxelArea objects (see section 'VoxelArea') can be used to simplify calculation
2886
2915
of the index for a single point in a flat VoxelManip array.
2887
2916
2888
- #### Content IDs
2917
+ ### Content IDs
2889
2918
A Content ID is a unique integer identifier for a specific node type.
2890
2919
These IDs are used by VoxelManip in place of the node name string for
2891
2920
`VoxelManip:get_data()` and `VoxelManip:set_data()`. You can use
@@ -2902,7 +2931,7 @@ The following builtin node types have their Content IDs defined as constants:
2902
2931
* `minetest.CONTENT_AIR`: ID for "air" nodes
2903
2932
* `minetest.CONTENT_IGNORE`: ID for "ignore" nodes
2904
2933
2905
- #### Mapgen VoxelManip objects
2934
+ ### Mapgen VoxelManip objects
2906
2935
Inside of `on_generated()` callbacks, it is possible to retrieve the same
2907
2936
VoxelManip object used by the core's Map Generator (commonly abbreviated
2908
2937
Mapgen). Most of the rules previously described still apply but with a few
@@ -2926,7 +2955,7 @@ differences:
2926
2955
necessary to update lighting information using either:
2927
2956
`VoxelManip:calc_lighting()` or `VoxelManip:set_lighting()`.
2928
2957
2929
- #### Other API functions operating on a VoxelManip
2958
+ ### Other API functions operating on a VoxelManip
2930
2959
If any VoxelManip contents were set to a liquid node,
2931
2960
`VoxelManip:update_liquids()` must be called for these liquid nodes to begin
2932
2961
flowing. It is recommended to call this function only after having written all
@@ -2942,7 +2971,7 @@ inside of the specified VoxelManip object.
2942
2971
directly on the map at the specified position, it will place the schematic
2943
2972
inside the VoxelManip.
2944
2973
2945
- #### Notes
2974
+ ### Notes
2946
2975
* Attempting to read data from a VoxelManip object before map is read will
2947
2976
result in a zero-length array table for `VoxelManip:get_data()`, and an
2948
2977
"ignore" node at any position for `VoxelManip:get_node_at()`.
@@ -2959,7 +2988,8 @@ inside the VoxelManip.
2959
2988
to write map data to instead of returning a new table each call. This greatly
2960
2989
enhances performance by avoiding unnecessary memory allocations.
2961
2990
2962
- ### Methods
2991
+ Methods
2992
+ -------
2963
2993
* `read_from_map(p1, p2)`: Loads a chunk of map into the VoxelManip object
2964
2994
containing the region formed by `p1` and `p2`.
2965
2995
* returns actual emerged `pmin`, actual emerged `pmax`
@@ -3023,12 +3053,13 @@ inside the VoxelManip.
3023
3053
`minetest.set_data()` on the loaded area elsewhere.
3024
3054
* `get_emerged_area()`: Returns actual emerged minimum and maximum positions.
3025
3055
3026
- ### `VoxelArea`
3056
+ `VoxelArea`
3057
+ -----------
3027
3058
A helper class for voxel areas.
3028
3059
It can be created via `VoxelArea:new{MinEdge=pmin, MaxEdge=pmax}`.
3029
3060
The coordinates are *inclusive*, like most other things in Minetest.
3030
3061
3031
- #### Methods
3062
+ ### Methods
3032
3063
* `getExtent()`: returns a 3D vector containing the size of the area formed by
3033
3064
`MinEdge` and `MaxEdge`.
3034
3065
* `getVolume()`: returns the volume of the area formed by `MinEdge` and
@@ -3071,26 +3102,32 @@ callback, `nil` is returned.
3071
3102
The following Mapgen objects are currently available:
3072
3103
3073
3104
### `voxelmanip`
3105
+
3074
3106
This returns three values; the `VoxelManip` object to be used, minimum and
3075
3107
maximum emerged position, in that order. All mapgens support this object.
3076
3108
3077
3109
### `heightmap`
3110
+
3078
3111
Returns an array containing the y coordinates of the ground levels of nodes in
3079
3112
the most recently generated chunk by the current mapgen.
3080
3113
3081
3114
### `biomemap`
3115
+
3082
3116
Returns an array containing the biome IDs of nodes in the most recently
3083
3117
generated chunk by the current mapgen.
3084
3118
3085
3119
### `heatmap`
3120
+
3086
3121
Returns an array containing the temperature values of nodes in the most
3087
3122
recently generated chunk by the current mapgen.
3088
3123
3089
3124
### `humiditymap`
3125
+
3090
3126
Returns an array containing the humidity values of nodes in the most recently
3091
3127
generated chunk by the current mapgen.
3092
3128
3093
3129
### `gennotify`
3130
+
3094
3131
Returns a table mapping requested generation notification types to arrays of
3095
3132
positions at which the corresponding generated structures are located within
3096
3133
the current chunk. To set the capture of positions of interest to be recorded
@@ -3163,7 +3200,8 @@ Registered entities
3163
3200
L-system trees
3164
3201
==============
3165
3202
3166
- ### Tree definition
3203
+ Tree definition
3204
+ ---------------
3167
3205
3168
3206
treedef={
3169
3207
axiom, --string initial tree axiom
@@ -3187,7 +3225,8 @@ L-system trees
3187
3225
will create one.
3188
3226
}
3189
3227
3190
- ### Key for Special L-System Symbols used in Axioms
3228
+ Key for Special L-System Symbols used in Axioms
3229
+ -----------------------------------------------
3191
3230
3192
3231
* `G`: move forward one unit with the pen up
3193
3232
* `F`: move forward one unit with the pen down drawing trunks and branches
@@ -3211,7 +3250,8 @@ L-system trees
3211
3250
* `[`: save in stack current state info
3212
3251
* `]`: recover from stack state info
3213
3252
3214
- ### Example
3253
+ Example
3254
+ -------
3215
3255
Spawn a small apple tree:
3216
3256
3217
3257
pos = {x=230,y=20,z=4}
@@ -3237,7 +3277,8 @@ Spawn a small apple tree:
3237
3277
'minetest' namespace reference
3238
3278
==============================
3239
3279
3240
- ### Utilities
3280
+ Utilities
3281
+ ---------
3241
3282
3242
3283
* `minetest.get_current_modname()`: returns the currently loading mod's name,
3243
3284
when loading a mod.
@@ -3327,14 +3368,16 @@ Spawn a small apple tree:
3327
3368
* `data`: string of data to hash
3328
3369
* `raw`: return raw bytes instead of hex digits, default: false
3329
3370
3330
- ### Logging
3371
+ Logging
3372
+ -------
3331
3373
* `minetest.debug(...)`
3332
3374
* Equivalent to `minetest.log(table.concat({...}, "\t"))`
3333
3375
* `minetest.log([level,] text)`
3334
3376
* `level` is one of `"none"`, `"error"`, `"warning"`, `"action"`,
3335
3377
`"info"`, or `"verbose"`. Default is `"none"`.
3336
3378
3337
- ### Registration functions
3379
+ Registration functions
3380
+ ----------------------
3338
3381
Call these functions only at load time!
3339
3382
3340
3383
* `minetest.register_entity(name, prototype table)`
@@ -3371,7 +3414,8 @@ Call these functions only at load time!
3371
3414
* `minetest.clear_registered_biomes()`
3372
3415
* `minetest.clear_registered_decorations()`
3373
3416
3374
- ### Global callback registration functions
3417
+ Global callback registration functions
3418
+ --------------------------------------
3375
3419
Call these functions only at load time!
3376
3420
3377
3421
* `minetest.register_globalstep(func(dtime))`
@@ -3524,7 +3568,8 @@ Call these functions only at load time!
3524
3568
* You should have joined some channels to receive events.
3525
3569
* If message comes from a server mod, `sender` field is an empty string.
3526
3570
3527
- ### Other registration functions
3571
+ Other registration functions
3572
+ ----------------------------
3528
3573
* `minetest.register_chatcommand(cmd, chatcommand definition)`
3529
3574
* Adds definition to `minetest.registered_chatcommands`
3530
3575
* `minetest.override_chatcommand(name, redefinition)`
@@ -3552,13 +3597,15 @@ Call these functions only at load time!
3552
3597
* Registers an auth handler that overrides the builtin one
3553
3598
* This function can be called by a single mod once only.
3554
3599
3555
- ### Setting-related
3600
+ Setting-related
3601
+ ---------------
3556
3602
* `minetest.settings`: Settings object containing all of the settings from the
3557
3603
main config file (`minetest.conf`).
3558
3604
* `minetest.setting_get_pos(name)`: Loads a setting from the main settings and
3559
3605
parses it as a position (in the format `(1,2,3)`). Returns a position or nil.
3560
3606
3561
- ### Authentication
3607
+ Authentication
3608
+ --------------
3562
3609
* `minetest.string_to_privs(str)`: returns `{priv1=true,...}`
3563
3610
* `minetest.privs_to_string(privs)`: returns `"priv1,priv2,..."`
3564
3611
* Convert between two privilege representations
@@ -3606,11 +3653,13 @@ Call these functions only at load time!
3606
3653
`minetest_get_player_privs` and `minetest.auth_reload` call the authentication
3607
3654
handler.
3608
3655
3609
- ### Chat
3656
+ Chat
3657
+ ----
3610
3658
* `minetest.chat_send_all(text)`
3611
3659
* `minetest.chat_send_player(name, text)`
3612
3660
3613
- ### Environment access
3661
+ Environment access
3662
+ ------------------
3614
3663
* `minetest.set_node(pos, node)`
3615
3664
* `minetest.add_node(pos, node): alias to `minetest.set_node`
3616
3665
* Set node at position `pos`
@@ -3904,7 +3953,8 @@ handler.
3904
3953
* The spawn level is intentionally above terrain level to cope with
3905
3954
full-node biome 'dust' nodes.
3906
3955
3907
- ### Mod channels
3956
+ Mod channels
3957
+ ------------
3908
3958
You can find mod channels communication scheme in `docs/mod_channels.png`.
3909
3959
3910
3960
* `minetest.mod_channel_join(channel_name)`
@@ -3913,7 +3963,8 @@ You can find mod channels communication scheme in `docs/mod_channels.png`.
3913
3963
`minetest.register_on_modchannel_message` call to receive incoming
3914
3964
messages.
3915
3965
3916
- ### Inventory
3966
+ Inventory
3967
+ ---------
3917
3968
`minetest.get_inventory(location)`: returns an `InvRef`
3918
3969
3919
3970
* `location` = e.g.
@@ -3933,7 +3984,8 @@ You can find mod channels communication scheme in `docs/mod_channels.png`.
3933
3984
returns left over ItemStack.
3934
3985
* See `minetest.item_eat` and `minetest.register_on_item_eat`
3935
3986
3936
- ### Formspec
3987
+ Formspec
3988
+ --------
3937
3989
* `minetest.show_formspec(playername, formname, formspec)`
3938
3990
* `playername`: name of player to show formspec
3939
3991
* `formname`: name passed to `on_player_receive_fields` callbacks.
@@ -3970,7 +4022,8 @@ You can find mod channels communication scheme in `docs/mod_channels.png`.
3970
4022
* `"CHG"`: has been changed
3971
4023
* `"VAL"`: not changed
3972
4024
3973
- ### Item handling
4025
+ Item handling
4026
+ -------------
3974
4027
* `minetest.inventorycube(img1, img2, img3)`
3975
4028
* Returns a string for making an image of a cube (useful as an item image)
3976
4029
* `minetest.get_pointed_thing_position(pointed_thing, above)`
@@ -4064,7 +4117,8 @@ You can find mod channels communication scheme in `docs/mod_channels.png`.
4064
4117
table and native form.
4065
4118
* `colorstring`: the new color of the item stack
4066
4119
4067
- ### Rollback
4120
+ Rollback
4121
+ --------
4068
4122
* `minetest.rollback_get_node_actions(pos, range, seconds, limit)`:
4069
4123
returns `{{actor, pos, time, oldnode, newnode}, ...}`
4070
4124
* Find who has done something to a node, or near a node
@@ -4074,7 +4128,8 @@ You can find mod channels communication scheme in `docs/mod_channels.png`.
4074
4128
* Revert latest actions of someone
4075
4129
* `actor`: `"player:<name>"`, also `"liquid"`.
4076
4130
4077
- ### Defaults for the `on_*` item definition functions
4131
+ Defaults for the `on_*` item definition functions
4132
+ -------------------------------------------------
4078
4133
These functions return the leftover itemstack.
4079
4134
4080
4135
* `minetest.item_place_node(itemstack, placer, pointed_thing[, param2, prevent_after_place])`
@@ -4100,14 +4155,16 @@ These functions return the leftover itemstack.
4100
4155
different spot. Can be `nil`
4101
4156
* See `minetest.do_item_eat`
4102
4157
4103
- ### Defaults for the `on_punch` and `on_dig` node definition callbacks
4158
+ Defaults for the `on_punch` and `on_dig` node definition callbacks
4159
+ ------------------------------------------------------------------
4104
4160
* `minetest.node_punch(pos, node, puncher, pointed_thing)`
4105
4161
* Calls functions registered by `minetest.register_on_punchnode()`
4106
4162
* `minetest.node_dig(pos, node, digger)`
4107
4163
* Checks if node can be dug, puts item into inventory, removes node
4108
4164
* Calls functions registered by `minetest.registered_on_dignodes()`
4109
4165
4110
- ### Sounds
4166
+ Sounds
4167
+ ------
4111
4168
* `minetest.sound_play(spec, parameters)`: returns a handle
4112
4169
* `spec` is a `SimpleSoundSpec`
4113
4170
* `parameters` is a sound parameter table
@@ -4119,12 +4176,14 @@ These functions return the leftover itemstack.
4119
4176
the sound volume.
4120
4177
* `gain` the target gain for the fade.
4121
4178
4122
- ### Timing
4179
+ Timing
4180
+ ------
4123
4181
* `minetest.after(time, func, ...)`
4124
4182
* Call the function `func` after `time` seconds, may be fractional
4125
4183
* Optional: Variable number of arguments that are passed to `func`
4126
4184
4127
- ### Server
4185
+ Server
4186
+ ------
4128
4187
* `minetest.request_shutdown([message],[reconnect],[delay])`: request for
4129
4188
server shutdown. Will display `message` to clients.
4130
4189
* `reconnect` == true displays a reconnect button
@@ -4149,7 +4208,8 @@ These functions return the leftover itemstack.
4149
4208
* `minetest.remove_player_auth(name)`: remove player authentication data
4150
4209
* Returns boolean indicating success (false if player nonexistant)
4151
4210
4152
- ### Bans
4211
+ Bans
4212
+ ----
4153
4213
* `minetest.get_ban_list()`: returns the ban list
4154
4214
(same as `minetest.get_ban_description("")`).
4155
4215
* `minetest.get_ban_description(ip_or_name)`: returns ban description (string)
@@ -4158,7 +4218,8 @@ These functions return the leftover itemstack.
4158
4218
* `minetest.kick_player(name, [reason])`: disconnect a player with a optional
4159
4219
reason.
4160
4220
4161
- ### Particles
4221
+ Particles
4222
+ ---------
4162
4223
* `minetest.add_particle(particle definition)`
4163
4224
* Deprecated: `minetest.add_particle(pos, velocity, acceleration,
4164
4225
expirationtime, size, collisiondetection, texture, playername)`
@@ -4181,7 +4242,8 @@ These functions return the leftover itemstack.
4181
4242
* If playername is specified, only deletes on the player's client,
4182
4243
otherwise on all clients.
4183
4244
4184
- ### Schematics
4245
+ Schematics
4246
+ ----------
4185
4247
* `minetest.create_schematic(p1, p2, probability_list, filename, slice_prob_list)`
4186
4248
* Create a schematic from the volume of map specified by the box formed by
4187
4249
p1 and p2.
@@ -4261,7 +4323,8 @@ These functions return the leftover itemstack.
4261
4323
the Lua code generated will use that number of spaces as indentation
4262
4324
instead of a tab character.
4263
4325
4264
- ### HTTP Requests:
4326
+ HTTP Requests:
4327
+ --------------
4265
4328
* `minetest.request_http_api()`:
4266
4329
* returns `HTTPApiTable` containing http functions if the calling mod has
4267
4330
been granted access by being listed in the `secure.http_mods` or
@@ -4283,12 +4346,14 @@ These functions return the leftover itemstack.
4283
4346
* `HTTPApiTable.fetch_async_get(handle)`: returns HTTPRequestResult
4284
4347
* Return response data for given asynchronous HTTP request
4285
4348
4286
- ### Storage API:
4349
+ Storage API:
4350
+ ------------
4287
4351
* `minetest.get_mod_storage()`:
4288
4352
* returns reference to mod private `StorageRef`
4289
4353
* must be called during mod load time
4290
4354
4291
- ### Misc.
4355
+ Misc.
4356
+ -----
4292
4357
* `minetest.get_connected_players()`: returns list of `ObjectRefs`
4293
4358
* `minetest.is_player(o)`: boolean, whether `o` is a player
4294
4359
* `minetest.player_exists(name)`: boolean, whether player exists
@@ -4456,14 +4521,16 @@ These functions return the leftover itemstack.
4456
4521
* `minetest.global_exists(name)`
4457
4522
* Checks if a global variable has been set, without triggering a warning.
4458
4523
4459
- ### Global objects
4524
+ Global objects
4525
+ --------------
4460
4526
* `minetest.env`: `EnvRef` of the server environment and world.
4461
4527
* Any function in the minetest namespace can be called using the syntax
4462
4528
`minetest.env:somefunction(somearguments)`
4463
4529
instead of `minetest.somefunction(somearguments)`
4464
4530
* Deprecated, but support is not to be dropped soon
4465
4531
4466
- ### Global tables
4532
+ Global tables
4533
+ -------------
4467
4534
* `minetest.registered_items`
4468
4535
* Map of registered items, indexed by name
4469
4536
* `minetest.registered_nodes`
@@ -4495,7 +4562,8 @@ Class reference
4495
4562
4496
4563
Sorted alphabetically.
4497
4564
4498
- ### `AreaStore`
4565
+ `AreaStore`
4566
+ -----------
4499
4567
A fast access data structure to store areas, and find areas near a given
4500
4568
position or area.
4501
4569
Every area has a `data` string attribute to store additional information.
@@ -4504,7 +4572,7 @@ You can create an empty `AreaStore` by calling `AreaStore()`, or
4504
4572
If you chose the parameter-less constructor, a fast implementation will be
4505
4573
automatically chosen for you.
4506
4574
4507
- #### Methods
4575
+ ### Methods
4508
4576
* `get_area(id, include_borders, include_data)`: returns the area with the id
4509
4577
`id`.
4510
4578
(optional) Boolean values `include_borders` and `include_data` control what's
@@ -4554,10 +4622,11 @@ automatically chosen for you.
4554
4622
* `from_file(filename)`: Experimental. Like `from_string()`, but reads the data
4555
4623
from a file.
4556
4624
4557
- ### `InvRef`
4625
+ `InvRef`
4626
+ --------
4558
4627
An `InvRef` is a reference to an inventory.
4559
4628
4560
- #### Methods
4629
+ ### Methods
4561
4630
* `is_empty(listname)`: return `true` if list is empty
4562
4631
* `get_size(listname)`: get size of a list
4563
4632
* `set_size(listname, size)`: set size of a list
@@ -4587,13 +4656,14 @@ An `InvRef` is a reference to an inventory.
4587
4656
`minetest.get_inventory(location)`.
4588
4657
* returns `{type="undefined"}` in case location is not known
4589
4658
4590
- ### `ItemStack`
4659
+ `ItemStack`
4660
+ -----------
4591
4661
An `ItemStack` is a stack of items.
4592
4662
4593
4663
It can be created via `ItemStack(x)`, where x is an `ItemStack`,
4594
4664
an itemstring, a table or `nil`.
4595
4665
4596
- #### Methods
4666
+ ### Methods
4597
4667
* `is_empty()`: returns `true` if stack is empty.
4598
4668
* `get_name()`: returns item name (e.g. `"default:stone"`).
4599
4669
* `set_name(item_name)`: returns a boolean indicating whether the item was
@@ -4634,21 +4704,23 @@ an itemstring, a table or `nil`.
4634
4704
* Copy (don't remove) up to `n` items from this stack
4635
4705
* `n`: number, default: `1`
4636
4706
4637
- ### `ItemStackMetaRef`
4707
+ `ItemStackMetaRef`
4708
+ ------------------
4638
4709
ItemStack metadata: reference extra data and functionality stored in a stack.
4639
4710
Can be obtained via `item:get_meta()`.
4640
4711
4641
- #### Methods
4712
+ ### Methods
4642
4713
* All methods in MetaDataRef
4643
4714
* `set_tool_capabilities([tool_capabilities])`
4644
4715
* Overrides the item's tool capabilities
4645
4716
* A nil value will clear the override data and restore the original
4646
4717
behavior.
4647
4718
4648
- ### `MetaDataRef`
4719
+ `MetaDataRef`
4720
+ -------------
4649
4721
See `StorageRef`, `NodeMetaRef`, `ItemStackMetaRef`, and `PlayerMetaRef`.
4650
4722
4651
- #### Methods
4723
+ ### Methods
4652
4724
* `contains(key)`: Returns true if key present, otherwise false.
4653
4725
* Returns `nil` when the MetaData is inexistent.
4654
4726
* `get(key)`: Returns `nil` if key not present, else the stored string.
@@ -4668,27 +4740,29 @@ See `StorageRef`, `NodeMetaRef`, `ItemStackMetaRef`, and `PlayerMetaRef`.
4668
4740
* `equals(other)`
4669
4741
* returns `true` if this metadata has the same key-value pairs as `other`
4670
4742
4671
- ### ModChannel
4743
+ ModChannel
4744
+ ----------
4672
4745
An interface to use mod channels on client and server
4673
4746
4674
- #### Methods
4747
+ ### Methods
4675
4748
* `leave()`: leave the mod channel.
4676
4749
* Server leaves channel `channel_name`.
4677
4750
* No more incoming or outgoing messages can be sent to this channel from
4678
4751
server mods.
4679
4752
* This invalidate all future object usage.
4680
- * Ensure your set mod_channel to nil after that to free Lua resources.
4753
+ * Ensure you set mod_channel to nil after that to free Lua resources.
4681
4754
* `is_writeable()`: returns true if channel is writeable and mod can send over
4682
4755
it.
4683
4756
* `send_all(message)`: Send `message` though the mod channel.
4684
4757
* If mod channel is not writeable or invalid, message will be dropped.
4685
4758
* Message size is limited to 65535 characters by protocol.
4686
4759
4687
- ### `NodeMetaRef`
4760
+ `NodeMetaRef`
4761
+ -------------
4688
4762
Node metadata: reference extra data and functionality stored in a node.
4689
4763
Can be obtained via `minetest.get_meta(pos)`.
4690
4764
4691
- #### Methods
4765
+ ### Methods
4692
4766
* All methods in MetaDataRef
4693
4767
* `get_inventory()`: returns `InvRef`
4694
4768
* `mark_as_private(name or {name1, name2, ...})`: Mark specific vars as private
@@ -4697,11 +4771,12 @@ Can be obtained via `minetest.get_meta(pos)`.
4697
4771
meaning it's best to call this when initializing all other meta (e.g.
4698
4772
`on_construct`).
4699
4773
4700
- ### `NodeTimerRef`
4774
+ `NodeTimerRef`
4775
+ --------------
4701
4776
Node Timers: a high resolution persistent per-node timer.
4702
4777
Can be gotten via `minetest.get_node_timer(pos)`.
4703
4778
4704
- #### Methods
4779
+ ### Methods
4705
4780
* `set(timeout,elapsed)`
4706
4781
* set a timer's state
4707
4782
* `timeout` is in seconds, and supports fractional values (0.1 etc)
@@ -4721,12 +4796,13 @@ Can be gotten via `minetest.get_node_timer(pos)`.
4721
4796
* `is_started()`: returns boolean state of timer
4722
4797
* returns `true` if timer is started, otherwise `false`
4723
4798
4724
- ### `ObjectRef`
4799
+ `ObjectRef`
4800
+ -----------
4725
4801
Moving things in the game are generally these.
4726
4802
4727
4803
This is basically a reference to a C++ `ServerActiveObject`
4728
4804
4729
- #### Methods
4805
+ ### Methods
4730
4806
* `remove()`: remove object (after returning from Lua)
4731
4807
* Note: Doesn't work on players, use `minetest.kick_player` instead
4732
4808
* `get_pos()`: returns `{x=num, y=num, z=num}`
@@ -4787,7 +4863,7 @@ This is basically a reference to a C++ `ServerActiveObject`
4787
4863
text = "My Nametag",
4788
4864
}
4789
4865
4790
- ##### LuaEntitySAO-only (no-op for other objects)
4866
+ #### LuaEntitySAO-only (no-op for other objects)
4791
4867
* `set_velocity(vel)`
4792
4868
* `vel` is a vector, e.g. `{x=0.0, y=2.3, z=1.0}`
4793
4869
* `add_velocity(vel)`
@@ -4814,7 +4890,7 @@ This is basically a reference to a C++ `ServerActiveObject`
4814
4890
* `get_entity_name()` (**Deprecated**: Will be removed in a future version)
4815
4891
* `get_luaentity()`
4816
4892
4817
- ##### Player-only (no-op for other objects)
4893
+ #### Player-only (no-op for other objects)
4818
4894
* `get_player_name()`: returns `""` if is not a player
4819
4895
* `get_player_velocity()`: returns `nil` if is not a player, otherwise a
4820
4896
table {x, y, z} representing the player's instantaneous velocity in nodes/s
@@ -4960,14 +5036,15 @@ This is basically a reference to a C++ `ServerActiveObject`
4960
5036
* in third person view (max. values `{x=-10/10,y=-10,15,z=-5/5}`)
4961
5037
* `get_eye_offset()`: returns `offset_first` and `offset_third`
4962
5038
4963
- ### `PcgRandom`
5039
+ `PcgRandom`
5040
+ -----------
4964
5041
A 32-bit pseudorandom number generator.
4965
5042
Uses PCG32, an algorithm of the permuted congruential generator family,
4966
5043
offering very strong randomness.
4967
5044
4968
5045
It can be created via `PcgRandom(seed)` or `PcgRandom(seed, sequence)`.
4969
5046
4970
- #### Methods
5047
+ ### Methods
4971
5048
* `next()`: return next integer random number [`-2147483648`...`2147483647`]
4972
5049
* `next(min, max)`: return next integer random number [`min`...`max`]
4973
5050
* `rand_normal_dist(min, max, num_trials=6)`: return normally distributed
@@ -4977,18 +5054,20 @@ It can be created via `PcgRandom(seed)` or `PcgRandom(seed, sequence)`.
4977
5054
* `variance = (((max - min + 1) ^ 2) - 1) / (12 * num_trials)`
4978
5055
* Increasing `num_trials` improves accuracy of the approximation
4979
5056
4980
- ### `PerlinNoise`
5057
+ `PerlinNoise`
5058
+ -------------
4981
5059
A perlin noise generator.
4982
5060
It can be created via `PerlinNoise(seed, octaves, persistence, scale)`
4983
5061
or `PerlinNoise(noiseparams)`.
4984
5062
Alternatively with `minetest.get_perlin(seeddiff, octaves, persistence, scale)`
4985
5063
or `minetest.get_perlin(noiseparams)`.
4986
5064
4987
- #### Methods
5065
+ ### Methods
4988
5066
* `get_2d(pos)`: returns 2D noise value at `pos={x=,y=}`
4989
5067
* `get_3d(pos)`: returns 3D noise value at `pos={x=,y=,z=}`
4990
5068
4991
- ### `PerlinNoiseMap`
5069
+ `PerlinNoiseMap`
5070
+ ----------------
4992
5071
A fast, bulk perlin noise generator.
4993
5072
4994
5073
It can be created via `PerlinNoiseMap(noiseparams, size)` or
@@ -5002,7 +5081,7 @@ For each of the functions with an optional `buffer` parameter: If `buffer` is
5002
5081
not nil, this table will be used to store the result instead of creating a new
5003
5082
table.
5004
5083
5005
- #### Methods
5084
+ ### Methods
5006
5085
* `get_2d_map(pos)`: returns a `<size.x>` times `<size.y>` 2D array of 2D noise
5007
5086
with values starting at `pos={x=,y=}`
5008
5087
* `get_3d_map(pos)`: returns a `<size.x>` times `<size.y>` times `<size.z>`
@@ -5028,28 +5107,31 @@ table.
5028
5107
`noise:calc_3d_map({x=1000, y=1000, z=1000})`
5029
5108
`noisevals = noise:get_map_slice({x=24, z=1}, {x=1, z=1})`
5030
5109
5031
- ### `PlayerMetaRef`
5110
+ `PlayerMetaRef`
5111
+ ---------------
5032
5112
Player metadata.
5033
5113
Uses the same method of storage as the deprecated player attribute API, so
5034
5114
data there will also be in player meta.
5035
5115
Can be obtained using `player:get_meta()`.
5036
5116
5037
- #### Methods
5117
+ ### Methods
5038
5118
* All methods in MetaDataRef
5039
5119
5040
- ### `PseudoRandom`
5120
+ `PseudoRandom`
5121
+ --------------
5041
5122
A 16-bit pseudorandom number generator.
5042
5123
Uses a well-known LCG algorithm introduced by K&R.
5043
5124
5044
5125
It can be created via `PseudoRandom(seed)`.
5045
5126
5046
- #### Methods
5127
+ ### Methods
5047
5128
* `next()`: return next integer random number [`0`...`32767`]
5048
5129
* `next(min, max)`: return next integer random number [`min`...`max`]
5049
5130
* `((max - min) == 32767) or ((max-min) <= 6553))` must be true
5050
5131
due to the simple implementation making bad distribution otherwise.
5051
5132
5052
- ### `Raycast`
5133
+ `Raycast`
5134
+ ---------
5053
5135
A raycast on the map. It works with selection boxes.
5054
5136
Can be used as an iterator in a for loop.
5055
5137
@@ -5065,26 +5147,28 @@ It can be created via `Raycast(pos1, pos2, objects, liquids)` or
5065
5147
* `objects` : if false, only nodes will be returned. Default is true.
5066
5148
* `liquids' : if false, liquid nodes won't be returned. Default is false.
5067
5149
5068
- #### Methods
5150
+ ### Methods
5069
5151
* `next()`: returns a `pointed_thing`
5070
5152
* Returns the next thing pointed by the ray or nil.
5071
5153
5072
- ### `SecureRandom`
5154
+ `SecureRandom`
5155
+ --------------
5073
5156
Interface for the operating system's crypto-secure PRNG.
5074
5157
5075
5158
It can be created via `SecureRandom()`. The constructor returns nil if a
5076
5159
secure random device cannot be found on the system.
5077
5160
5078
- #### Methods
5161
+ ### Methods
5079
5162
* `next_bytes([count])`: return next `count` (default 1, capped at 2048) many
5080
5163
random bytes, as a string.
5081
5164
5082
- ### `Settings`
5165
+ `Settings`
5166
+ ----------
5083
5167
An interface to read config files in the format of `minetest.conf`.
5084
5168
5085
5169
It can be created via `Settings(filename)`.
5086
5170
5087
- #### Methods
5171
+ ### Methods
5088
5172
* `get(key)`: returns a value
5089
5173
* `get_bool(key, [default])`: returns a boolean
5090
5174
* `default` is the value returned if `key` is not found.
@@ -5106,11 +5190,12 @@ It can be created via `Settings(filename)`.
5106
5190
* Writes changes to file.
5107
5191
* `to_table()`: returns `{[key1]=value1,...}`
5108
5192
5109
- ### `StorageRef`
5193
+ `StorageRef`
5194
+ ------------
5110
5195
Mod metadata: per mod metadata, saved automatically.
5111
5196
Can be obtained via `minetest.get_mod_storage()` during load time.
5112
5197
5113
- #### Methods
5198
+ ### Methods
5114
5199
* All methods in MetaDataRef
5115
5200
5116
5201
@@ -5119,7 +5204,8 @@ Can be obtained via `minetest.get_mod_storage()` during load time.
5119
5204
Definition tables
5120
5205
=================
5121
5206
5122
- ### Object Properties
5207
+ Object Properties
5208
+ -----------------
5123
5209
5124
5210
{
5125
5211
hp_max = 1,
@@ -5220,7 +5306,8 @@ Definition tables
5220
5306
-- Defaults to 'true'
5221
5307
}
5222
5308
5223
- ### Entity definition (`register_entity`)
5309
+ Entity definition (`register_entity`)
5310
+ -------------------------------------
5224
5311
5225
5312
{
5226
5313
-- Deprecated: Everything in object properties is read directly from here
@@ -5240,7 +5327,8 @@ Definition tables
5240
5327
-- for more info) by using a '_' prefix.
5241
5328
}
5242
5329
5243
- ### ABM (ActiveBlockModifier) definition (`register_abm`)
5330
+ ABM (ActiveBlockModifier) definition (`register_abm`)
5331
+ -----------------------------------------------------
5244
5332
5245
5333
{
5246
5334
label = "Lava cooling",
@@ -5274,7 +5362,8 @@ Definition tables
5274
5362
loaded mapblocks.
5275
5363
}
5276
5364
5277
- ### LBM (LoadingBlockModifier) definition (`register_lbm`)
5365
+ LBM (LoadingBlockModifier) definition (`register_lbm`)
5366
+ ------------------------------------------------------
5278
5367
5279
5368
{
5280
5369
label = "Upgrade legacy doors",
@@ -5292,7 +5381,8 @@ Definition tables
5292
5381
action = func(pos, node),
5293
5382
}
5294
5383
5295
- ### Item definition (`register_node`, `register_craftitem`, `register_tool`)
5384
+ Item definition (`register_node`, `register_craftitem`, `register_tool`)
5385
+ ------------------------------------------------------------------------
5296
5386
5297
5387
{
5298
5388
description = "Steel Axe",
@@ -5399,7 +5489,8 @@ Definition tables
5399
5489
]]
5400
5490
}
5401
5491
5402
- ### Tile definition
5492
+ Tile definition
5493
+ ---------------
5403
5494
* `"image.png"`
5404
5495
* `{name="image.png", animation={Tile Animation definition}}`
5405
5496
* `{name="image.png", backface_culling=bool, tileable_vertical=bool,
@@ -5424,7 +5515,8 @@ Definition tables
5424
5515
* deprecated, yet still supported field names:
5425
5516
* `image` (name)
5426
5517
5427
- ### Tile animation definition
5518
+ Tile animation definition
5519
+ -------------------------
5428
5520
5429
5521
{
5430
5522
type = "vertical_frames",
@@ -5446,7 +5538,8 @@ Definition tables
5446
5538
-- ^ specify length of a single frame
5447
5539
}
5448
5540
5449
- ### Node definition (`register_node`)
5541
+ Node definition (`register_node`)
5542
+ ---------------------------------
5450
5543
5451
5544
{
5452
5545
-- <all fields allowed in item definitions>,
@@ -5699,7 +5792,8 @@ Definition tables
5699
5792
removing the node ]]
5700
5793
}
5701
5794
5702
- ### Recipe for `register_craft` (shaped)
5795
+ Recipe for `register_craft` (shaped)
5796
+ ------------------------------------
5703
5797
5704
5798
{
5705
5799
output = 'default:pick_stone',
@@ -5712,7 +5806,8 @@ Definition tables
5712
5806
replace one input item with another item on crafting>]]
5713
5807
}
5714
5808
5715
- ### Recipe for `register_craft` (shapeless)
5809
+ Recipe for `register_craft` (shapeless)
5810
+ ---------------------------------------
5716
5811
5717
5812
{
5718
5813
type = "shapeless",
@@ -5726,14 +5821,16 @@ Definition tables
5726
5821
replace one input item with another item on crafting>]]
5727
5822
}
5728
5823
5729
- ### Recipe for `register_craft` (tool repair)
5824
+ Recipe for `register_craft` (tool repair)
5825
+ -----------------------------------------
5730
5826
5731
5827
{
5732
5828
type = "toolrepair",
5733
5829
additional_wear = -0.02,
5734
5830
}
5735
5831
5736
- ### Recipe for `register_craft` (cooking)
5832
+ Recipe for `register_craft` (cooking)
5833
+ -------------------------------------
5737
5834
5738
5835
{
5739
5836
type = "cooking",
@@ -5742,15 +5839,17 @@ Definition tables
5742
5839
cooktime = 3,
5743
5840
}
5744
5841
5745
- ### Recipe for `register_craft` (furnace fuel)
5842
+ Recipe for `register_craft` (furnace fuel)
5843
+ ------------------------------------------
5746
5844
5747
5845
{
5748
5846
type = "fuel",
5749
5847
recipe = "default:leaves",
5750
5848
burntime = 1,
5751
5849
}
5752
5850
5753
- ### Ore definition (`register_ore`)
5851
+ Ore definition (`register_ore`)
5852
+ -------------------------------
5754
5853
5755
5854
See 'Ore types' section above for essential information.
5756
5855
@@ -5838,7 +5937,8 @@ Definition tables
5838
5937
-- ^ The above 2 parameters are only valid for "stratum" ore.
5839
5938
}
5840
5939
5841
- ### Biome definition (`register_biome`)
5940
+ Biome definition (`register_biome`)
5941
+ -----------------------------------
5842
5942
5843
5943
{
5844
5944
name = "tundra",
@@ -5903,7 +6003,8 @@ Definition tables
5903
6003
-- ^ 0 and 100 but can exceed these values.
5904
6004
}
5905
6005
5906
- ### Decoration definition (`register_decoration`)
6006
+ Decoration definition (`register_decoration`)
6007
+ ---------------------------------------------
5907
6008
5908
6009
{
5909
6010
deco_type = "simple", -- See "Decoration types"
@@ -6034,7 +6135,8 @@ Definition tables
6034
6135
-- ^ to the 'place_on' node.
6035
6136
}
6036
6137
6037
- ### Chat command definition (`register_chatcommand`)
6138
+ Chat command definition (`register_chatcommand`)
6139
+ ------------------------------------------------
6038
6140
6039
6141
{
6040
6142
params = "<name> <privilege>", -- Short parameter description
@@ -6057,7 +6159,8 @@ Note that in params, use of symbols is as follows:
6057
6159
* `()` signifies grouping. For example, when param1 and param2 are both
6058
6160
required, or only param3 is required: `(<param1> <param2>) | <param3>`
6059
6161
6060
- ### Detached inventory callbacks
6162
+ Detached inventory callbacks
6163
+ ----------------------------
6061
6164
6062
6165
{
6063
6166
allow_move = func(inv, from_list, from_index, to_list, to_index, count, player),
@@ -6082,7 +6185,8 @@ Note that in params, use of symbols is as follows:
6082
6185
-- ^ No return value
6083
6186
}
6084
6187
6085
- ### HUD Definition (`hud_add`, `hud_get`)
6188
+ HUD Definition (`hud_add`, `hud_get`)
6189
+ -------------------------------------
6086
6190
6087
6191
{
6088
6192
hud_elem_type = "image", -- see HUD element types
@@ -6106,7 +6210,8 @@ Note that in params, use of symbols is as follows:
6106
6210
-- ^ Size of element in pixels
6107
6211
}
6108
6212
6109
- ### Particle definition (`add_particle`)
6213
+ Particle definition (`add_particle`)
6214
+ ------------------------------------
6110
6215
6111
6216
{
6112
6217
pos = {x=0, y=0, z=0},
@@ -6135,7 +6240,8 @@ Note that in params, use of symbols is as follows:
6135
6240
}
6136
6241
6137
6242
6138
- ### `ParticleSpawner` definition (`add_particlespawner`)
6243
+ `ParticleSpawner` definition (`add_particlespawner`)
6244
+ ----------------------------------------------------
6139
6245
6140
6246
{
6141
6247
amount = 1,
@@ -6178,7 +6284,8 @@ Note that in params, use of symbols is as follows:
6178
6284
-- ^ Values 0-14.
6179
6285
}
6180
6286
6181
- ### `HTTPRequest` definition (`HTTPApiTable.fetch_async`, `HTTPApiTable.fetch_async`)
6287
+ `HTTPRequest` definition (`HTTPApiTable.fetch_async`, `HTTPApiTable.fetch_async`)
6288
+ ---------------------------------------------------------------------------------
6182
6289
6183
6290
{
6184
6291
url = "http://example.org",
@@ -6201,7 +6308,8 @@ Note that in params, use of symbols is as follows:
6201
6308
-- ^ Default is false.
6202
6309
}
6203
6310
6204
- ### `HTTPRequestResult` definition (`HTTPApiTable.fetch` callback, `HTTPApiTable.fetch_async_get`)
6311
+ `HTTPRequestResult` definition (`HTTPApiTable.fetch` callback, `HTTPApiTable.fetch_async_get`)
6312
+ ----------------------------------------------------------------------------------------------
6205
6313
6206
6314
{
6207
6315
completed = true,
@@ -6216,7 +6324,8 @@ Note that in params, use of symbols is as follows:
6216
6324
data = "response"
6217
6325
}
6218
6326
6219
- ### Authentication handler definition
6327
+ Authentication handler definition
6328
+ ---------------------------------
6220
6329
6221
6330
{
6222
6331
get_auth = func(name),
0 commit comments