diff options
| -rw-r--r-- | API.md | 9 | ||||
| -rw-r--r-- | init.lua | 16 | 
2 files changed, 21 insertions, 4 deletions
@@ -298,6 +298,15 @@ the item is not in creative inventory.  to the group `in_doc=1` (see above). Only use this function when you can  not use groups. +### `doc.sub.items.add_suppressed_item_entries(itemstrings)` +Adds items which will be forced to **not** be added to the entry list. + +`itemstrings` is a table of itemstrings of items to force the entries for. + +***Note***: The recommended way to suppress item entries is by adding the +item to the group `not_in_doc=1` (see above). Only use this function when you +can not use groups. +  ### `doc.sub.items.add_item_name_overrides(itemstrings)`  Overrides the entry names of entries to the provided names. By default,  each entry name equals the item's `description` field. @@ -13,6 +13,7 @@ doc.sub.items.temp.eat_bad = "Hold it in your hand, then leftclick to eat it. Bu  local groupdefs = {}  local mininggroups = {}  local miscgroups = {} +-- List of forcefully added (true) and hidden (false) items  local forced_items = {  	["air"] = true,  } @@ -710,7 +711,7 @@ function doc.sub.items.add_notable_groups(groupnames)  	end  end --- Add item which will be forced to be added to the item list, +-- Add items which will be forced to be added to the item list,  -- even if the item is not in creative inventory  function doc.sub.items.add_forced_item_entries(itemstrings)  	for i=1,#itemstrings do @@ -718,6 +719,13 @@ function doc.sub.items.add_forced_item_entries(itemstrings)  	end  end +-- Add items which will be forced *not* to be added to the item list +function doc.sub.items.add_suppressed_item_entries(itemstrings) +	for i=1,#itemstrings do +		forced_items[itemstrings[i]] = false +	end +end +  -- Register a list of entry names where the entry name should differ  -- from the original item description  function doc.sub.items.add_item_name_overrides(itemstrings) @@ -748,7 +756,7 @@ local function gather_descs()  		else  			name = def.description  		end -		if not (name == nil or name == "" or def.groups.not_in_creative_inventory or def.groups.not_in_doc) or forced then +		if not (name == nil or name == "" or def.groups.not_in_creative_inventory or def.groups.not_in_doc or forced_items[id] == false) or forced then  			if help.longdesc[id] ~= nil then  				ld = help.longdesc[id]  			end @@ -793,7 +801,7 @@ local function gather_descs()  		else  			name = def.description  		end -		if not (name == nil or name == "" or def.groups.not_in_creative_inventory or def.groups.not_in_doc) or forced then +		if not (name == nil or name == "" or def.groups.not_in_creative_inventory or def.groups.not_in_doc or forced_items[id] == false) or forced then  			if help.longdesc[id] ~= nil then  				ld = help.longdesc[id]  			end @@ -824,7 +832,7 @@ local function gather_descs()  		else  			name = def.description  		end -		if not (name == nil or name == "" or def.groups.not_in_creative_inventory or def.groups.not_in_doc) or forced then +		if not (name == nil or name == "" or def.groups.not_in_creative_inventory or def.groups.not_in_doc or forced_items[id] == false) or forced then  			if help.longdesc[id] ~= nil then  				ld = help.longdesc[id]  			end  | 
