From e7e4938bfeaf106a6ce9f0134b21eee48336c6f5 Mon Sep 17 00:00:00 2001 From: Nihilistzsche Date: Fri, 10 Feb 2023 17:20:07 -0800 Subject: [PATCH] Everything efficiency. --- compatibility/crafting-efficiency.lua | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/compatibility/crafting-efficiency.lua b/compatibility/crafting-efficiency.lua index 82ee49f..ff1a70f 100644 --- a/compatibility/crafting-efficiency.lua +++ b/compatibility/crafting-efficiency.lua @@ -7,13 +7,22 @@ if mods["crafting-efficiency-2"] then for i, recipe in pairs(util.me.recipes) do -- add remaining recipes with direct items to find the icons - if data.raw.recipe[recipe] and data.raw.item[recipe] and not eff_data[recipe] and - (data.raw.recipe[recipe].main_product or util.get_result_count(recipe) == 1) then + if data.raw.recipe[recipe] and data.raw.item[recipe] and not eff_data[recipe] then + local research_level = 1 + if not data.raw.recipe[recipe].enabled then + for tech, tbl in pairs(data.raw.technology) do + for _, effect in pairs(tbl.effects or {}) do + if effect.type == "unlock-recipe" and effect.recipe == recipe then + research_level = math.min(#tbl.unit.ingredients, 6) + end + end + end + end eff_data[recipe] = { max = 15, icon = data.raw.item[recipe].icon, crafting = { efficiency = 10 }, - research = { level = 6 }, + research = { level = research_level }, } end end