]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - doc/lua_api.txt
Add wstrgettext to list of translation update keywords
[dragonfireclient.git] / doc / lua_api.txt
index fc8b02e50ebc3de1770c9b2ddfe23ec519295b0a..586c520fc0774de0e8689c173e06d0b562bfca3c 100644 (file)
@@ -337,9 +337,11 @@ Apply a mask to the base image.
 
 The mask is applied using binary AND.
 
-#### `[colorize:<color>`
+#### `[colorize:<color>:<ratio>`
 Colorize the textures with the given color.
 `<color>` is specified as a `ColorString`.
+`<ratio>` is an int ranging from 0 to 255, and specifies how much of the
+color to apply. If ommitted, the alpha will be used.
 
 Sounds
 ------
@@ -416,6 +418,22 @@ the global `minetest.registered_*` tables.
 * `minetest.register_craftitem(name, item definition)`
     * added to `minetest.registered_items[name]`
 
+* `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.clear_registered_ores()`
+   * clears all ores currently registered
+
+* `minetest.clear_registered_decorations()`
+   * clears all decorations currently registered
+
 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.
@@ -467,8 +485,10 @@ node definition:
 `param1` is reserved for the engine when `paramtype != "none"`:
 
     paramtype = "light"
-    ^ The value stores light with and without sun in it's
-      upper and lower 4 bits.
+    ^ The value stores light with and without sun in its upper and lower 4 bits
+      respectively. Allows light to propagate from or through the node with
+      light value falling by 1 per node. This is essential for a light source
+      node to spread its light.
 
 `param2` is reserved for the engine when any of these are used:
 
@@ -1326,7 +1346,8 @@ examples.
 * Position and size units are inventory slots
 * Example for formspec 8x4 in 16x resolution:
   image shall be sized 8 times 16px  times  4 times 16px
-* If `true` the background is clipped to formspec size (`x` and `y` are used as offset values, `w` and `h` are ignored)
+* If `true` the background is clipped to formspec size
+  (`x` and `y` are used as offset values, `w` and `h` are ignored)
 
 #### `pwdfield[<X>,<Y>;<W>,<H>;<name>;<label>]`
 * Textual password style field; will be sent to server when a button is clicked
@@ -1670,6 +1691,9 @@ Call these functions only at load time!
     * Note: Item must already be defined, (opt)depend on the mod defining it.
     * Example: `minetest.override_item("default:mese", {light_source=LIGHT_MAX})`
 
+* `minetest.clear_registered_ores()`
+* `minetest.clear_registered_decorations()`
+
 ### Global callback registration functions
 Call these functions only at load time!
 
@@ -1845,7 +1869,8 @@ and `minetest.auth_reload` call the authetification handler.
     * Function cannot be called after the registration period; only initialization and `on_mapgen_init`
     * Takes a table as an argument with the fields `mgname`, `seed`, `water_level`, and `flags`.
         * Leave field unset to leave that parameter unchanged
-        * `flags` contains a comma-delimited string of flags to set, or if the prefix `"no"` is attached, clears instead.
+        * `flags` contains a comma-delimited string of flags to set,
+          or if the prefix `"no"` is attached, clears instead.
         * `flags` is in the same format and has the same options as `mg_flags` in `minetest.conf`
 * `minetest.set_noiseparams(name, noiseparams, set_default)`
     * Sets the noiseparams setting of `name` to the noiseparams table specified in `noiseparams`.
@@ -1857,6 +1882,8 @@ and `minetest.auth_reload` call the authetification handler.
    * Generate all registered decorations within the VoxelManip specified by `vm`.
 * `minetest.clear_objects()`
     * clear all objects in the environments
+* `minetest.delete_area(pos1, pos2)`
+    * delete all mapblocks in the area from pos1 to pos2, inclusive
 * `minetest.line_of_sight(pos1, pos2, stepsize)`: returns `boolean, pos`
     * Check if there is a direct line of sight between `pos1` and `pos2`
     * Returns the position of the blocking node when `false`
@@ -1934,7 +1961,8 @@ and `minetest.auth_reload` call the authetification handler.
     * Get position of a `pointed_thing` (that you can get from somewhere)
 * `minetest.dir_to_facedir(dir, is6d)`
     * Convert a vector to a facedir value, used in `param2` for `paramtype2="facedir"`;
-    * passing something non-`nil`/`false` for the optional second parameter causes it to take the y component into account
+    * passing something non-`nil`/`false` for the optional second parameter causes it to
+      take the y component into account
 * `minetest.facedir_to_dir(facedir)`
     * Convert a facedir back into a vector aimed directly out the "back" of a node
 * `minetest.dir_to_wallmounted(dir)`
@@ -1983,7 +2011,8 @@ and `minetest.auth_reload` call the authetification handler.
       ground)
 
 ### Rollback
-* `minetest.rollback_get_node_actions(pos, range, seconds, limit)`: returns `{{actor, pos, time, oldnode, newnode}, ...}`
+* `minetest.rollback_get_node_actions(pos, range, seconds, limit)`:
+  returns `{{actor, pos, time, oldnode, newnode}, ...}`
     * Find who has done something to a node, or near a node
     * `actor`: `"player:<name>"`, also `"liquid"`.
 * `minetest.rollback_revert_actions_by(actor, seconds)`: returns `boolean, log_messages`
@@ -2070,8 +2099,8 @@ These functions return the leftover itemstack.
             * If there are two or more entries with the same pos value, the last entry is used.
             * If `pos` is not inside the box formed by `p1` and `p2`, it is ignored.
             * If `probability_list` equals `nil`, no probabilities are applied.
-            * Slice probability works in the same manner, except takes a field called `ypos` instead which indicates
-              the y position of the slice with a probability applied.
+            * Slice probability works in the same manner, except takes a field called `ypos` instead which
+              indicates the y position of the slice with a probability applied.
             * If slice probability list equals `nil`, no slice probabilities are applied.
     * Saves schematic in the Minetest Schematic format to filename.
 
@@ -2193,19 +2222,23 @@ Please note that forceloaded areas are saved when the server restarts.
 
 ### Global tables
 * `minetest.registered_items`
-    * List of registered items, indexed by name
+    * Map of registered items, indexed by name
 * `minetest.registered_nodes`
-    * List of registered node definitions, indexed by name
+    * Map of registered node definitions, indexed by name
 * `minetest.registered_craftitems`
-    * List of registered craft item definitions, indexed by name
+    * Map of registered craft item definitions, indexed by name
 * `minetest.registered_tools`
-    * List of registered tool definitions, indexed by name
+    * Map of registered tool definitions, indexed by name
 * `minetest.registered_entities`
-    * List of registered entity prototypes, indexed by name
+    * Map of registered entity prototypes, indexed by name
 * `minetest.object_refs`
-    * List of object references, indexed by active object id
+    * Map of object references, indexed by active object id
 * `minetest.luaentities`
-    * List of Lua entities, indexed by active object id
+    * Map of Lua entities, indexed by active object id
+* `minetest.registered_ores`
+    * List of registered ore definitions.
+* `minetest.registered_decorations`
+    * List of registered decoration definitions.
 
 Class reference
 ---------------
@@ -2359,7 +2392,8 @@ This is basically a reference to a C++ `ServerActiveObject`
 * `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
-* `set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, frame_speed=30)`: set animation for player model in third person view
+* `set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, frame_speed=30)`:
+  set animation for player model in third person view
     * stand/idle animation key frames
     * walk animation key frames
     * dig animation key frames
@@ -2474,7 +2508,8 @@ for 2D noise, and it must be must be larger than 1 for 3D noise (otherwise
   with values starting at `pos={x=,y=}`
 * `get3dMap(pos)`: returns a `<size.x>` times `<size.y>` times `<size.z>` 3D array
   of 3D noise with values starting at `pos={x=,y=,z=}`
-* `get2dMap_flat(pos)`: returns a flat `<size.x * size.y>` element array of 2D noise with values starting at `pos={x=,y=}`
+* `get2dMap_flat(pos)`: returns a flat `<size.x * size.y>` element array of 2D noise
+  with values starting at `pos={x=,y=}`
 * `get3dMap_flat(pos)`: Same as `get2dMap_flat`, but 3D noise
 
 ### `VoxelManip`
@@ -2849,7 +2884,9 @@ Definition tables
         alpha = 255,
         use_texture_alpha = false, -- Use texture's alpha channel
         post_effect_color = {a=0, r=0, g=0, b=0}, -- If player is inside node
-        paramtype = "none", -- See "Nodes"
+        paramtype = "none", -- See "Nodes" --[[
+        ^ paramtype = "light" allows light to propagate from or through the node with light value
+        ^ falling by 1 per node. This line is essential for a light source node to spread its light. ]]
         paramtype2 = "none", -- See "Nodes"
         is_ground_content = true, -- If false, the cave generator will not carve through this
         sunlight_propagates = false, -- If true, sunlight will go infinitely through this
@@ -2863,15 +2900,17 @@ Definition tables
         liquid_alternative_source = "", -- Source version of flowing liquid
         liquid_viscosity = 0, -- Higher viscosity = slower flow (max. 7)
         liquid_renewable = true, -- Can new liquid source be created by placing two or more sources nearby?
-        leveled = 0, -- Block contain level in param2. value - default level, used for snow. Don't forget use "leveled" type nodebox
+        leveled = 0, --[[
+        ^ Block contains level in param2. Value is default level, used for snow.
+        ^ Don't forget to use "leveled" type nodebox. ]]
         liquid_range = 8, -- number of flowing nodes around source (max. 8)
         drowning = 0, -- Player will take this amount of damage if no bubbles are left
         light_source = 0, -- Amount of light emitted by node
         damage_per_second = 0, -- If player is inside node, this damage is caused
         node_box = {type="regular"}, -- See "Node boxes"
         mesh = "model",
-        selection_box = {type="regular"}, -- See "Node boxes"
-        ^ If drawtype "nodebox" is used and selection_box is nil, then node_box is used
+        selection_box = {type="regular"}, -- See "Node boxes" --[[
+        ^ 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
         sounds = {
@@ -3222,4 +3261,3 @@ Definition tables
         playername = "singleplayer"
     --  ^ Playername is optional, if specified spawns particle only on the player's client
     }
-