From 19efce45ed8be7b008e4c91740b786623f6f920e Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Sun, 20 Mar 2022 13:30:11 +0100 Subject: [PATCH] Revert "Remove mod name from tooltips" This reverts commit 64b0248c772966766c0bd3d6f0f47b96ff60625c. The mod name may differ from the item name, in which cases it is helpful to have this information contained in the tooltip. No information is shown in case the mod name is missing. --- internal.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal.lua b/internal.lua index b264d22..3194dba 100644 --- a/internal.lua +++ b/internal.lua @@ -256,8 +256,14 @@ local function formspec_add_item_browser(player, formspec, ui_peruser) ui_peruser.btn_size, ui_peruser.btn_size, name, button_name ) + local tooltip = item.description + if item.mod_origin then + -- "mod_origin" may not be specified for items that were + -- registered in a callback (during or before ServerEnv init) + tooltip = tooltip .. " [" .. item.mod_origin .. "]" + end formspec[n + 1] = ("tooltip[%s;%s]"):format( - button_name, minetest.formspec_escape(item.description) + button_name, minetest.formspec_escape(tooltip) ) n = n + 2 list_index = list_index + 1