diff --git a/lua_api.html b/lua_api.html index f5e4d64..d042d44 100644 --- a/lua_api.html +++ b/lua_api.html @@ -21,6 +21,7 @@ layout: default
If you have any difficulty in understanding this, please read Programming in Lua.
init.lua
scripts in a shared environment.
name = Minetest
The game directory can contain the file minetest.conf, which will be used -to set default settings when running the particular game.
+to set default settings when running the particular game. +It can also contain a settingtypes.txt in the same format as the one in builtin. +This settingtypes.txt will be parsed by the menu and the settings will be displayed in the "Games" category in the settings tab.Games can provide custom main menu images. They are put inside a menu
directory inside the game directory.
The images are named $identifier.png
, where $identifier
is one of overlay,background,footer,header
.
@@ -435,6 +438,7 @@ empty, except for lines starting with #
, which are comments.
A screenshot shown in modmanager within mainmenu.
description.txt
A File containing description to be shown within mainmenu.
+settingtypes.txt
A file in the same format as the one in builtin. It will be parsed by the +settings menu and the settings will be displayed in the "Mods" category.
init.lua
The main Lua script. Running this script should register everything it wants to register. Subsequent execution depends on minetest calling the @@ -642,13 +649,13 @@ from the available ones of the following files:
{ pos = {x=1,y=2,z=3}, gain = 1.0, -- default - max_hear_distance = 32, -- default + max_hear_distance = 32, -- default, uses an euclidean metric } -- Play connected to an object, looped { object = <an ObjectRef>, gain = 1.0, -- default - max_hear_distance = 32, -- default + max_hear_distance = 32, -- default, uses an euclidean metric loop = true, -- only sounds connected to objects can be looped } @@ -812,6 +819,10 @@ paramtype2 == "facedir" 0 = y+ 1 = z+ 2 = z- 3 = x+ 4 = x- 5 = y- facedir's two less significant bits are rotation around the axis paramtype2 == "leveled" +paramtype2 == "degrotate" +^ The rotation of this node is stored in param2. Plants are rotated this way. + Values range 0 - 179. The value stored in param2 is multiplied by two to + get the actual rotation of the node. collision_box = { type = "fixed", fixed = { @@ -1008,14 +1019,13 @@ attribute set, puff ore generation will instead generate the absolute difference noise displacement values. This flag has no effect for ore types other thanpuff
.
The varying types of decorations that can be placed.
-The default value is simple
, and is currently the only type supported.
simple
Creates a 1 times H
times 1 column of a specified node (or a random node from
a list, if a decoration list is specified). Can specify a certain node it must
spawn next to, such as water or lava, for example. Can also generate a
decoration of random height between a specified lower and upper bound.
This type of decoration is intended for placement of grass, flowers, cacti,
-papyri, and so on.
schematic
Copies a box of MapNodes
from a specified schematic file (or raw description).
Can specify a probability of a node randomly appearing when placed.
@@ -1046,8 +1056,8 @@ in the form of a table. This table specifies the following fields:
See section "Flag Specifier Format".
-Currently supported flags: place_center_x
, place_center_y
,
- place_center_z
, force_placement
.
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.colorspec = 0xFF00FF00
or string form, a ColorString (defined above):
colorspec = "green"
-vector.new([x[, y, z]])
: returns a vector.
vector.add(v, x)
: returns a vectorvector.subtract(v, x)
: returns a vectorvector.multiply(v, x)
: returns a vectorvector.divide(v, x)
: returns a vectorvector.multiply(v, x)
: returns a scaled vector or Schur productvector.divide(v, x)
: returns a scaled vector or Schur quotientminetest.debug(line)
stderr
and logfile (print()
is redirected here)minetest.debug(...)
minetest.log(table.concat({...}, "\t"))
minetest.log(line)
minetest.log(loglevel, line)
loglevel
is one of "error"
, "action"
, "info"
, "verbose"
minetest.log([level,] text)
level
is one of "none"
, "error"
, "warning"
, "action"
,
+ "info"
, or "verbose"
. Default is "none"
.minetest.set_player_privs(name, {priv1=true,...})
minetest.get_player_privs(name) -> {priv1=true,...}
minetest.auth_reload()
minetest.check_player_privs(name, {priv1=true,...})
: returns bool, missing_privs
minetest.check_player_privs(player_or_name, ...)
: returns bool, missing_privs
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.auth_reload
call the authetification handler.
minetest.get_player_by_name(name)
: Get an ObjectRef
to a playerminetest.get_objects_inside_radius(pos, radius)
minetest.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.auth_reload
call the authetification handler.
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
radius
: using a maximum metricnodenames
: e.g. {"ignore", "group:tree"}
or "default:dirt"
minetest.auth_reload
call the authetification handler.
minetest.get_biome_id(biome_name)
minetest.get_mapgen_params()
Returns mapgen parameters, a table containing
mgname
, seed
, chunksize
, water_level
, and flags
.minetest.set_mapgen_params(MapgenParams)
minetest.auth_reload
call the authetification handler.
pos1
to pos2
or nil
pos1
: start positionpos2
: end positionsearchdistance
: number of blocks to search in each directionsearchdistance
: 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"
register_entity
){
-- In the following two fields, also group:groupname will work.
nodenames = {"default:lava_source"},
- neighbors = {"default:water_source", "default:water_flowing"}, -- (any of these)
--- ^ If left out or empty, any neighbor will do
- interval = 1.0, -- (operation interval)
- chance = 1, -- (chance of trigger is 1.0/this)
+ neighbors = {"default:water_source", "default:water_flowing"}, -- Any of these --[[
+ ^ If left out or empty, any neighbor will do ]]
+ interval = 1.0, -- Operation interval in seconds
+ chance = 1, -- Chance of trigger per-node per-interval is 1.0 / this
+ catch_up = true, -- If true, catch-up behaviour is enabled --[[
+ ^ The chance value is temporarily reduced when returning to
+ an area to simulate time lost by the area being unattended.
+ ^ Note chance value can often be reduced to 1 ]]
action = func(pos, node, active_object_count, active_object_count_wider),
}
@@ -3862,14 +3889,17 @@ minetest.spawn_tree(pos,apple_tree)
},
on_construct = func(pos), --[[
- ^ Node constructor; always called after adding node
+ ^ Node constructor; called after adding node
^ Can set up metadata and stuff like that
+ ^ Not called for bulk node placement (i.e. schematics and VoxelManip)
^ default: nil ]]
on_destruct = func(pos), --[[
- ^ Node destructor; always called before removing node
+ ^ Node destructor; called before removing node
+ ^ Not called for bulk node placement (i.e. schematics and VoxelManip)
^ default: nil ]]
after_destruct = func(pos, oldnode), --[[
- ^ Node destructor; always called after removing node
+ ^ Node destructor; called after removing node
+ ^ Not called for bulk node placement (i.e. schematics and VoxelManip)
^ default: nil ]]
after_place_node = func(pos, placer, itemstack, pointed_thing) --[[
@@ -4040,6 +4070,11 @@ minetest.spawn_tree(pos,apple_tree)
-- ^ Minimum and maximum `y` positions these decorations can be generated at.
-- ^ This parameter refers to the `y` position of the decoration base, so
-- the actual maximum height would be `height_max + size.Y`.
+ flags = "liquid_surface",
+-- ^ Flags for all decoration types.
+-- ^ "liquid_surface": Instead of placement on the highest solid surface
+-- ^ in a mapchunk column, placement is on the highest liquid surface.
+-- ^ Placement is disabled if solid nodes are found above the liquid surface.
----- Simple-type parameters
decoration = "default:grass",