X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=doc%2Flua_api.txt;h=352b04cb0d4347bd0387597f2d3003e8bd85aa64;hb=cb00632e23a41d8d171631de9d85e168b251b80e;hp=6d38e14c1ff642c1a3961300e1fb02c31833efd1;hpb=42e1a127140965cac1be6e51e48192e341c2a29e;p=minetest.git
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 6d38e14c1..352b04cb0 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -4,9 +4,8 @@ Minetest Lua Modding API Reference
* More information at
* Developer Wiki:
-
Introduction
-============
+------------
Content and functionality can be added to Minetest using Lua scripting
in run-time loaded mods.
@@ -3528,11 +3527,14 @@ Utilities
-- Chat messages are no longer predicted (0.4.16)
no_chat_message_prediction = true,
-- The transparency channel of textures can optionally be used on
- -- objects (ie: players and lua entities) (5.0)
+ -- objects (ie: players and lua entities) (5.0.0)
object_use_texture_alpha = true,
-- Object selectionbox is settable independently from collisionbox
- -- (5.0)
+ -- (5.0.0)
object_independent_selectionbox = true,
+ -- Specifies whether binary data can be uploaded or downloaded using
+ -- the HTTP API (5.1.0)
+ httpfetch_binary_data = true,
}
* `minetest.has_feature(arg)`: returns `boolean, missing_features`
@@ -3719,6 +3721,7 @@ Call these functions only at load time!
* Called after a new player has been created
* `minetest.register_on_punchplayer(function(player, hitter, time_from_last_punch, tool_capabilities, dir, damage))`
* Called when a player is punched
+ * Note: This callback is invoked even if the punched player is dead.
* `player`: ObjectRef - Player that was punched
* `hitter`: ObjectRef - Player that hit
* `time_from_last_punch`: Meant for disallowing spamming of clicks
@@ -3738,15 +3741,16 @@ Call these functions only at load time!
giving a type - use this for custom damage types.
* `punch`: Was punched. `reason.object` will hold the puncher, or nil if none.
* `fall`
- * `node_damage`: damage_per_second from a neighbouring node.
+ * `node_damage`: `damage_per_second` from a neighbouring node.
+ `reason.node` will hold the node name or nil.
* `drown`
* `respawn`
* Any of the above types may have additional fields from mods.
* `reason.from` will be `mod` or `engine`.
* `modifier`: when true, the function should return the actual `hp_change`.
- Note: modifiers only get a temporary hp_change that can be modified by later modifiers.
- modifiers can return true as a second argument to stop the execution of further functions.
- Non-modifiers receive the final hp change calculated by the modifiers.
+ Note: modifiers only get a temporary `hp_change` that can be modified by later modifiers.
+ Modifiers can return true as a second argument to stop the execution of further functions.
+ Non-modifiers receive the final HP change calculated by the modifiers.
* `minetest.register_on_dieplayer(function(ObjectRef, reason))`
* Called when a player dies
* `reason`: a PlayerHPChangeReason table, see register_on_player_hpchange
@@ -5382,6 +5386,11 @@ This is basically a reference to a C++ `ServerActiveObject`
* in first person view
* in third person view (max. values `{x=-10/10,y=-10,15,z=-5/5}`)
* `get_eye_offset()`: returns `offset_first` and `offset_third`
+* `send_mapblock(blockpos)`:
+ * Sends a server-side loaded mapblock to the player.
+ * Returns `false` if failed.
+ * Resource intensive - use sparsely
+ * To get blockpos, integer divide pos by 16
`PcgRandom`
-----------
@@ -5680,7 +5689,7 @@ Used by `ObjectRef` methods. Part of an Entity definition.
automatic_face_movement_max_rotation_per_sec = -1,
-- Limit automatic rotation to this value in degrees per second.
- -- No limit if value < 0.
+ -- No limit if value <= 0.
backface_culling = true,
-- Set to false to disable backface_culling for model
@@ -6155,17 +6164,44 @@ Used by `minetest.register_node`.
},
drop = "",
- -- Name of dropped node when dug. Default is the node itself.
- -- Alternatively:
+ -- Name of dropped item when dug.
+ -- Default dropped item is the node itself.
+ -- Using a table allows multiple items, drop chances and tool filtering:
drop = {
- -- Maximum number of items to drop
max_items = 1,
- -- Choose max_items randomly from this list
+ -- Maximum number of item lists to drop.
+ -- The entries in 'items' are processed in order. For each:
+ -- Tool filtering is applied, chance of drop is applied, if both are
+ -- successful the entire item list is dropped.
+ -- Entry processing continues until the number of dropped item lists
+ -- equals 'max_items'.
+ -- Therefore, entries should progress from low to high drop chance.
items = {
+ -- Entry examples.
+ {
+ -- 1 in 1000 chance of dropping a diamond.
+ -- Default rarity is '1'.
+ rarity = 1000,
+ items = {"default:diamond"},
+ },
+ {
+ -- Only drop if using a tool whose name is identical to one
+ -- of these.
+ tools = {"default:shovel_mese", "default:shovel_diamond"},
+ rarity = 5,
+ items = {"default:dirt"},
+ -- Whether all items in the dropped item list inherit the
+ -- hardware coloring palette color from the dug node.
+ -- Default is 'false'.
+ inherit_color = true,
+ },
{
- items = {"foo:bar", "baz:frob"}, -- Items to drop
- rarity = 1, -- Probability of dropping is 1 / rarity
- inherit_color = true, -- Inherit palette color from the node
+ -- Only drop if using a tool whose name contains
+ -- "default:shovel_".
+ tools = {"~default:shovel_"},
+ rarity = 2,
+ -- The item list dropped.
+ items = {"default:sand", "default:desert_sand"},
},
},
},
@@ -6477,10 +6513,14 @@ Used by `minetest.register_biome`.
depth_riverbed = 2,
-- Node placed under river water and thickness of this layer
- node_cave_liquid = "default:water_source",
- -- Nodes placed as a blob of liquid in 50% of large caves.
- -- If absent, cave liquids fall back to classic behaviour of lava or
- -- water distributed according to a hardcoded 3D noise.
+ node_cave_liquid = "default:lava_source",
+ node_cave_liquid = {"default:water_source", "default:lava_source"},
+ -- Nodes placed inside 50% of the medium size caves.
+ -- Multiple nodes can be specified, each cave will use a randomly
+ -- chosen node from the list.
+ -- If this field is left out or 'nil', cave liquids fall back to
+ -- classic behaviour of lava and water distributed using 3D noise.
+ -- For no cave liquid, specify "air".
node_dungeon = "default:cobble",
-- Node used for primary dungeon structure.