aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuzzy <Wuzzy@disroot.org>2023-03-19 20:25:08 +0100
committerGitHub <noreply@github.com>2023-03-19 20:25:08 +0100
commit09342c0811bb8d035e012a79dce714a6b63722e4 (patch)
treeea0e742ff11260b2678d89db98fb890f574ecc45
parent0050f12b3275fd72cf8a2a4873ee07fdbe79755b (diff)
downloadminetest-09342c0811bb8d035e012a79dce714a6b63722e4.tar.xz
Clarify documentation of inventory actions (#13181)
The text was not clear enough on what these do exactly. It was written in a way that sounded like this allows you to capture ALL inventory changes of the player inventory. However, this is not true: It only captures inventory changes within the player inventory or when the item was exchanged with another inventory.
-rw-r--r--doc/lua_api.txt14
1 files changed, 9 insertions, 5 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 958e88284..a427854c9 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -5370,6 +5370,15 @@ Call these functions only at load time!
* `minetest.register_allow_player_inventory_action(function(player, action, inventory, inventory_info))`
* Determines how much of a stack may be taken, put or moved to a
player inventory.
+ * Function arguments: see `minetest.register_on_player_inventory_action`
+ * Return a numeric value to limit the amount of items to be taken, put or
+ moved. A value of `-1` for `take` will make the source stack infinite.
+* `minetest.register_on_player_inventory_action(function(player, action, inventory, inventory_info))`
+ * Called after an item take, put or move event from/to/in a player inventory
+ * These inventory actions are recognized:
+ * move: Item was moved within the player inventory
+ * put: Item was put into player inventory from another inventory
+ * take: Item was taken from player inventory and put into another inventory
* `player` (type `ObjectRef`) is the player who modified the inventory
`inventory` (type `InvRef`).
* List of possible `action` (string) values and their
@@ -5377,11 +5386,6 @@ Call these functions only at load time!
* `move`: `{from_list=string, to_list=string, from_index=number, to_index=number, count=number}`
* `put`: `{listname=string, index=number, stack=ItemStack}`
* `take`: Same as `put`
- * Return a numeric value to limit the amount of items to be taken, put or
- moved. A value of `-1` for `take` will make the source stack infinite.
-* `minetest.register_on_player_inventory_action(function(player, action, inventory, inventory_info))`
- * Called after a take, put or move event from/to/in a player inventory
- * Function arguments: see `minetest.register_allow_player_inventory_action`
* Does not accept or handle any return value.
* `minetest.register_on_protection_violation(function(pos, name))`
* Called by `builtin` and mods when a player violates protection at a