The game directory contains the file game.conf, which contains these fields:
name = <Human-readable full name of the game>
-eg.
+e.g.
name = Minetest
The game directory can contain the file minetest.conf, which will be used
$path_user/mods/ <-- User-installed mods
$worldpath/worldmods/
-In a run-in-place version (eg. the distributed windows version):
+In a run-in-place version (e.g. the distributed windows version):
minetest-0.4.x/games/gameid/mods/
- minetest-0.4.x/mods/gameid/ <-- User-installed mods
+ minetest-0.4.x/mods/ <-- User-installed mods
minetest-0.4.x/worlds/worldname/worldmods/
-On an installed version on linux:
+On an installed version on Linux:
/usr/share/minetest/games/gameid/mods/
- ~/.minetest/mods/gameid/ <-- User-installed mods
+ ~/.minetest/mods/ <-- User-installed mods
~/.minetest/worlds/worldname/worldmods
Mod load path for world-specific games
It is possible to include a game in a world; in this case, no mods or
games are loaded or checked from anywhere else.
-This is useful for eg. adventure worlds.
+This is useful for e.g. adventure worlds.
This happens if the following directory exists:
$world/game/
A screenshot shown in modmanager within mainmenu.
description.txt:
- File containing desctiption to be shown within mainmenu.
+ File containing description to be shown within mainmenu.
init.lua:
The main Lua script. Running this script should register everything it
This can be used for maintaining backwards compatibility.
-This can be also used for setting quick access names for things, eg. if
+This can be also used for setting quick access names for things, e.g. if
you have an item called epiclylongmodname:stuff, you could do
minetest.register_alias("stuff", "epiclylongmodname:stuff")
and be able to use "/giveme stuff".
Textures
--------
-Mods should generally prefix their textures with modname_, eg. given
+Mods should generally prefix their textures with modname_, e.g. given
the mod name "foomod", a texture could be called
"foomod_foothing.png"
Textures are referred to by their complete name, or alternatively by
stripping out the file extension:
- eg. foomod_foothing.png
- eg. foomod_foothing
+ e.g. foomod_foothing.png
+ e.g. foomod_foothing
Sounds
-------
-Only OGG files are supported.
+Only OGG Vorbis files are supported.
For positional playing of sounds, only single-channel (mono) files are
supported. Otherwise OpenAL will play them non-positionally.
-Mods should generally prefix their sounds with modname_, eg. given
+Mods should generally prefix their sounds with modname_, e.g. given
the mod name "foomod", a sound could be called
"foomod_foosound.ogg"
foomod_foosound.9.ogg
Examples of sound parameter tables:
--- Play locationless on all clients
+-- Play location-less on all clients
{
gain = 1.0, -- default
}
--- Play locationless to a player
+-- Play location-less to a player
{
to_player = name,
gain = 1.0, -- default
}
SimpleSoundSpec:
-eg. ""
-eg. "default_place_node"
-eg. {}
-eg. {name="default_place_node"}
-eg. {name="default_place_node", gain=1.0}
+e.g. ""
+e.g. "default_place_node"
+e.g. {}
+e.g. {name="default_place_node"}
+e.g. {name="default_place_node", gain=1.0}
Registered definitions of stuff
--------------------------------
-> minetest.registered_items[name]
Note that in some cases you will stumble upon things that are not contained
-in these tables (eg. when a mod has been removed). Always check for
+in these tables (e.g. when a mod has been removed). Always check for
existence before trying to access the fields.
Example: If you want to check the drawtype of a node, you could do:
A box of a regular node would look like:
{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
-type = "leveled" is same as "fixed", but y2 will be automaticaly setted to level from param2
+type = "leveled" is same as "fixed", but y2 will be automatically set to level from param2
Ore types
---------------
Items and item stacks can exist in three formats:
Serialized; This is called stackstring or itemstring:
-eg. 'default:dirt 5'
-eg. 'default:pick_wood 21323'
-eg. 'default:apple'
+e.g. 'default:dirt 5'
+e.g. 'default:pick_wood 21323'
+e.g. 'default:apple'
Table format:
-eg. {name="default:dirt", count=5, wear=0, metadata=""}
+e.g. {name="default:dirt", count=5, wear=0, metadata=""}
^ 5 dirt nodes
-eg. {name="default:pick_wood", count=1, wear=21323, metadata=""}
- ^ a wooden pick about 1/3 weared out
-eg. {name="default:apple", count=1, wear=0, metadata=""}
+e.g. {name="default:pick_wood", count=1, wear=21323, metadata=""}
+ ^ a wooden pick about 1/3 worn out
+e.g. {name="default:apple", count=1, wear=0, metadata=""}
^ an apple.
ItemStack:
Groups of items
----------------
-Groups of items can define what kind of an item it is (eg. wool).
+Groups of items can define what kind of an item it is (e.g. wool).
Groups of nodes
----------------
The rating is the percentage of damage caused by tools with this damage group.
See "Entity damage mechanism".
-object.get_armor_groups() -> a group-rating table (eg. {fleshy=100})
+object.get_armor_groups() -> a group-rating table (e.g. {fleshy=100})
object.set_armor_groups({fleshy=30, cracky=80})
Groups of tools
---------------
- immortal: Disables the group damage system for an entity
- level: Can be used to give an additional sense of progression in the game.
- - A larger level will cause eg. a weapon of a lower level make much less
- damage, and get weared out much faster, or not be able to get drops
+ - A larger level will cause e.g. a weapon of a lower level make much less
+ damage, and get worn out much faster, or not be able to get drops
from destroyed nodes.
- 0 is something that is directly accessible at the start of gameplay
- There is no upper limit
----------------------------------------------
- crumbly: dirt, sand
- cracky: tough but crackable stuff like stone.
-- snappy: something that can be cut using fine tools; eg. leaves, small
+- snappy: something that can be cut using fine tools; e.g. leaves, small
plants, wire, sheets of metal
-- choppy: something that can be cut using force; eg. trees, wooden planks
+- choppy: something that can be cut using force; e.g. trees, wooden planks
- fleshy: Living things like animals and the player. This could imply
some blood effects when hitting.
- explody: Especially prone to explosions
- eatable: anything that can be eaten. Rating might define HP gain in half
hearts.
- flammable: can be set on fire. Rating might define the intensity of the
- fire, affecting eg. the speed of the spreading of an open fire.
+ fire, affecting e.g. the speed of the spreading of an open fire.
- wool: any wool (any origin, any color)
- metal: any metal
- weapon: any weapon
**Full punch interval**:
When used as a weapon, the tool will do full damage if this time is spent
-between punches. If eg. half the time is spent, the tool will do half
+between punches. If e.g. half the time is spent, the tool will do half
damage.
**Maximum drop level**
Suggests the maximum level of node, when dug with the tool, that will drop
-it's useful item. (eg. iron ore to drop a lump of iron).
+it's useful item. (e.g. iron ore to drop a lump of iron).
- This is not automated; it is the responsibility of the node definition
to implement this
**Digging times**
List of digging times for different ratings of the group, for nodes of the
maximum level.
- * For example, as a lua table, ''times={2=2.00, 3=0.70}''. This would
+ * For example, as a Lua table, ''times={2=2.00, 3=0.70}''. This would
result in the tool to be able to dig nodes that have a rating of 2 or 3
for this group, and unable to dig the rating 1, which is the toughest.
Unless there is a matching group that enables digging otherwise.
damage_groups = {fleshy=2},
}
-This makes the tool be able to dig nodes that fullfill both of these:
+This makes the tool be able to dig nodes that fulfill both of these:
- Have the **crumbly** group
- Have a **level** group less or equal to 2
foreach group in cap.damage_groups:
damage += cap.damage_groups[group] * limit(actual_interval / cap.full_punch_interval, 0.0, 1.0)
* (object.armor_groups[group] / 100.0)
- -- Where object.armor_groups[group] is 0 for inexisting values
+ -- Where object.armor_groups[group] is 0 for inexistent values
return damage
Client predicts damage based on damage groups. Because of this, it is able to
give an immediate response when an entity is damaged or dies; the response is
-pre-defined somehow (eg. by defining a sprite animation) (not implemented;
+pre-defined somehow (e.g. by defining a sprite animation) (not implemented;
TODO).
- Currently a smoke puff will appear when an entity dies.
^ Position and size units are inventory slots
vertlabel[<X>,<Y>;<label>]
-^ Textual label drawn verticaly
+^ Textual label drawn vertically
^ x and y work as per field
^ label is the text on the label
^ Position and size units are inventory slots
^ x, y, w, h, and name work as per button
^ texture name is the filename of an image
^ Position and size units are inventory slots
-^ noclip true meand imagebutton doesn't need to be within specified formsize
-^ drawborder draw button bodrer or not
+^ noclip=true means imagebutton doesn't need to be within specified formsize
+^ drawborder draw button border or not
^ pressed texture name is the filename of an image on pressed state
item_image_button[<X>,<Y>;<W>,<H>;<item name>;<name>;<label>]
^ When clicked, fields will be sent and the form will quit.
textlist[<X>,<Y>;<W>,<H>;<name>;<listelem 1>,<listelem 2>,...,<listelem n>]
-^Scrollabel itemlist showing arbitrary text elements
+^ Scrollable item list showing arbitrary text elements
^ x and y position the itemlist relative to the top left of the menu
^ w and h are the size of the itemlist
^ name fieldname sent to server on doubleclick value is current selected element
^ if you want a listelement to start with # write ##
textlist[<X>,<Y>;<W>,<H>;<name>;<listelem 1>,<listelem 2>,...,<listelem n>;<selected idx>;<transparent>]
-^Scrollabel itemlist showing arbitrary text elements
+^ Scrollable itemlist showing arbitrary text elements
^ x and y position the itemlist relative to the top left of the menu
^ w and h are the size of the itemlist
^ name fieldname sent to server on doubleclick value is current selected element
tabheader[<X>,<Y>;<name>;<caption 1>,<caption 2>,...,<caption n>;<current_tab>;<transparent>;<draw_border>]
^ show a tabHEADER at specific position (ignores formsize)
^ x and y position the itemlist relative to the top left of the menu
-^ name fieldname data is transfered to lua
+^ name fieldname data is transfered to Lua
^ caption 1... name shown on top of tab
^ current_tab index of selected tab 1...
^ transparent (optional) show transparent
^ show a dropdown field
^ x and y position of dropdown
^ width of dropdown
-^ fieldname data is transfered to lua
+^ fieldname data is transfered to Lua
^ items to be shown in dropdown
^ index of currently selected dropdown item
-^ color in hexadecimal format RRGGBB (only)
checkbox[<X>,<Y>;<name>;<label>;<selected>;<tooltip>]
^ show a checkbox
^ x and y position of checkbox
-^ name fieldname data is transfered to lua
+^ name fieldname data is transfered to Lua
^ label to be shown left of checkbox
^ selected (optional) true/false
^ tooltip (optional)
vector.normalize(v) -> vector
vector.round(v) -> vector
vector.equals(v1, v2) -> bool
-For the folowing x can be either a vector or a number.
+For the following functions x can be either a vector or a number.
vector.add(v, x) -> vector
vector.subtract(v, x) -> vector
vector.multiply(v, x) -> vector
^ Return object serialized as a string
math.hypot(x, y)
^ Get the hypotenuse of a triangle with legs x and y.
- Usefull for distance calculation.
+ Useful for distance calculation.
string:split(separator)
-^ eg. string:split("a,b", ",") == {"a","b"}
+^ e.g. string:split("a,b", ",") == {"a","b"}
string:trim()
-^ eg. string.trim("\n \t\tfoo bar\t ") == "foo bar"
+^ e.g. string.trim("\n \t\tfoo bar\t ") == "foo bar"
minetest.pos_to_string({x=X,y=Y,z=Z}) -> "(X,Y,Z)"
^ Convert position to a printable string
minetest.string_to_pos(string) -> position
-----------------------------
Utilities:
minetest.get_current_modname() -> string
-minetest.get_modpath(modname) -> eg. "/home/user/.minetest/usermods/modname"
+minetest.get_modpath(modname) -> e.g. "/home/user/.minetest/usermods/modname"
^ Useful for loading additional .lua modules or static data from mod
minetest.get_modnames() -> list of installed mods
^ Return a list of installed mods, sorted alphabetically
-minetest.get_worldpath() -> eg. "/home/user/.minetest/world"
+minetest.get_worldpath() -> e.g. "/home/user/.minetest/world"
^ Useful for storing custom data
minetest.is_singleplayer()
minetest.features
minetest.get_player_information(playername)
^ table containing information about player peer:
{
- address = "127.0.0.1", -- ip address of client
+ address = "127.0.0.1", -- IP address of client
ip_version = 4, -- IPv4 / IPv6
min_rtt = 0.01, -- minimum round trip time
max_rtt = 0.2, -- maximum round trip time
minetest.get_timeofday()
minetest.get_gametime(): returns the time, in seconds, since the world was created
minetest.find_node_near(pos, radius, nodenames) -> pos or nil
-^ nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
+^ nodenames: e.g. {"ignore", "group:tree"} or "default:dirt"
minetest.find_nodes_in_area(minp, maxp, nodenames) -> list of positions
-^ nodenames: eg. {"ignore", "group:tree"} or "default:dirt"
+^ nodenames: e.g. {"ignore", "group:tree"} or "default:dirt"
minetest.get_perlin(seeddiff, octaves, persistence, scale)
^ Return world-specific perlin noise (int(worldseed)+seeddiff)
minetest.get_voxel_manip()
Inventory:
minetest.get_inventory(location) -> InvRef
-^ location = eg. {type="player", name="celeron55"}
+^ location = e.g. {type="player", name="celeron55"}
{type="node", pos={x=, y=, z=}}
{type="detached", name="creative"}
minetest.create_detached_inventory(name, callbacks) -> InvRef
^ drops: list of itemstrings
^ Handles drops from nodes after digging: Default action is to put them into
digger's inventory
-^ Can be overridden to get different functionality (eg. dropping items on
+^ Can be overridden to get different functionality (e.g. dropping items on
ground)
Rollback:
^ probability_list is an array of tables containing two fields, pos and prob.
^ pos is the 3d vector specifying the absolute coordinates of the node being modified,
^ and prob is the integer value from 0 to 255 of the probability (see: Schematic specifier).
- ^ If there are two or more entries with the same pos value, the last occuring in the array is used.
+ ^ If there are two or more entries with the same pos value, the last entry is used.
^ If pos is not inside the box formed by p1 and p2, it is ignored.
^ If probability_list is nil, no probabilities are applied.
^ Slice probability works in the same manner, except takes a field called ypos instead which indicates
^ force_placement is a boolean indicating whether nodes other than air and
^ ignore are replaced by the schematic
-Random:
+Misc.:
minetest.get_connected_players() -> list of ObjectRefs
minetest.hash_node_position({x=,y=,z=}) -> 48-bit integer
^ Gives a unique hash number for a node position (16+16+16=48bit)
-minetest.get_position_from_hash(hash) -> postion
-^ Inverse transform of minetest.hash_node_postion
+minetest.get_position_from_hash(hash) -> position
+^ Inverse transform of minetest.hash_node_position
minetest.get_item_group(name, group) -> rating
^ Get rating of a group of an item. (0 = not in group)
minetest.get_node_group(name, group) -> rating
^ Warning: JSON is more strict than the Lua table format.
1. You can only use strings and positive integers of at least one as keys.
2. You can not mix string and integer keys.
- This is due to the fact that Javascript has two distinct array and object values.
+ This is due to the fact that JSON has two distinct array and object values.
^ Example: write_json({10, {a = false}}) -> "[10, {\"a\": false}]"
minetest.serialize(table) -> string
^ Convert a table containing tables, strings, numbers, booleans and nils
^ Example: deserialize('print("foo")') -> nil (function call fails)
^ error:[string "print("foo")"]:1: attempt to call global 'print' (a nil value)
minetest.is_protected(pos, name) -> bool
-^ This function should be overriden by protection mods and should be used to
+^ This function should be overridden by protection mods and should be used to
check if a player can interact at a position.
^ This function should call the old version of itself if the position is not
protected by the mod.
The above four options are mutually-exclusive; the last in the list takes
precedence over the first.
- force_facedir: if true, forcably reset the facedir to north when placing on
+ force_facedir: if true, forcefully reset the facedir to north when placing on
the floor or ceiling
minetest.rotate_node(itemstack, placer, pointed_thing)
minetest.object_refs
^ List of object references, indexed by active object id
minetest.luaentities
-^ List of lua entities, indexed by active object id
+^ List of Lua entities, indexed by active object id
Class reference
----------------
^ will trigger the node's on_timer function after timeout-elapsed seconds
- start(timeout)
^ start a timer
- ^ equivelent to set(timeout,0)
+ ^ equivalent to set(timeout,0)
- stop()
^ stops the timer
- get_timeout() -> current timeout in seconds
description = "Steel Axe",
groups = {}, -- key=name, value=rating; rating=1..3.
if rating not applicable, use 1.
- eg. {wool=1, fluffy=3}
+ e.g. {wool=1, fluffy=3}
{soil=2, outerspace=1, crumbly=1}
{bendy=2, snappy=1},
{hard=1, metal=1, spikes=1}
^ default: nil
^ Function must return either nil if no item shall be removed from
inventory, or an itemstack to replace the original itemstack.
- eg. itemstack:take_item(); return itemstack
+ e.g. itemstack:take_item(); return itemstack
^ Otherwise, the function is free to do what it wants.
^ The default functions handle regular use cases.
after_use = func(itemstack, user, node, digparams),
post_effect_color = {a=0, r=0, g=0, b=0}, -- If player is inside node
paramtype = "none", -- See "Nodes"
paramtype2 = "none", -- See "Nodes"
- is_ground_content = true, -- If false, cavegen will not carve through this
+ is_ground_content = true, -- If false, the cave generator will not carve through this
sunlight_propagates = false, -- If true, sunlight will go infinitely through this
walkable = true, -- If true, objects collide with node
pointable = true, -- If true, can be pointed at
liquid_viscosity = 0, -- Higher viscosity = slower flow (max. 7)
liquid_renewable = true, -- Can new liquid source be created by placing two or more sources nearby?
freezemelt = "", -- water for snow/ice, ice/snow for water
- leveled = 0, -- Block contain level in param2. value - default level, used for snow. Dont forget use "leveled" type nodebox
- liquid_range = 8, -- number of flowing nodes arround source (max. 8)
+ leveled = 0, -- Block contain level in param2. value - default level, used for snow. Don't forget use "leveled" type nodebox
+ liquid_range = 8, -- number of flowing nodes around source (max. 8)
drowning = 0, -- Player will take this amount of damage if no bubbles are left
light_source = 0, -- Amount of light emitted by node
damage_per_second = 0, -- If player is inside node, this damage is caused
on_receive_fields = func(pos, formname, fields, sender),
^ fields = {name1 = value1, name2 = value2, ...}
- ^ Called when an UI form (eg. sign text input) returns data
+ ^ Called when an UI form (e.g. sign text input) returns data
^ default: nil
allow_metadata_inventory_move = func(pos, from_list, from_index,
recipe = {
{'default:cobble', 'default:cobble', 'default:cobble'},
{'', 'default:stick', ''},
- {'', 'default:stick', ''}, -- Also groups; eg. 'group:crumbly'
+ {'', 'default:stick', ''}, -- Also groups; e.g. 'group:crumbly'
},
replacements = <optional list of item pairs,
replace one input item with another item on crafting>
replacements = {{"oldname", "convert_to"}, ...},
flags = "place_center_x, place_center_z",
^ Flags for schematic decorations. See 'Schematic attributes'.
- rotation = "90" --rotate schematic 90 degrees on placement
+ rotation = "90" -- rotate schematic 90 degrees on placement
^ Rotation can be "0", "90", "180", "270", or "random".
}
texture = "image.png",
^ Uses texture (string)
playername = "singleplayer"
- ^ Playername is optional, if specified spawns particle only on the player's client
+ ^ optional, if specified spawns particle only on the player's client
}
-Particlespawner definition (add_particlespawner)
+ParticleSpawner definition (add_particlespawner)
{
amount = 1,
time = 1,
maxexptime = 1,
minsize = 1,
maxsize = 1,
- ^ The particle's properties are random values in between the boundings:
+ ^ The particle's properties are random values in between the bounds:
^ minpos/maxpos, minvel/maxvel (velocity), minacc/maxacc (acceleration),
^ minsize/maxsize, minexptime/maxexptime (expirationtime)
collisiondetection = false,
- ^ collisiondetection: if true uses collisiondetection
+ ^ collisiondetection: if true uses collision detection
vertical = false,
^ vertical: if true faces player using y axis only
texture = "image.png",