diff options
| author | JP Guerrero <jeanpatrick.guerrero@gmail.com> | 2016-12-04 00:30:56 +0100 | 
|---|---|---|
| committer | JP Guerrero <jeanpatrick.guerrero@gmail.com> | 2016-12-04 00:45:48 +0100 | 
| commit | 0c3287a41554244003a7ddf99a7c62a7ca072e60 (patch) | |
| tree | 7bd8d15013b793f79f9b029b3a9ea3aabcf4bdca | |
| parent | ebcedb44b9329335574ff6066743de8782262905 (diff) | |
Fix crash in some specific conditions
| -rw-r--r-- | init.lua | 15 | 
1 files changed, 8 insertions, 7 deletions
@@ -32,22 +32,22 @@ function craftguide:extract_groups(itemstr)  end  function craftguide:get_tooltip(item, recipe_type, cooktime, groups) -	local item_desc = minetest.registered_items[item].description -	local tooltip = "tooltip["..item..";"..((groups and "") or item_desc) - +	local tooltip = ""  	if groups then  		local groupstr = "Any item belonging to the "  		for i=1, #groups do  			groupstr = groupstr..minetest.colorize("#FFFF00", groups[i])..  				   ((groups[i+1] and " and ") or "")  		end -		tooltip = tooltip..groupstr.." group(s)" +		tooltip = "tooltip["..item..";"..groupstr.." group(s)".. +			  ((recipe_type ~= "cooking" and "]") or "")  	end  	if recipe_type == "cooking" then -		tooltip = tooltip.."\nCooking time: "..minetest.colorize("#FFFF00", cooktime) +		tooltip = ((groups and tooltip) or ("tooltip["..item..";")).. +			  ((groups and "") or minetest.registered_items[item].description).. +			  "\nCooking time: "..minetest.colorize("#FFFF00", cooktime).."]"  	end - -	return tooltip.."]" +	return tooltip  end  function craftguide:get_formspec(player_name) @@ -166,6 +166,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)  	else for item in pairs(fields) do  		 if minetest.get_craft_recipe(item).items then  			data.item = item +			data.recipe_num = 1  			craftguide:get_formspec(player_name)  		 end  	     end  | 
