diff --git a/doc/en/item-properties.md b/doc/en/item-properties.md index 0240676b..8abcb93c 100644 --- a/doc/en/item-properties.md +++ b/doc/en/item-properties.md @@ -18,6 +18,14 @@ Name of the item model. The model will be loaded automatically. Default value is `packid:itemname.model`. If the model is not specified, an automatic one will be generated. +### Caption and Description +`caption` - name of item in inventory +`description` - item description in inventory + +this props allow to use `md` + +*see [Text Styles](/doc/en/text-styles.md)* + ## Behaviour ### *placing-block* diff --git a/doc/en/scripting/builtins/libitem.md b/doc/en/scripting/builtins/libitem.md index a2d01632..25a7e48f 100644 --- a/doc/en/scripting/builtins/libitem.md +++ b/doc/en/scripting/builtins/libitem.md @@ -10,6 +10,9 @@ item.index(name: str) -> int -- Returns the item display name. block.caption(blockid: int) -> str +-- Returns the item display description. +item.description(itemid: int) -> str + -- Returns max stack size for the item item.stack_size(itemid: int) -> int diff --git a/doc/ru/item-properties.md b/doc/ru/item-properties.md index 68803296..8a75ca72 100644 --- a/doc/ru/item-properties.md +++ b/doc/ru/item-properties.md @@ -17,6 +17,14 @@ Значение по-умолчанию - `packid:itemname.model`. Если модель не указана, будет сгенерирована автоматическию +### Имя и Описание +`caption` - имя предмета в инвентаре +`description` - описание предмета в инвентаре + +Можно использовать `md` + +*см. [Text Styles](/doc/en/text-styles.md)* + ## Поведение ### Устанавливаемый блок - `placing-block` diff --git a/src/content/loading/ItemLoader.cpp b/src/content/loading/ItemLoader.cpp index 6367ccd5..1703b778 100644 --- a/src/content/loading/ItemLoader.cpp +++ b/src/content/loading/ItemLoader.cpp @@ -29,6 +29,7 @@ template<> void ContentUnitLoader::loadUnit( parentDef->cloneTo(def); } root.at("caption").get(def.caption); + root.at("description").get(def.description); std::string iconTypeStr = ""; root.at("icon-type").get(iconTypeStr); diff --git a/src/items/ItemDef.cpp b/src/items/ItemDef.cpp index 8162323b..1d362ebd 100644 --- a/src/items/ItemDef.cpp +++ b/src/items/ItemDef.cpp @@ -8,6 +8,7 @@ ItemDef::ItemDef(const std::string& name) : name(name) { } void ItemDef::cloneTo(ItemDef& dst) { dst.caption = caption; + dst.description = description; dst.stackSize = stackSize; dst.generated = generated; std::copy(&emission[0], &emission[3], dst.emission);