summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
authorWuzzy <almikes@aol.com>2016-07-24 15:04:48 +0200
committerWuzzy <almikes@aol.com>2016-07-24 15:04:48 +0200
commit189e7da46fd690ca36d8f5bd1818047e2f2512cc (patch)
tree766e5484f734dfad15e2ab3e2279389528d98653 /init.lua
parent09ce7b83fbcfcb11c152fe5fd04c2c70abf2c82f (diff)
Fix crash for tools w/ partly defined capabilities
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua26
1 files changed, 19 insertions, 7 deletions
diff --git a/init.lua b/init.lua
index eec1ade..157dde6 100644
--- a/init.lua
+++ b/init.lua
@@ -298,19 +298,31 @@ doc.new_category("tools", {
formstring = formstring .. "Range: "..range.."\n"
formstring = formstring .. "\n"
+ if data.def.tool_capabilities.full_punch_interval ~= nil then
+ punch = data.def.tool_capabilities.full_punch_interval
+ end
+
if data.def.tool_capabilities ~= nil and data.def.tool_capabilities ~= {} then
- formstring = formstring .. "Full punch interval: "..data.def.tool_capabilities.full_punch_interval.." s\n"
+ local punch = 1.0
+ if data.def.tool_capabilities.full_punch_interval ~= nil then
+ punch = data.def.tool_capabilities.full_punch_interval
+ end
+ formstring = formstring .. "Full punch interval: "..punch.." s\n"
local groupcaps = data.def.tool_capabilities.groupcaps
- formstring = formstring .. "Groupcaps:\n"
- for k,v in pairs(groupcaps) do
- formstring = formstring .. k .. ": blabla" .. "\n"
+ if groupcaps ~= nil then
+ formstring = formstring .. "Groupcaps:\n"
+ for k,v in pairs(groupcaps) do
+ formstring = formstring .. k .. ": blabla" .. "\n"
+ end
end
- formstring = formstring .. "Damage groups:\n"
local damage_groups = data.def.tool_capabilities.damage_groups
- for k,v in pairs(damage_groups) do
- formstring = formstring .. k .. ": " .. v .. " HP\n"
+ if damage_groups ~= nil then
+ formstring = formstring .. "Damage groups:\n"
+ for k,v in pairs(damage_groups) do
+ formstring = formstring .. k .. ": " .. v .. " HP\n"
+ end
end
end