diff options
author | Dániel Juhász <juhdanad@gmail.com> | 2017-03-10 18:25:58 +0100 |
---|---|---|
committer | Auke Kok <sofar@foo-projects.org> | 2017-04-08 18:39:15 -0700 |
commit | 58d83a7bb2f992194c3df304b1dcbb81f98f78c0 (patch) | |
tree | 4beedb69ac8b9b74352ef52c3a1d27004e77bc1d /doc | |
parent | d4e9dd4643607192f5adebeecda86f25074f02cd (diff) | |
download | minetest-58d83a7bb2f992194c3df304b1dcbb81f98f78c0.tar.gz minetest-58d83a7bb2f992194c3df304b1dcbb81f98f78c0.tar.bz2 minetest-58d83a7bb2f992194c3df304b1dcbb81f98f78c0.zip |
Hardware coloring for itemstacks
Adds the possibility to colorize item stacks based on their metadata.
In the item/node definition you can specify palette (an image file)
and color (fallback color if the item has no palette or metadata).
Then you can add palette_index to the metadata.
Dropped itemstacks with different colors do not merge.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/lua_api.txt | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/lua_api.txt b/doc/lua_api.txt index ca1b5d14c..721f5448a 100644 --- a/doc/lua_api.txt +++ b/doc/lua_api.txt @@ -1480,6 +1480,9 @@ Item metadata only contains a key-value store. Some of the values in the key-value store are handled specially: * `description`: Set the itemstack's description. Defaults to idef.description +* `color`: A `ColorString`, which sets the stack's color. +* `palette_index`: If the item has a palette, this is used to get the + current color from the palette. Example stuff: @@ -2855,6 +2858,8 @@ See `StorageRef`, `NodeMetaRef` and `ItemStackMetaRef`. * Any non-table value will clear the metadata * See "Node Metadata" for an example * returns `true` on success +* `equals(other)` + * returns `true` if this metadata has the same key-value pairs as `other` ### `NodeMetaRef` Node metadata: reference extra data and functionality stored in a node. @@ -3735,6 +3740,19 @@ Definition tables {hard = 1, metal = 1, spikes = 1} inventory_image = "default_tool_steelaxe.png", wield_image = "", + palette = "", + --[[ + ^ An image file containing the palette of a node. + ^ You can set the currently used color as the + ^ "palette_index" field of the item stack metadata. + ^ The palette is always stretched to fit indices + ^ between 0 and 255, to ensure compatibility with + ^ "colorfacedir" and "colorwallmounted" nodes. + ]] + color = "0xFFFFFFFF", + --[[ + ^ The color of the item. The palette overrides this. + ]] wield_scale = {x = 1, y = 1, z = 1}, stack_max = 99, range = 4.0, |