From 2e1267b7de777f5c60e79a456f27a94ad47a39c5 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 8 Jun 2017 21:25:41 +0200 Subject: [PATCH] Enable progressive mode for crafting guide --- mods/HELP/mcl_craftguide/init.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/mods/HELP/mcl_craftguide/init.lua b/mods/HELP/mcl_craftguide/init.lua index 8b2ca598a3..45314251e7 100644 --- a/mods/HELP/mcl_craftguide/init.lua +++ b/mods/HELP/mcl_craftguide/init.lua @@ -1,7 +1,13 @@ mcl_craftguide = {} local craftguide, datas, mt = {}, {}, minetest -local progressive_mode = mt.setting_getbool("craftguide_progressive_mode") +-- Progressive Mode: +-- true: Only show recipes which include at least one of the items the player posesses +-- false: Show all crafting recipes +local progressive_mode = true +if mt.setting_getbool("craftguide_progressive_mode") == false then + progressive_mode = false +end local get_recipe = mt.get_craft_recipe local get_result, show_formspec = mt.get_craft_result, mt.show_formspec local reg_items = mt.registered_items @@ -365,7 +371,7 @@ function craftguide:recipe_in_inv(inv, item_name, recipes_f) local show_item_recipes = {} for i=1, #recipes do - show_item_recipes[i] = true + show_item_recipes[i] = false for _, item in pairs(recipes[i].items) do local group_in_inv = false if item:sub(1,6) == "group:" then @@ -376,8 +382,8 @@ function craftguide:recipe_in_inv(inv, item_name, recipes_f) end end end - if not group_in_inv and not item_in_inv(inv, item) then - show_item_recipes[i] = false + if group_in_inv or item_in_inv(inv, item) then + show_item_recipes[i] = true end end end