mirror of
				https://github.com/minetest-mods/craftguide.git
				synced 2025-10-25 19:45:27 +02:00 
			
		
		
		
	Compare commits
	
		
			7 Commits
		
	
	
		
			a7d5653d8f
			...
			5b91f9f171
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 5b91f9f171 | ||
|  | 54e6406e53 | ||
|  | 917dd8714f | ||
|  | 6ef7dda7de | ||
|  | a3c41cbd8d | ||
|  | 3866c41ab9 | ||
|  | e2c13c4d27 | 
							
								
								
									
										92
									
								
								init.lua
									
									
									
									
									
								
							
							
						
						
									
										92
									
								
								init.lua
									
									
									
									
									
								
							| @@ -147,6 +147,11 @@ craftguide.group_stereotypes = { | |||||||
| 	wool = "wool:white", | 	wool = "wool:white", | ||||||
| 	wood = "default:wood", | 	wood = "default:wood", | ||||||
| 	tree = "default:tree", | 	tree = "default:tree", | ||||||
|  | 	sand = "default:sand", | ||||||
|  | 	glass = "default:glass", | ||||||
|  | 	stick = "default:stick", | ||||||
|  | 	stone = "default:stone", | ||||||
|  | 	leaves = "default:leaves", | ||||||
| 	coal = "default:coal_lump", | 	coal = "default:coal_lump", | ||||||
| 	vessel = "vessels:glass_bottle", | 	vessel = "vessels:glass_bottle", | ||||||
| 	flower = "flowers:dandelion_yellow", | 	flower = "flowers:dandelion_yellow", | ||||||
| @@ -155,20 +160,20 @@ craftguide.group_stereotypes = { | |||||||
| } | } | ||||||
|  |  | ||||||
| local group_names = { | local group_names = { | ||||||
| 	carpet = S"Any carpet", |  | ||||||
| 	coal = S"Any coal", |  | ||||||
| 	dye = S"Any dye", | 	dye = S"Any dye", | ||||||
| 	flower = S"Any flower", | 	coal = S"Any coal", | ||||||
| 	glass = S"Any glass", |  | ||||||
| 	leaves = S"Any leaves", |  | ||||||
| 	mushroom = S"Any mushroom", |  | ||||||
| 	sand = S"Any sand", | 	sand = S"Any sand", | ||||||
| 	stick = S"Any stick", |  | ||||||
| 	stone = S"Any kind of stone block", |  | ||||||
| 	tree = S"Any tree", | 	tree = S"Any tree", | ||||||
| 	vessel = S"Any vessel", |  | ||||||
| 	wool = S"Any wool", | 	wool = S"Any wool", | ||||||
|  | 	glass = S"Any glass", | ||||||
|  | 	stick = S"Any stick", | ||||||
|  | 	stone = S"Any stone", | ||||||
|  | 	carpet = S"Any carpet", | ||||||
|  | 	flower = S"Any flower", | ||||||
|  | 	leaves = S"Any leaves", | ||||||
|  | 	vessel = S"Any vessel", | ||||||
| 	wood = S"Any wood planks", | 	wood = S"Any wood planks", | ||||||
|  | 	mushroom = S"Any mushroom", | ||||||
|  |  | ||||||
| 	["color_red,flower"] = S"Any red flower", | 	["color_red,flower"] = S"Any red flower", | ||||||
| 	["color_blue,flower"] = S"Any blue flower", | 	["color_blue,flower"] = S"Any blue flower", | ||||||
| @@ -627,68 +632,50 @@ local function cache_usages(item) | |||||||
| end | end | ||||||
|  |  | ||||||
| local function drop_table(name, drop) | local function drop_table(name, drop) | ||||||
| 	local drop_sure, drop_maybe = {}, {} | 	local count_sure = 0 | ||||||
| 	local drop_items = drop.items or {} | 	local drop_items = drop.items or {} | ||||||
|  | 	local max_items = drop.max_items | ||||||
|  |  | ||||||
| 	for i = 1, #drop_items do | 	for i = 1, #drop_items do | ||||||
| 		local di = drop_items[i] | 		local di = drop_items[i] | ||||||
|  | 		local valid_rarity = di.rarity and di.rarity > 1 | ||||||
|  |  | ||||||
|  | 		if di.rarity or not max_items or | ||||||
|  | 				(max_items and not di.rarity and count_sure < max_items) then | ||||||
| 			for j = 1, #di.items do | 			for j = 1, #di.items do | ||||||
| 				local dstack = ItemStack(di.items[j]) | 				local dstack = ItemStack(di.items[j]) | ||||||
| 				local dname  = dstack:get_name() | 				local dname  = dstack:get_name() | ||||||
| 				local dcount = dstack:get_count() | 				local dcount = dstack:get_count() | ||||||
|  | 				local empty  = dstack:is_empty() | ||||||
|  |  | ||||||
| 			if not dstack:is_empty() and (dname ~= name or | 				if not empty and (dname ~= name or | ||||||
| 						(dname == name and dcount > 1)) then | 						(dname == name and dcount > 1)) then | ||||||
| 				if not di.rarity or di.rarity <= 1 then | 					local rarity = valid_rarity and di.rarity | ||||||
| 					if drop_sure[dname] then |  | ||||||
| 						if dcount > drop_sure[dname].output then |  | ||||||
| 							dcount = dcount + drop_sure[dname].output |  | ||||||
| 						else |  | ||||||
| 							dcount = drop_sure[dname].output |  | ||||||
| 						end |  | ||||||
| 					end |  | ||||||
|  |  | ||||||
| 					drop_sure[dname] = { | 					craftguide.register_craft{ | ||||||
| 						output = dcount, | 						type   = rarity and "digging_chance" or "digging", | ||||||
| 						tools  = di.tools, | 						items  = {name}, | ||||||
| 					} | 						output = fmt("%s %u", dname, dcount), | ||||||
| 				else | 						rarity = rarity, | ||||||
| 					drop_maybe[#drop_maybe + 1] = { |  | ||||||
| 						item   = dname, |  | ||||||
| 						output = dcount, |  | ||||||
| 						rarity = di.rarity, |  | ||||||
| 						tools  = di.tools, | 						tools  = di.tools, | ||||||
| 					} | 					} | ||||||
| 				end | 				end | ||||||
| 			end | 			end | ||||||
| 		end | 		end | ||||||
| 	end |  | ||||||
|  |  | ||||||
| 	for item, data in pairs(drop_sure) do | 		if not di.rarity then | ||||||
| 		craftguide.register_craft{ | 			count_sure = count_sure + 1 | ||||||
| 			type   = "digging", |  | ||||||
| 			items  = {name}, |  | ||||||
| 			output = fmt("%s %u", item, data.output), |  | ||||||
| 			tools  = data.tools, |  | ||||||
| 		} |  | ||||||
| 		end | 		end | ||||||
|  |  | ||||||
| 	for _, data in ipairs(drop_maybe) do |  | ||||||
| 		craftguide.register_craft{ |  | ||||||
| 			type   = "digging_chance", |  | ||||||
| 			items  = {name}, |  | ||||||
| 			output = fmt("%s %u", data.item, data.output), |  | ||||||
| 			rarity = data.rarity, |  | ||||||
| 			tools  = data.tools, |  | ||||||
| 		} |  | ||||||
| 	end | 	end | ||||||
| end | end | ||||||
|  |  | ||||||
| local function cache_drops(name, drop) | local function cache_drops(name, drop) | ||||||
| 	if true_str(drop) then | 	if true_str(drop) then | ||||||
| 		local dstack = ItemStack(drop) | 		local dstack = ItemStack(drop) | ||||||
| 		if not dstack:is_empty() and dstack:get_name() ~= name then | 		local dname  = dstack:get_name() | ||||||
|  | 		local empty  = dstack:is_empty() | ||||||
|  |  | ||||||
|  | 		if not empty and dname ~= name then | ||||||
| 			craftguide.register_craft{ | 			craftguide.register_craft{ | ||||||
| 				type = "digging", | 				type = "digging", | ||||||
| 				items = {name}, | 				items = {name}, | ||||||
| @@ -1258,13 +1245,12 @@ local function get_panels(lang_code, query_item, recipes, usages, show_usages, | |||||||
| 			-0.2 + spacing, panel.height, PNG.bg_full, 10) | 			-0.2 + spacing, panel.height, PNG.bg_full, 10) | ||||||
|  |  | ||||||
| 		if recipe_or_usage and not rn then | 		if recipe_or_usage and not rn then | ||||||
| 			local X = XOFFSET - 0.7 | 			local lbl = is_recipe and ES"No recipes" or ES"No usages" | ||||||
| 			local Y = YOFFSET - 0.4 + spacing |  | ||||||
|  |  | ||||||
| 			fs[#fs + 1] = fmt(FMT.image, X, Y, 2, 2, PNG.nothing) | 			fs[#fs + 1] = fmt(FMT.hypertext, | ||||||
|  | 				8.29, YOFFSET + spacing + 0.3, 6.8, 1, | ||||||
| 			fs[#fs + 1] = fmt(FMT.tooltip, | 				fmt("<center><style size=20><b>%s</b></style></center>", | ||||||
| 				X, Y, 2, 2, is_recipe and ES"No recipes" or ES"No usages") | 					translate(lang_code, lbl))) | ||||||
|  |  | ||||||
| 		elseif panel.name == "title" then | 		elseif panel.name == "title" then | ||||||
| 			get_title_fs(query_item, lang_code, favs, fs, spacing) | 			get_title_fs(query_item, lang_code, favs, fs, spacing) | ||||||
| @@ -1359,7 +1345,7 @@ local function make_fs(data) | |||||||
|  |  | ||||||
| 		fs[#fs + 1] = fmt(FMT.hypertext, | 		fs[#fs + 1] = fmt(FMT.hypertext, | ||||||
| 			0.05, 3, 8.29, 1, | 			0.05, 3, 8.29, 1, | ||||||
| 			fmt("<center><style size=20><b>%s</b></style></center>]", | 			fmt("<center><style size=20><b>%s</b></style></center>", | ||||||
| 				translate(data.lang_code, lbl))) | 				translate(data.lang_code, lbl))) | ||||||
| 	end | 	end | ||||||
|  |  | ||||||
|   | |||||||
| @@ -27,7 +27,7 @@ Any dark grey dye= | |||||||
| Any green dye= | Any green dye= | ||||||
| Any green flower= | Any green flower= | ||||||
| Any grey dye= | Any grey dye= | ||||||
| Any kind of stone block= | Any stone= | ||||||
| Any magenta dye= | Any magenta dye= | ||||||
| Any orange dye= | Any orange dye= | ||||||
| Any orange flower= | Any orange flower= | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user