diff options
| author | Wuzzy <almikes@aol.com> | 2016-12-16 13:42:10 +0100 | 
|---|---|---|
| committer | Wuzzy <almikes@aol.com> | 2016-12-16 13:43:40 +0100 | 
| commit | dbdbc54321031485fca8084dd3c867ca2f6bdd8e (patch) | |
| tree | 74c3e8a7e11f0a6e59edee03398d5a2763685fbe /init.lua | |
| parent | 3edeabd1fda551f1528ee8af884e10fdfebadf5c (diff) | |
Automatically collect all crafting groups
Diffstat (limited to 'init.lua')
| -rw-r--r-- | init.lua | 20 | 
1 files changed, 19 insertions, 1 deletions
| @@ -52,7 +52,7 @@ local groups_to_string = function(grouptable, filter)  	local gstring = ""  	local groups_count = 0  	for id, value in pairs(grouptable) do -		if groupdefs[id] ~= nil and (filter == nil or filter[id] == true) then +		if (filter == nil or filter[id] == true) then  			-- Readable group name  			if groups_count > 0 then  				-- List seperator @@ -1064,6 +1064,24 @@ local function gather_descs()  		end  	end +	-- ... and gather all groups which appear in crafting recipes +	for id, def in pairs(minetest.registered_items) do +		local crafts = minetest.get_all_craft_recipes(id) +		if crafts ~= nil then +			for c=1,#crafts do +				for k,v in pairs(crafts[c].items) do +					if string.sub(v,1,6) == "group:" then +						local groupstring = string.sub(v,7,-1) +						local groups = string.split(groupstring, ",") +						for g=1, #groups do +							miscgroups[groups[g]] = true +						end +					end +				end +			end +		end +	end +  	-- 2nd pass: Add entries  	-- Set default air text | 
