mirror of
https://github.com/minetest/minetest.git
synced 2024-09-12 00:26:50 +02:00
Do not set a default for description in itemdef table (#10559)
* Do not set a default for description in itemdef table * improve documentation
This commit is contained in:
parent
fca4db4184
commit
be3fe161fc
@ -118,11 +118,9 @@ function core.register_item(name, itemdef)
|
|||||||
end
|
end
|
||||||
itemdef.name = name
|
itemdef.name = name
|
||||||
|
|
||||||
-- default description to item name
|
|
||||||
itemdef.description = itemdef.description or name
|
|
||||||
-- default short_description to first line of description
|
-- default short_description to first line of description
|
||||||
itemdef.short_description = itemdef.short_description or
|
itemdef.short_description = itemdef.short_description or
|
||||||
itemdef.description:gsub("\n.*","")
|
(itemdef.description or ""):gsub("\n.*","")
|
||||||
|
|
||||||
-- Apply defaults and add to registered_* table
|
-- Apply defaults and add to registered_* table
|
||||||
if itemdef.type == "node" then
|
if itemdef.type == "node" then
|
||||||
|
@ -2023,10 +2023,10 @@ Item metadata only contains a key-value store.
|
|||||||
|
|
||||||
Some of the values in the key-value store are handled specially:
|
Some of the values in the key-value store are handled specially:
|
||||||
|
|
||||||
* `description`: Set the item stack's description. Defaults to
|
* `description`: Set the item stack's description.
|
||||||
`idef.description`.
|
See also: `get_description` in [`ItemStack`]
|
||||||
* `short_description`: Set the item stack's short description. Defaults
|
* `short_description`: Set the item stack's short description.
|
||||||
to `idef.short_description`.
|
See also: `get_short_description` in [`ItemStack`]
|
||||||
* `color`: A `ColorString`, which sets the stack's color.
|
* `color`: A `ColorString`, which sets the stack's color.
|
||||||
* `palette_index`: If the item has a palette, this is used to get the
|
* `palette_index`: If the item has a palette, this is used to get the
|
||||||
current color from the palette.
|
current color from the palette.
|
||||||
@ -5983,8 +5983,18 @@ an itemstring, a table or `nil`.
|
|||||||
stack).
|
stack).
|
||||||
* `set_metadata(metadata)`: (DEPRECATED) Returns true.
|
* `set_metadata(metadata)`: (DEPRECATED) Returns true.
|
||||||
* `get_description()`: returns the description shown in inventory list tooltips.
|
* `get_description()`: returns the description shown in inventory list tooltips.
|
||||||
|
* The engine uses the same as this function for item descriptions.
|
||||||
|
* Fields for finding the description, in order:
|
||||||
|
* `description` in item metadata (See [Item Metadata].)
|
||||||
|
* `description` in item definition
|
||||||
|
* item name
|
||||||
* `get_short_description()`: returns the short description.
|
* `get_short_description()`: returns the short description.
|
||||||
* Unlike the description, this does not include new lines.
|
* Unlike the description, this does not include new lines.
|
||||||
|
* The engine uses the same as this function for short item descriptions.
|
||||||
|
* Fields for finding the short description, in order:
|
||||||
|
* `short_description` in item metadata (See [Item Metadata].)
|
||||||
|
* `short_description` in item definition
|
||||||
|
* first line of the description (See `get_description()`.)
|
||||||
* `clear()`: removes all items from the stack, making it empty.
|
* `clear()`: removes all items from the stack, making it empty.
|
||||||
* `replace(item)`: replace the contents of this stack.
|
* `replace(item)`: replace the contents of this stack.
|
||||||
* `item` can also be an itemstring or table.
|
* `item` can also be an itemstring or table.
|
||||||
@ -7085,11 +7095,12 @@ Used by `minetest.register_node`, `minetest.register_craftitem`, and
|
|||||||
{
|
{
|
||||||
description = "Steel Axe",
|
description = "Steel Axe",
|
||||||
-- Can contain new lines. "\n" has to be used as new line character.
|
-- Can contain new lines. "\n" has to be used as new line character.
|
||||||
-- Defaults to the item's name.
|
-- See also: `get_description` in [`ItemStack`]
|
||||||
|
|
||||||
short_description = "Steel Axe",
|
short_description = "Steel Axe",
|
||||||
-- Must not contain new lines.
|
-- Must not contain new lines.
|
||||||
-- Defaults to the first line of description.
|
-- Defaults to the first line of description.
|
||||||
|
-- See also: `get_short_description` in [`ItemStack`]
|
||||||
|
|
||||||
groups = {},
|
groups = {},
|
||||||
-- key = name, value = rating; rating = 1..3.
|
-- key = name, value = rating; rating = 1..3.
|
||||||
|
Loading…
Reference in New Issue
Block a user