Skip to content

Commit

Permalink
Tooltips: add Durability info. Relates to #1602
Browse files Browse the repository at this point in the history
  • Loading branch information
alek13 committed Dec 12, 2024
1 parent ae2814b commit e767d52
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Damage=Damage
Defense=Defense
Food=Food
Effects=Effects
Durability=Durability

# Properties / Digging
crumbly=crumbly
Expand Down Expand Up @@ -62,6 +63,10 @@ Suffocation=Suffocation
# Food
@1@2 to satiety=@1@2 to satiety

# Durability
# @1: @2 uses=@1: @2 uses


# copy from `tt_base` (`node_info`)
damage on contact=damage on contact
healing on contact=healing on contact
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ Damage=Урон
Defense=Защита
Food=Еда
Effects=Эффекты
Durability=Прочность

# Properties / Digging:
crumbly=сыпучий
cracky=разламывающийся
snappy=непрочный
choppy=рубящийся
fleshy=живой/прокалываемый
fleshy=телесный
explody=взрывающийся
unbreakable=неломающийся
bendy=гнущийся
Expand Down Expand Up @@ -63,6 +64,10 @@ Suffocation=Удушье
# Food
@1@2 to satiety=@1@2 к сытости

# Durability
# @1: @2 uses=@1: @2 использований


# copy from `tt_base` (`node_info`)
damage on contact=урон при контакте
healing on contact=исцеление при контакте
Expand Down
4 changes: 4 additions & 0 deletions mods/lord/Player/Help/lord_tooltips/locale/template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ defense_poison=from poison
# Food
@1@2 to satiety=

# Durability
# @1: @2 uses=


# copy from `tt_base` (`node_info`)
damage on contact=
healing on contact=
Expand Down
3 changes: 2 additions & 1 deletion mods/lord/Player/Help/lord_tooltips/src/lord_tooltips.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ local armor_snippet = require('snippet.armor')
local food_snippet = require('snippet.food')
local buffs_snippet = require('snippet.buffs')
local potions_snippet = require('snippet.potions')
local durability_snippet = require('snippet.durability')


return {
Expand All @@ -16,6 +17,6 @@ return {
tt.register_snippet(food_snippet)
tt.register_snippet(buffs_snippet)
tt.register_snippet(potions_snippet)
-- Прочность: armor_use/wear
tt.register_snippet(durability_snippet)
end,
}
29 changes: 29 additions & 0 deletions mods/lord/Player/Help/lord_tooltips/src/snippet/durability.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
local items, colorize
= minetest.registered_items, minetest.colorize

local S = minetest.get_mod_translator()




--- @param item_string string
--- @return string|nil
return function(item_string)
local tool_capabilities = items[item_string].tool_capabilities
if not tool_capabilities or not tool_capabilities.groupcaps then return nil end

local strength_strings = {}
for group, caps in pairs(tool_capabilities.groupcaps) do
if caps.uses then
local list_item = S('@1: @2', colorize('#bbb', S(group)), caps.uses)
strength_strings[#strength_strings + 1] = '' .. list_item
end
end

return #strength_strings ~= 0
and ('\n' ..
colorize('#ee8', S('Durability')) .. ':\n' ..
table.concat(strength_strings, '\n')
)
or nil
end

0 comments on commit e767d52

Please sign in to comment.