From ce32a327ff6e4e6810a9377e67eaeb47940b7c4c Mon Sep 17 00:00:00 2001 From: Paul Ouellette Date: Tue, 11 Dec 2018 11:37:06 -0500 Subject: [PATCH] lua_api.txt: Various fixes and improvements (#7945) * Add missing tables of registered things * Eliminate some duplication Registration functions in 'Registered definitions' section merged into 'Registration functions' section. * Misc. fixes * Add privilege definition table * Remove not-special soil group from special groups * Merge two registration functions sections * Move 'added to' information to tables section Also fix some capitalization and missing periods * Minor fixes * Split Registration functions into two subsections And update Registered definition tables to match order * Fixes --- doc/lua_api.txt | 252 +++++++++++++++++++++++++----------------------- 1 file changed, 132 insertions(+), 120 deletions(-) diff --git a/doc/lua_api.txt b/doc/lua_api.txt index dc87eee0..e845d8f2 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -859,74 +859,19 @@ one player using `to_player = name,` Registered definitions ====================== -Anything added using certain `minetest.register_*` functions gets added to -the global `minetest.registered_*` tables. - -* `minetest.register_entity(name, entity definition)` - * added to `minetest.registered_entities[name]` - -* `minetest.register_node(name, node definition)` - * added to `minetest.registered_items[name]` - * added to `minetest.registered_nodes[name]` - -* `minetest.register_tool(name, item definition)` - * added to `minetest.registered_items[name]` - -* `minetest.register_craftitem(name, item definition)` - * added to `minetest.registered_items[name]` - -* `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 - -* `minetest.register_biome(biome definition)` - * returns an integer uniquely identifying the registered biome - * added to `minetest.registered_biome` with the key of `biome.name` - * if `biome.name` is nil, the key is the returned ID - -* `minetest.unregister_biome(name)` - * Unregisters the biome name from engine, and deletes the entry with key - `name` from `minetest.registered_biome` - -* `minetest.register_ore(ore definition)` - * returns an integer uniquely identifying the registered ore - * added to `minetest.registered_ores` with the key of `ore.name` - * if `ore.name` is nil, the key is the returned ID - -* `minetest.register_decoration(decoration definition)` - * returns an integer uniquely identifying the registered decoration - * added to `minetest.registered_decorations` with the key of - `decoration.name`. - * if `decoration.name` is nil, the key is the returned ID - -* `minetest.register_schematic(schematic definition)` - * returns an integer uniquely identifying the registered schematic - * added to `minetest.registered_schematic` with the key of `schematic.name` - * if `schematic.name` is nil, the key is the returned ID - * if the schematic is loaded from a file, schematic.name is set to the - filename. - * if the function is called when loading the mod, and schematic.name is a - relative path, then the current mod path will be prepended to the - schematic filename. - -* `minetest.clear_registered_biomes()` - * clears all biomes currently registered - -* `minetest.clear_registered_ores()` - * clears all ores currently registered - -* `minetest.clear_registered_decorations()` - * clears all decorations currently registered - -* `minetest.clear_registered_schematics()` - * clears all schematics currently registered +Anything added using certain [Registration functions] gets added to one or more +of the global [Registered definition tables]. Note that in some cases you will stumble upon things that are not contained in these tables (e.g. when a mod has been removed). Always check for existence before trying to access the fields. -Example: If you want to check the drawtype of a node, you could do: +Example: + +All nodes register with `minetest.register_node` get added to the table +`minetest.registered_nodes`. + +If you want to check the drawtype of a node, you could do: local function get_nodedef_field(nodename, fieldname) if not minetest.registered_nodes[nodename] then @@ -1248,6 +1193,7 @@ Below are the specific uses for fields in each type; fields not listed for that type are ignored. ### `image` + Displays an image on the HUD. * `scale`: The scale of the image, with 1 being the original texture size. @@ -1321,6 +1267,7 @@ For helper functions see [Spatial Vectors]. * `{type="object", ref=ObjectRef}` Exact pointing location (currently only `Raycast` supports these fields): + * `pointed_thing.intersection_point`: The absolute world coordinates of the point on the selection box which is pointed at. May be in the selection box if the pointer is in the box too. @@ -1546,7 +1493,6 @@ Special groups * `attached_node`: if the node under it is not a walkable block the node will be dropped as an item. If the node is wallmounted the wallmounted direction is checked. -* `soil`: saplings will grow on nodes in this group * `connect_to_raillike`: makes nodes of raillike drawtype with same group value connect to each other * `slippery`: Players and items will slide on the node. @@ -1554,7 +1500,6 @@ Special groups * `disable_repair`: If set to 1 for a tool, it cannot be repaired using the `"toolrepair"` crafting recipe - Known damage and digging time defining groups --------------------------------------------- @@ -1985,6 +1930,7 @@ Elements * `` tooltip font color as `ColorString` (optional) ### `tooltip[,;,;;;]` + * Adds tooltip for an area. Other tooltips will take priority when present. * `` tooltip background color as `ColorString` (optional) * `` tooltip font color as `ColorString` (optional) @@ -2097,9 +2043,9 @@ Elements ### `item_image_button[,;,;;;