summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDániel Juhász <juhdanad@gmail.com>2017-06-24 18:15:09 +0000
committerLoïc Blot <nerzhul@users.noreply.github.com>2017-06-24 20:15:09 +0200
commit5a41a98ff6ac899038bfc359912ebb021479451b (patch)
treeb937d7cb348aa198c6b8d666cebf52e736d8ed87 /doc
parentc2df1a08351101034f52fd2810051715714c9c40 (diff)
downloadminetest-5a41a98ff6ac899038bfc359912ebb021479451b.tar.gz
minetest-5a41a98ff6ac899038bfc359912ebb021479451b.tar.bz2
minetest-5a41a98ff6ac899038bfc359912ebb021479451b.zip
Helper methods for hardware colorization (#5870)
Diffstat (limited to 'doc')
-rw-r--r--doc/lua_api.txt21
1 files changed, 18 insertions, 3 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index 664ad960a..540bbe118 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -541,10 +541,8 @@ to itself (without metadata).
Craft recipes only support item strings, but fortunately item strings
can also contain metadata. Example craft recipe registration:
- local stack = ItemStack("wool:block")
- dyed:get_meta():set_int("palette_index", 3) -- add index
minetest.register_craft({
- output = dyed:to_string(), -- convert to string
+ output = minetest.itemstring_with_palette("wool:block", 3),
type = "shapeless",
recipe = {
"wool:block",
@@ -552,6 +550,8 @@ can also contain metadata. Example craft recipe registration:
},
})
+To set the `color` field, you can use `minetest.itemstring_with_color`.
+
Metadata field filtering in the `recipe` field are not supported yet,
so the craft output is independent of the color of the ingredients.
@@ -2728,6 +2728,21 @@ and `minetest.auth_reload` call the authetification handler.
digger's inventory
* Can be overridden to get different functionality (e.g. dropping items on
ground)
+* `minetest.itemstring_with_palette(item, palette_index)`: returns an item string
+ * Creates an item string which contains palette index information
+ for hardware colorization. You can use the returned string
+ as an output in a craft recipe.
+ * `item`: the item stack which becomes colored. Can be in string,
+ table and native form.
+ * `palette_index`: this index is added to the item stack
+* `minetest.itemstring_with_color(item, colorstring)`: returns an item string
+ * Creates an item string which contains static color information
+ for hardware colorization. Use this method if you wish to colorize
+ an item that does not own a palette. You can use the returned string
+ as an output in a craft recipe.
+ * `item`: the item stack which becomes colored. Can be in string,
+ table and native form.
+ * `colorstring`: the new color of the item stack
### Rollback
* `minetest.rollback_get_node_actions(pos, range, seconds, limit)`: