From bfc0637c82d065f45d4584bc0c0517ff6d4274bf Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 30 Jun 2023 14:17:51 +0200 Subject: [PATCH] Add proper short_description to enchanted tools --- locale/template.txt | 3 ++- locale/xdecor.de.tr | 3 ++- locale/xdecor.fr.tr | 3 ++- locale/xdecor.it.tr | 3 ++- src/enchanting.lua | 12 +++++++----- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/locale/template.txt b/locale/template.txt index 4addddd..2fb1cd5 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -51,7 +51,8 @@ Bronze= Diamond= Durability= Efficiency= -Enchanted @1 @2 @3= +Enchanted @1 @2= +Enchanted @1 @2@n@3= Enchantment Table= Mese= Pickaxe= diff --git a/locale/xdecor.de.tr b/locale/xdecor.de.tr index f85a165..9061d6e 100644 --- a/locale/xdecor.de.tr +++ b/locale/xdecor.de.tr @@ -49,7 +49,8 @@ Bronze=Bronze Diamond=Diamant Durability=Haltbarkeit Efficiency=Effizienz -Enchanted @1 @2 @3=verzauberte(s) @1@2 @3 +Enchanted @1 @2=@1@2 (verzaubert) +Enchanted @1 @2@n@3=@1@2 (verzaubert)@n@3 Enchantment Table=Zaubertisch Mese=Mese Pickaxe=spitzhacke diff --git a/locale/xdecor.fr.tr b/locale/xdecor.fr.tr index 52ae158..00d1358 100644 --- a/locale/xdecor.fr.tr +++ b/locale/xdecor.fr.tr @@ -51,7 +51,8 @@ Bronze=Bronze Diamond=Diamant Durability=Durabilité Efficiency=Efficacité -Enchanted @1 @2 @3=@2 en @1 enchantée @3 +Enchanted @1 @2=@2 en @1 enchantée +Enchanted @1 @2@n@3=@2 en @1 enchantée@n@3 Enchantment Table=Table d’enchantements Mese=Mese Pickaxe=Pioche diff --git a/locale/xdecor.it.tr b/locale/xdecor.it.tr index f88655b..0591a7b 100644 --- a/locale/xdecor.it.tr +++ b/locale/xdecor.it.tr @@ -51,7 +51,8 @@ Bronze=Bronzo Diamond=Diamante Durability=Durabilità Efficiency=Efficacia -Enchanted @1 @2 @3=@2 su @1 incantesimo @3 +Enchanted @1 @2=@2 su @1 incantesimo +Enchanted @1 @2@n@3=@2 su @1 incantesimo@n@3 Enchantment Table=Tavolo per migliorie Mese=Mese Pickaxe=Piccone diff --git a/src/enchanting.lua b/src/enchanting.lua index bcdc0cf..da2ac98 100644 --- a/src/enchanting.lua +++ b/src/enchanting.lua @@ -53,8 +53,8 @@ function enchanting:get_tooltip(enchant, orig_caps, fleshy) } return minetest.colorize and minetest.colorize(specs[enchant][1], - "\n" .. enchant_loc[enchant] .. specs[enchant][2]) or - "\n" .. enchant_loc[enchant] .. specs[enchant][2] + enchant_loc[enchant] .. specs[enchant][2]) or + enchant_loc[enchant] .. specs[enchant][2] end local enchant_buttons = { @@ -295,10 +295,12 @@ function enchanting:register_tools(mod, def) fleshy = fleshy + enchanting.damages end + local arg1 = def.material_desc[material] or cap(material) + local arg2 = def.tools[tool].desc or cap(tool) + local arg3 = self:get_tooltip(enchant, original_groupcaps[group], fleshy) minetest.register_tool(":" .. mod .. ":enchanted_" .. tool .. "_" .. material .. "_" .. enchant, { - description = S("Enchanted @1 @2 @3", - def.material_desc[material] or cap(material), def.tools[tool].desc or cap(tool), - self:get_tooltip(enchant, original_groupcaps[group], fleshy)), + description = S("Enchanted @1 @2\n@3", arg1, arg2, arg3), + short_description = S("Enchanted @1 @2", arg1, arg2), inventory_image = original_tool.inventory_image .. "^[colorize:violet:50", wield_image = original_tool.wield_image, groups = {not_in_creative_inventory = 1},