diff options
author | Wuzzy <almikes@aol.com> | 2016-07-24 15:04:48 +0200 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-07-24 15:04:48 +0200 |
commit | 189e7da46fd690ca36d8f5bd1818047e2f2512cc (patch) | |
tree | 766e5484f734dfad15e2ab3e2279389528d98653 /init.lua | |
parent | 09ce7b83fbcfcb11c152fe5fd04c2c70abf2c82f (diff) |
Fix crash for tools w/ partly defined capabilities
Diffstat (limited to 'init.lua')
-rw-r--r-- | init.lua | 26 |
1 files changed, 19 insertions, 7 deletions
@@ -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 |