mirror of
https://github.com/lisacvuk/minetest-toolranks.git
synced 2025-01-24 22:50:18 +01:00
minor fixes
* add nil checks for tool groupcaps `uses` and `times` * fix tool description coloring text after it * correct escape for newlines in translation strings
This commit is contained in:
parent
8010feb5bf
commit
4a2551e9f5
9
init.lua
9
init.lua
@ -48,14 +48,15 @@ function toolranks.create_description(name, uses)
|
|||||||
local description = name
|
local description = name
|
||||||
local tooltype = toolranks.get_tool_type(description)
|
local tooltype = toolranks.get_tool_type(description)
|
||||||
local newdesc = S(
|
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,
|
toolranks.colors.green,
|
||||||
description,
|
description,
|
||||||
toolranks.colors.gold,
|
toolranks.colors.gold,
|
||||||
toolranks.get_level(uses),
|
toolranks.get_level(uses),
|
||||||
S(tooltype),
|
S(tooltype),
|
||||||
toolranks.colors.grey,
|
toolranks.colors.grey,
|
||||||
(type(uses) == "number" and uses or 0)
|
(type(uses) == "number" and uses or 0),
|
||||||
|
toolranks.colors.white
|
||||||
)
|
)
|
||||||
return newdesc
|
return newdesc
|
||||||
end
|
end
|
||||||
@ -122,11 +123,15 @@ function toolranks.new_afteruse(itemstack, user, node, digparams)
|
|||||||
caps.punch_attack_uses = caps.punch_attack_uses and (caps.punch_attack_uses * use_multiplier)
|
caps.punch_attack_uses = caps.punch_attack_uses and (caps.punch_attack_uses * use_multiplier)
|
||||||
|
|
||||||
for _,c in pairs(caps.groupcaps) do
|
for _,c in pairs(caps.groupcaps) do
|
||||||
|
if c.uses then
|
||||||
c.uses = c.uses * use_multiplier
|
c.uses = c.uses * use_multiplier
|
||||||
|
end
|
||||||
|
if c.times then
|
||||||
for i,t in ipairs(c.times) do
|
for i,t in ipairs(c.times) do
|
||||||
c.times[i] = t / speed_multiplier
|
c.times[i] = t / speed_multiplier
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
itemmeta:set_tool_capabilities(caps)
|
itemmeta:set_tool_capabilities(caps)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# textdomain: toolranks
|
# 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
|
pickaxe=pickaxe
|
||||||
axe=axe
|
axe=axe
|
||||||
shovel=shovel
|
shovel=shovel
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# textdomain: toolranks
|
# 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
|
pickaxe=pioche
|
||||||
axe=hache
|
axe=hache
|
||||||
shovel=pelle
|
shovel=pelle
|
||||||
|
Loading…
Reference in New Issue
Block a user