From 9e0b276e350a796c22174413c3774a614b367a3c Mon Sep 17 00:00:00 2001 From: Brevven Date: Sat, 4 Feb 2023 01:57:04 -0800 Subject: [PATCH] nihilistzsche update to tech recipes --- compatibility/crafting-efficiency.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/compatibility/crafting-efficiency.lua b/compatibility/crafting-efficiency.lua index 48c6340..ae51f03 100644 --- a/compatibility/crafting-efficiency.lua +++ b/compatibility/crafting-efficiency.lua @@ -9,13 +9,24 @@ if mods["crafting-efficiency-2"] then -- add remaining recipes with direct items to find the icons if data.raw.recipe[recipe] and (data.raw.item[recipe] or data.raw.fluid[recipe]) and not eff_data[recipe] and - recipe ~= "phenol" and -- for some reason this doesn't work right now (data.raw.recipe[recipe].main_product or util.get_result_count(recipe) == 1) then + local research_level = 6 + if data.raw.recipe[recipe].enabled then + research_level = 1 + else + 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, research_level) + end + end + end + end eff_data[recipe] = { max = 15, icon = data.raw.item[recipe] and data.raw.item[recipe].icon or data.raw.fluid[recipe].icon, crafting = { efficiency = 10 }, - research = { level = 6 }, + research = { level = research_level }, } end end