Hide full punch interval if not a weapon
This commit is contained in:
parent
6338dc6457
commit
0caac1361c
27
init.lua
27
init.lua
@ -146,22 +146,15 @@ local burntime_to_text = function(burntime)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--[[ Convert tool capabilities to readable text. Extracted information:
|
--[[ Convert tool capabilities to readable text. Extracted information:
|
||||||
* Full punch interval
|
|
||||||
* Mining capabilities
|
* Mining capabilities
|
||||||
* Durability (when mining
|
* Durability (when mining
|
||||||
|
* Full punch interval
|
||||||
* Damage groups
|
* Damage groups
|
||||||
]]
|
]]
|
||||||
local toolcaps_to_text = function(tool_capabilities, check_uses)
|
local toolcaps_to_text = function(tool_capabilities, check_uses)
|
||||||
local formstring = ""
|
local formstring = ""
|
||||||
if check_uses == nil then check_uses = false end
|
if check_uses == nil then check_uses = false end
|
||||||
if tool_capabilities ~= nil and tool_capabilities ~= {} then
|
if tool_capabilities ~= nil and tool_capabilities ~= {} then
|
||||||
local punch = 1.0
|
|
||||||
if tool_capabilities.full_punch_interval ~= nil then
|
|
||||||
punch = tool_capabilities.full_punch_interval
|
|
||||||
end
|
|
||||||
formstring = formstring .. S("Full punch interval: @1 s", string.format("%.1f", punch))
|
|
||||||
formstring = formstring .. "\n\n"
|
|
||||||
|
|
||||||
local groupcaps = tool_capabilities.groupcaps
|
local groupcaps = tool_capabilities.groupcaps
|
||||||
if groupcaps ~= nil then
|
if groupcaps ~= nil then
|
||||||
local miningcapstr = ""
|
local miningcapstr = ""
|
||||||
@ -200,12 +193,12 @@ local toolcaps_to_text = function(tool_capabilities, check_uses)
|
|||||||
maxtimestr = string.format("%.1f", maxtime)
|
maxtimestr = string.format("%.1f", maxtime)
|
||||||
if mintimestr ~= maxtimestr then
|
if mintimestr ~= maxtimestr then
|
||||||
miningtimesstr = miningtimesstr ..
|
miningtimesstr = miningtimesstr ..
|
||||||
S("• @1, rating @2: @3s-@4s",
|
S("• @1, rating @2: @3 s - @4 s",
|
||||||
doc.sub.items.get_group_name(k), rating,
|
doc.sub.items.get_group_name(k), rating,
|
||||||
mintimestr, maxtimestr)
|
mintimestr, maxtimestr)
|
||||||
else
|
else
|
||||||
miningtimesstr = miningtimesstr ..
|
miningtimesstr = miningtimesstr ..
|
||||||
S("• @1, rating @2: @3s",
|
S("• @1, rating @2: @3 s",
|
||||||
doc.sub.items.get_group_name(k), rating,
|
doc.sub.items.get_group_name(k), rating,
|
||||||
mintimestr)
|
mintimestr)
|
||||||
end
|
end
|
||||||
@ -247,14 +240,26 @@ local toolcaps_to_text = function(tool_capabilities, check_uses)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Weapon data
|
||||||
local damage_groups = tool_capabilities.damage_groups
|
local damage_groups = tool_capabilities.damage_groups
|
||||||
if damage_groups ~= nil then
|
if damage_groups ~= nil then
|
||||||
formstring = formstring .. S("This is a melee weapon which deals damage by punching.\nMaximum damage per hit:\n")
|
formstring = formstring .. S("This is a melee weapon which deals damage by punching.") .. "\n"
|
||||||
|
-- Damage groups
|
||||||
|
formstring = formstring .. S("Maximum damage per hit:") .. "\n"
|
||||||
for k,v in pairs(damage_groups) do
|
for k,v in pairs(damage_groups) do
|
||||||
formstring = formstring .. S("• @1: @2 HP", doc.sub.items.get_group_name(k), v)
|
formstring = formstring .. S("• @1: @2 HP", doc.sub.items.get_group_name(k), v)
|
||||||
formstring = formstring .. "\n"
|
formstring = formstring .. "\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Full punch interval
|
||||||
|
local punch = 1.0
|
||||||
|
if tool_capabilities.full_punch_interval ~= nil then
|
||||||
|
punch = tool_capabilities.full_punch_interval
|
||||||
|
end
|
||||||
|
formstring = formstring .. S("Full punch interval: @1 s", string.format("%.1f", punch))
|
||||||
|
formstring = formstring .. "\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
return formstring
|
return formstring
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user