From 5b916a14c0347a97e73a7db0512c00c496358704 Mon Sep 17 00:00:00 2001
From: rubenwardy Content and functionality can be added to Minetest 0.4 by using Lua
scripting in run-time loaded mods.Table of Contents
-
+Table of Contents
@@ -309,6 +308,7 @@ layout: default
Introduction
If you see a deficiency in the API, feel free to attempt to add the functionality in the engine and API. You can send such improvements as source code patches to celeron55@gmail.com.
-This may not be the most up to date version. See lua_api.txt - More information at http://www.minetest.net/ - Developer Wiki: http://dev.minetest.net/
-If you have any difficulty in understanding this, please read Programming in Lua.
Mods are loaded during server startup from the mod load paths by running @@ -796,7 +796,7 @@ changed in the future.
set to level fromparam2
.
If drawtype mesh
is used, tiles should hold model materials textures.
-Only static meshes are implemented.
+Only static meshes are implemented.
For supported model formats see Irrlicht engine documentation.
Noise Parameters, or commonly called "NoiseParams
", define the properties of perlin noise.
scale
parameter in noise_params
.
IMPORTANT: The noise is not transformed by offset
or scale
when comparing against the noise
-threshold, but scale is used to determine relative height.
+threshold, but scale is used to determine relative height.
The height of the blob is randomly scattered, with a maximum height of clust_size
.
clust_scarcity
and clust_num_ores
are ignored.
This is essentially an improved version of the so-called "stratus" ore seen in some unofficial mods.
-claylike
-- not yet implementedPlaces ore if there are no more than clust_scarcity
number of specified nodes within a Von Neumann
-neighborhood of clust_size
radius.
blob
Creates a deformed sphere of ore according to 3d perlin noise described by
+noise_params
. The maximum size of the blob is clust_size
, and
+clust_scarcity
has the same meaning as with the scatter
type.
Creates veins of ore varying in density by according to the intersection of two
+instances of 3d perlin noise with diffferent seeds, both described by
+noise_params
. random_factor
varies the influence random chance has on
+placement of an ore inside the vein, which is 1
by default. Note that
+modifying this parameter may require adjusting noise_threshhold
.
+The parameters clust_scarcity
, clust_num_ores
, and clust_size
are ignored
+by this ore type. This ore type is difficult to control since it is sensitive
+to small changes. The following is a decent set of parameters to work from:
noise_params = {
+ offset = 0,
+ scale = 3,
+ spread = {x=200, y=200, z=200},
+ seed = 5390,
+ octaves = 4,
+ persist = 0.5,
+ flags = "eased",
+},
+noise_threshhold = 1.6
+
+WARNING: Use this ore type very sparingly since it is ~200x more +computationally expensive than any other ore.
See section "Flag Specifier Format".
Currently supported flags: absheight
absheight
Also produce this same ore between the height range of -height_max
and -height_min
.
Also produce this same ore between the height range of -y_max
and -y_min
.
Useful for having ore in sky realms without having to duplicate ore entries.
The varying types of decorations that can be placed.
@@ -1261,7 +1284,7 @@ return damageClient 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 (e.g. by defining a sprite animation) (not implemented;
-TODO).
+TODO).
Currently a smoke puff will appear when an entity dies.
The group immortal
completely disables normal damage.
Entities can define a special armor group, which is punch_operable
. This
@@ -1733,7 +1756,10 @@ value must (always) be two hexadecimal digits.
0
when the absolute value is within the tolerance (default: 0
)
-string:split(separator)
max_splits
is negative, do not limit splits.sep_is_pattern
specifies if separator is a plain string or a pattern (regex).string:split("a,b", ",") == {"a","b"}
true
, remaining functions are not calledminetest.register_on_mapgen_init(func(MapgenParams))
MapgenParams
consists of a table with the fields mgname
, seed
, water_level
, and flags
minetest.register_on_craft(func(itemstack, player, old_craft_grid, craft_inv))
player
crafts somethingitemstack
is the outputminetest.auth_reload
call the authetification handler.
int(worldseed)+seeddiff
)minetest.get_voxel_manip()
minetest.get_voxel_manip([pos1, pos2])
minetest.set_gen_notify(flags, {deco_ids})
minetest.auth_reload
call the authetification handler.
minetest.get_mapgen_params()
Returns mapgen parameters, a table containing
+ mgname
, seed
, chunksize
, water_level
, and flags
.minetest.set_mapgen_params(MapgenParams)
on_mapgen_init
NodeMetaRef
Node metadata: reference extra data and functionality stored in a node. +
Node metadata: reference extra data and functionality stored in a node.
Can be gotten via minetest.get_meta(pos)
.
minetest.get_meta(pos)
.
NoteTimerRef
Node Timers: a high resolution persistent per-node timer. +
Node Timers: a high resolution persistent per-node timer.
Can be gotten via minetest.get_node_timer(pos)
.
minetest.get_node_timer(pos)
.
an itemstring, a table or nil
.
is_empty()
: return true
if stack is emptyget_name()
: returns item name (e.g. "default:stone"
)set_name(itemname)
get_count()
: returns number of items on the stackis_empty()
: Returns true
if stack is empty.get_name()
: Returns item name (e.g. "default:stone"
).set_name(item_name)
: Returns boolean success.
+ Clears item on failure.get_count()
: Returns number of items on the stack.set_count(count)
get_wear()
: returns tool wear (0
-65535
), 0
for non-toolsset_wear(wear)
get_metadata()
: returns metadata (a string attached to an item stack)set_metadata(metadata)
clear()
: removes all items from the stack, making it emptyreplace(item)
: replace the contents of this stackitem
can also be an itemstring or tableget_wear()
: Returns tool wear (0
-65535
), 0
for non-tools.set_wear(wear)
: Returns boolean success.
+ Clears item on failure.get_metadata()
: Returns metadata (a string attached to an item stack).set_metadata(metadata)
: Returns true.clear()
: removes all items from the stack, making it empty.replace(item)
: replace the contents of this stack.item
can also be an itemstring or table.to_string()
: returns the stack in itemstring formto_table()
: returns the stack in Lua table formget_stack_max()
: returns the maximum size of the stack (depends on the item)get_free_space()
: returns get_stack_max() - get_count()
is_known()
: returns true
if the item name refers to a defined item typeget_definition()
: returns the item definition tableget_tool_capabilities()
: returns the digging properties of the item,
+to_string()
: Returns the stack in itemstring form.to_table()
: Returns the stack in Lua table form.get_stack_max()
: Returns the maximum size of the stack (depends on the item).get_free_space()
: Returns get_stack_max() - get_count()
.is_known()
: Returns true
if the item name refers to a defined item type.get_definition()
: Returns the item definition table.get_tool_capabilities()
: Returns the digging properties of the item,
or those of the hand if none are defined for this item typeadd_wear(amount)
: increases wear by amount
if the item is a tooladd_item(item)
: put some item or stack onto this stack,item_fits(item)
: returns true
if item or stack can be fully added to this onetake_item(n)
: take (and remove) up to n
items from this stackItemStack
n
is omitted, n=1
is usedpeek_item(n)
: copy (don't remove) up to n
items from this stackItemStack
n
is omitted, n=1
is usedadd_wear(amount)
: Increases wear by amount
if the item is a tool.add_item(item)
: Put some item or stack onto this stack.
+ Returns leftover ItemStack
.item_fits(item)
: Returns true
if item or stack can be fully added to
+ this one.take_item(n=1)
: Take (and remove) up to n
items from this stack.
+ Returns taken ItemStack
.peek_item(n=1)
: copy (don't remove) up to n
items from this stack.
+ Returns taken ItemStack
.PseudoRandom
A pseudorandom number generator.
@@ -2987,7 +3006,7 @@ an itemstring, a table ornil
.
PerlinNoise
A perlin noise generator.
It can be created via PerlinNoise(seed, octaves, persistence, scale)
-or PerlinNoise(noiseparams)
.
+or PerlinNoise(noiseparams)
.
Alternatively with minetest.get_perlin(seeddiff, octaves, persistence, scale)
or minetest.get_perlin(noiseparams)
.
VoxelManip
An interface to the MapVoxelManipulator
for Lua.
It can be created via VoxelManip()
or minetest.get_voxel_manip()
.
It can be created via VoxelManip()
or minetest.get_voxel_manip()
.
+The map will be pre-loaded if two positions are passed to either.
read_from_map(p1, p2)
: Reads a chunk of map from the map containing the region formed by p1
and p2
.update_liquids()
: Update liquid flowwas_modified()
: Returns true
or false
if the data in the voxel manipulator had been modified since
the last read from map, due to a call to minetest.set_data()
on the loaded area elsewhereget_emerged_area()
: Returns actual emerged minimum and maximum positions.VoxelArea
A helper class for voxel areas. @@ -3412,7 +3433,6 @@ minetest.spawn_tree(pos,apple_tree) liquid_alternative_source = "", -- Source version of flowing liquid 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. 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 @@ -3579,8 +3599,8 @@ minetest.spawn_tree(pos,apple_tree) clust_size = 3, -- ^ Size of the bounding box of the cluster -- ^ In this example, there is a 3x3x3 cluster where 8 out of the 27 nodes are coal ore - height_min = -31000, - height_max = 64, + y_min = -31000, + y_max = 64, flags = "", -- ^ Attributes for this ore generation noise_threshhold = 0.5, @@ -3588,6 +3608,10 @@ minetest.spawn_tree(pos,apple_tree) noise_params = {offset=0, scale=1, spread={x=100, y=100, z=100}, seed=23, octaves=3, persist=0.70} -- ^ NoiseParams structure describing the perlin noise used for ore distribution. -- ^ Needed for sheet ore_type. Omit from scatter ore_type for a uniform ore distribution + random_factor = 1.0, +-- ^ Multiplier of the randomness contribution to the noise value at any +-- given point to decide if ore should be placed. Set to 0 for solid veins. +-- ^ This parameter is only valid for ore_type == "vein". }
register_decoration
)