diff options
| author | RealBadAngel <mk@realbadangel.pl> | 2012-12-12 15:52:01 +0100 | 
|---|---|---|
| committer | RealBadAngel <mk@realbadangel.pl> | 2012-12-12 15:52:01 +0100 | 
| commit | 2fa07f5c30524d4d0c3c62d29a8e780e6a1fd710 (patch) | |
| tree | 099b1cea07a4ed7ac098e9effea366712e5d1cbd | |
| parent | faffd2ae65183f603d8894987d8d1010a1311acf (diff) | |
When in surrival, pressing item list button will switch to Crafting Guide
| -rw-r--r-- | unified_inventory/unified_inventory/api.lua | 17 | 
1 files changed, 7 insertions, 10 deletions
diff --git a/unified_inventory/unified_inventory/api.lua b/unified_inventory/unified_inventory/api.lua index c2fe3fc..b6d3676 100644 --- a/unified_inventory/unified_inventory/api.lua +++ b/unified_inventory/unified_inventory/api.lua @@ -357,6 +357,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)  	for i=0,80,1 do  		local button="item_button"..list_index  		if fields[button] then  +			if minetest.setting_getbool("creative_mode")==false then +				unified_inventory.set_inventory_formspec(player, unified_inventory.get_formspec(player,"craftguide")) +				page="craftguide" +				end			  			if page=="craftguide" then   				unified_inventory.current_item[player_name] = unified_inventory.filtered_items_list[player_name][list_index]   				unified_inventory.alternate[player_name] = 1 @@ -502,22 +506,15 @@ unified_inventory.update_recipe = function(player, stack_name, alternate)  	local itemstack = ItemStack(craft.output)  	inv:set_stack("output", 1, itemstack) -	-- cook -	if craft.type == "cooking" then +	-- cook, fuel, grinding recipes +	if craft.type == "cooking" or craft.type == "fuel" or craft.type == "grinding" then  		def=unified_inventory.find_item_def(craft.recipe)  		if def then  			inv:set_stack("build", 1, def)  		end  		return   	end -	-- fuel -	if craft.type == "fuel" then -		def=unified_inventory.find_item_def(craft.recipe) -		if def then -			inv:set_stack("build", 1, def) -		end -		return -	end +	  	-- build (shaped or shapeless)  	if craft.recipe[1] then  		def=unified_inventory.find_item_def(craft.recipe[1])  | 
