diff options
-rw-r--r-- | API.md | 7 | ||||
-rw-r--r-- | init.lua | 14 |
2 files changed, 18 insertions, 3 deletions
@@ -262,6 +262,13 @@ The intention of this function is to give a short rundown of the groups which are notable as they are important to gameplay in some way yet don't deserve a full-blown factoid. +### `doc.sub.items.add_notable_groups(groupnames)` +Declare a number of groups as mining groups, that is, groups which are +primarily used for determining mining times. They will appear in the +“Mining capabilities” factoid. + +`groupnames` is a table of group names. + ### `doc.sub.items.add_forced_item_entries(itemstrings)` Adds items which will be forced to be added to the entry list, even if the item is not in creative inventory. @@ -1,6 +1,7 @@ doc.sub.items = {} local groupdefs = {} +local mininggroups = {} local miscgroups = {} local forced_items = { ["air"] = true, @@ -334,10 +335,10 @@ doc.new_category("nodes", { local mstring = "This block can be mined by mining tools which match any of the following mining ratings and its mining level.\n" mstring = mstring .. "Mining ratings:\n" local minegroupcount = 0 - for g,name in pairs(groupdefs) do - local rating = data.def.groups[g] + for group,_ in pairs(mininggroups) do + local rating = data.def.groups[group] if rating ~= nil then - mstring = mstring .. "- "..name..": "..rating.."\n" + mstring = mstring .. "- "..groupdefs[group]..": "..rating.."\n" minegroupcount = minegroupcount + 1 end end @@ -613,6 +614,13 @@ function doc.sub.items.add_real_group_names(groupnames) end end +-- Declare groups as mining groups +function doc.sub.items.add_mining_groups(groupnames) + for g=1,#groupnames do + mininggroups[groupnames[g]] = true + end +end + -- Adds groups to be displayed in the generic “misc.” groups -- factoid. Those groups should be neither be used as mining -- groups nor as damage groups and should be relevant to the |