Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ function toolranks.create_description(name, uses)
local description = name
local tooltype = toolranks.get_tool_type(description)
local newdesc = S(
"@1@2\n@3Level @4 @5\n@6@Node dug: @7",
"@1@2\n@3Level @4 @5\n@6Node dug: @7@8",
toolranks.colors.green,
description,
toolranks.colors.gold,
toolranks.get_level(uses),
S(tooltype),
toolranks.colors.grey,
(type(uses) == "number" and uses or 0)
(type(uses) == "number" and uses or 0),
toolranks.colors.white
)
return newdesc
end
Expand Down Expand Up @@ -112,7 +113,7 @@ function toolranks.new_afteruse(itemstack, user, node, digparams)
to_player = pname,
gain = 2.0,
})
-- Make tool better by modifying tool_capabilities (if defined)
-- Make tool better by modifying tool_capabilities (if defined)
if itemdef.tool_capabilities then
local speed_multiplier = 1 + (level * level_multiplier * (max_speed - 1))
local use_multiplier = 1 + (level * level_multiplier * (max_use - 1))
Expand All @@ -122,14 +123,18 @@ function toolranks.new_afteruse(itemstack, user, node, digparams)
caps.punch_attack_uses = caps.punch_attack_uses and (caps.punch_attack_uses * use_multiplier)

for _,c in pairs(caps.groupcaps) do
c.uses = c.uses * use_multiplier
for i,t in ipairs(c.times) do
c.times[i] = t / speed_multiplier
if c.uses then
c.uses = c.uses * use_multiplier
end
if c.times then
for i,t in ipairs(c.times) do
c.times[i] = t / speed_multiplier
end
end
end
itemmeta:set_tool_capabilities(caps)
end
end
end

-- Old method for compatibility with tools without tool_capabilities defined
local wear = digparams.wear
Expand Down
2 changes: 1 addition & 1 deletion locale/toolranks.en.tr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# textdomain: toolranks
@1@2@n@3Level @4 @5@n@6Node dug: @7=@1@2@n@3Level @4 @5@n@6Node dug: @7
@1@2@\n@3Level @4 @5@\n@6Node dug: @7@8=@1@2@\n@3Level @4 @5@\n@6Node dug: @7@8
pickaxe=pickaxe
axe=axe
shovel=shovel
Expand Down
2 changes: 1 addition & 1 deletion locale/toolranks.fr.tr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# textdomain: toolranks
@1@2@n@3Level @4 @5@n@6Node dug: @7=@1@2@n@3@5 niveau @4@n@6Blocks minés : @7
@1@2@\n@3Level @4 @5@\n@6Node dug: @7@8=@1@2@\n@3@5 niveau @4@\n@6Blocks minés : @7@8
pickaxe=pioche
axe=hache
shovel=pelle
Expand Down