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
+
Example stuff:
local meta = stack:get_meta()
// Draw tooltip
std::wstring tooltip_text = L"";
if (hovering && !m_selected_item) {
- tooltip_text = utf8_to_wide(item.getDefinition(m_client->idef()).description);
+ const std::string &desc = item.metadata.getString("description");
+ if (desc.empty())
+ tooltip_text =
+ utf8_to_wide(item.getDefinition(m_client->idef()).description);
+ else
+ tooltip_text = utf8_to_wide(desc);
}
if (tooltip_text != L"") {
std::vector<std::wstring> tt_rows = str_split(tooltip_text, L'\n');