diff options
author | Wuzzy <almikes@aol.com> | 2016-08-03 17:54:48 +0200 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-08-03 17:54:48 +0200 |
commit | f6ca0a514ac457e668ac60dcc5366139accaac38 (patch) | |
tree | 43e014964d2f74a0813532de7b7893a88399c1d5 | |
parent | 59409f353271ea5a669cb66da567096a3fd1fa6f (diff) |
Fix nodes being falsely labelled as undiggable
-rw-r--r-- | init.lua | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -244,13 +244,21 @@ doc.new_category("nodes", { formstring = formstring .. "This block decreases your breath and causes a drowning damage of "..data.def.drowning.." hit point every 2 seconds.\n" end + --[[ Check if there are no groups at all, helps for finding undiggable nodes, + -- but this approach might miss some of these; still better than nothing. ]] + local nogroups = true + for k,v in pairs(data.def.groups) do + -- If this is reached once, we know the groups table is not empty + nogroups = false + break + end if data.def.drop ~= "" then if data.def.groups.dig_immediate == 2 then formstring = formstring .. "This block can be mined by any mining tool in half a second.\n" elseif data.def.groups.dig_immediate == 3 then formstring = formstring .. "This block can be mined by any mining tool immediately.\n" -- Note: “unbreakable” is an unofficial group for undiggable blocks - elseif data.def.groups.immortal == 1 or data.def.groups.unbreakable == 1 or #data.def.groups == 0 then + elseif nogroups or data.def.groups.immortal == 1 or data.def.groups.unbreakable == 1 then formstring = formstring .. "This block can not be mined by ordinary mining tools.\n" end else @@ -258,7 +266,7 @@ doc.new_category("nodes", { formstring = formstring .. "This block can be destroyed by any mining tool in half a second.\n" elseif data.def.groups.dig_immediate == 3 then formstring = formstring .. "This block can be destroyed by any mining tool immediately.\n" - elseif data.def.groups.immortal == 1 or data.def.groups.unbreakable == 1 or #data.def.groups == 0 then + elseif nogroups or data.def.groups.immortal == 1 or data.def.groups.unbreakable == 1 then formstring = formstring .. "This block can not be destroyed by ordinary mining tools.\n" end end |