Improved tool tooltips (#4306)

Co-authored-by: Araca <araca.prod@gmail.com>
Reviewed-on: VoxeLibre/VoxeLibre#4306
This commit is contained in:
the-real-herowl 2024-05-22 18:55:07 +00:00
parent bbc20d5f06
commit 48e6ffa935
42 changed files with 81 additions and 55 deletions

View File

@ -534,6 +534,7 @@ end
function mcl_util.use_item_durability(itemstack, n) function mcl_util.use_item_durability(itemstack, n)
local uses = mcl_util.calculate_durability(itemstack) local uses = mcl_util.calculate_durability(itemstack)
itemstack:add_wear(65535 / uses * n) itemstack:add_wear(65535 / uses * n)
tt.reload_itemstack_description(itemstack) -- update tooltip
end end
function mcl_util.deal_damage(target, damage, mcl_reason) function mcl_util.deal_damage(target, damage, mcl_reason)

View File

@ -448,6 +448,7 @@ function minetest.node_dig(pos, node, digger)
end end
end end
end end
tt.reload_itemstack_description(wielded) -- update tooltip
digger:set_wielded_item(wielded) digger:set_wielded_item(wielded)
end end

View File

@ -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 if def.tool_capabilities and def.tool_capabilities.punch_attack_uses then
local wear = math.floor(65535/tool_capabilities.punch_attack_uses) local wear = math.floor(65535/tool_capabilities.punch_attack_uses)
weapon:add_wear(wear) weapon:add_wear(wear)
tt.reload_itemstack_description(weapon) -- update tooltip
hitter:set_wielded_item(weapon) hitter:set_wielded_item(weapon)
end end
end, hitter:get_player_name()) end, hitter:get_player_name())

View File

@ -122,6 +122,7 @@ mooshroom_def.on_rightclick = function(self, clicker)
if not minetest.is_creative_enabled(clicker:get_player_name()) then if not minetest.is_creative_enabled(clicker:get_player_name()) then
item:add_wear(mobs_mc.shears_wear) 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) clicker:get_inventory():set_stack("main", clicker:get_wield_index(), item)
end end
-- Use bucket to milk -- Use bucket to milk

View File

@ -249,6 +249,7 @@ mcl_mobs.register_mob("mobs_mc:sheep", {
}) })
if not minetest.is_creative_enabled(clicker:get_player_name()) then if not minetest.is_creative_enabled(clicker:get_player_name()) then
item:add_wear(mobs_mc.shears_wear) 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) clicker:get_inventory():set_stack("main", clicker:get_wield_index(), item)
end end
return return

View File

@ -131,6 +131,7 @@ mcl_mobs.register_mob("mobs_mc:snowman", {
-- Wear out -- Wear out
if not minetest.is_creative_enabled(clicker:get_player_name()) then if not minetest.is_creative_enabled(clicker:get_player_name()) then
item:add_wear(mobs_mc.shears_wear) 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) clicker:get_inventory():set_stack("main", clicker:get_wield_index(), item)
end end
end end

View File

@ -255,7 +255,7 @@ local function factoid_toolcaps(tool_capabilities, check_uses)
formstring = formstring .. miningtimesstr formstring = formstring .. miningtimesstr
end end
if useslines > 0 then if useslines > 0 then
formstring = formstring .. S("Mining durability:") .. "\n" formstring = formstring .. S("Durability:") .. "\n"
formstring = formstring .. miningusesstr formstring = formstring .. miningusesstr
end end
if caplines > 0 or useslines > 0 or timelines > 0 then if caplines > 0 or useslines > 0 or timelines > 0 then

View File

@ -134,7 +134,7 @@ Unknown item (@1)=Unbekannter Gegenstand (@1)
Itemstring: "@1"=Itemstring: „@1“ Itemstring: "@1"=Itemstring: „@1“
Durability: @1 uses=Haltbarkeit: @1 Benutzungen Durability: @1 uses=Haltbarkeit: @1 Benutzungen
Durability: @1=Haltbarkeit: @1 Durability: @1=Haltbarkeit: @1
Mining durability:=Grabehaltbarkeit: Durability:=Haltbarkeit:
• @1, level @2: @3 uses=• @1, Stufe @2: @3 Benutzungen • @1, level @2: @3 uses=• @1, Stufe @2: @3 Benutzungen
• @1, level @2: Unlimited=• @1, Stufe @2: Unbegrenzt • @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. 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.

View File

@ -135,7 +135,7 @@ Unknown item (@1)=ukendt genstand (@1)
Itemstring: "@1"=Genstandsstreng: "@1" Itemstring: "@1"=Genstandsstreng: "@1"
Durability: @1 uses=Holdbarhed: @1 anvendelser Durability: @1 uses=Holdbarhed: @1 anvendelser
Durability: @1=Holdbarhed: @1 Durability: @1=Holdbarhed: @1
Mining durability:=Udvindingsholdbarhed: Durability:=Holdbarhed:
• @1, level @2: @3 uses=• @1, level @2: @3 anvendelser • @1, level @2: @3 uses=• @1, level @2: @3 anvendelser
• @1, level @2: Unlimited=• @1, level @2: Uendelig • @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. 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.

View File

@ -135,7 +135,7 @@ Unknown item (@1)=Objet inconnu (@1)
Itemstring: "@1"=Identifiant d'objet : "@1" Itemstring: "@1"=Identifiant d'objet : "@1"
Durability: @1 uses=Durabilité : @1 utilisations Durability: @1 uses=Durabilité : @1 utilisations
Durability: @1=Durabilité : @1 Durability: @1=Durabilité : @1
Mining durability:=Durabilité de minage : Durability:=Durabilité :
• @1, level @2: @3 uses=• @1, niveau @2 : @3 utilisations • @1, level @2: @3 uses=• @1, niveau @2 : @3 utilisations
• @1, level @2: Unlimited=• @1, niveau @2 : Illimité • @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. 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.

View File

@ -135,7 +135,7 @@ Unknown item (@1)=不明なアイテム (@1)
Itemstring: "@1"=アイテム文字列:"@1" Itemstring: "@1"=アイテム文字列:"@1"
Durability: @1 uses=耐久度:@1回 使用 Durability: @1 uses=耐久度:@1回 使用
Durability: @1=耐久度:@1 Durability: @1=耐久度:@1
Mining durability:=採掘耐久度: Durability:=耐久度:
• @1, level @2: @3 uses=・@1, レベル @2@3回 使用 • @1, level @2: @3 uses=・@1, レベル @2@3回 使用
• @1, level @2: Unlimited=・@1, レベル @2無限 • @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.=このブロックの回転は、置き方に影響されます:床や天井に置くと垂直方向、横に置くと水平方向になります。スニークしながら置くと、代わって直角の方向に向きます。 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.=このブロックの回転は、置き方に影響されます:床や天井に置くと垂直方向、横に置くと水平方向になります。スニークしながら置くと、代わって直角の方向に向きます。

View File

@ -135,7 +135,7 @@ Unknown item (@1)=Nieznany przedmiot (@1)
Itemstring: "@1"=Id przedmiotu: "@1" Itemstring: "@1"=Id przedmiotu: "@1"
Durability: @1 uses=Wytrzymałość: @1 użyć Durability: @1 uses=Wytrzymałość: @1 użyć
Durability: @1=Wytrzymałość: @1 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: @3 uses=• @1, poziom @2: @3 użyć
• @1, level @2: Unlimited=• @1, poziom @2: Nielimitowane • @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. 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.

View File

@ -135,7 +135,7 @@ Unknown item (@1)=Item desconhecido (@1)
Itemstring: "@1"= Itemstring: "@1"=
Durability: @1 uses= Durability: @1 uses=
Durability: @1= Durability: @1=
Mining durability:= Durability:=
• @1, level @2: @3 uses= • @1, level @2: @3 uses=
• @1, level @2: Unlimited= • @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.= 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.=

View File

@ -135,7 +135,7 @@ Unknown item (@1)=Item desconhecido (@1)
Itemstring: "@1"= Itemstring: "@1"=
Durability: @1 uses=Durabilidade: @1 usos Durability: @1 uses=Durabilidade: @1 usos
Durability: @1=Durabilidade: @1 Durability: @1=Durabilidade: @1
Mining durability:= Durability:=Durabilidade:
• @1, level @2: @3 uses= • @1, level @2: @3 uses=
• @1, level @2: Unlimited= • @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.= 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.=

View File

@ -135,7 +135,7 @@ Unknown item (@1)=Неизвестный предмет (@1)
Itemstring: "@1"=Техническое название: "@1" Itemstring: "@1"=Техническое название: "@1"
Durability: @1 uses=Прочность: @1 использований Durability: @1 uses=Прочность: @1 использований
Durability: @1=Прочность: @1 Durability: @1=Прочность: @1
Mining durability:=Прочность при добыче: Durability:=Прочность:
• @1, level @2: @3 uses=• @1, уровень @2: @3 раз(а) • @1, level @2: @3 uses=• @1, уровень @2: @3 раз(а)
• @1, level @2: Unlimited=• @1, уровень @2: Неограниченно • @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.=Поворот этого блока зависит от того как вы его ставите: поставьте его на пол или потолок для вертикальной ориентации; поместите на стену для горизонтальной ориентации. Удерживайте [Красться] при размещении для перпендикулярной ориентации. 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.=Поворот этого блока зависит от того как вы его ставите: поставьте его на пол или потолок для вертикальной ориентации; поместите на стену для горизонтальной ориентации. Удерживайте [Красться] при размещении для перпендикулярной ориентации.

View File

@ -135,7 +135,7 @@ Unknown item (@1)=
Itemstring: "@1"= Itemstring: "@1"=
Durability: @1 uses= Durability: @1 uses=
Durability: @1= Durability: @1=
Mining durability:= Durability:=
• @1, level @2: @3 uses= • @1, level @2: @3 uses=
• @1, level @2: Unlimited= • @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.= 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.=

View File

@ -374,7 +374,7 @@ doc.sub.items.register_factoid("tools", "misc", function(itemstring, def)
capstr = capstr .. S("Mining speed: @1", speedstr) .. "\n" capstr = capstr .. S("Mining speed: @1", speedstr) .. "\n"
end end
if miningusesstr ~= "" then if miningusesstr ~= "" then
capstr = capstr .. S("Mining durability: @1", miningusesstr) .. "\n" capstr = capstr .. S("Durability: @1", miningusesstr) .. "\n"
end end
-- Only show one group at max -- Only show one group at max

View File

@ -70,7 +70,7 @@ Instantaneous=Unmittelbar
@1 uses=@1 Verwendungen @1 uses=@1 Verwendungen
Unlimited uses=Unbegrenzte Verwendungen Unlimited uses=Unbegrenzte Verwendungen
Block breaking strength: @1=Blockbruchstärke: @1 Block breaking strength: @1=Blockbruchstärke: @1
Mining durability: @1=Grabehaltbarkeit: @1 Durability: @1=Haltbarkeit: @1
Armor points: @1=Rüstungspunkte: @1 Armor points: @1=Rüstungspunkte: @1
Armor durability: @1=Rüstungshaltbarkeit: @1 Armor durability: @1=Rüstungshaltbarkeit: @1
It can be worn on the head.=Es kann auf dem Kopf getragen werden. It can be worn on the head.=Es kann auf dem Kopf getragen werden.

View File

@ -70,7 +70,7 @@ Instantaneous=Momentan
@1 uses=@1 anvendelser @1 uses=@1 anvendelser
Unlimited uses=Uendelige anvendelser Unlimited uses=Uendelige anvendelser
Block breaking strength: @1=Blokkens brudstyrke: @1 Block breaking strength: @1=Blokkens brudstyrke: @1
Mining durability: @1=Udvindingsholdbarhed: @1 Durability: @1=Holdbarhed: @1
Armor points: @1=Rustningspoint: @1 Armor points: @1=Rustningspoint: @1
Armor durability: @1=Rustningens holdbarhed: @1 Armor durability: @1=Rustningens holdbarhed: @1
It can be worn on the head.=Den kan bæres på hovedet. It can be worn on the head.=Den kan bæres på hovedet.

View File

@ -71,7 +71,7 @@ Instantaneous=Instantané
@1 uses=@1 utilisations @1 uses=@1 utilisations
Unlimited uses=Utilisations illimitées Unlimited uses=Utilisations illimitées
Block breaking strength: @1=Résistance de rupture de bloc : @1 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 points: @1=Point d'armure : @1
Armor durability: @1=Durabilité de l'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. It can be worn on the head.=Il peut être porté sur la tête.

View File

@ -70,7 +70,7 @@ Instantaneous=瞬間的
@1 uses=@1 使用 @1 uses=@1 使用
Unlimited uses=無限に使用可能 Unlimited uses=無限に使用可能
Block breaking strength: @1=ブロック破壊力:@1 Block breaking strength: @1=ブロック破壊力:@1
Mining durability: @1=採掘耐久度@1 Durability: @1=耐久性@1
Armor points: @1=防具値:@1 Armor points: @1=防具値:@1
Armor durability: @1=防具耐久度:@1 Armor durability: @1=防具耐久度:@1
It can be worn on the head.=頭に装着することもできます。 It can be worn on the head.=頭に装着することもできます。

View File

@ -70,7 +70,7 @@ Instantaneous=Natychmiastowe
@1 uses=@1 użyć @1 uses=@1 użyć
Unlimited uses=Nielimitowane użycia Unlimited uses=Nielimitowane użycia
Block breaking strength: @1=Siła niszczenia bloku: @1 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 points: @1=Punkty zbroi: @1
Armor durability: @1=Wytrzymałość zbroi: @1 Armor durability: @1=Wytrzymałość zbroi: @1
It can be worn on the head.=Może być noszony na głowie. It can be worn on the head.=Może być noszony na głowie.

View File

@ -70,7 +70,7 @@ Instantaneous=мгновенно
@1 uses=@1 @1 uses=@1
Unlimited uses=не ограничено Unlimited uses=не ограничено
Block breaking strength: @1=Сила добычи: @1 Block breaking strength: @1=Сила добычи: @1
Mining durability: @1=Прочность при добыче: @1 Durability: @1=Прочность: @1
Armor points: @1=Очки брони: @1 Armor points: @1=Очки брони: @1
Armor durability: @1=Прочность брони: @1 Armor durability: @1=Прочность брони: @1
It can be worn on the head.=Это можно носить на голове. It can be worn on the head.=Это можно носить на голове.

View File

@ -71,7 +71,7 @@ Instantaneous=
@1 uses= @1 uses=
Unlimited uses= Unlimited uses=
Block breaking strength: @1= Block breaking strength: @1=
Mining durability: @1= Durability: @1=
Armor points: @1= Armor points: @1=
Armor durability: @1= Armor durability: @1=
It can be worn on the head.= It can be worn on the head.=

View File

@ -41,7 +41,6 @@ Fast=Schnell
Slow=Langsam Slow=Langsam
Very slow=Sehr langsam Very slow=Sehr langsam
Painfully slow=Furchtbar langsam Painfully slow=Furchtbar langsam
Mining durability: @1=Grabehaltbarkeit: @1
Block breaking strength: @1=Blockbruchstärke: @1 Block breaking strength: @1=Blockbruchstärke: @1
@1 uses=@1 Verwendungen @1 uses=@1 Verwendungen
Unlimited uses=Unbegrenzte Verwendungen Unlimited uses=Unbegrenzte Verwendungen

View File

@ -41,7 +41,6 @@ Fast=Rápido
Slow=Lento Slow=Lento
Very slow=Muy lento Very slow=Muy lento
Painfully slow=Dolorosamente lento Painfully slow=Dolorosamente lento
Mining durability: @1=Durabilidad de minería: @1
Block breaking strength: @1=Fuerza para romper bloques: @1 Block breaking strength: @1=Fuerza para romper bloques: @1
@1 uses=@1 usos @1 uses=@1 usos
Unlimited uses=Usos ilimitados Unlimited uses=Usos ilimitados

View File

@ -41,7 +41,6 @@ Fast=Rapide
Slow=Lent Slow=Lent
Very slow=Très lent Very slow=Très lent
Painfully slow=Péniblement lent Painfully slow=Péniblement lent
Mining durability: @1=Durabilité de minage : @1
Block breaking strength: @1=Résistance à la rupture : @1 Block breaking strength: @1=Résistance à la rupture : @1
@1 uses=@1 utilisations @1 uses=@1 utilisations
Unlimited uses=Utilisations illimitées Unlimited uses=Utilisations illimitées

View File

@ -41,7 +41,6 @@ Fast=速い
Slow=遅い Slow=遅い
Very slow=とても遅い Very slow=とても遅い
Painfully slow=苦痛レベルで遅い Painfully slow=苦痛レベルで遅い
Mining durability: @1=採掘耐久度:@1
Block breaking strength: @1=ブロック破壊力:@1 Block breaking strength: @1=ブロック破壊力:@1
@1 uses=@1 使用 @1 uses=@1 使用
Unlimited uses=無限に使用可能 Unlimited uses=無限に使用可能

View File

@ -41,7 +41,7 @@ Fast=Szybkie
Slow=Wolne Slow=Wolne
Very slow=Bardzo wolne Very slow=Bardzo wolne
Painfully slow=Boleśnie 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 Block breaking strength: @1=Siła niszczenia bloku: @1
@1 uses=@1 użyć @1 uses=@1 użyć
Unlimited uses=Nielimitowane użycia Unlimited uses=Nielimitowane użycia

View File

@ -41,7 +41,6 @@ Fast=Rápido
Slow=Lento Slow=Lento
Very slow=Muito lento Very slow=Muito lento
Painfully slow=Dolorosamente lento Painfully slow=Dolorosamente lento
Mining durability: @1=Durabilidade de mineração: @1
Block breaking strength: @1=Força de quebra do bloco: @1 Block breaking strength: @1=Força de quebra do bloco: @1
@1 uses=@1 usos @1 uses=@1 usos
Unlimited uses=Usos ilimitados Unlimited uses=Usos ilimitados

View File

@ -42,7 +42,6 @@ Fast=Высокая
Slow=Низкая Slow=Низкая
Very slow=Очень низкая Very slow=Очень низкая
Painfully slow=Крайне низкая Painfully slow=Крайне низкая
Mining durability: @1=Прочность при добыче: @1
Block breaking strength: @1=Сила добычи: @1 Block breaking strength: @1=Сила добычи: @1
@1 uses=@1 @1 uses=@1
Unlimited uses=не ограничено Unlimited uses=не ограничено

View File

@ -41,7 +41,6 @@ Fast=
Slow= Slow=
Very slow= Very slow=
Painfully slow= Painfully slow=
Mining durability: @1=
Block breaking strength: @1= Block breaking strength: @1=
@1 uses= @1 uses=
Unlimited uses= Unlimited uses=

View File

@ -35,7 +35,7 @@ local function newline(str)
end end
-- Digging capabilities of tool -- Digging capabilities of tool
tt.register_snippet(function(itemstring, toolcaps) tt.register_snippet(function(itemstring, toolcaps, itemstack)
local def = minetest.registered_items[itemstring] local def = minetest.registered_items[itemstring]
if not toolcaps then if not toolcaps then
return return
@ -85,7 +85,12 @@ tt.register_snippet(function(itemstring, toolcaps)
if def._doc_items_durability == nil and base_uses > 0 then if def._doc_items_durability == nil and base_uses > 0 then
local real_uses = base_uses * math.pow(3, maxlevel) local real_uses = base_uses * math.pow(3, maxlevel)
if real_uses < 65535 then 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 else
miningusesstr = S("Unlimited uses") miningusesstr = S("Unlimited uses")
end end
@ -95,7 +100,7 @@ tt.register_snippet(function(itemstring, toolcaps)
capstr = capstr .. S("Mining speed: @1", speedstr) .. "\n" capstr = capstr .. S("Mining speed: @1", speedstr) .. "\n"
end end
if miningusesstr ~= "" then if miningusesstr ~= "" then
capstr = capstr .. S("Mining durability: @1", miningusesstr) .. "\n" capstr = capstr .. S("Durability: @1", miningusesstr) .. "\n"
end end
-- Only show one group at max -- Only show one group at max

View File

@ -25,6 +25,7 @@ tt.register_snippet(function(itemstring)
end end
return s return s
end) end)
tt.register_snippet(function(itemstring, _, itemstack) tt.register_snippet(function(itemstring, _, itemstack)
--local def = minetest.registered_items[itemstring] --local def = minetest.registered_items[itemstring]
local s = "" local s = ""
@ -34,13 +35,18 @@ tt.register_snippet(function(itemstring, _, itemstack)
s = s .. S("Armor points: @1", pts) s = s .. S("Armor points: @1", pts)
s = s .. "\n" s = s .. "\n"
end end
local remaining_uses = use
if itemstack then if itemstack then
local unbreaking = mcl_enchanting.get_enchantment(itemstack, "unbreaking") local unbreaking = mcl_enchanting.get_enchantment(itemstack, "unbreaking")
if unbreaking > 0 then if unbreaking > 0 then
use = math.floor(use / (0.6 + 0.4 / (unbreaking + 1))) use = math.floor(use / (0.6 + 0.4 / (unbreaking + 1)))
end end
remaining_uses = math.round(use - (itemstack:get_wear() * use) / 65535)
end end
if use > 0 then 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) s = s .. S("Armor durability: @1", use)
end end
if s == "" then if s == "" then
@ -109,6 +115,9 @@ end)
tt.register_snippet(function(itemstring, _, itemstack) tt.register_snippet(function(itemstring, _, itemstack)
if itemstring:sub(1, 23) == "mcl_fishing:fishing_rod" or itemstring:sub(1, 12) == "mcl_bows:bow" then 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
end) end)

View File

@ -227,6 +227,7 @@ local dispenserdef = {
entity.gotten = true entity.gotten = true
minetest.sound_play("mcl_tools_shears_cut", { pos = pos }, true) minetest.sound_play("mcl_tools_shears_cut", { pos = pos }, true)
stack:add_wear(65535 / stackdef._mcl_diggroups.shearsy.uses) stack:add_wear(65535 / stackdef._mcl_diggroups.shearsy.uses)
tt.reload_itemstack_description(stack) -- update tooltip
inv:set_stack("main", stack_id, stack) inv:set_stack("main", stack_id, stack)
break break
end end

View File

@ -300,6 +300,7 @@ controls.register_on_release(function(player, key, time)
durability = durability * (unbreaking + 1) durability = durability * (unbreaking + 1)
end end
wielditem:add_wear(65535/durability) wielditem:add_wear(65535/durability)
tt.reload_itemstack_description(wielditem) -- update tooltip
end end
player:set_wielded_item(wielditem) player:set_wielded_item(wielditem)
reset_bow_state(player, true) reset_bow_state(player, true)

View File

@ -350,6 +350,7 @@ controls.register_on_press(function(player, key, time)
durability = durability / 3 durability = durability / 3
end end
wielditem:add_wear(65535/durability) wielditem:add_wear(65535/durability)
tt.reload_itemstack_description(wielditem) -- update tooltip
end end
player:set_wielded_item(wielditem) player:set_wielded_item(wielditem)
reset_bow_state(player, true) reset_bow_state(player, true)

View File

@ -323,6 +323,7 @@ function mcl_campfires.register_campfire(name, def)
local wear = mcl_autogroup.get_wear(toolname, "shovely") local wear = mcl_autogroup.get_wear(toolname, "shovely")
if wear then if wear then
itemstack:add_wear(wear) itemstack:add_wear(wear)
tt.reload_itemstack_description(itemstack) -- update tooltip
end end
end end
node.name = name node.name = name

View File

@ -485,6 +485,7 @@ mcl_experience.register_on_add_xp(function(player, xp)
end end
stack:set_wear(math.floor(new_wear)) stack:set_wear(math.floor(new_wear))
tt.reload_itemstack_description(stack) -- update tooltip
inv:set_stack(list, index, stack) inv:set_stack(list, index, stack)
end end

View File

@ -43,6 +43,7 @@ local hoe_on_place_function = function(wear_divisor)
if create_soil(pointed_thing.under, user:get_inventory()) then if create_soil(pointed_thing.under, user:get_inventory()) then
if not minetest.is_creative_enabled(user:get_player_name()) then if not minetest.is_creative_enabled(user:get_player_name()) then
itemstack:add_wear(65535/wear_divisor) itemstack:add_wear(65535/wear_divisor)
tt.reload_itemstack_description(itemstack) -- update tooltip
end end
return itemstack return itemstack
end end

View File

@ -1,6 +1,7 @@
--Fishing Rod, Bobber, and Flying Bobber mechanics and Bobber artwork by Rootyjr. --Fishing Rod, Bobber, and Flying Bobber mechanics and Bobber artwork by Rootyjr.
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
local FISHING_ROD_DURABILITY = 65
local bobber_ENTITY={ local bobber_ENTITY={
physical = false, physical = false,
@ -38,7 +39,7 @@ local fish = function(itemstack, player, pointed_thing)
local ent = nil local ent = nil
local noent = true local noent = true
local durability = 65 local durability = FISHING_ROD_DURABILITY
local unbreaking = mcl_enchanting.get_enchantment(itemstack, "unbreaking") local unbreaking = mcl_enchanting.get_enchantment(itemstack, "unbreaking")
if unbreaking > 0 then if unbreaking > 0 then
durability = durability * (unbreaking + 1) 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 if not minetest.is_creative_enabled(player:get_player_name()) then
local idef = itemstack:get_definition() local idef = itemstack:get_definition()
itemstack:add_wear(65535/durability) -- 65 uses 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 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) minetest.sound_play(idef.sound.breaks, {pos=player:get_pos(), gain=0.5}, true)
end end
@ -154,6 +156,7 @@ local fish = function(itemstack, player, pointed_thing)
if not minetest.is_creative_enabled(player:get_player_name()) then if not minetest.is_creative_enabled(player:get_player_name()) then
local idef = itemstack:get_definition() local idef = itemstack:get_definition()
itemstack:add_wear((65535/durability)*2) -- if so and not creative then wear double like in MC. 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 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) minetest.sound_play(idef.sound.breaks, {pos=player:get_pos(), gain=0.5}, true)
end end

View File

@ -186,6 +186,7 @@ local make_grass_path = function(itemstack, placer, pointed_thing)
local wear = mcl_autogroup.get_wear(toolname, "shovely") local wear = mcl_autogroup.get_wear(toolname, "shovely")
if wear then if wear then
itemstack:add_wear(wear) itemstack:add_wear(wear)
tt.reload_itemstack_description(itemstack) -- update tooltip
end end
end end
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above, max_hear_distance = 16}, true) 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") local wear = mcl_autogroup.get_wear(toolname, "shovely")
if wear then if wear then
itemstack:add_wear(wear) itemstack:add_wear(wear)
tt.reload_itemstack_description(itemstack) -- update tooltip
end end
end end
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = above, max_hear_distance = 16}, true) 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") local wear = mcl_autogroup.get_wear(toolname, "shearsy")
if wear then if wear then
itemstack:add_wear(wear) itemstack:add_wear(wear)
tt.reload_itemstack_description(itemstack) -- update tooltip
end end
end end
@ -420,6 +423,7 @@ local function make_stripped_trunk(itemstack, placer, pointed_thing)
local wear = mcl_autogroup.get_wear(toolname, "axey") local wear = mcl_autogroup.get_wear(toolname, "axey")
if wear then if wear then
itemstack:add_wear(wear) itemstack:add_wear(wear)
tt.reload_itemstack_description(itemstack) -- update tooltip
end end
end end
end end