mirror of
https://github.com/minetest-mods/unified_inventory.git
synced 2024-12-29 04:00:24 +01:00
When in surrival, pressing item list button will switch to Crafting Guide
This commit is contained in:
parent
faffd2ae65
commit
2fa07f5c30
@ -357,6 +357,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||||||
for i=0,80,1 do
|
for i=0,80,1 do
|
||||||
local button="item_button"..list_index
|
local button="item_button"..list_index
|
||||||
if fields[button] then
|
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
|
if page=="craftguide" then
|
||||||
unified_inventory.current_item[player_name] = unified_inventory.filtered_items_list[player_name][list_index]
|
unified_inventory.current_item[player_name] = unified_inventory.filtered_items_list[player_name][list_index]
|
||||||
unified_inventory.alternate[player_name] = 1
|
unified_inventory.alternate[player_name] = 1
|
||||||
@ -502,22 +506,15 @@ unified_inventory.update_recipe = function(player, stack_name, alternate)
|
|||||||
local itemstack = ItemStack(craft.output)
|
local itemstack = ItemStack(craft.output)
|
||||||
inv:set_stack("output", 1, itemstack)
|
inv:set_stack("output", 1, itemstack)
|
||||||
|
|
||||||
-- cook
|
-- cook, fuel, grinding recipes
|
||||||
if craft.type == "cooking" then
|
if craft.type == "cooking" or craft.type == "fuel" or craft.type == "grinding" then
|
||||||
def=unified_inventory.find_item_def(craft.recipe)
|
def=unified_inventory.find_item_def(craft.recipe)
|
||||||
if def then
|
if def then
|
||||||
inv:set_stack("build", 1, def)
|
inv:set_stack("build", 1, def)
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
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)
|
-- build (shaped or shapeless)
|
||||||
if craft.recipe[1] then
|
if craft.recipe[1] then
|
||||||
def=unified_inventory.find_item_def(craft.recipe[1])
|
def=unified_inventory.find_item_def(craft.recipe[1])
|
||||||
|
Loading…
Reference in New Issue
Block a user