aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorDániel Juhász <juhdanad@gmail.com>2017-06-24 18:58:01 +0200
committerSmallJoker <mk939@ymail.com>2018-06-03 17:31:59 +0200
commit9d40d89d2721359b02c578366ebfd0ef1b91116d (patch)
treeea87bf43dd4f5d6758c53b5d33e378ffc8bc5f88 /doc
parent037b01eac7d41de442149ba75a427f8b340b02dd (diff)
downloadminetest-9d40d89d2721359b02c578366ebfd0ef1b91116d.tar.gz
minetest-9d40d89d2721359b02c578366ebfd0ef1b91116d.tar.bz2
minetest-9d40d89d2721359b02c578366ebfd0ef1b91116d.zip
Make dropped items colorable
Diffstat (limited to 'doc')
-rw-r--r--doc/lua_api.txt23
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index edef75593..03c825689 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -536,6 +536,21 @@ automatically transferred between node and item forms by the engine,
when a player digs or places a colored node.
You can disable this feature by setting the `drop` field of the node
to itself (without metadata).
+To transfer the color to a special drop, you need a drop table.
+Example:
+
+ minetest.register_node("mod:stone", {
+ description = "Stone",
+ tiles = {"default_stone.png"},
+ paramtype2 = "color",
+ palette = "palette.png",
+ drop = {
+ items = {
+ -- assume that mod:cobblestone also has the same palette
+ {items = {"mod:cobblestone"}, inherit_color = true },
+ }
+ }
+ })
### Colored items in craft recipes
Craft recipes only support item strings, but fortunately item strings
@@ -2679,6 +2694,13 @@ and `minetest.auth_reload` call the authetification handler.
* Convert a vector into a yaw (angle)
* `minetest.yaw_to_dir(yaw)`
* Convert yaw (angle) to a vector
+* `minetest.is_colored_paramtype(ptype)`
+ * Returns a boolean. Returns `true` if the given `paramtype2` contains color
+ information (`color`, `colorwallmounted` or `colorfacedir`).
+* `minetest.strip_param2_color(param2, paramtype2)`
+ * Removes everything but the color information from the
+ given `param2` value.
+ * Returns `nil` if the given `paramtype2` does not contain color information
* `minetest.get_node_drops(nodename, toolname)`
* Returns list of item names.
* **Note**: This will be removed or modified in a future version.
@@ -4216,6 +4238,7 @@ Definition tables
{
items = {"foo:bar", "baz:frob"}, -- Items to drop.
rarity = 1, -- Probability of dropping is 1 / rarity.
+ inherit_color = true, -- To inherit palette color from the node
},
},
},