From 57adbec0dda387659e7cb26293bdd64a06904161 Mon Sep 17 00:00:00 2001 From: Brevven Date: Mon, 16 Jan 2023 19:22:37 -0800 Subject: [PATCH] crafting efficiency --- changelog.txt | 5 +++++ compatibility/crafting-efficiency.lua | 27 +++++++++++++++++++++++++++ data-updates.lua | 1 + info.json | 2 +- me.lua | 1 + modules.lua | 4 ++-- 6 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 compatibility/crafting-efficiency.lua diff --git a/changelog.txt b/changelog.txt index 9a6c4ac..4e676b8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,9 @@ --------------------------------------------------------------------------------------------------- +Version: 0.1.9 +Date: 2022-01-17 + Features: + - (Beta) Crafting efficiency compatibility +--------------------------------------------------------------------------------------------------- Version: 0.1.8 Date: 2022-12-29 Changes: diff --git a/compatibility/crafting-efficiency.lua b/compatibility/crafting-efficiency.lua new file mode 100644 index 0000000..48c6340 --- /dev/null +++ b/compatibility/crafting-efficiency.lua @@ -0,0 +1,27 @@ +local util = require("data-util"); + +if mods["crafting-efficiency-2"] then + + local eff_data = { + } + + 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] 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 + 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 }, + } + end + end + for recipe, d in pairs(eff_data) do + log("Adding "..recipe.." crafting efficiency") + d.name = recipe:gsub("^%l", string.upper).." efficiency" + CE_Add_Recipe(d, recipe) + end +end diff --git a/data-updates.lua b/data-updates.lua index 882370f..c91001d 100644 --- a/data-updates.lua +++ b/data-updates.lua @@ -6,6 +6,7 @@ require("strange-matter") require("compatibility/248k") require("compatibility/5dims") require("compatibility/sciencecosttweakerm") +require("compatibility/crafting-efficiency") local util = require("data-util"); diff --git a/info.json b/info.json index b6a8e68..5ad7c07 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bzgas", - "version": "0.1.8", + "version": "0.1.9", "factorio_version": "1.1", "title": "Natural Gas", "author": "Brevven", diff --git a/me.lua b/me.lua index 5b97149..e01ec22 100644 --- a/me.lua +++ b/me.lua @@ -2,6 +2,7 @@ local me = {} me.name = "bzgas" me.list = {} +me.recipes = {"bakelite", "phenol", "phenol-from-oil"} -- formaldehyde excluded intentionally for theme function me.finite() -- Krastorio 2 return me.get_setting("kr-finite-oil") diff --git a/modules.lua b/modules.lua index 04fe609..f73fde1 100644 --- a/modules.lua +++ b/modules.lua @@ -1,6 +1,6 @@ -recipes = {"bakelite", "phenol", "phenol-from-oil"} -- formaldehyde excluded intentionally for theme +local util = require("data-util"); -for i, recipe in pairs(recipes) do +for i, recipe in pairs(util.me.recipes) do if data.raw.recipe[recipe] then for j, module in pairs(data.raw.module) do if module.effect then