aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorWuzzy <Wuzzy@disroot.org>2022-06-03 19:47:04 +0000
committerGitHub <noreply@github.com>2022-06-03 21:47:04 +0200
commit6a6b579c5472065dd4ba8edcebe120b4b1c9198e (patch)
treef9cd6f5fd653e9ad394be96ab0ccac7ba82fb26a /doc
parent6d163b72dc777c6dfc62175c7af231cd62e5c2c7 (diff)
downloadminetest-6a6b579c5472065dd4ba8edcebe120b4b1c9198e.tar.gz
minetest-6a6b579c5472065dd4ba8edcebe120b4b1c9198e.tar.bz2
minetest-6a6b579c5472065dd4ba8edcebe120b4b1c9198e.zip
Add helper functions to make tool usable n times (#12047)
Diffstat (limited to 'doc')
-rw-r--r--doc/lua_api.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 43748dfba..8a8030394 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -3590,6 +3590,12 @@ Helper functions
* `minetest.pointed_thing_to_face_pos(placer, pointed_thing)`: returns a
position.
* returns the exact position on the surface of a pointed node
+* `minetest.get_tool_wear_after_use(uses [, initial_wear])`
+ * Simulates a tool being used once and returns the added wear,
+ such that, if only this function is used to calculate wear,
+ the tool will break exactly after `uses` times of uses
+ * `uses`: Number of times the tool can be used
+ * `initial_wear`: The initial wear the tool starts with (default: 0)
* `minetest.get_dig_params(groups, tool_capabilities [, wear])`:
Simulates an item that digs a node.
Returns a table with the following fields:
@@ -6525,7 +6531,13 @@ an itemstring, a table or `nil`.
or those of the hand if none are defined for this item type
* `add_wear(amount)`
* Increases wear by `amount` if the item is a tool, otherwise does nothing
+ * Valid `amount` range is [0,65536]
* `amount`: number, integer
+* `add_wear_by_uses(max_uses)`
+ * Increases wear in such a way that, if only this function is called,
+ the item breaks after `max_uses` times
+ * Valid `max_uses` range is [0,65536]
+ * Does nothing if item is not a tool or if `max_uses` is 0
* `add_item(item)`: returns leftover `ItemStack`
* Put some item or stack onto this stack
* `item_fits(item)`: returns `true` if item or stack can be fully added to