From 48e6ffa935a94e99704687639f20882f4a07846e Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Wed, 22 May 2024 18:55:07 +0000 Subject: [PATCH] Improved tool tooltips (#4306) Co-authored-by: Araca Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4306 --- mods/CORE/mcl_util/init.lua | 1 + mods/ENTITIES/mcl_item_entity/init.lua | 1 + mods/ENTITIES/mcl_mobs/combat.lua | 1 + mods/ENTITIES/mobs_mc/cow+mooshroom.lua | 1 + mods/ENTITIES/mobs_mc/sheep.lua | 1 + mods/ENTITIES/mobs_mc/snowman.lua | 1 + mods/HELP/doc/doc_items/init.lua | 2 +- .../HELP/doc/doc_items/locale/doc_items.de.tr | 2 +- .../HELP/doc/doc_items/locale/doc_items.dk.tr | 2 +- .../HELP/doc/doc_items/locale/doc_items.fr.tr | 2 +- .../HELP/doc/doc_items/locale/doc_items.ja.tr | 2 +- .../HELP/doc/doc_items/locale/doc_items.pl.tr | 2 +- .../HELP/doc/doc_items/locale/doc_items.pt.tr | 2 +- .../doc/doc_items/locale/doc_items.pt_BR.tr | 2 +- .../HELP/doc/doc_items/locale/doc_items.ru.tr | 2 +- mods/HELP/doc/doc_items/locale/template.txt | 2 +- mods/HELP/mcl_doc/init.lua | 2 +- mods/HELP/mcl_doc/locale/mcl_doc.de.tr | 2 +- mods/HELP/mcl_doc/locale/mcl_doc.dk.tr | 2 +- mods/HELP/mcl_doc/locale/mcl_doc.fr.tr | 2 +- mods/HELP/mcl_doc/locale/mcl_doc.ja.tr | 2 +- mods/HELP/mcl_doc/locale/mcl_doc.pl.tr | 2 +- mods/HELP/mcl_doc/locale/mcl_doc.ru.tr | 2 +- mods/HELP/mcl_doc/locale/template.txt | 2 +- mods/HELP/mcl_tt/locale/mcl_tt.de.tr | 1 - mods/HELP/mcl_tt/locale/mcl_tt.es.tr | 1 - mods/HELP/mcl_tt/locale/mcl_tt.fr.tr | 1 - mods/HELP/mcl_tt/locale/mcl_tt.ja.tr | 1 - mods/HELP/mcl_tt/locale/mcl_tt.pl.tr | 2 +- mods/HELP/mcl_tt/locale/mcl_tt.pt_BR.tr | 1 - mods/HELP/mcl_tt/locale/mcl_tt.ru.tr | 1 - mods/HELP/mcl_tt/locale/template.txt | 1 - mods/HELP/mcl_tt/snippets_base.lua | 11 +++-- mods/HELP/mcl_tt/snippets_mcl.lua | 11 ++++- mods/ITEMS/REDSTONE/mcl_dispensers/init.lua | 1 + mods/ITEMS/mcl_bows/bow.lua | 1 + mods/ITEMS/mcl_bows/crossbow.lua | 1 + mods/ITEMS/mcl_campfires/api.lua | 1 + mods/ITEMS/mcl_enchanting/enchantments.lua | 1 + mods/ITEMS/mcl_farming/hoes.lua | 49 ++++++++++--------- mods/ITEMS/mcl_fishing/init.lua | 5 +- mods/ITEMS/mcl_tools/init.lua | 4 ++ 42 files changed, 81 insertions(+), 55 deletions(-) diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 7295aaa0f..c2ae5391e 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -534,6 +534,7 @@ end function mcl_util.use_item_durability(itemstack, n) local uses = mcl_util.calculate_durability(itemstack) itemstack:add_wear(65535 / uses * n) + tt.reload_itemstack_description(itemstack) -- update tooltip end function mcl_util.deal_damage(target, damage, mcl_reason) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index 1734fa6af..19e91b460 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -448,6 +448,7 @@ function minetest.node_dig(pos, node, digger) end end end + tt.reload_itemstack_description(wielded) -- update tooltip digger:set_wielded_item(wielded) end diff --git a/mods/ENTITIES/mcl_mobs/combat.lua b/mods/ENTITIES/mcl_mobs/combat.lua index 745a06c5c..f39760fab 100644 --- a/mods/ENTITIES/mcl_mobs/combat.lua +++ b/mods/ENTITIES/mcl_mobs/combat.lua @@ -646,6 +646,7 @@ function mob_class:on_punch(hitter, tflp, tool_capabilities, dir) if def.tool_capabilities and def.tool_capabilities.punch_attack_uses then local wear = math.floor(65535/tool_capabilities.punch_attack_uses) weapon:add_wear(wear) + tt.reload_itemstack_description(weapon) -- update tooltip hitter:set_wielded_item(weapon) end end, hitter:get_player_name()) diff --git a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua index 4ee21b2ea..4722c157c 100644 --- a/mods/ENTITIES/mobs_mc/cow+mooshroom.lua +++ b/mods/ENTITIES/mobs_mc/cow+mooshroom.lua @@ -122,6 +122,7 @@ mooshroom_def.on_rightclick = function(self, clicker) if not minetest.is_creative_enabled(clicker:get_player_name()) then item:add_wear(mobs_mc.shears_wear) + tt.reload_itemstack_description(item) -- update tooltip clicker:get_inventory():set_stack("main", clicker:get_wield_index(), item) end -- Use bucket to milk diff --git a/mods/ENTITIES/mobs_mc/sheep.lua b/mods/ENTITIES/mobs_mc/sheep.lua index 6ef8016e6..e0df5323c 100644 --- a/mods/ENTITIES/mobs_mc/sheep.lua +++ b/mods/ENTITIES/mobs_mc/sheep.lua @@ -249,6 +249,7 @@ mcl_mobs.register_mob("mobs_mc:sheep", { }) if not minetest.is_creative_enabled(clicker:get_player_name()) then item:add_wear(mobs_mc.shears_wear) + tt.reload_itemstack_description(item) -- update tooltip clicker:get_inventory():set_stack("main", clicker:get_wield_index(), item) end return diff --git a/mods/ENTITIES/mobs_mc/snowman.lua b/mods/ENTITIES/mobs_mc/snowman.lua index 62b988b9a..595c7d63e 100644 --- a/mods/ENTITIES/mobs_mc/snowman.lua +++ b/mods/ENTITIES/mobs_mc/snowman.lua @@ -131,6 +131,7 @@ mcl_mobs.register_mob("mobs_mc:snowman", { -- Wear out if not minetest.is_creative_enabled(clicker:get_player_name()) then item:add_wear(mobs_mc.shears_wear) + tt.reload_itemstack_description(item) -- update tooltip clicker:get_inventory():set_stack("main", clicker:get_wield_index(), item) end end diff --git a/mods/HELP/doc/doc_items/init.lua b/mods/HELP/doc/doc_items/init.lua index d0106c847..0c3205b04 100644 --- a/mods/HELP/doc/doc_items/init.lua +++ b/mods/HELP/doc/doc_items/init.lua @@ -255,7 +255,7 @@ local function factoid_toolcaps(tool_capabilities, check_uses) formstring = formstring .. miningtimesstr end if useslines > 0 then - formstring = formstring .. S("Mining durability:") .. "\n" + formstring = formstring .. S("Durability:") .. "\n" formstring = formstring .. miningusesstr end if caplines > 0 or useslines > 0 or timelines > 0 then diff --git a/mods/HELP/doc/doc_items/locale/doc_items.de.tr b/mods/HELP/doc/doc_items/locale/doc_items.de.tr index f14c99314..c816d6efd 100644 --- a/mods/HELP/doc/doc_items/locale/doc_items.de.tr +++ b/mods/HELP/doc/doc_items/locale/doc_items.de.tr @@ -134,7 +134,7 @@ Unknown item (@1)=Unbekannter Gegenstand (@1) Itemstring: "@1"=Itemstring: „@1“ Durability: @1 uses=Haltbarkeit: @1 Benutzungen Durability: @1=Haltbarkeit: @1 -Mining durability:=Grabehaltbarkeit: +Durability:=Haltbarkeit: • @1, level @2: @3 uses=• @1, Stufe @2: @3 Benutzungen • @1, level @2: Unlimited=• @1, Stufe @2: Unbegrenzt This block's rotation is affected by the way you place it: Place it on the floor or ceiling for a vertical orientation; place it at the side for a horizontal orientation. Sneaking while placing it leads to a perpendicular orientation instead.=Die Rotation dieses Blocks hängt davon ab, wie sie ihn platzieren: Platzieren Sie ihn auf den Boden oder an die Decke, um ihn vertikal aufzustellen; platzieren Sie in an der Seite für eine horizontale Ausrichtung. Wenn Sie während des Bauens schleichen, wird der Block stattdessen senkrecht zur üblichen Ausrichtung rotiert. diff --git a/mods/HELP/doc/doc_items/locale/doc_items.dk.tr b/mods/HELP/doc/doc_items/locale/doc_items.dk.tr index 1dd3eff8a..435e98779 100644 --- a/mods/HELP/doc/doc_items/locale/doc_items.dk.tr +++ b/mods/HELP/doc/doc_items/locale/doc_items.dk.tr @@ -135,7 +135,7 @@ Unknown item (@1)=ukendt genstand (@1) Itemstring: "@1"=Genstandsstreng: "@1" Durability: @1 uses=Holdbarhed: @1 anvendelser Durability: @1=Holdbarhed: @1 -Mining durability:=Udvindingsholdbarhed: +Durability:=Holdbarhed: • @1, level @2: @3 uses=• @1, level @2: @3 anvendelser • @1, level @2: Unlimited=• @1, level @2: Uendelig This block's rotation is affected by the way you place it: Place it on the floor or ceiling for a vertical orientation; place it at the side for a horizontal orientation. Sneaking while placing it leads to a perpendicular orientation instead.=Denne bloks rotation påvirkes af måden du placerer den på: Placér den på gulvet eller loftet for en lodret orientering; placér den på siden for en horisontal orientering. Hvis du sniger dig mens den placeres den vinkelret i stedet. diff --git a/mods/HELP/doc/doc_items/locale/doc_items.fr.tr b/mods/HELP/doc/doc_items/locale/doc_items.fr.tr index 269c97480..fe3a136c6 100644 --- a/mods/HELP/doc/doc_items/locale/doc_items.fr.tr +++ b/mods/HELP/doc/doc_items/locale/doc_items.fr.tr @@ -135,7 +135,7 @@ Unknown item (@1)=Objet inconnu (@1) Itemstring: "@1"=Identifiant d'objet : "@1" Durability: @1 uses=Durabilité : @1 utilisations Durability: @1=Durabilité : @1 -Mining durability:=Durabilité de minage : +Durability:=Durabilité : • @1, level @2: @3 uses=• @1, niveau @2 : @3 utilisations • @1, level @2: Unlimited=• @1, niveau @2 : Illimité This block's rotation is affected by the way you place it: Place it on the floor or ceiling for a vertical orientation; place it at the side for a horizontal orientation. Sneaking while placing it leads to a perpendicular orientation instead.=La manière dont vous placez ce bloc affecte sa rotation : placez-le au sol ou au plafond pour une orientation verticale ; placez-le sur un coté pour une orientation horizontale. Pour le placer de manière perpendiculaire, utilisez la touche déplacement discrêt en le plaçant. diff --git a/mods/HELP/doc/doc_items/locale/doc_items.ja.tr b/mods/HELP/doc/doc_items/locale/doc_items.ja.tr index a2e1107de..3617081cd 100644 --- a/mods/HELP/doc/doc_items/locale/doc_items.ja.tr +++ b/mods/HELP/doc/doc_items/locale/doc_items.ja.tr @@ -135,7 +135,7 @@ Unknown item (@1)=不明なアイテム (@1) Itemstring: "@1"=アイテム文字列:"@1" Durability: @1 uses=耐久度:@1回 使用 Durability: @1=耐久度:@1 -Mining durability:=採掘耐久度: +Durability:=耐久度: • @1, level @2: @3 uses=・@1, レベル @2:@3回 使用 • @1, level @2: Unlimited=・@1, レベル @2:無限 This block's rotation is affected by the way you place it: Place it on the floor or ceiling for a vertical orientation; place it at the side for a horizontal orientation. Sneaking while placing it leads to a perpendicular orientation instead.=このブロックの回転は、置き方に影響されます:床や天井に置くと垂直方向、横に置くと水平方向になります。スニークしながら置くと、代わって直角の方向に向きます。 diff --git a/mods/HELP/doc/doc_items/locale/doc_items.pl.tr b/mods/HELP/doc/doc_items/locale/doc_items.pl.tr index 8ff945368..efa035429 100644 --- a/mods/HELP/doc/doc_items/locale/doc_items.pl.tr +++ b/mods/HELP/doc/doc_items/locale/doc_items.pl.tr @@ -135,7 +135,7 @@ Unknown item (@1)=Nieznany przedmiot (@1) Itemstring: "@1"=Id przedmiotu: "@1" Durability: @1 uses=Wytrzymałość: @1 użyć Durability: @1=Wytrzymałość: @1 -Mining durability:=Wytrzymałość kopania: +Durability:=Wytrzymałość: • @1, level @2: @3 uses=• @1, poziom @2: @3 użyć • @1, level @2: Unlimited=• @1, poziom @2: Nielimitowane This block's rotation is affected by the way you place it: Place it on the floor or ceiling for a vertical orientation; place it at the side for a horizontal orientation. Sneaking while placing it leads to a perpendicular orientation instead.=Na rotację tego bloku wpływa sposób postawienia: Postaw go na podłodze lub suficie aby uzyskać pionową orientację; postaw go na boku by uzyskać poziomą orientację. Skradanie się podczas postawiania sprawia, że zostanie postawiony prostopadle. diff --git a/mods/HELP/doc/doc_items/locale/doc_items.pt.tr b/mods/HELP/doc/doc_items/locale/doc_items.pt.tr index abcf11547..3dcc3c760 100644 --- a/mods/HELP/doc/doc_items/locale/doc_items.pt.tr +++ b/mods/HELP/doc/doc_items/locale/doc_items.pt.tr @@ -135,7 +135,7 @@ Unknown item (@1)=Item desconhecido (@1) Itemstring: "@1"= Durability: @1 uses= Durability: @1= -Mining durability:= +Durability:= • @1, level @2: @3 uses= • @1, level @2: Unlimited= This block's rotation is affected by the way you place it: Place it on the floor or ceiling for a vertical orientation; place it at the side for a horizontal orientation. Sneaking while placing it leads to a perpendicular orientation instead.= diff --git a/mods/HELP/doc/doc_items/locale/doc_items.pt_BR.tr b/mods/HELP/doc/doc_items/locale/doc_items.pt_BR.tr index eec43dba7..a9c219343 100644 --- a/mods/HELP/doc/doc_items/locale/doc_items.pt_BR.tr +++ b/mods/HELP/doc/doc_items/locale/doc_items.pt_BR.tr @@ -135,7 +135,7 @@ Unknown item (@1)=Item desconhecido (@1) Itemstring: "@1"= Durability: @1 uses=Durabilidade: @1 usos Durability: @1=Durabilidade: @1 -Mining durability:= +Durability:=Durabilidade: • @1, level @2: @3 uses= • @1, level @2: Unlimited= This block's rotation is affected by the way you place it: Place it on the floor or ceiling for a vertical orientation; place it at the side for a horizontal orientation. Sneaking while placing it leads to a perpendicular orientation instead.= diff --git a/mods/HELP/doc/doc_items/locale/doc_items.ru.tr b/mods/HELP/doc/doc_items/locale/doc_items.ru.tr index ce5a9ca0a..1a6e5b3df 100644 --- a/mods/HELP/doc/doc_items/locale/doc_items.ru.tr +++ b/mods/HELP/doc/doc_items/locale/doc_items.ru.tr @@ -135,7 +135,7 @@ Unknown item (@1)=Неизвестный предмет (@1) Itemstring: "@1"=Техническое название: "@1" Durability: @1 uses=Прочность: @1 использований Durability: @1=Прочность: @1 -Mining durability:=Прочность при добыче: +Durability:=Прочность: • @1, level @2: @3 uses=• @1, уровень @2: @3 раз(а) • @1, level @2: Unlimited=• @1, уровень @2: Неограниченно This block's rotation is affected by the way you place it: Place it on the floor or ceiling for a vertical orientation; place it at the side for a horizontal orientation. Sneaking while placing it leads to a perpendicular orientation instead.=Поворот этого блока зависит от того как вы его ставите: поставьте его на пол или потолок для вертикальной ориентации; поместите на стену для горизонтальной ориентации. Удерживайте [Красться] при размещении для перпендикулярной ориентации. diff --git a/mods/HELP/doc/doc_items/locale/template.txt b/mods/HELP/doc/doc_items/locale/template.txt index 77f107863..8ddcc553d 100644 --- a/mods/HELP/doc/doc_items/locale/template.txt +++ b/mods/HELP/doc/doc_items/locale/template.txt @@ -135,7 +135,7 @@ Unknown item (@1)= Itemstring: "@1"= Durability: @1 uses= Durability: @1= -Mining durability:= +Durability:= • @1, level @2: @3 uses= • @1, level @2: Unlimited= This block's rotation is affected by the way you place it: Place it on the floor or ceiling for a vertical orientation; place it at the side for a horizontal orientation. Sneaking while placing it leads to a perpendicular orientation instead.= diff --git a/mods/HELP/mcl_doc/init.lua b/mods/HELP/mcl_doc/init.lua index 4ba387e12..034e7f38c 100644 --- a/mods/HELP/mcl_doc/init.lua +++ b/mods/HELP/mcl_doc/init.lua @@ -374,7 +374,7 @@ doc.sub.items.register_factoid("tools", "misc", function(itemstring, def) capstr = capstr .. S("Mining speed: @1", speedstr) .. "\n" end if miningusesstr ~= "" then - capstr = capstr .. S("Mining durability: @1", miningusesstr) .. "\n" + capstr = capstr .. S("Durability: @1", miningusesstr) .. "\n" end -- Only show one group at max diff --git a/mods/HELP/mcl_doc/locale/mcl_doc.de.tr b/mods/HELP/mcl_doc/locale/mcl_doc.de.tr index e929f9aec..5d64b387e 100644 --- a/mods/HELP/mcl_doc/locale/mcl_doc.de.tr +++ b/mods/HELP/mcl_doc/locale/mcl_doc.de.tr @@ -70,7 +70,7 @@ Instantaneous=Unmittelbar @1 uses=@1 Verwendungen Unlimited uses=Unbegrenzte Verwendungen Block breaking strength: @1=Blockbruchstärke: @1 -Mining durability: @1=Grabehaltbarkeit: @1 +Durability: @1=Haltbarkeit: @1 Armor points: @1=Rüstungspunkte: @1 Armor durability: @1=Rüstungshaltbarkeit: @1 It can be worn on the head.=Es kann auf dem Kopf getragen werden. diff --git a/mods/HELP/mcl_doc/locale/mcl_doc.dk.tr b/mods/HELP/mcl_doc/locale/mcl_doc.dk.tr index 7dfc40fdf..d4e45b1fa 100644 --- a/mods/HELP/mcl_doc/locale/mcl_doc.dk.tr +++ b/mods/HELP/mcl_doc/locale/mcl_doc.dk.tr @@ -70,7 +70,7 @@ Instantaneous=Momentan @1 uses=@1 anvendelser Unlimited uses=Uendelige anvendelser Block breaking strength: @1=Blokkens brudstyrke: @1 -Mining durability: @1=Udvindingsholdbarhed: @1 +Durability: @1=Holdbarhed: @1 Armor points: @1=Rustningspoint: @1 Armor durability: @1=Rustningens holdbarhed: @1 It can be worn on the head.=Den kan bæres på hovedet. diff --git a/mods/HELP/mcl_doc/locale/mcl_doc.fr.tr b/mods/HELP/mcl_doc/locale/mcl_doc.fr.tr index 0ac2fefbb..9126a08de 100644 --- a/mods/HELP/mcl_doc/locale/mcl_doc.fr.tr +++ b/mods/HELP/mcl_doc/locale/mcl_doc.fr.tr @@ -71,7 +71,7 @@ Instantaneous=Instantané @1 uses=@1 utilisations Unlimited uses=Utilisations illimitées Block breaking strength: @1=Résistance de rupture de bloc : @1 -Mining durability: @1=Durabilité de minage : @1 +Durability: @1=Durabilité : @1 Armor points: @1=Point d'armure : @1 Armor durability: @1=Durabilité de l'armure : @1 It can be worn on the head.=Il peut être porté sur la tête. diff --git a/mods/HELP/mcl_doc/locale/mcl_doc.ja.tr b/mods/HELP/mcl_doc/locale/mcl_doc.ja.tr index 0cef853c8..0d00f4a3a 100644 --- a/mods/HELP/mcl_doc/locale/mcl_doc.ja.tr +++ b/mods/HELP/mcl_doc/locale/mcl_doc.ja.tr @@ -70,7 +70,7 @@ Instantaneous=瞬間的 @1 uses=@1 使用 Unlimited uses=無限に使用可能 Block breaking strength: @1=ブロック破壊力:@1 -Mining durability: @1=採掘耐久度:@1 +Durability: @1=耐久性:@1 Armor points: @1=防具値:@1 Armor durability: @1=防具耐久度:@1 It can be worn on the head.=頭に装着することもできます。 diff --git a/mods/HELP/mcl_doc/locale/mcl_doc.pl.tr b/mods/HELP/mcl_doc/locale/mcl_doc.pl.tr index c451c8c39..015b0c45f 100644 --- a/mods/HELP/mcl_doc/locale/mcl_doc.pl.tr +++ b/mods/HELP/mcl_doc/locale/mcl_doc.pl.tr @@ -70,7 +70,7 @@ Instantaneous=Natychmiastowe @1 uses=@1 użyć Unlimited uses=Nielimitowane użycia Block breaking strength: @1=Siła niszczenia bloku: @1 -Mining durability: @1=Wytrzymałość kopania: @1 +Durability: @1=Wytrzymałość: @1 Armor points: @1=Punkty zbroi: @1 Armor durability: @1=Wytrzymałość zbroi: @1 It can be worn on the head.=Może być noszony na głowie. diff --git a/mods/HELP/mcl_doc/locale/mcl_doc.ru.tr b/mods/HELP/mcl_doc/locale/mcl_doc.ru.tr index 741c0742c..ce2da5a5d 100644 --- a/mods/HELP/mcl_doc/locale/mcl_doc.ru.tr +++ b/mods/HELP/mcl_doc/locale/mcl_doc.ru.tr @@ -70,7 +70,7 @@ Instantaneous=мгновенно @1 uses=@1 Unlimited uses=не ограничено Block breaking strength: @1=Сила добычи: @1 -Mining durability: @1=Прочность при добыче: @1 +Durability: @1=Прочность: @1 Armor points: @1=Очки брони: @1 Armor durability: @1=Прочность брони: @1 It can be worn on the head.=Это можно носить на голове. diff --git a/mods/HELP/mcl_doc/locale/template.txt b/mods/HELP/mcl_doc/locale/template.txt index ec825644c..2d4e20044 100644 --- a/mods/HELP/mcl_doc/locale/template.txt +++ b/mods/HELP/mcl_doc/locale/template.txt @@ -71,7 +71,7 @@ Instantaneous= @1 uses= Unlimited uses= Block breaking strength: @1= -Mining durability: @1= +Durability: @1= Armor points: @1= Armor durability: @1= It can be worn on the head.= diff --git a/mods/HELP/mcl_tt/locale/mcl_tt.de.tr b/mods/HELP/mcl_tt/locale/mcl_tt.de.tr index 54c376c3b..eccfbfade 100644 --- a/mods/HELP/mcl_tt/locale/mcl_tt.de.tr +++ b/mods/HELP/mcl_tt/locale/mcl_tt.de.tr @@ -41,7 +41,6 @@ Fast=Schnell Slow=Langsam Very slow=Sehr langsam Painfully slow=Furchtbar langsam -Mining durability: @1=Grabehaltbarkeit: @1 Block breaking strength: @1=Blockbruchstärke: @1 @1 uses=@1 Verwendungen Unlimited uses=Unbegrenzte Verwendungen diff --git a/mods/HELP/mcl_tt/locale/mcl_tt.es.tr b/mods/HELP/mcl_tt/locale/mcl_tt.es.tr index bc962eef8..17c9c8651 100644 --- a/mods/HELP/mcl_tt/locale/mcl_tt.es.tr +++ b/mods/HELP/mcl_tt/locale/mcl_tt.es.tr @@ -41,7 +41,6 @@ Fast=Rápido Slow=Lento Very slow=Muy lento Painfully slow=Dolorosamente lento -Mining durability: @1=Durabilidad de minería: @1 Block breaking strength: @1=Fuerza para romper bloques: @1 @1 uses=@1 usos Unlimited uses=Usos ilimitados diff --git a/mods/HELP/mcl_tt/locale/mcl_tt.fr.tr b/mods/HELP/mcl_tt/locale/mcl_tt.fr.tr index 77e9a35b0..4311e9b3e 100644 --- a/mods/HELP/mcl_tt/locale/mcl_tt.fr.tr +++ b/mods/HELP/mcl_tt/locale/mcl_tt.fr.tr @@ -41,7 +41,6 @@ Fast=Rapide Slow=Lent Very slow=Très lent Painfully slow=Péniblement lent -Mining durability: @1=Durabilité de minage : @1 Block breaking strength: @1=Résistance à la rupture : @1 @1 uses=@1 utilisations Unlimited uses=Utilisations illimitées diff --git a/mods/HELP/mcl_tt/locale/mcl_tt.ja.tr b/mods/HELP/mcl_tt/locale/mcl_tt.ja.tr index 5e5cd5e7a..5bb044f3f 100644 --- a/mods/HELP/mcl_tt/locale/mcl_tt.ja.tr +++ b/mods/HELP/mcl_tt/locale/mcl_tt.ja.tr @@ -41,7 +41,6 @@ Fast=速い Slow=遅い Very slow=とても遅い Painfully slow=苦痛レベルで遅い -Mining durability: @1=採掘耐久度:@1 Block breaking strength: @1=ブロック破壊力:@1 @1 uses=@1 使用 Unlimited uses=無限に使用可能 diff --git a/mods/HELP/mcl_tt/locale/mcl_tt.pl.tr b/mods/HELP/mcl_tt/locale/mcl_tt.pl.tr index aecc15d1e..71e1b13a4 100644 --- a/mods/HELP/mcl_tt/locale/mcl_tt.pl.tr +++ b/mods/HELP/mcl_tt/locale/mcl_tt.pl.tr @@ -41,7 +41,7 @@ Fast=Szybkie Slow=Wolne Very slow=Bardzo wolne Painfully slow=Boleśnie wolne -Mining durability: @1=Wytrzymałość kopania: @1 +Durability: @1=Wytrzymałość: @1 Block breaking strength: @1=Siła niszczenia bloku: @1 @1 uses=@1 użyć Unlimited uses=Nielimitowane użycia diff --git a/mods/HELP/mcl_tt/locale/mcl_tt.pt_BR.tr b/mods/HELP/mcl_tt/locale/mcl_tt.pt_BR.tr index 9d00a06d4..5fee59f2f 100644 --- a/mods/HELP/mcl_tt/locale/mcl_tt.pt_BR.tr +++ b/mods/HELP/mcl_tt/locale/mcl_tt.pt_BR.tr @@ -41,7 +41,6 @@ Fast=Rápido Slow=Lento Very slow=Muito lento Painfully slow=Dolorosamente lento -Mining durability: @1=Durabilidade de mineração: @1 Block breaking strength: @1=Força de quebra do bloco: @1 @1 uses=@1 usos Unlimited uses=Usos ilimitados diff --git a/mods/HELP/mcl_tt/locale/mcl_tt.ru.tr b/mods/HELP/mcl_tt/locale/mcl_tt.ru.tr index def0a6d1d..fd9b9b37c 100644 --- a/mods/HELP/mcl_tt/locale/mcl_tt.ru.tr +++ b/mods/HELP/mcl_tt/locale/mcl_tt.ru.tr @@ -42,7 +42,6 @@ Fast=Высокая Slow=Низкая Very slow=Очень низкая Painfully slow=Крайне низкая -Mining durability: @1=Прочность при добыче: @1 Block breaking strength: @1=Сила добычи: @1 @1 uses=@1 Unlimited uses=не ограничено diff --git a/mods/HELP/mcl_tt/locale/template.txt b/mods/HELP/mcl_tt/locale/template.txt index 6fb735b13..0acb7b599 100644 --- a/mods/HELP/mcl_tt/locale/template.txt +++ b/mods/HELP/mcl_tt/locale/template.txt @@ -41,7 +41,6 @@ Fast= Slow= Very slow= Painfully slow= -Mining durability: @1= Block breaking strength: @1= @1 uses= Unlimited uses= diff --git a/mods/HELP/mcl_tt/snippets_base.lua b/mods/HELP/mcl_tt/snippets_base.lua index 4e200d539..f20f3dfe2 100644 --- a/mods/HELP/mcl_tt/snippets_base.lua +++ b/mods/HELP/mcl_tt/snippets_base.lua @@ -35,7 +35,7 @@ local function newline(str) end -- Digging capabilities of tool -tt.register_snippet(function(itemstring, toolcaps) +tt.register_snippet(function(itemstring, toolcaps, itemstack) local def = minetest.registered_items[itemstring] if not toolcaps then return @@ -85,7 +85,12 @@ tt.register_snippet(function(itemstring, toolcaps) if def._doc_items_durability == nil and base_uses > 0 then local real_uses = base_uses * math.pow(3, maxlevel) if real_uses < 65535 then - miningusesstr = S("@1 uses", real_uses) + if itemstack then + local remaining_uses = math.round(real_uses - (itemstack:get_wear() * base_uses) / 65535) + miningusesstr = remaining_uses .. "/" .. real_uses + else + miningusesstr = S("@1 uses", real_uses) + end else miningusesstr = S("Unlimited uses") end @@ -95,7 +100,7 @@ tt.register_snippet(function(itemstring, toolcaps) capstr = capstr .. S("Mining speed: @1", speedstr) .. "\n" end if miningusesstr ~= "" then - capstr = capstr .. S("Mining durability: @1", miningusesstr) .. "\n" + capstr = capstr .. S("Durability: @1", miningusesstr) .. "\n" end -- Only show one group at max diff --git a/mods/HELP/mcl_tt/snippets_mcl.lua b/mods/HELP/mcl_tt/snippets_mcl.lua index 825776f5f..2066670f3 100644 --- a/mods/HELP/mcl_tt/snippets_mcl.lua +++ b/mods/HELP/mcl_tt/snippets_mcl.lua @@ -25,6 +25,7 @@ tt.register_snippet(function(itemstring) end return s end) + tt.register_snippet(function(itemstring, _, itemstack) --local def = minetest.registered_items[itemstring] local s = "" @@ -34,13 +35,18 @@ tt.register_snippet(function(itemstring, _, itemstack) s = s .. S("Armor points: @1", pts) s = s .. "\n" end + local remaining_uses = use if itemstack then local unbreaking = mcl_enchanting.get_enchantment(itemstack, "unbreaking") if unbreaking > 0 then use = math.floor(use / (0.6 + 0.4 / (unbreaking + 1))) end + remaining_uses = math.round(use - (itemstack:get_wear() * use) / 65535) end if use > 0 then + if use ~= remaining_uses then + use = remaining_uses .. "/" .. use -- implicit conversion from number to string + end s = s .. S("Armor durability: @1", use) end if s == "" then @@ -109,6 +115,9 @@ end) tt.register_snippet(function(itemstring, _, itemstack) if itemstring:sub(1, 23) == "mcl_fishing:fishing_rod" or itemstring:sub(1, 12) == "mcl_bows:bow" then - return S("Durability: @1", S("@1 uses", mcl_util.calculate_durability(itemstack or ItemStack(itemstring)))) + local stack = itemstack or ItemStack(itemstring) + local use = mcl_util.calculate_durability(stack) + local remaining_use = math.round(use - (stack:get_wear() * use) / 65535) + return S("Durability: @1", S("@1 uses", remaining_use .."/".. use)) end end) diff --git a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua index ae419a512..9e5224b15 100644 --- a/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_dispensers/init.lua @@ -227,6 +227,7 @@ local dispenserdef = { entity.gotten = true minetest.sound_play("mcl_tools_shears_cut", { pos = pos }, true) stack:add_wear(65535 / stackdef._mcl_diggroups.shearsy.uses) + tt.reload_itemstack_description(stack) -- update tooltip inv:set_stack("main", stack_id, stack) break end diff --git a/mods/ITEMS/mcl_bows/bow.lua b/mods/ITEMS/mcl_bows/bow.lua index 37c38a085..3d22c6df6 100644 --- a/mods/ITEMS/mcl_bows/bow.lua +++ b/mods/ITEMS/mcl_bows/bow.lua @@ -300,6 +300,7 @@ controls.register_on_release(function(player, key, time) durability = durability * (unbreaking + 1) end wielditem:add_wear(65535/durability) + tt.reload_itemstack_description(wielditem) -- update tooltip end player:set_wielded_item(wielditem) reset_bow_state(player, true) diff --git a/mods/ITEMS/mcl_bows/crossbow.lua b/mods/ITEMS/mcl_bows/crossbow.lua index b6a1a3ad6..54c6d7da2 100644 --- a/mods/ITEMS/mcl_bows/crossbow.lua +++ b/mods/ITEMS/mcl_bows/crossbow.lua @@ -350,6 +350,7 @@ controls.register_on_press(function(player, key, time) durability = durability / 3 end wielditem:add_wear(65535/durability) + tt.reload_itemstack_description(wielditem) -- update tooltip end player:set_wielded_item(wielditem) reset_bow_state(player, true) diff --git a/mods/ITEMS/mcl_campfires/api.lua b/mods/ITEMS/mcl_campfires/api.lua index 4c1ddc758..7fa495edb 100644 --- a/mods/ITEMS/mcl_campfires/api.lua +++ b/mods/ITEMS/mcl_campfires/api.lua @@ -323,6 +323,7 @@ function mcl_campfires.register_campfire(name, def) local wear = mcl_autogroup.get_wear(toolname, "shovely") if wear then itemstack:add_wear(wear) + tt.reload_itemstack_description(itemstack) -- update tooltip end end node.name = name diff --git a/mods/ITEMS/mcl_enchanting/enchantments.lua b/mods/ITEMS/mcl_enchanting/enchantments.lua index 591dfb679..379a18e07 100644 --- a/mods/ITEMS/mcl_enchanting/enchantments.lua +++ b/mods/ITEMS/mcl_enchanting/enchantments.lua @@ -485,6 +485,7 @@ mcl_experience.register_on_add_xp(function(player, xp) end stack:set_wear(math.floor(new_wear)) + tt.reload_itemstack_description(stack) -- update tooltip inv:set_stack(list, index, stack) end diff --git a/mods/ITEMS/mcl_farming/hoes.lua b/mods/ITEMS/mcl_farming/hoes.lua index 72d8f7b7a..0a389522e 100644 --- a/mods/ITEMS/mcl_farming/hoes.lua +++ b/mods/ITEMS/mcl_farming/hoes.lua @@ -43,6 +43,7 @@ local hoe_on_place_function = function(wear_divisor) if create_soil(pointed_thing.under, user:get_inventory()) then if not minetest.is_creative_enabled(user:get_player_name()) then itemstack:add_wear(65535/wear_divisor) + tt.reload_itemstack_description(itemstack) -- update tooltip end return itemstack end @@ -54,7 +55,7 @@ local uses = { stone = 132, iron = 251, gold = 33, - diamond = 1562, + diamond = 1562, netherite = 2031, } @@ -274,26 +275,26 @@ minetest.register_craft({ {"mcl_core:diamond", "mcl_core:diamond"}, {"mcl_core:stick", ""}, {"mcl_core:stick", ""} - } -}) - -minetest.register_tool("mcl_farming:hoe_netherite", { - description = S("Netherite Hoe"), - _tt_help = hoe_tt.."\n"..S("Uses: @1", uses.netherite), - _doc_items_longdesc = hoe_longdesc, - _doc_items_usagehelp = hoe_usagehelp, - inventory_image = "farming_tool_netheritehoe.png", - wield_scale = mcl_vars.tool_wield_scale, - on_place = hoe_on_place_function(uses.netherite), - groups = { tool=1, hoe=1, enchantability=10, fire_immune=1 }, - tool_capabilities = { - full_punch_interval = 0.25, - damage_groups = { fleshy = 4, }, - punch_attack_uses = uses.netherite, - }, - _repair_material = "mcl_nether:netherite_ingot", - _mcl_toollike_wield = true, - _mcl_diggroups = { - hoey = { speed = 8, level = 5, uses = uses.netherite } - }, -}) + } +}) + +minetest.register_tool("mcl_farming:hoe_netherite", { + description = S("Netherite Hoe"), + _tt_help = hoe_tt.."\n"..S("Uses: @1", uses.netherite), + _doc_items_longdesc = hoe_longdesc, + _doc_items_usagehelp = hoe_usagehelp, + inventory_image = "farming_tool_netheritehoe.png", + wield_scale = mcl_vars.tool_wield_scale, + on_place = hoe_on_place_function(uses.netherite), + groups = { tool=1, hoe=1, enchantability=10, fire_immune=1 }, + tool_capabilities = { + full_punch_interval = 0.25, + damage_groups = { fleshy = 4, }, + punch_attack_uses = uses.netherite, + }, + _repair_material = "mcl_nether:netherite_ingot", + _mcl_toollike_wield = true, + _mcl_diggroups = { + hoey = { speed = 8, level = 5, uses = uses.netherite } + }, +}) diff --git a/mods/ITEMS/mcl_fishing/init.lua b/mods/ITEMS/mcl_fishing/init.lua index 4638325bd..ca9c3b2e3 100644 --- a/mods/ITEMS/mcl_fishing/init.lua +++ b/mods/ITEMS/mcl_fishing/init.lua @@ -1,6 +1,7 @@ --Fishing Rod, Bobber, and Flying Bobber mechanics and Bobber artwork by Rootyjr. local S = minetest.get_translator(minetest.get_current_modname()) +local FISHING_ROD_DURABILITY = 65 local bobber_ENTITY={ physical = false, @@ -38,7 +39,7 @@ local fish = function(itemstack, player, pointed_thing) local ent = nil local noent = true - local durability = 65 + local durability = FISHING_ROD_DURABILITY local unbreaking = mcl_enchanting.get_enchantment(itemstack, "unbreaking") if unbreaking > 0 then durability = durability * (unbreaking + 1) @@ -140,6 +141,7 @@ local fish = function(itemstack, player, pointed_thing) if not minetest.is_creative_enabled(player:get_player_name()) then local idef = itemstack:get_definition() itemstack:add_wear(65535/durability) -- 65 uses + tt.reload_itemstack_description(itemstack) -- update tooltip if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then minetest.sound_play(idef.sound.breaks, {pos=player:get_pos(), gain=0.5}, true) end @@ -154,6 +156,7 @@ local fish = function(itemstack, player, pointed_thing) if not minetest.is_creative_enabled(player:get_player_name()) then local idef = itemstack:get_definition() itemstack:add_wear((65535/durability)*2) -- if so and not creative then wear double like in MC. + tt.reload_itemstack_description(itemstack) -- update tooltip if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then minetest.sound_play(idef.sound.breaks, {pos=player:get_pos(), gain=0.5}, true) end diff --git a/mods/ITEMS/mcl_tools/init.lua b/mods/ITEMS/mcl_tools/init.lua index 6282da5c3..266adc6fc 100644 --- a/mods/ITEMS/mcl_tools/init.lua +++ b/mods/ITEMS/mcl_tools/init.lua @@ -186,6 +186,7 @@ local make_grass_path = function(itemstack, placer, pointed_thing) local wear = mcl_autogroup.get_wear(toolname, "shovely") if wear then itemstack:add_wear(wear) + tt.reload_itemstack_description(itemstack) -- update tooltip end end minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above, max_hear_distance = 16}, true) @@ -209,6 +210,7 @@ local make_grass_path = function(itemstack, placer, pointed_thing) local wear = mcl_autogroup.get_wear(toolname, "shovely") if wear then itemstack:add_wear(wear) + tt.reload_itemstack_description(itemstack) -- update tooltip end end minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above, max_hear_distance = 16}, true) @@ -240,6 +242,7 @@ if minetest.get_modpath("mcl_farming") then local wear = mcl_autogroup.get_wear(toolname, "shearsy") if wear then itemstack:add_wear(wear) + tt.reload_itemstack_description(itemstack) -- update tooltip end end @@ -420,6 +423,7 @@ local function make_stripped_trunk(itemstack, placer, pointed_thing) local wear = mcl_autogroup.get_wear(toolname, "axey") if wear then itemstack:add_wear(wear) + tt.reload_itemstack_description(itemstack) -- update tooltip end end end