From b16252dcae8c6b0e79c20fa4c3cbddc37ad377cb Mon Sep 17 00:00:00 2001 From: sfan5 Date: Thu, 22 Dec 2016 19:29:15 +0100 Subject: Various anticheat improvements * Calculate maximum interact distance from wielded tool * New "interacted_while_dead" cheat_type for the Lua API * Disallow dropping items while dead * Move player to spawn before resurrecting them --- doc/lua_api.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 34c64b8df..d2ddc635b 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2036,9 +2036,10 @@ Call these functions only at load time! * `minetest.register_on_cheat(func(ObjectRef, cheat))` * Called when a player cheats * `cheat`: `{type=}`, where `` is one of: - * `"moved_too_fast"` - * `"interacted_too_far"` - * `"finished_unknown_dig"` + * `moved_too_fast` + * `interacted_too_far` + * `interacted_while_dead` + * `finished_unknown_dig` * `dug_unbreakable` * `dug_too_fast` * `minetest.register_on_chat_message(func(name, message))` -- cgit v1.2.3 From 7057c196c442ff3484b53f48d940f4c9e0ffe23a Mon Sep 17 00:00:00 2001 From: Luke Puchner-Hardman Date: Tue, 23 Sep 2014 14:39:34 +0200 Subject: Added "[sheet" to the texture special commands. "[sheet:WxH:X,Y" assumes the base image is a tilesheet with W*H tiles on it and crops to the tile at position X,Y. Basically it works like "[verticalframe" but in 2D. For testing, I combined the four default_chest images into one. --- doc/lua_api.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index d2ddc635b..648a29303 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -403,6 +403,11 @@ Apply a mask to the base image. The mask is applied using binary AND. +#### `[sheet:x:,` +Retrieves a tile at position x,y from the base image +which it assumes to be a tilesheet with dimensions w,h. + + #### `[colorize::` Colorize the textures with the given color. `` is specified as a `ColorString`. -- cgit v1.2.3 From a07b032245bef76a7695e139a9daca7cb646a73d Mon Sep 17 00:00:00 2001 From: sfan5 Date: Fri, 23 Dec 2016 14:43:56 +0100 Subject: Add 2D sheet animation for nodes --- doc/lua_api.txt | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 648a29303..6166826af 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -3702,7 +3702,26 @@ Definition tables * `image` (name) ### Tile animation definition -* `{type="vertical_frames", aspect_w=16, aspect_h=16, length=3.0}` + + { + type = "vertical_frames", + aspect_w = 16, + -- ^ specify width of a frame in pixels + aspect_h = 16, + -- ^ specify height of a frame in pixels + length = 3.0, + -- ^ specify full loop length + } + + { + type = "sheet_2d", + frames_w = 5, + -- ^ specify width in number of frames + frames_h = 3, + -- ^ specify height in number of frames + frame_length = 0.5, + -- ^ specify length of a single frame + } ### Node definition (`register_node`) -- cgit v1.2.3 From e8b7179ccd5b1f70eba3f9ac570c5f10474cf7a7 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Wed, 28 Dec 2016 13:01:32 +0000 Subject: Expose and document chatcommands as minetest.registered_chatcommands --- doc/lua_api.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 6166826af..6f83039c8 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2076,6 +2076,7 @@ Call these functions only at load time! ### Other registration functions * `minetest.register_chatcommand(cmd, chatcommand definition)` + * Adds definition to minetest.registered_chatcommands * `minetest.register_privilege(name, definition)` * `definition`: `"description text"` * `definition`: `{ description = "description text", give_to_singleplayer = boolean}` -- cgit v1.2.3 From 545c37f6139125c9a2f9cc0ecfd1d3ff1f44b832 Mon Sep 17 00:00:00 2001 From: LNJ Date: Thu, 5 Jan 2017 22:38:43 +0100 Subject: lua_api.txt: Add registered_chatcommands to global tables --- doc/lua_api.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 6f83039c8..d05db9d49 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2729,6 +2729,8 @@ These functions return the leftover itemstack. * Map of object references, indexed by active object id * `minetest.luaentities` * Map of Lua entities, indexed by active object id +* `minetest.registered_chatcommands` + * Map of registered chat command definitions, indexed by name * `minetest.registered_ores` * List of registered ore definitions. * `minetest.registered_biomes` -- cgit v1.2.3 From ec30d49e026af2d0cb8329eb66aec48d12e79839 Mon Sep 17 00:00:00 2001 From: Rui Date: Tue, 10 Jan 2017 04:39:45 +0900 Subject: Add staticdata parameter to add_entity (#5009) * Add staticdata parameter to add_entity * Add add_entity_with_staticdata to core.features --- doc/lua_api.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index d05db9d49..fc0f8e1fc 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2173,7 +2173,7 @@ and `minetest.auth_reload` call the authetification handler. * `minetest.get_node_timer(pos)` * Get `NodeTimerRef` -* `minetest.add_entity(pos, name)`: Spawn Lua-defined entity at position +* `minetest.add_entity(pos, name, [staticdata])`: Spawn Lua-defined entity at position * Returns `ObjectRef`, or `nil` if failed * `minetest.add_item(pos, item)`: Spawn item * Returns `ObjectRef`, or `nil` if failed -- cgit v1.2.3 From 63c892eedfe21cbca2e2369d28e5e4d4e62ca1bd Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Mon, 16 Jan 2017 13:08:59 +0000 Subject: Rename ObjectRef methods to be consistent and predictable --- doc/lua_api.txt | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index fc0f8e1fc..da6a898d9 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2788,9 +2788,9 @@ This is basically a reference to a C++ `ServerActiveObject` #### Methods * `remove()`: remove object (after returning from Lua) * Note: Doesn't work on players, use minetest.kick_player instead -* `getpos()`: returns `{x=num, y=num, z=num}` -* `setpos(pos)`; `pos`=`{x=num, y=num, z=num}` -* `moveto(pos, continuous=false)`: interpolated move +* `get_pos()`: returns `{x=num, y=num, z=num}` +* `set_pos(pos)`; `pos`=`{x=num, y=num, z=num}` +* `move_to(pos, continuous=false)`: interpolated move * `punch(puncher, time_from_last_punch, tool_capabilities, direction)` * `puncher` = another `ObjectRef`, * `time_from_last_punch` = time since last punch action of the puncher @@ -2836,14 +2836,14 @@ This is basically a reference to a C++ `ServerActiveObject` } ##### LuaEntitySAO-only (no-op for other objects) -* `setvelocity({x=num, y=num, z=num})` -* `getvelocity()`: returns `{x=num, y=num, z=num}` -* `setacceleration({x=num, y=num, z=num})` -* `getacceleration()`: returns `{x=num, y=num, z=num}` -* `setyaw(radians)` -* `getyaw()`: returns number in radians -* `settexturemod(mod)` -* `setsprite(p={x=0,y=0}, num_frames=1, framelength=0.2, +* `set_velocity({x=num, y=num, z=num})` +* `get_velocity()`: returns `{x=num, y=num, z=num}` +* `set_acceleration({x=num, y=num, z=num})` +* `get_acceleration()`: returns `{x=num, y=num, z=num}` +* `set_yaw(radians)` +* `get_yaw()`: returns number in radians +* `set_texture_mod(mod)` +* `set_sprite(p={x=0,y=0}, num_frames=1, framelength=0.2, select_horiz_by_yawpitch=false)` * Select sprite from spritesheet with optional animation and DM-style texture selection based on yaw relative to camera -- cgit v1.2.3 From c5967f75f0a9827d1b65b384edd6ba07c73ffd2f Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Wed, 18 Jan 2017 10:19:57 +0000 Subject: Add minetest.player_exists() (#5064) --- doc/lua_api.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index da6a898d9..c96131455 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2583,6 +2583,7 @@ These functions return the leftover itemstack. ### Misc. * `minetest.get_connected_players()`: returns list of `ObjectRefs` +* `minetest.player_exists(name)`: boolean, whether player exists (regardless of online status) * `minetest.hud_replace_builtin(name, hud_definition)` * Replaces definition of a builtin hud element * `name`: `"breath"` or `"health"` -- cgit v1.2.3 From 7279f0b37335396c85f6bdd7dc67ff56e53df0f9 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 14 Jan 2017 16:48:49 +0100 Subject: Add particle animation, glow This is implemented by reusing and extending the TileAnimation code for the methods used by particles. --- doc/lua_api.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index c96131455..9bdc01c07 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -4180,10 +4180,15 @@ The Biome API is still in an experimental phase and subject to change. -- ^ vertical: if true faces player using y axis only texture = "image.png", -- ^ Uses texture (string) - playername = "singleplayer" + playername = "singleplayer", -- ^ optional, if specified spawns particle only on the player's client + animation = {Tile Animation definition}, + -- ^ optional, specifies how to animate the particle texture + glow = 0 + -- ^ optional, specify particle self-luminescence in darkness } + ### `ParticleSpawner` definition (`add_particlespawner`) { -- cgit v1.2.3 From efa54f9c460239c23a2014076764d6c6830589e6 Mon Sep 17 00:00:00 2001 From: Elijah Duffy Date: Fri, 20 Jan 2017 10:49:20 -0800 Subject: Add chatcommand unregister and override API (#5076) Introduces two functions to unregister and override chatcommands. minetest.unregister_chatcommand("") and minetest.override_chatcommand("", {}) --- doc/lua_api.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 9bdc01c07..aada851a1 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2077,6 +2077,10 @@ Call these functions only at load time! ### Other registration functions * `minetest.register_chatcommand(cmd, chatcommand definition)` * Adds definition to minetest.registered_chatcommands +* `minetest.override_chatcommand(name, redefinition)` + * Overrides fields of a chatcommand registered with register_chatcommand. +* `minetest.unregister_chatcommand(name)` + * Unregisters a chatcommands registered with register_chatcommand. * `minetest.register_privilege(name, definition)` * `definition`: `"description text"` * `definition`: `{ description = "description text", give_to_singleplayer = boolean}` -- cgit v1.2.3 From c57b4ff9b592617539aa978374c13cdd5f1603a6 Mon Sep 17 00:00:00 2001 From: sapier Date: Sat, 14 Jan 2017 19:32:10 +0100 Subject: Add Entity get_texture_mod() to Lua API Send texture modifier to clients connecting later too --- doc/lua_api.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index aada851a1..e5a3362ee 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2848,6 +2848,7 @@ This is basically a reference to a C++ `ServerActiveObject` * `set_yaw(radians)` * `get_yaw()`: returns number in radians * `set_texture_mod(mod)` +* `get_texture_mod()` returns current texture modifier * `set_sprite(p={x=0,y=0}, num_frames=1, framelength=0.2, select_horiz_by_yawpitch=false)` * Select sprite from spritesheet with optional animation and DM-style -- cgit v1.2.3 From d04d8aba7029a2501854a2838fd282b81358a54e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Juh=C3=A1sz?= Date: Thu, 12 Jan 2017 15:46:30 +0100 Subject: Add hardware node coloring. Includes: - Increase ContentFeatures serialization version - Color property and palettes for nodes - paramtype2 = "color", "colored facedir" or "colored wallmounted" --- doc/lua_api.txt | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index e5a3362ee..2a0b72053 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -638,6 +638,19 @@ node definition: bit 4 (0x10) - Makes the plant mesh 1.4x larger bit 5 (0x20) - Moves each face randomly a small bit down (1/8 max) bits 6-7 are reserved for future use. + paramtype2 == "color" + ^ `param2` tells which color is picked from the palette. + The palette should have 256 pixels. + paramtype2 == "colorfacedir" + ^ Same as `facedir`, but with colors. + The first three bits of `param2` tells which color + is picked from the palette. + The palette should have 8 pixels. + paramtype2 == "colorwallmounted" + ^ Same as `wallmounted`, but with colors. + The first five bits of `param2` tells which color + is picked from the palette. + The palette should have 32 pixels. collision_box = { type = "fixed", fixed = { @@ -3707,6 +3720,9 @@ Definition tables when displacement mapping is used Directions are from the point of view of the tile texture, not the node it's on +* `{name="image.png", color=ColorSpec}` + * the texture's color will be multiplied with this color. + * the tile's color overrides the owning node's color in all cases. * deprecated, yet still supported field names: * `image` (name) @@ -3749,8 +3765,17 @@ Definition tables special_tiles = {tile definition 1, Tile definition 2}, --[[ ^ Special textures of node; used rarely (old field name: special_materials) ^ List can be shortened to needed length ]] - alpha = 255, + color = ColorSpec, --[[ + ^ The node's original color will be multiplied with this color. + ^ If the node has a palette, then this setting only has an effect + ^ in the inventory and on the wield item. ]] use_texture_alpha = false, -- Use texture's alpha channel + palette = "palette.png", --[[ + ^ The node's `param2` is used to select a pixel from the image + ^ (pixels are arranged from left to right and from top to bottom). + ^ The node's color will be multiplied with the selected pixel's + ^ color. Tiles can override this behavior. + ^ Only when `paramtype2` supports palettes. ]] post_effect_color = "green#0F", -- If player is inside node, see "ColorSpec" paramtype = "none", -- See "Nodes" --[[ ^ paramtype = "light" allows light to propagate from or through the node with light value -- cgit v1.2.3 From 2d7a6f2cc0717eb92de4a91326a871d525ce513d Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 12 Jan 2017 11:27:39 -0800 Subject: Vector: Add vector.sort(a, b): return box edges This function returns the box corners of the smallest box that includes the two given coordinates. --- doc/lua_api.txt | 1 + 1 file changed, 1 insertion(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 2a0b72053..31a1daefb 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1850,6 +1850,7 @@ Spatial Vectors * `vector.round(v)`: returns a vector, each dimension rounded to nearest int * `vector.apply(v, func)`: returns a vector * `vector.equals(v1, v2)`: returns a boolean +* `vector.sort(v1, v2)`: returns minp, maxp vectors of the cuboid defined by v1 and v2 For the following functions `x` can be either a vector or a number: -- cgit v1.2.3 From 7fc67199683d3c60fe0b3ddcb2a9594b4804cc38 Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Thu, 12 Jan 2017 11:56:41 -0800 Subject: core: Add dir_to_yaw and yaw_to_dir helpers These are needed to go from things like entity yaw to a vector and vice versa. --- doc/lua_api.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 31a1daefb..62a7b81f7 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2403,6 +2403,10 @@ and `minetest.auth_reload` call the authetification handler. * Convert a vector to a wallmounted value, used for `paramtype2="wallmounted"` * `minetest.wallmounted_to_dir(wallmounted)` * Convert a wallmounted value back into a vector aimed directly out the "back" of a node +* `minetest.dir_to_yaw(dir)` + * Convert a vector into a yaw (angle) +* `minetest.yaw_to_dir(yaw)` + * Convert yaw (angle) to a vector * `minetest.get_node_drops(nodename, toolname)` * Returns list of item names. * **Note**: This will be removed or modified in a future version. -- cgit v1.2.3 From b7a98e98500402c3bbdb6d56d0fe42b4f5b3cedb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Fri, 27 Jan 2017 08:59:30 +0100 Subject: Implement player attribute backend (#4155) * This backend permit mods to store extra players attributes to a common interface. * Add the obj:set_attribute(attr, value) Lua call * Add the obj:get_attribute(attr) Lua call Examples: * player:set_attribute("home:home", "10,25,-78") * player:get_attribute("default:mana") Attributes are saved as a json in the player file in extended_attributes key They are saved only if a modification on the attributes occurs and loaded when emergePlayer is called (they are attached to PlayerSAO). --- doc/lua_api.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 62a7b81f7..ee7d57c2f 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2899,6 +2899,8 @@ This is basically a reference to a C++ `ServerActiveObject` * `0`: player is drowning, * `1`-`10`: remaining number of bubbles * `11`: bubbles bar is not shown +* `set_attribute(attribute, value)`: sets an extra attribute with value on player +* `get_attribute(attribute)`: returns value for extra attribute. Returns nil if no attribute found. * `set_inventory_formspec(formspec)` * Redefine player's inventory form * Should usually be called in on_joinplayer -- cgit v1.2.3 From 814ee971f70a8ef1fa4a470bcf385300686e9e70 Mon Sep 17 00:00:00 2001 From: sapier Date: Sat, 21 Jan 2017 15:58:07 +0100 Subject: Make entity on_punch have same signature and behaviour as player on_punch --- doc/lua_api.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index ee7d57c2f..ff745c1c2 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1392,7 +1392,7 @@ a non-tool item, so that it can do something else than take damage. On the Lua side, every punch calls: - entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction) + entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction, damage) This should never be called directly, because damage is usually not handled by the entity itself. @@ -1403,6 +1403,9 @@ the entity itself. * `tool_capabilities` can be `nil`. * `direction` is a unit vector, pointing from the source of the punch to the punched object. +* `damage` damage that will be done to entity +Return value of this function will determin if damage is done by this function +(retval true) or shall be done by engine (retval false) To punch an entity/object in Lua, call: -- cgit v1.2.3 From 79d752ba4f6f0197627cc20f99b2540f63b6dc88 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Mon, 2 Jan 2017 15:17:28 +0100 Subject: from_table: Fix crash for missing inventory or field --- doc/lua_api.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index ff745c1c2..9a1cb6bac 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2781,8 +2781,9 @@ Can be gotten via `minetest.get_meta(pos)`. * `get_inventory()`: returns `InvRef` * `to_table()`: returns `nil` or `{fields = {...}, inventory = {list1 = {}, ...}}` * `from_table(nil or {})` - * to clear metadata, use from_table(nil) + * Any non-table value will clear the metadata * See "Node Metadata" + * returns `true` on success ### `NodeTimerRef` Node Timers: a high resolution persistent per-node timer. -- cgit v1.2.3 From e761b9f48626db2af8b62a0cf85691208951cf0d Mon Sep 17 00:00:00 2001 From: sapier Date: Sat, 14 Jan 2017 23:16:58 +0100 Subject: Add multiply texture modifier Allows colorizing of textures using a color multiplication method. --- doc/lua_api.txt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 9a1cb6bac..219882f46 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -419,6 +419,13 @@ the word "`alpha`", then each texture pixel will contain the RGB of `` and the alpha of `` multiplied by the alpha of the texture pixel. +#### `[multiply:` +Multiplies texture colors with the given color. +`` is specified as a `ColorString`. +Result is more like what you'd expect if you put a color on top of another +color. Meaning white surfaces get a lot of your new color while black parts don't +change very much. + Sounds ------ Only Ogg Vorbis files are supported. -- cgit v1.2.3 From f2aa2c6a986dec47856c49ae5f54fbf3c688e027 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Tue, 31 Jan 2017 19:49:01 +0000 Subject: Add ItemStack key-value meta storage --- doc/lua_api.txt | 45 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 9 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 219882f46..2f5e3706c 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1411,7 +1411,7 @@ the entity itself. * `direction` is a unit vector, pointing from the source of the punch to the punched object. * `damage` damage that will be done to entity -Return value of this function will determin if damage is done by this function +Return value of this function will determin if damage is done by this function (retval true) or shall be done by engine (retval false) To punch an entity/object in Lua, call: @@ -1427,9 +1427,9 @@ Node Metadata ------------- The instance of a node in the world normally only contains the three values mentioned in "Nodes". However, it is possible to insert extra data into a -node. It is called "node metadata"; See "`NodeMetaRef`". +node. It is called "node metadata"; See `NodeMetaRef`. -Metadata contains two things: +Node metadata contains two things: * A key-value store * An inventory @@ -1467,6 +1467,18 @@ Example stuff: } }) +Item Metadata +------------- +Item stacks can store metadata too. See `ItemStackMetaRef`. + +Item metadata only contains a key-value store. + +Example stuff: + + local meta = stack:get_meta() + meta:set_string("key", "value") + print(dump(meta:to_table())) + Formspec -------- Formspec defines a menu. Currently not much else than inventories are @@ -2774,9 +2786,8 @@ These functions return the leftover itemstack. Class reference --------------- -### `NodeMetaRef` -Node metadata: reference extra data and functionality stored in a node. -Can be gotten via `minetest.get_meta(pos)`. +### `MetaDataRef` +See `NodeMetaRef` and `ItemStackMetaRef`. #### Methods * `set_string(name, value)` @@ -2785,13 +2796,29 @@ Can be gotten via `minetest.get_meta(pos)`. * `get_int(name)` * `set_float(name, value)` * `get_float(name)` -* `get_inventory()`: returns `InvRef` -* `to_table()`: returns `nil` or `{fields = {...}, inventory = {list1 = {}, ...}}` +* `to_table()`: returns `nil` or a table with keys: + * `fields`: key-value storage + * `inventory`: `{list1 = {}, ...}}` (NodeMetaRef only) * `from_table(nil or {})` * Any non-table value will clear the metadata - * See "Node Metadata" + * See "Node Metadata" for an example * returns `true` on success +### `NodeMetaRef` +Node metadata: reference extra data and functionality stored in a node. +Can be gotten via `minetest.get_meta(pos)`. + +#### Methods +* All methods in MetaDataRef +* `get_inventory()`: returns `InvRef` + +### `ItemStackMetaRef` +ItemStack metadata: reference extra data and functionality stored in a stack. +Can be gotten via `item:get_meta()`. + +#### Methods +* All methods in MetaDataRef + ### `NodeTimerRef` Node Timers: a high resolution persistent per-node timer. Can be gotten via `minetest.get_node_timer(pos)`. -- cgit v1.2.3 From f2f9a923515386d787a245fac52f78e815b3a839 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 3 Feb 2017 22:28:09 +0000 Subject: Add per-stack descriptions using ItemStack Metadata --- doc/lua_api.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 2f5e3706c..dd20ae904 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1473,6 +1473,10 @@ Item stacks can store metadata too. See `ItemStackMetaRef`. Item metadata only contains a key-value store. +Some of the values in the key-value store are handled specially: + +* `description`: Set the itemstack's description. Defaults to idef.description + Example stuff: local meta = stack:get_meta() -- cgit v1.2.3 From ef6feca501fcf0d5a1fd2021f1d4df96a4533f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Wed, 8 Feb 2017 00:15:55 +0100 Subject: Add ModMetadata API (#5131) * mod can create a ModMetadata object where store its values and retrieve it. * Modmetadata object can only be fetched at mod loading * Save when modified using same time as map interval or at server stop * add helper function to get mod storage path * ModMetadata has exactly same calls than all every other Metadata --- doc/lua_api.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index dd20ae904..4774e8a5a 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2629,6 +2629,11 @@ These functions return the leftover itemstack. * `HTTPApiTable.fetch_async_get(handle)`: returns HTTPRequestResult * Return response data for given asynchronous HTTP request +### Storage API: +* `minetest.get_mod_storage()`: + * returns reference to mod private `StorageRef` + * must be called during mod load time + ### Misc. * `minetest.get_connected_players()`: returns list of `ObjectRefs` * `minetest.player_exists(name)`: boolean, whether player exists (regardless of online status) @@ -2791,7 +2796,7 @@ Class reference --------------- ### `MetaDataRef` -See `NodeMetaRef` and `ItemStackMetaRef`. +See `StorageRef`, `NodeMetaRef` and `ItemStackMetaRef`. #### Methods * `set_string(name, value)` @@ -2845,6 +2850,9 @@ Can be gotten via `minetest.get_node_timer(pos)`. * `is_started()`: returns boolean state of timer * returns `true` if timer is started, otherwise `false` +### `StorageRef` +This is basically a reference to a C++ `ModMetadata` + ### `ObjectRef` Moving things in the game are generally these. -- cgit v1.2.3 From 74b670a7930736fb4f43dcb5c9e0a366bf23cad4 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 10 Feb 2017 06:59:38 +0000 Subject: Correct lua_api.txt docs related to meta (#5198) --- doc/lua_api.txt | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 4774e8a5a..0245ee7bd 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2815,7 +2815,7 @@ See `StorageRef`, `NodeMetaRef` and `ItemStackMetaRef`. ### `NodeMetaRef` Node metadata: reference extra data and functionality stored in a node. -Can be gotten via `minetest.get_meta(pos)`. +Can be obtained via `minetest.get_meta(pos)`. #### Methods * All methods in MetaDataRef @@ -2823,7 +2823,14 @@ Can be gotten via `minetest.get_meta(pos)`. ### `ItemStackMetaRef` ItemStack metadata: reference extra data and functionality stored in a stack. -Can be gotten via `item:get_meta()`. +Can be obtained via `item:get_meta()`. + +#### Methods +* All methods in MetaDataRef + +### `StorageRef` +Mod metadata: per mod metadata, saved automatically. +Can be obtained via `minetest.get_mod_storage()` during load time. #### Methods * All methods in MetaDataRef @@ -2850,9 +2857,6 @@ Can be gotten via `minetest.get_node_timer(pos)`. * `is_started()`: returns boolean state of timer * returns `true` if timer is started, otherwise `false` -### `StorageRef` -This is basically a reference to a C++ `ModMetadata` - ### `ObjectRef` Moving things in the game are generally these. @@ -3100,8 +3104,9 @@ an itemstring, a table or `nil`. * `set_count(count)`: Returns boolean whether item was cleared * `get_wear()`: Returns tool wear (`0`-`65535`), `0` for non-tools. * `set_wear(wear)`: Returns boolean whether item was cleared -* `get_metadata()`: Returns metadata (a string attached to an item stack). -* `set_metadata(metadata)`: Returns true. +* `get_meta()`: Returns ItemStackMetaRef. See section for more details +* `get_metadata()`: (DEPRECATED) Returns metadata (a string attached to an item stack). +* `set_metadata(metadata)`: (DEPRECATED) 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. -- cgit v1.2.3 From 01b2d2c66c9095341554400ba67505b137ec1d86 Mon Sep 17 00:00:00 2001 From: red-001 Date: Sun, 19 Feb 2017 16:11:53 +0000 Subject: Fix the documentation for `minetest.is_yes` (#5276) --- doc/lua_api.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 0245ee7bd..9c96c41db 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1914,7 +1914,7 @@ Helper functions * `minetest.formspec_escape(string)`: returns a string * escapes the characters "[", "]", "\", "," and ";", which can not be used in formspecs * `minetest.is_yes(arg)` - * returns whether `arg` can be interpreted as yes + * returns true if passed 'y', 'yes', 'true' or a number that isn't zero. * `minetest.get_us_time()` * returns time with microsecond precision. May not return wall time. * `table.copy(table)`: returns a table -- cgit v1.2.3 From 6de83a2756316653ed67b23bbeb0fb43aa2a68c6 Mon Sep 17 00:00:00 2001 From: adelcoding1 Date: Sat, 4 Mar 2017 10:46:55 +0100 Subject: FormSpec: Add position and anchor elements (#5284) --- doc/lua_api.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 9c96c41db..7b956dc74 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1522,6 +1522,16 @@ examples. * `fixed_size`: `true`/`false` (optional) * deprecated: `invsize[,;]` +#### `position[,]` +* Define the position of the formspec +* A value between 0.0 and 1.0 represents a position inside the screen +* The default value is the center of the screen (0.5, 0.5) + +#### `anchor[,]` +* Define the anchor of the formspec +* A value between 0.0 and 1.0 represents an anchor inside the formspec +* The default value is the center of the formspec (0.5, 0.5) + #### `container[,]` * Start of a container block, moves all physical elements in the container by (X, Y) * Must have matching container_end -- cgit v1.2.3 From c9ac722ea9ab3783bf59e7cb991bfb3a91211490 Mon Sep 17 00:00:00 2001 From: zaoqi Date: Sun, 5 Mar 2017 01:36:37 +0800 Subject: Add minetest.spawn_falling_node(pos) (#5339) * Add minetest.spawn_falling_node(pos) * lua_api.txt: Add minetest.spawn_falling_node(pos) * Update minetest.spawn_falling_node(pos) --- doc/lua_api.txt | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 7b956dc74..23aac90d9 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2219,6 +2219,9 @@ and `minetest.auth_reload` call the authetification handler. * Returns `true` if successful, `false` on failure (e.g. protected location) * `minetest.punch_node(pos)` * Punch node with the same effects that a player would cause +* `minetest.spawn_falling_node(pos)` + * Change node into falling node + * Returns `true` if successful, `false` on failure * `minetest.find_nodes_with_meta(pos1, pos2)` * Get a table of positions of nodes that have metadata within a region {pos1, pos2} -- cgit v1.2.3 From ab371cc93491baf0973ecc94b96c3a1fdb4abfd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Juh=C3=A1sz?= Date: Sat, 10 Dec 2016 19:02:44 +0100 Subject: Light calculation: New bulk node lighting code This commit introduces a new bulk node lighting algorithm to minimize lighting bugs during l-system tree generation, schematic placement and non-mapgen-object lua voxelmanip light calculation. If the block above the changed area is not loaded, it gets loaded to avoid lighting bugs. Light is updated as soon as write_to_map is called on a voxel manipulator, therefore update_map does nothing. --- doc/lua_api.txt | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 23aac90d9..484a5848c 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -3282,9 +3282,6 @@ format as produced by get_data() et al. and is *not required* to be a table retr Once the internal VoxelManip state has been modified to your liking, the changes can be committed back to the map by calling `VoxelManip:write_to_map()`. -Finally, a call to `VoxelManip:update_map()` is required to re-calculate lighting and set the blocks -as being modified so that connected clients are sent the updated parts of map. - ##### Flat array format Let @@ -3349,8 +3346,6 @@ but with a few differences: will also update the Mapgen VoxelManip object's internal state active on the current thread. * After modifying the Mapgen VoxelManip object's internal buffer, it may be necessary to update lighting information using either: `VoxelManip:calc_lighting()` or `VoxelManip:set_lighting()`. -* `VoxelManip:update_map()` does not need to be called after `write_to_map()`. The map update is performed - automatically after all on_generated callbacks have been run for that generated block. ##### Other API functions operating on a VoxelManip If any VoxelManip contents were set to a liquid node, `VoxelManip:update_liquids()` must be called @@ -3393,9 +3388,7 @@ will place the schematic inside of the VoxelManip. * returns raw node data in the form of an array of node content IDs * if the param `buffer` is present, this table will be used to store the result instead * `set_data(data)`: Sets the data contents of the `VoxelManip` object -* `update_map()`: Update map after writing chunk back to map. - * To be used only by `VoxelManip` objects created by the mod itself; - not a `VoxelManip` that was retrieved from `minetest.get_mapgen_object` +* `update_map()`: Does nothing, kept for compatibility. * `set_lighting(light, [p1, p2])`: Set the lighting within the `VoxelManip` to a uniform value * `light` is a table, `{day=<0...15>, night=<0...15>}` * To be used only by a `VoxelManip` object from `minetest.get_mapgen_object` -- cgit v1.2.3 From c05dfac9a309c7aef1b908ac0070ca71b587f75d Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Wed, 15 Mar 2017 22:07:19 +0100 Subject: lua_api: Document minetest.features (#5311) --- doc/lua_api.txt | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 484a5848c..9b53b87f5 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1943,13 +1943,31 @@ Helper functions * `minetest.get_worldpath()`: returns e.g. `"/home/user/.minetest/world"` * Useful for storing custom data * `minetest.is_singleplayer()` -* `minetest.features` - * Table containing API feature flags: `{foo=true, bar=true}` +* `minetest.features`: Table containing API feature flags + { + glasslike_framed = true, + nodebox_as_selectionbox = true, + chat_send_player_param3 = true, + get_all_craft_recipes_works = true, + use_texture_alpha = true, + -- ^ The transparency channel of textures can be used optionally + no_legacy_abms = true, + -- ^ Tree and grass ABMs are no longer done from C++ + texture_names_parens = true, + -- ^ Texture grouping is possible using parentheses + area_store_custom_ids = true, + -- ^ Unique Area ID for AreaStore:insert_area + add_entity_with_staticdata = true, + -- ^ add_entity supports passing initial staticdata to on_activate + no_chat_message_prediction = true, + -- ^ Chat messages are no longer predicted + } * `minetest.has_feature(arg)`: returns `boolean, missing_features` * `arg`: string or table in format `{foo=true, bar=true}` * `missing_features`: `{foo=true, bar=true}` -* `minetest.get_player_information(player_name)`: returns a table containing - information about player. Example return value: +* `minetest.get_player_information(player_name)`: + * Returns a table containing information about a player + Example return value: { address = "127.0.0.1", -- IP address of client ip_version = 4, -- IPv4 / IPv6 -- cgit v1.2.3 From c4b98deb616fbe204c503d678fb920baa33cbede Mon Sep 17 00:00:00 2001 From: Paramat Date: Mon, 20 Mar 2017 21:22:16 +0000 Subject: Firelike drawtype: Add missing docs for visual_scale in lua_api.txt (#5434) --- doc/lua_api.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 9b53b87f5..2ac8f1077 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -3841,9 +3841,10 @@ Definition tables drawtype = "normal", -- See "Node drawtypes" visual_scale = 1.0, --[[ - ^ Supported for drawtypes "plantlike", "signlike", "torchlike", "mesh". - ^ For plantlike, the image will start at the bottom of the node; for the - ^ other drawtypes, the image will be centered on the node. + ^ Supported for drawtypes "plantlike", "signlike", "torchlike", + ^ "firelike", "mesh". + ^ For plantlike and firelike, the image will start at the bottom of the + ^ node, for the other drawtypes the image will be centered on the node. ^ Note that positioning for "torchlike" may still change. ]] tiles = {tile definition 1, def2, def3, def4, def5, def6}, --[[ ^ Textures of node; +Y, -Y, +X, -X, +Z, -Z (old field name: tile_images) -- cgit v1.2.3 From 81c3dc32a8e48aee076e4b28cae0037a4ae254d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Mart=C3=ADnez?= Date: Tue, 28 Mar 2017 16:55:39 -0300 Subject: Add functions to strip color information. (#5472) --- doc/lua_api.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 2ac8f1077..72599cb7c 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1872,6 +1872,12 @@ The following functions provide escape sequences: * `color` is a ColorString * The escape sequence sets the background of the whole text element to `color`. Only defined for item descriptions and tooltips. +* `color.strip_foreground_colors(str)` + * Removes foreground colors added by `get_color_escape_sequence`. +* `color.strip_background_colors(str)` + * Removes background colors added by `get_background_escape_sequence`. +* `color.strip_colors(str)` + * Removes all color escape sequences. Spatial Vectors --------------- -- cgit v1.2.3 From ea549bbae3650d246db7b70a2b07485a4b404409 Mon Sep 17 00:00:00 2001 From: paramat Date: Wed, 29 Mar 2017 03:40:30 +0100 Subject: Paramtype2: Add missing type CPT2_GLASSLIKE_LIQUID_LEVEL Add the missing paramtype2 for param2 controlling the liquid level inside the glasslike_framed drawtype. Add missing documentation of the feature to lua_api.txt. Update and improve comments for drawtype enumerations in nodedef.h. --- doc/lua_api.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 72599cb7c..0ca3767f9 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -658,6 +658,10 @@ node definition: The first five bits of `param2` tells which color is picked from the palette. The palette should have 32 pixels. + paramtype2 == "glasslikeliquidlevel" + ^ Only valid for "glasslike_framed" or "glasslike_framed_optional" drawtypes. + param2 defines 64 levels of internal liquid. + Liquid texture is defined using `special_tiles = {"modname_tilename.png"},` collision_box = { type = "fixed", fixed = { -- cgit v1.2.3 From 26f4a5c2d1e3d825816188fcd63f6d1f6758ae60 Mon Sep 17 00:00:00 2001 From: MarkuBu Date: Sat, 1 Apr 2017 16:50:53 +0200 Subject: First commit for fine pointed (#5485) --- doc/lua_api.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 0ca3767f9..0d3f00c67 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1939,6 +1939,8 @@ Helper functions * returns time with microsecond precision. May not return wall time. * `table.copy(table)`: returns a table * returns a deep copy of `table` +* `minetest.pointed_thing_to_face_pos(placer, pointed_thing)`: returns a position + * returns the exact position on the surface of a pointed node `minetest` namespace reference ------------------------------ -- cgit v1.2.3 From fb4c730708a4140f05d2161c27e6c58bb0f72a9b Mon Sep 17 00:00:00 2001 From: raymoo Date: Sat, 8 Apr 2017 01:42:59 -0700 Subject: Document that write_json will error on unserializable types. (#5539) Previously it was erroneously documented that it would save them as null. --- doc/lua_api.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 0d3f00c67..ca1b5d14c 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2709,7 +2709,7 @@ These functions return the leftover itemstack. * `minetest.write_json(data[, styled])`: returns a string or `nil` and an error message * Convert a Lua table into a JSON string * styled: Outputs in a human-readable format if this is set, defaults to false - * Unserializable things like functions and userdata are saved as null. + * Unserializable things like functions and userdata will cause an error. * **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. -- cgit v1.2.3 From 58d83a7bb2f992194c3df304b1dcbb81f98f78c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Juh=C3=A1sz?= Date: Fri, 10 Mar 2017 18:25:58 +0100 Subject: Hardware coloring for itemstacks Adds the possibility to colorize item stacks based on their metadata. In the item/node definition you can specify palette (an image file) and color (fallback color if the item has no palette or metadata). Then you can add palette_index to the metadata. Dropped itemstacks with different colors do not merge. --- doc/lua_api.txt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index ca1b5d14c..721f5448a 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1480,6 +1480,9 @@ Item metadata only contains a key-value store. Some of the values in the key-value store are handled specially: * `description`: Set the itemstack's description. Defaults to idef.description +* `color`: A `ColorString`, which sets the stack's color. +* `palette_index`: If the item has a palette, this is used to get the + current color from the palette. Example stuff: @@ -2855,6 +2858,8 @@ See `StorageRef`, `NodeMetaRef` and `ItemStackMetaRef`. * Any non-table value will clear the metadata * See "Node Metadata" for an example * returns `true` on success +* `equals(other)` + * returns `true` if this metadata has the same key-value pairs as `other` ### `NodeMetaRef` Node metadata: reference extra data and functionality stored in a node. @@ -3735,6 +3740,19 @@ Definition tables {hard = 1, metal = 1, spikes = 1} inventory_image = "default_tool_steelaxe.png", wield_image = "", + palette = "", + --[[ + ^ An image file containing the palette of a node. + ^ You can set the currently used color as the + ^ "palette_index" field of the item stack metadata. + ^ The palette is always stretched to fit indices + ^ between 0 and 255, to ensure compatibility with + ^ "colorfacedir" and "colorwallmounted" nodes. + ]] + color = "0xFFFFFFFF", + --[[ + ^ The color of the item. The palette overrides this. + ]] wield_scale = {x = 1, y = 1, z = 1}, stack_max = 99, range = 4.0, -- cgit v1.2.3 From 34d32ce55ae4f3f29d7b645075dc8efacb2c96d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sat, 15 Apr 2017 23:19:18 +0200 Subject: Implement delayed server shutdown with cancelation (#4664) --- doc/lua_api.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 721f5448a..7b967726d 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2576,8 +2576,12 @@ These functions return the leftover itemstack. * Optional: Variable number of arguments that are passed to `func` ### Server -* `minetest.request_shutdown([message],[reconnect])`: request for server shutdown. Will display `message` to clients, - and `reconnect` == true displays a reconnect button. +* `minetest.request_shutdown([message],[reconnect],[delay])`: request for server shutdown. Will display `message` to clients, + `reconnect` == true displays a reconnect button, + `delay` adds an optional delay (in seconds) before shutdown + negative delay cancels the current active shutdown + zero delay triggers an immediate shutdown. +* `minetest.cancel_shutdown_requests()`: cancel current delayed shutdown * `minetest.get_server_status()`: returns server status string * `minetest.get_server_uptime()`: returns the server uptime in seconds -- cgit v1.2.3 From f6da7b3fda5bbb793c7795a228ea6f2602b93fbe Mon Sep 17 00:00:00 2001 From: paramat Date: Wed, 5 Apr 2017 12:18:22 +0100 Subject: Sneak: Add option for old move code Temporary option for the old move code for specific old sneak behaviour. Enabled by setting the added 'new move' physics override to false. By default 'new move' is true. --- doc/lua_api.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 7b967726d..4427e26d8 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -3021,7 +3021,11 @@ This is basically a reference to a C++ `ServerActiveObject` * `jump`: multiplier to default jump value (default: `1`) * `gravity`: multiplier to default gravity value (default: `1`) * `sneak`: whether player can sneak (default: `true`) - * `sneak_glitch`: whether player can use the sneak glitch (default: `true`) + * `sneak_glitch`: whether player can use the new move code replications + of the old sneak side-effects: sneak ladders and 2 node sneak jump + when next to a ledge 2 nodes up (default: `true`) + * `new_move`: use new move/sneak code. When `false` the exact old code + is used for the specific old sneak behaviour (default: `true`) * `get_physics_override()`: returns the table given to set_physics_override * `hud_add(hud definition)`: add a HUD element described by HUD def, returns ID number on success -- cgit v1.2.3 From 858c72297409ca54092c3c908279d2a05fef58cd Mon Sep 17 00:00:00 2001 From: Hybrid Dog Date: Mon, 10 Apr 2017 22:07:52 +0200 Subject: Tools: Fix tool digging speed limit --- doc/lua_api.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 4427e26d8..6e7a1de68 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1231,9 +1231,8 @@ Another example: Make red wool from white wool and red dye: * `0` is something that is directly accessible at the start of gameplay * There is no upper limit * `dig_immediate`: (player can always pick up node without tool wear) - * `2`: node is removed without tool wear after 0.5 seconds or so - (rail, sign) - * `3`: node is removed without tool wear immediately (torch) + * `2`: node is removed without tool wear after 0.5 seconds (rail, sign) + * `3`: node is removed without tool wear after 0.15 seconds (torch) * `disable_jump`: Player (and possibly other things) cannot jump from node * `fall_damage_add_percent`: damage speed = `speed * (1 + value/100)` * `bouncy`: value is bounce speed in percent -- cgit v1.2.3 From 57e5aa662851485902575c3c747437e365bf72c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Juh=C3=A1sz?= Date: Sat, 11 Mar 2017 17:07:04 +0100 Subject: Light update for map blocks This is not really different from the light update of a voxel manipulator. This update does not assume that the lighting was correct before, therefore it is useful for correction. Also expose this function to the Lua API for light correction, and allow voxel manipulators not to update the light. --- doc/lua_api.txt | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 6e7a1de68..16e662e0c 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2398,6 +2398,22 @@ and `minetest.auth_reload` call the authetification handler. * increase level of leveled node by level, default `level` equals `1` * if `totallevel > maxlevel`, returns rest (`total-max`) * can be negative for decreasing +* `minetest.fix_light(pos1, pos2)`: returns `true`/`false` + * resets the light in a cuboid-shaped part of + the map and removes lighting bugs. + * Loads the area if it is not loaded. + * `pos1` is the corner of the cuboid with the least coordinates + (in node coordinates), inclusive. + * `pos2` is the opposite corner of the cuboid, inclusive. + * The actual updated cuboid might be larger than the specified one, + because only whole map blocks can be updated. + The actual updated area consists of those map blocks that intersect + with the given cuboid. + * However, the neighborhood of the updated area might change + as well, as light can spread out of the cuboid, also light + might be removed. + * returns `false` if the area is not fully generated, + `true` otherwise * `core.check_single_for_falling(pos)` * causes an unsupported `group:falling_node` node to fall and causes an unattached `group:attached_node` node to fall. @@ -3421,8 +3437,14 @@ will place the schematic inside of the VoxelManip. * `read_from_map(p1, p2)`: Loads a chunk of map into the VoxelManip object containing the region formed by `p1` and `p2`. * returns actual emerged `pmin`, actual emerged `pmax` -* `write_to_map()`: Writes the data loaded from the `VoxelManip` back to the map. +* `write_to_map([light])`: Writes the data loaded from the `VoxelManip` back to the map. * **important**: data must be set using `VoxelManip:set_data()` before calling this + * if `light` is true, then lighting is automatically recalculated. + The default value is true. + If `light` is false, no light calculations happen, and you should correct + all modified blocks with `minetest.fix_light()` as soon as possible. + Keep in mind that modifying the map where light is incorrect can cause + more lighting bugs. * `get_node_at(pos)`: Returns a `MapNode` table of the node currently loaded in the `VoxelManip` at that position * `set_node_at(pos, node)`: Sets a specific `MapNode` in the `VoxelManip` at that position -- cgit v1.2.3 From 1ffb180868ffcec6812cd3aac8f56ffefb91c8bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Juh=C3=A1sz?= Date: Fri, 21 Apr 2017 15:34:59 +0200 Subject: Soft node overlay (#5186) This commit adds node overlays, which are tiles that are drawn on top of other tiles. --- doc/lua_api.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 16e662e0c..4e328ac76 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -3908,6 +3908,12 @@ Definition tables tiles = {tile definition 1, def2, def3, def4, def5, def6}, --[[ ^ Textures of node; +Y, -Y, +X, -X, +Z, -Z (old field name: tile_images) ^ List can be shortened to needed length ]] + overlay_tiles = {tile definition 1, def2, def3, def4, def5, def6}, --[[ + ^ Same as `tiles`, but these textures are drawn on top of the + ^ base tiles. You can use this to colorize only specific parts of + ^ your texture. If the texture name is an empty string, that + ^ overlay is not drawn. Since such tiles are drawn twice, it + ^ is not recommended to use overlays on very common nodes. special_tiles = {tile definition 1, Tile definition 2}, --[[ ^ Special textures of node; used rarely (old field name: special_materials) ^ List can be shortened to needed length ]] -- cgit v1.2.3 From cca58fe0fd1aac4246a23e1fc4f8469bdd280c6d Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Wed, 19 Apr 2017 23:10:39 -0700 Subject: Add on_flood() callback. This callback is called if a liquid definitely floods a non-air node on the map. The callback arguments are (pos, oldnode, newnode) and can return a `bool` value indicating whether flooding the node should be cancelled (`return true` will prevent the node from flooding). Documentation is added, the callback function was tested with a modified minetest_game. Note that `return true` will likely cause the node's `on_flood()` callback to be called every second until the node gets removed, so care must be taken to prevent many callbacks from using this return value. The current default liquid update interval is 1.0 seconds, which isn't unmanageable. The larger aim of this patch is to remove the lava cooling ABM, which is a significant cost to idle servers that have lava on their map. This callback will be much more efficient. --- doc/lua_api.txt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 4e328ac76..774b1e992 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -4002,6 +4002,13 @@ Definition tables ^ Node destructor; called after removing node ^ Not called for bulk node placement (i.e. schematics and VoxelManip) ^ default: nil ]] + on_flood = func(pos, oldnode, newnode), --[[ + ^ Called when a liquid (newnode) is about to flood oldnode, if + ^ it has `floodable = true` in the nodedef. Not called for bulk + ^ node placement (i.e. schematics and VoxelManip) or air nodes. If + ^ return true the node is not flooded, but on_flood callback will + ^ most likely be called over and over again every liquid update + ^ interval. Default: nil ]] after_place_node = func(pos, placer, itemstack, pointed_thing) --[[ ^ Called after constructing node when node was placed using -- cgit v1.2.3 From 58c083f305d77bd3c7d366c1f0e4a54d80a51719 Mon Sep 17 00:00:00 2001 From: paramat Date: Thu, 20 Apr 2017 22:47:28 +0100 Subject: Sneak glitch: Set default to false The 'sneak glitch' physics override now controls whether a player can use the new move code replications of the old sneak side-effects: sneak ladders and 2 node sneak jump. This completes our intention to replicate the old sneak side-effects in new code and provide them as an option that is disabled by default. --- doc/lua_api.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 774b1e992..33254fb2a 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -3038,7 +3038,7 @@ This is basically a reference to a C++ `ServerActiveObject` * `sneak`: whether player can sneak (default: `true`) * `sneak_glitch`: whether player can use the new move code replications of the old sneak side-effects: sneak ladders and 2 node sneak jump - when next to a ledge 2 nodes up (default: `true`) + (default: `false`) * `new_move`: use new move/sneak code. When `false` the exact old code is used for the specific old sneak behaviour (default: `true`) * `get_physics_override()`: returns the table given to set_physics_override -- cgit v1.2.3 From 29ab20c27229672c24a7699afbcd54caad903331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sun, 23 Apr 2017 14:35:08 +0200 Subject: Player data to Database (#5475) * Player data to Database Add player data into databases (SQLite3 & PG only) PostgreSQL & SQLite: better POO Design for databases Add --migrate-players argument to server + deprecation warning * Remove players directory if empty --- doc/lua_api.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 33254fb2a..c3d8d2bf6 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2599,6 +2599,8 @@ These functions return the leftover itemstack. * `minetest.cancel_shutdown_requests()`: cancel current delayed shutdown * `minetest.get_server_status()`: returns server status string * `minetest.get_server_uptime()`: returns the server uptime in seconds +* `minetest.remove_player(name)`: remove player from database (if he is not connected). + * Returns a code (0: successful, 1: no such player, 2: player is connected) ### Bans * `minetest.get_ban_list()`: returns the ban list (same as `minetest.get_ban_description("")`) -- cgit v1.2.3 From 70ceeb80a180507e38db957f217e2c78ce901692 Mon Sep 17 00:00:00 2001 From: Bluebird Date: Wed, 26 Apr 2017 00:24:15 -0500 Subject: Tiny documentation fix. (#5659) There are plenty of lines longer than 80 characters, and spliting the function declaration across two lines can be momentarily confusing. --- doc/lua_api.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index c3d8d2bf6..4f90e9223 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1919,8 +1919,7 @@ Helper functions * `math.sign(x, tolerance)` * Get the sign of a number. Optional: Also returns `0` when the absolute value is within the tolerance (default: `0`) -* `string.split(str, separator=",", include_empty=false, max_splits=-1, -* sep_is_pattern=false)` +* `string.split(str, separator=",", include_empty=false, max_splits=-1, sep_is_pattern=false)` * If `max_splits` is negative, do not limit splits. * `sep_is_pattern` specifies if separator is a plain string or a pattern (regex). * e.g. `string:split("a,b", ",") == {"a","b"}` -- cgit v1.2.3 From d130e1fdc09398367bfed3e0d4a4b2574ca33ab1 Mon Sep 17 00:00:00 2001 From: Bluebird Date: Thu, 27 Apr 2017 04:49:07 -0500 Subject: Fix incorrect formspec-tooltip doc, add detail in 'floodable' & 'on_flood' docs (#5660) * Fix incorrect formspec tooltip documentation * Improve `floodable` and `on_flood` documentation. The original documentation did not specify that liquids should not themselves be floodable. This is probably something that should be mentioned. --- doc/lua_api.txt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 4f90e9223..d4141b5d4 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1580,7 +1580,7 @@ examples. * Sets default background color of tooltips * Sets default font color of tooltips -#### `tooltip[;;,]` +#### `tooltip[;;;]` * Adds tooltip for an element * `` tooltip background color as `ColorString` (optional) * `` tooltip font color as `ColorString` (optional) @@ -3942,7 +3942,9 @@ Definition tables diggable = true, -- If false, can never be dug climbable = false, -- If true, can be climbed on (ladder) buildable_to = false, -- If true, placed nodes can replace this node - floodable = false, -- If true, liquids flow into and replace this node + floodable = false, --[[ + ^ If true, liquids flow into and replace this node. + ^ Warning: making a liquid node 'floodable' does not work and may cause problems. ]] liquidtype = "none", -- "none"/"source"/"flowing" liquid_alternative_flowing = "", -- Flowing version of source liquid liquid_alternative_source = "", -- Source version of flowing liquid @@ -4009,7 +4011,8 @@ Definition tables ^ node placement (i.e. schematics and VoxelManip) or air nodes. If ^ return true the node is not flooded, but on_flood callback will ^ most likely be called over and over again every liquid update - ^ interval. Default: nil ]] + ^ interval. Default: nil. + ^ Warning: making a liquid node 'floodable' does not work and may cause problems. ]] after_place_node = func(pos, placer, itemstack, pointed_thing) --[[ ^ Called after constructing node when node was placed using -- cgit v1.2.3 From 1ef9eee31133a3001ed0c642df5cbe54169850de Mon Sep 17 00:00:00 2001 From: red-001 Date: Thu, 27 Apr 2017 10:49:44 +0100 Subject: Allow scripts to get the client protocol version in non-debug builds. (#5649) --- doc/lua_api.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index d4141b5d4..b47046cb1 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1991,11 +1991,11 @@ Helper functions max_jitter = 0.5, -- maximum packet time jitter avg_jitter = 0.03, -- average packet time jitter connection_uptime = 200, -- seconds since client connected + prot_vers = 31, -- protocol version used by client -- following information is available on debug build only!!! -- DO NOT USE IN MODS --ser_vers = 26, -- serialization version used by client - --prot_vers = 23, -- protocol version used by client --major = 0, -- major version number --minor = 4, -- minor version number --patch = 10, -- patch version number -- cgit v1.2.3 From e21a1ab3bd31f9b854ef77c33698624755fc915c Mon Sep 17 00:00:00 2001 From: Auke Kok Date: Fri, 28 Apr 2017 11:11:43 -0700 Subject: Allow mesh and nodeboxes to wave like plants or leaves. (#3497) We introduce a new value for "waving" - 2: 0 - waving disabled 1 - wave like a plant 2 - wave like a leave Plantlike nodes will only allow waving = 1, but for leaves we will permit both 1 and 2 since current minetest_game sets it to 1 for all leaves. This makes it somewhat backwards compatible. For mesh and nodebox, values 1 and 2 are both valid, and the node can wave in both fashions as desired. I've tested this with the crops:corn plants, which are mesh nodes, and the results are really good. The code change is trivial as well, so I've opted to document the waving parameter in lua_api.txt because it was missing from there. Nodeboxes likely will not wave properly unless waving = 2. However it's possible that waving=1 may be desired by some mod developers for geometries I have not tried, so the code will not prohibit either value for mesh and nodebox drawtypes. Add lua_api.txt documentation for this feature and document both the existing functionality and the expansion to mesh and nodebox drawtypes. --- doc/lua_api.txt | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index b47046cb1..603619ab0 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -3973,6 +3973,12 @@ Definition tables ^ If drawtype "nodebox" is used and selection_box is nil, then node_box is used. ]] legacy_facedir_simple = false, -- Support maps made in and before January 2012 legacy_wallmounted = false, -- Support maps made in and before January 2012 + waving = 0, --[[ valid for mesh, nodebox, plantlike, allfaces_optional nodes + ^ 1 - wave node like plants (top of node moves, bottom is fixed) + ^ 2 - wave node like leaves (whole node moves side-to-side synchronously) + ^ caveats: not all models will properly wave + ^ plantlike drawtype nodes can only wave like plants + ^ allfaces_optional drawtype nodes can only wave like leaves --]] sounds = { footstep = , dig = , -- "__group" = group-based sound (default) -- cgit v1.2.3 From 7f4cdbcbe9b5b4655c2c5eba2043628487668e24 Mon Sep 17 00:00:00 2001 From: you Date: Fri, 28 Apr 2017 20:12:28 +0200 Subject: Fix click-digging torches (#5652) Torches are dug instantly again. When the digging time is 0, a delay of 0.15 seconds is added between digging nodes. If the left mouse button is released, the delay is set to 0, thus click-digging. --- doc/lua_api.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 603619ab0..eba8a5fef 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1230,9 +1230,9 @@ Another example: Make red wool from white wool and red dye: from destroyed nodes. * `0` is something that is directly accessible at the start of gameplay * There is no upper limit -* `dig_immediate`: (player can always pick up node without tool wear) - * `2`: node is removed without tool wear after 0.5 seconds (rail, sign) - * `3`: node is removed without tool wear after 0.15 seconds (torch) +* `dig_immediate`: (player can always pick up node without reducing tool wear) + * `2`: the node always gets the digging time 0.5 seconds (rail, sign) + * `3`: the node always gets the digging time 0 seconds (torch) * `disable_jump`: Player (and possibly other things) cannot jump from node * `fall_damage_add_percent`: damage speed = `speed * (1 + value/100)` * `bouncy`: value is bounce speed in percent @@ -1333,6 +1333,10 @@ 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. +If the result digging time is 0, a delay of 0.15 seconds is added between +digging nodes; If the player releases LMB after digging, this delay is set to 0, +i.e. players can more quickly click the nodes away instead of holding LMB. + #### Damage groups List of damage for groups of entities. See "Entity damage mechanism". @@ -3445,7 +3449,7 @@ will place the schematic inside of the VoxelManip. If `light` is false, no light calculations happen, and you should correct all modified blocks with `minetest.fix_light()` as soon as possible. Keep in mind that modifying the map where light is incorrect can cause - more lighting bugs. + more lighting bugs. * `get_node_at(pos)`: Returns a `MapNode` table of the node currently loaded in the `VoxelManip` at that position * `set_node_at(pos, node)`: Sets a specific `MapNode` in the `VoxelManip` at that position -- cgit v1.2.3 From f1d7a26b7c341b468f34325cec5c3d495f175a8f Mon Sep 17 00:00:00 2001 From: Ben Deutsch Date: Fri, 17 Mar 2017 10:39:47 +0100 Subject: Add clouds API --- doc/lua_api.txt | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index eba8a5fef..479e38a2e 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -3077,6 +3077,15 @@ This is basically a reference to a C++ `ServerActiveObject` * `"skybox"`: Uses 6 textures, `bgcolor` used * `"plain"`: Uses 0 textures, `bgcolor` used * `get_sky()`: returns bgcolor, type and a table with the textures +* `set_clouds(parameters)`: set cloud parameters + * `parameters` is a table with the following optional fields: + * `density`: from `0` (no clouds) to `1` (full clouds) (default `0.4`) + * `color`: basic cloud color, with alpha channel (default `#fff0f0e5`) + * `ambient`: cloud color lower bound, use for a "glow at night" effect (default `#000000`) + * `height`: cloud height, i.e. y of cloud base (default per conf, usually `120`) + * `thickness`: cloud thickness in nodes (default `16`) + * `speed`: 2D cloud speed + direction in nodes per second (default `{x=0, y=-2}`) +* `get_clouds()`: returns a table with the current cloud parameters as in `set_clouds` * `override_day_night_ratio(ratio or nil)` * `0`...`1`: Overrides day-night ratio, controlling sunlight to a specific amount * `nil`: Disables override, defaulting to sunlight based on day-night cycle -- cgit v1.2.3 From bd921a7916f0fafc493b1c4d0eeb5e2bb1d6a7c2 Mon Sep 17 00:00:00 2001 From: Brandon Date: Sun, 10 Jul 2016 00:08:26 -0500 Subject: Sound API: Add fading sounds --- doc/lua_api.txt | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 479e38a2e..77ffb88e2 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -456,11 +456,13 @@ Examples of sound parameter tables: -- Play locationless on all clients { gain = 1.0, -- default + fade = 0.0, -- default, change to a value > 0 to fade the sound in } -- Play locationless to one player { to_player = name, gain = 1.0, -- default + fade = 0.0, -- default, change to a value > 0 to fade the sound in } -- Play locationless to one player, looped { @@ -2587,6 +2589,11 @@ These functions return the leftover itemstack. * `spec` is a `SimpleSoundSpec` * `parameters` is a sound parameter table * `minetest.sound_stop(handle)` +* `minetest.sound_fade(handle, step, gain)` + * `handle` is a handle returned by minetest.sound_play + * `step` determines how fast a sound will fade. + Negative step will lower the sound volume, positive step will increase the sound volume + * `gain` the target gain for the fade. ### Timing * `minetest.after(time, func, ...)` -- cgit v1.2.3 From ad9fcf859ec2347325830e09504ae96968b51ea8 Mon Sep 17 00:00:00 2001 From: paramat Date: Fri, 28 Apr 2017 03:06:49 +0100 Subject: Set sky API: Add bool for clouds in front of custom skybox Default true. Add 'm_clouds_enabled' bool to sky.h, set from new bool in 'set sky' API. Make 'getCloudsVisible()' depend on 'm_clouds_enabled' instead of 'm_visible' (whether normal sky is visible). --- doc/lua_api.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 77ffb88e2..599e02fcb 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -3077,13 +3077,15 @@ This is basically a reference to a C++ `ServerActiveObject` * `hud_set_hotbar_selected_image(texturename)` * sets image for selected item of hotbar * `hud_get_hotbar_selected_image`: returns texturename -* `set_sky(bgcolor, type, {texture names})` +* `set_sky(bgcolor, type, {texture names}, clouds)` * `bgcolor`: ColorSpec, defaults to white - * Available types: + * `type`: Available types: * `"regular"`: Uses 0 textures, `bgcolor` ignored * `"skybox"`: Uses 6 textures, `bgcolor` used * `"plain"`: Uses 0 textures, `bgcolor` used -* `get_sky()`: returns bgcolor, type and a table with the textures + * `clouds`: Boolean for whether clouds appear in front of `"skybox"` or + `"plain"` custom skyboxes (default: `true`) +* `get_sky()`: returns bgcolor, type, table of textures, clouds * `set_clouds(parameters)`: set cloud parameters * `parameters` is a table with the following optional fields: * `density`: from `0` (no clouds) to `1` (full clouds) (default `0.4`) -- cgit v1.2.3 From d6cf5450a897b00e5ed0d053f14108c94dfb3701 Mon Sep 17 00:00:00 2001 From: red-001 Date: Thu, 4 May 2017 21:52:58 +0100 Subject: Add option to also check the center to `find_node_near` (#5255) * Add option to also check the center to `find_node_near` --- doc/lua_api.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 599e02fcb..1550a78be 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2280,9 +2280,11 @@ and `minetest.auth_reload` call the authetification handler. * `minetest.get_gametime()`: returns the time, in seconds, since the world was created * `minetest.get_day_count()`: returns number days elapsed since world was created, * accounting for time changes. -* `minetest.find_node_near(pos, radius, nodenames)`: returns pos or `nil` +* `minetest.find_node_near(pos, radius, nodenames, [search_center])`: returns pos or `nil` * `radius`: using a maximum metric * `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"` + * `search_center` is an optional boolean (default: `false`) + If true `pos` is also checked for the nodes * `minetest.find_nodes_in_area(minp, maxp, nodenames)`: returns a list of positions * returns as second value a table with the count of the individual nodes found * `nodenames`: e.g. `{"ignore", "group:tree"}` or `"default:dirt"` -- cgit v1.2.3 From 43d1f375d18a2fbc547a9b4f23d1354d645856ca Mon Sep 17 00:00:00 2001 From: ShadowNinja Date: Fri, 12 Dec 2014 14:49:19 -0500 Subject: Use a settings object for the main settings This unifies the settings APIs. This also unifies the sync and async registration APIs, since the async registration API did not support adding non-functions to the API table. --- doc/lua_api.txt | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 1550a78be..166cc024a 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -172,8 +172,8 @@ The main Lua script. Running this script should register everything it wants to register. Subsequent execution depends on minetest calling the registered callbacks. -`minetest.setting_get(name)` and `minetest.setting_getbool(name)` can be used -to read custom or existing settings at load time, if necessary. +`minetest.settings` can be used to read custom or existing settings at load +time, if necessary. (See `Settings`) ### `models` Models for entities or meshnodes. @@ -2177,16 +2177,10 @@ Call these functions only at load time! * See `minetest.builtin_auth_handler` in `builtin.lua` for reference ### Setting-related -* `minetest.setting_set(name, value)` - * Setting names can't contain whitespace or any of `="{}#`. - * Setting values can't contain the sequence `\n"""`. - * Setting names starting with "secure." can't be set. -* `minetest.setting_get(name)`: returns string or `nil` -* `minetest.setting_setbool(name, value)` - * See documentation on `setting_set` for restrictions. -* `minetest.setting_getbool(name)`: returns boolean or `nil` -* `minetest.setting_get_pos(name)`: returns position or nil -* `minetest.setting_save()`, returns `nil`, save all settings to config file +* `minetest.settings`: Settings object containing all of the settings from the + main config file (`minetest.conf`). +* `minetest.setting_get_pos(name)`: Loads a setting from the main settings and + parses it as a position (in the format `(1,2,3)`). Returns a position or nil. ### Authentication * `minetest.notify_authentication_modified(name)` @@ -3536,10 +3530,15 @@ It can be created via `Settings(filename)`. * `get(key)`: returns a value * `get_bool(key)`: returns a boolean * `set(key, value)` + * Setting names can't contain whitespace or any of `="{}#`. + * Setting values can't contain the sequence `\n"""`. + * Setting names starting with "secure." can't be set on the main settings object (`minetest.settings`). +* `set_bool(key, value)` + * See documentation for set() above. * `remove(key)`: returns a boolean (`true` for success) * `get_names()`: returns `{key1,...}` * `write()`: returns a boolean (`true` for success) - * write changes to file + * Writes changes to file. * `to_table()`: returns `{[key1]=value1,...}` Mapgen objects -- cgit v1.2.3 From b6f4a9c7e1a4f0bac66fd6f6ff844425ac775975 Mon Sep 17 00:00:00 2001 From: TeTpaAka Date: Fri, 29 May 2015 20:30:55 +0200 Subject: Make the player collisionbox settable --- doc/lua_api.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 166cc024a..1f8abd70c 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -3705,7 +3705,8 @@ Definition tables collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5}, visual = "cube"/"sprite"/"upright_sprite"/"mesh"/"wielditem", visual_size = {x=1, y=1}, - mesh = "model", + mesh = "model", -- for players (0, -1, 0) is ground level, + -- for all other entities (0, 0, 0) is ground level. textures = {}, -- number of required textures depends on visual colors = {}, -- number of required colors depends on visual spritediv = {x=1, y=1}, -- cgit v1.2.3 From 2d5bd7f414f8b8107254490af2360d6e29f1a8d2 Mon Sep 17 00:00:00 2001 From: paramat Date: Sun, 7 May 2017 01:48:42 +0100 Subject: Player properties: Set correct default collisionbox Recent commit b6f4a9c7e1a4f0bac66fd6f6ff844425ac775975 removed a hardcoded player collisionbox which resulted on falling back to an incorrect default. This stopped players walking through 2-node high spaces and made the player slightly wider. Improve docs for custom player collisionbox feature and reformat nearby lines. --- doc/lua_api.txt | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 1f8abd70c..607a13fdd 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -3700,25 +3700,29 @@ Definition tables { hp_max = 1, physical = true, - collide_with_objects = true, -- collide with other objects if physical=true + collide_with_objects = true, -- collide with other objects if physical = true weight = 5, - collisionbox = {-0.5,-0.5,-0.5, 0.5,0.5,0.5}, - visual = "cube"/"sprite"/"upright_sprite"/"mesh"/"wielditem", - visual_size = {x=1, y=1}, - mesh = "model", -- for players (0, -1, 0) is ground level, - -- for all other entities (0, 0, 0) is ground level. + collisionbox = {-0.5, 0.0, -0.5, 0.5, 1.0, 0.5}, + -- ^ For players (0, -1, 0) is at object base level, + -- for all other objects (0, 0, 0) is at object base level. + -- For example, Minetest Game player box is (-0.3, -1.0, -0.3, 0.3, 0.75, 0.3). + visual = "cube" / "sprite" / "upright_sprite" / "mesh" / "wielditem", + visual_size = {x = 1, y = 1}, + mesh = "model", textures = {}, -- number of required textures depends on visual colors = {}, -- number of required colors depends on visual - spritediv = {x=1, y=1}, - initial_sprite_basepos = {x=0, y=0}, + spritediv = {x = 1, y = 1}, + initial_sprite_basepos = {x = 0, y = 0}, is_visible = true, makes_footstep_sound = false, automatic_rotate = false, stepheight = 0, automatic_face_movement_dir = 0.0, - -- ^ automatically set yaw to movement direction; offset in degrees; false to disable + -- ^ Automatically set yaw to movement direction, offset in degrees, + -- 'false' to disable. automatic_face_movement_max_rotation_per_sec = -1, - -- ^ limit automatic rotation to this value in degrees per second. values < 0 no limit + -- ^ Limit automatic rotation to this value in degrees per second, + -- value < 0 no limit. backface_culling = true, -- false to disable backface_culling for model nametag = "", -- by default empty, for players their name is shown if empty nametag_color = , -- sets color of nametag as ColorSpec -- cgit v1.2.3 From c1b3ed4180dea16e2fa77663a7d2bf155595dd60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Blot?= Date: Sun, 7 May 2017 12:13:15 +0200 Subject: Player attrs: permits to remove an attribute by setting value to nil (#5716) * Player attrs: permits to remove an attribute by setting value to nil When doing player:set_attribute("attr", nil) remove attribute Also remove a useless check on C++ API part (already done by checkplayer) Fix #5709 --- doc/lua_api.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 607a13fdd..d8e297f4c 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -3028,7 +3028,9 @@ This is basically a reference to a C++ `ServerActiveObject` * `0`: player is drowning, * `1`-`10`: remaining number of bubbles * `11`: bubbles bar is not shown -* `set_attribute(attribute, value)`: sets an extra attribute with value on player +* `set_attribute(attribute, value)`: + * Sets an extra attribute with value on player. + * If value is nil, remove attribute from player. * `get_attribute(attribute)`: returns value for extra attribute. Returns nil if no attribute found. * `set_inventory_formspec(formspec)` * Redefine player's inventory form -- cgit v1.2.3 From da88a186766020762f5c86bc6ba1624e4feaae2c Mon Sep 17 00:00:00 2001 From: paramat Date: Tue, 9 May 2017 01:59:02 +0100 Subject: Revert custom player collision box and step height commits These caused inability to pass through 2 node high spaces or step up onto slabs or steps when a new client connected to an older server. --- doc/lua_api.txt | 3 --- 1 file changed, 3 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index d8e297f4c..901dd3c46 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -3705,9 +3705,6 @@ Definition tables collide_with_objects = true, -- collide with other objects if physical = true weight = 5, collisionbox = {-0.5, 0.0, -0.5, 0.5, 1.0, 0.5}, - -- ^ For players (0, -1, 0) is at object base level, - -- for all other objects (0, 0, 0) is at object base level. - -- For example, Minetest Game player box is (-0.3, -1.0, -0.3, 0.3, 0.75, 0.3). visual = "cube" / "sprite" / "upright_sprite" / "mesh" / "wielditem", visual_size = {x = 1, y = 1}, mesh = "model", -- cgit v1.2.3 From 071e114ffa945522a7a9acc3259427166992d5ee Mon Sep 17 00:00:00 2001 From: sfan5 Date: Wed, 10 May 2017 15:29:21 +0200 Subject: Private nodemeta (#5702) * Private node metadata that isn't sent to the client --- doc/lua_api.txt | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 901dd3c46..a295d7d0e 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -2895,6 +2895,10 @@ Can be obtained via `minetest.get_meta(pos)`. #### Methods * All methods in MetaDataRef * `get_inventory()`: returns `InvRef` +* `mark_as_private(name or {name1, name2, ...})`: Mark specific vars as private + This will prevent them from being sent to the client. Note that the "private" + status will only be remembered if an associated key-value pair exists, meaning + it's best to call this when initializing all other meta (e.g. on_construct). ### `ItemStackMetaRef` ItemStack metadata: reference extra data and functionality stored in a stack. -- cgit v1.2.3 From f286c54908e007e4861428f98017a156531fe3f0 Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Fri, 12 May 2017 10:27:58 +0100 Subject: Replace inconsistent mentions of core.* with minetest.* (#5749) --- doc/lua_api.txt | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index a295d7d0e..4e2ec00c3 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1872,14 +1872,14 @@ Escape sequences Most text can contain escape sequences, that can for example color the text. There are a few exceptions: tab headers, dropdowns and vertical labels can't. The following functions provide escape sequences: -* `core.get_color_escape_sequence(color)`: +* `minetest.get_color_escape_sequence(color)`: * `color` is a ColorString * The escape sequence sets the text color to `color` -* `core.colorize(color, message)`: +* `minetest.colorize(color, message)`: * Equivalent to: - `core.get_color_escape_sequence(color) .. + `minetest.get_color_escape_sequence(color) .. message .. - core.get_color_escape_sequence("#ffffff")` + minetest.get_color_escape_sequence("#ffffff")` * `color.get_background_escape_sequence(color)` * `color` is a ColorString * The escape sequence sets the background of the whole text element to @@ -2026,7 +2026,7 @@ Helper functions reliable or verifyable. Compatible forks will have a different name and version entirely. To check for the presence of engine features, test whether the functions exported by the wanted features exist. For example: - `if core.nodeupdate then ... end`. + `if minetest.nodeupdate then ... end`. ### Logging * `minetest.debug(...)` @@ -2359,8 +2359,8 @@ and `minetest.auth_reload` call the authetification handler. * `function EmergeAreaCallback(blockpos, action, calls_remaining, param)` * - `blockpos` is the *block* coordinates of the block that had been emerged * - `action` could be one of the following constant values: - * `core.EMERGE_CANCELLED`, `core.EMERGE_ERRORED`, `core.EMERGE_FROM_MEMORY`, - * `core.EMERGE_FROM_DISK`, `core.EMERGE_GENERATED` + * `minetest.EMERGE_CANCELLED`, `minetest.EMERGE_ERRORED`, `minetest.EMERGE_FROM_MEMORY`, + * `minetest.EMERGE_FROM_DISK`, `minetest.EMERGE_GENERATED` * - `calls_remaining` is the number of callbacks to be expected after this one * - `param` is the user-defined parameter passed to emerge_area (or nil if the * parameter was absent) @@ -2415,11 +2415,11 @@ and `minetest.auth_reload` call the authetification handler. might be removed. * returns `false` if the area is not fully generated, `true` otherwise -* `core.check_single_for_falling(pos)` +* `minetest.check_single_for_falling(pos)` * causes an unsupported `group:falling_node` node to fall and causes an unattached `group:attached_node` node to fall. * does not spread these updates to neighbours. -* `core.check_for_falling(pos)` +* `minetest.check_for_falling(pos)` * causes an unsupported `group:falling_node` node to fall and causes an unattached `group:attached_node` node to fall. * spread these updates to neighbours and can cause a cascade @@ -3408,9 +3408,9 @@ Note that the node being queried needs to have already been been registered. The following builtin node types have their Content IDs defined as constants: ``` -core.CONTENT_UNKNOWN (ID for "unknown" nodes) -core.CONTENT_AIR (ID for "air" nodes) -core.CONTENT_IGNORE (ID for "ignore" nodes) +minetest.CONTENT_UNKNOWN (ID for "unknown" nodes) +minetest.CONTENT_AIR (ID for "air" nodes) +minetest.CONTENT_IGNORE (ID for "ignore" nodes) ``` ##### Mapgen VoxelManip objects -- cgit v1.2.3 From 0120fe16a761f9e06c8c2877439db6a46d808143 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sat, 13 May 2017 13:14:41 +0200 Subject: CSM: Document forgotten functions --- doc/lua_api.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 4e2ec00c3..762446466 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1931,7 +1931,10 @@ Helper functions * e.g. `string:split("a,b", ",") == {"a","b"}` * `string:trim()` * e.g. `string.trim("\n \t\tfoo bar\t ") == "foo bar"` -* `minetest.pos_to_string({x=X,y=Y,z=Z}, decimal_places))`: returns `"(X,Y,Z)"` +* `minetest.wrap_text(str, limit)`: returns a string + * Adds new lines to the string to keep it within the specified character limit + * limit: Maximal amount of characters in one line +* `minetest.pos_to_string({x=X,y=Y,z=Z}, decimal_places))`: returns string `"(X,Y,Z)"` * Convert position to a printable string Optional: 'decimal_places' will round the x, y and z of the pos to the given decimal place. * `minetest.string_to_pos(string)`: returns a position -- cgit v1.2.3 From 30c51a1115539b76aa76091de0adbb083c680b42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Juh=C3=A1sz?= Date: Fri, 2 Jun 2017 13:57:59 +0000 Subject: Document hardware coloring and soft node overlays (#5876) --- doc/lua_api.txt | 161 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index 762446466..e6d856368 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -426,6 +426,167 @@ Result is more like what you'd expect if you put a color on top of another color. Meaning white surfaces get a lot of your new color while black parts don't change very much. +Hardware coloring +----------------- +The goal of hardware coloring is to simplify the creation of +colorful nodes. If your textures use the same pattern, and they only +differ in their color (like colored wool blocks), you can use hardware +coloring instead of creating and managing many texture files. +All of these methods use color multiplication (so a white-black texture +with red coloring will result in red-black color). + +### Static coloring +This method is useful if you wish to create nodes/items with +the same texture, in different colors, each in a new node/item definition. + +#### Global color +When you register an item or node, set its `color` field (which accepts a +`ColorSpec`) to the desired color. + +An `ItemStack`s static color can be overwritten by the `color` metadata +field. If you set that field to a `ColorString`, that color will be used. + +#### Tile color +Each tile may have an individual static color, which overwrites every +other coloring methods. To disable the coloring of a face, +set its color to white (because multiplying with white does nothing). +You can set the `color` property of the tiles in the node's definition +if the tile is in table format. + +### Palettes +For nodes and items which can have many colors, a palette is more +suitable. A palette is a texture, which can contain up to 256 pixels. +Each pixel is one possible color for the node/item. +You can register one node/item, which can have up to 256 colors. + +#### Palette indexing +When using palettes, you always provide a pixel index for the given +node or `ItemStack`. The palette is read from left to right and from +top to bottom. If the palette has less than 256 pixels, then it is +stretched to contain exactly 256 pixels (after arranging the pixels +to one line). The indexing starts from 0. + +Examples: +* 16x16 palette, index = 0: the top left corner +* 16x16 palette, index = 4: the fifth pixel in the first row +* 16x16 palette, index = 16: the pixel below the top left corner +* 16x16 palette, index = 255: the bottom right corner +* 2 (width)x4 (height) palette, index=31: the top left corner. + The palette has 8 pixels, so each pixel is stretched to 32 pixels, + to ensure the total 256 pixels. +* 2x4 palette, index=32: the top right corner +* 2x4 palette, index=63: the top right corner +* 2x4 palette, index=64: the pixel below the top left corner + +#### Using palettes with items +When registering an item, set the item definition's `palette` field to +a texture. You can also use texture modifiers. + +The `ItemStack`'s color depends on the `palette_index` field of the +stack's metadata. `palette_index` is an integer, which specifies the +index of the pixel to use. + +#### Linking palettes with nodes +When registering a node, set the item definition's `palette` field to +a texture. You can also use texture modifiers. +The node's color depends on its `param2`, so you also must set an +appropriate `drawtype`: +* `drawtype = "color"` for nodes which use their full `param2` for + palette indexing. These nodes can have 256 different colors. + The palette should contain 256 pixels. +* `drawtype = "colorwallmounted"` for nodes which use the first + five bits (most significant) of `param2` for palette indexing. + The remaining three bits are describing rotation, as in `wallmounted` + draw type. Division by 8 yields the palette index (without stretching the + palette). These nodes can have 32 different colors, and the palette + should contain 32 pixels. + Examples: + * `param2 = 17` is 2 * 8 + 1, so the rotation is 1 and the third (= 2 + 1) + pixel will be picked from the palette. + * `param2 = 35` is 4 * 8 + 3, so the rotation is 3 and the fifth (= 4 + 1) + pixel will be picked from the palette. +* `drawtype = "colorfacedir"` for nodes which use the first + three bits of `param2` for palette indexing. The remaining + five bits are describing rotation, as in `facedir` draw type. + Division by 32 yields the palette index (without stretching the + palette). These nodes can have 8 different colors, and the + palette should contain 8 pixels. + Examples: + * `param2 = 17` is 0 * 32 + 17, so the rotation is 17 and the + first (= 0 + 1) pixel will be picked from the palette. + * `param2 = 35` is 1 * 32 + 3, so the rotation is 3 and the + second (= 1 + 1) pixel will be picked from the palette. + +To colorize a node on the map, set its `param2` value (according +to the node's draw type). + +### Conversion between nodes in the inventory and the on the map +Static coloring is the same for both cases, there is no need +for conversion. + +If the `ItemStack`'s metadata contains the `color` field, it will be +lost on placement, because nodes on the map can only use palettes. + +If the `ItemStack`'s metadata contains the `palette_index` field, you +currently must manually convert between it and the node's `param2` with +custom `on_place` and `on_dig` callbacks. + +### Colored items in craft recipes +Craft recipes only support item strings, but fortunately item strings +can also contain metadata. Example craft recipe registration: + + local stack = ItemStack("wool:block") + dyed:get_meta():set_int("palette_index", 3) -- add index + minetest.register_craft({ + output = dyed:to_string(), -- convert to string + type = "shapeless", + recipe = { + "wool:block", + "dye:red", + }, + }) + +Metadata field filtering in the `recipe` field are not supported yet, +so the craft output is independent of the color of the ingredients. + +Soft texture overlay +-------------------- +Sometimes hardware coloring is not enough, because it affects the +whole tile. Soft texture overlays were added to Minetest to allow +the dynamic coloring of only specific parts of the node's texture. +For example a grass block may have colored grass, while keeping the +dirt brown. + +These overlays are 'soft', because unlike texture modifiers, the layers +are not merged in the memory, but they are simply drawn on top of each +other. This allows different hardware coloring, but also means that +tiles with overlays are drawn slower. Using too much overlays might +cause FPS loss. + +To define an overlay, simply set the `overlay_tiles` field of the node +definition. These tiles are defined in the same way as plain tiles: +they can have a texture name, color etc. +To skip one face, set that overlay tile to an empty string. + +Example (colored grass block): + + minetest.register_node("default:dirt_with_grass", { + description = "Dirt with Grass", + -- Regular tiles, as usual + -- The dirt tile disables palette coloring + tiles = {{name = "default_grass.png"}, + {name = "default_dirt.png", color = "white"}}, + -- Overlay tiles: define them in the same style + -- The top and bottom tile does not have overlay + overlay_tiles = {"", "", + {name = "default_grass_side.png", tileable_vertical = false}}, + -- Global color, used in inventory + color = "green", + -- Palette in the world + paramtype2 = "color", + palette = "default_foilage.png", + }) + Sounds ------ Only Ogg Vorbis files are supported. -- cgit v1.2.3 From 1b83b0acfde26e1689202bb99659934ed598d705 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 2 Jun 2017 14:15:49 +0200 Subject: Lua_api.txt: Various edits and Markdown syntax improvements Add minor bits of missing Lua API documentation. Remove L-system lighting bug warning. Clarify 2 lines in node timer documentation. Fix many Markdown syntax errors in lua_api.txt. --- doc/lua_api.txt | 255 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 137 insertions(+), 118 deletions(-) (limited to 'doc/lua_api.txt') diff --git a/doc/lua_api.txt b/doc/lua_api.txt index e6d856368..e4ffa7bbe 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -186,7 +186,11 @@ Naming convention for registered textual names ---------------------------------------------- Registered names should generally be in this format: - "modname:" ( can have characters a-zA-Z0-9_) + `modname:` + +`` can have these characters: + + a-zA-Z0-9_ This is to prevent conflicting names from corrupting maps and is enforced by the mod loader. @@ -209,7 +213,7 @@ The `:` prefix can also be used for maintaining backwards compatibility. ### Aliases Aliases can be added by using `minetest.register_alias(name, convert_to)` or -`minetest.register_alias_force(name, convert_to). +`minetest.register_alias_force(name, convert_to)`. This will make Minetest to convert things called name to things called `convert_to`. @@ -309,10 +313,10 @@ Example: default_sandstone.png^[resize:16x16 #### `[opacity:` - Makes the base image transparent according to the given ratio. - r must be between 0 and 255. - 0 means totally transparent. - 255 means totally opaque. +Makes the base image transparent according to the given ratio. + +`r` must be between 0 and 255. +0 means totally transparent. 255 means totally opaque. Example: @@ -676,7 +680,7 @@ the global `minetest.registered_*` tables. * `minetest.unregister_item(name)` * Unregisters the item name from engine, and deletes the entry with key * `name` from `minetest.registered_items` and from the associated item - * table according to its nature: minetest.registered_nodes[] etc + * table according to its nature: `minetest.registered_nodes[]` etc * `minetest.register_biome(biome definition)` * returns an integer uniquely identifying the registered biome @@ -754,9 +758,9 @@ They are represented by a table: {name="name", param1=num, param2=num} -`param1` and `param2` are 8-bit integers. The engine uses them for certain -automated functions. If you don't use these functions, you can use them to -store arbitrary values. +`param1` and `param2` are 8-bit integers ranging from 0 to 255. The engine uses +them for certain automated functions. If you don't use these functions, you can +use them to store arbitrary values. The functions of `param1` and `param2` are determined by certain fields in the node definition: @@ -825,15 +829,6 @@ node definition: ^ Only valid for "glasslike_framed" or "glasslike_framed_optional" drawtypes. param2 defines 64 levels of internal liquid. Liquid texture is defined using `special_tiles = {"modname_tilename.png"},` - collision_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, - }, - }, - ^ defines list of collision boxes for the node. If empty, collision boxes - will be the same as nodeboxes, in case of any other nodes will be full cube - as in the example above. Nodes can also contain extra data. See "Node Metadata". @@ -984,6 +979,7 @@ If no flags are specified (or defaults is), 2D noise is eased and 3D noise is no Accumulates the absolute value of each noise gradient result. Noise parameters format example for 2D or 3D perlin noise or perlin noise maps: + np_terrain = { offset = 0, scale = 1, @@ -994,8 +990,8 @@ Noise parameters format example for 2D or 3D perlin noise or perlin noise maps: lacunarity = 2.0, flags = "defaults, absvalue" } - ^ A single noise parameter table can be used to get 2D or 3D noise, - when getting 2D noise spread.z is ignored. + ^ A single noise parameter table can be used to get 2D or 3D noise, + when getting 2D noise spread.z is ignored. Ore types @@ -1067,14 +1063,15 @@ to small changes. The following is a decent set of parameters to work from: }, noise_threshold = 1.6 -WARNING: Use this ore type *very* sparingly since it is ~200x more +**WARNING**: Use this ore type *very* sparingly since it is ~200x more computationally expensive than any other ore. Ore attributes -------------- See section "Flag Specifier Format". -Currently supported flags: `absheight` +Currently supported flags: +`absheight`, `puff_cliffs`, `puff_additive_composition`. ### `absheight` Also produce this same ore between the height range of `-y_max` and `-y_min`. @@ -1130,6 +1127,7 @@ in the form of a table. This table specifies the following fields: previous contents (default: false) About probability values: + * A probability value of `0` or `1` means that node will never appear (0% chance). * A probability value of `254` or `255` means the node will always appear (100% chance). * If the probability value `p` is greater than `1`, then there is a @@ -1284,16 +1282,32 @@ There are three kinds of items: nodes, tools and craftitems. things according to `tool_capabilities`. * Craftitem (`register_craftitem`): A miscellaneous item. +### Amount and wear +All item stacks have an amount between 0 to 65535. It is 1 by +default. Tool item stacks can not have an amount greater than 1. + +Tools use a wear (=damage) value ranging from 0 to 65535. The +value 0 is the default and used is for unworn tools. The values +1 to 65535 are used for worn tools, where a higher value stands for +a higher wear. Non-tools always have a wear value of 0. + ### Item formats Items and item stacks can exist in three formats: Serializes, table format and `ItemStack`. #### Serialized -This is called "stackstring" or "itemstring": +This is called "stackstring" or "itemstring". It is a simple string with +1-3 components: the full item identifier, an optional amount and an optional +wear value. Syntax: + + [[ ]] -* e.g. `'default:dirt 5'` -* e.g. `'default:pick_wood 21323'` -* e.g. `'default:apple'` +Examples: + +* `'default:apple'`: 1 apple +* `'default:dirt 5'`: 5 dirt +* `'default:pick_stone'`: a new stone pickaxe +* `'default:pick_wood 1 21323'`: a wooden pickaxe, ca. 1/3 worn out #### Table format Examples: @@ -1387,6 +1401,9 @@ Another example: Make red wool from white wool and red dye: ### Special groups * `immortal`: Disables the group damage system for an entity +* `punch_operable`: For entities; disables the regular damage mechanism for + players punching it by hand or a non-tool item, so that it can do something + else than take damage. * `level`: Can be used to give an additional sense of progression in the game. * 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 @@ -1425,6 +1442,7 @@ Another example: Make red wool from white wool and red dye: ### Examples of custom groups Item groups are often used for defining, well, _groups of items_. + * `meat`: any meat-kind of a thing (rating might define the size or healing ability or be irrelevant -- it is not defined as of yet) * `eatable`: anything that can be eaten. Rating might define HP gain in half @@ -1645,7 +1663,7 @@ Item metadata only contains a key-value store. Some of the values in the key-value store are handled specially: -* `description`: Set the itemstack's description. Defaults to idef.description +* `description`: Set the item stack's description. Defaults to `idef.description` * `color`: A `ColorString`, which sets the stack's color. * `palette_index`: If the item has a palette, this is used to get the current color from the palette. @@ -1707,7 +1725,7 @@ examples. #### `container[,]` * Start of a container block, moves all physical elements in the container by (X, Y) -* Must have matching container_end +* Must have matching `container_end` * Containers can be nested, in which case the offsets are added (child containers are relative to parent containers) @@ -1792,7 +1810,7 @@ examples. #### `field[,;,;;