crafting efficiency

This commit is contained in:
Brevven 2023-01-16 18:05:11 -08:00
parent 9a4e1ca235
commit fac1717a43
6 changed files with 41 additions and 18 deletions

View file

@ -1,4 +1,9 @@
---------------------------------------------------------------------------------------------------
Version: 0.7.7
Date: 2022-12-17
Features:
- (Beta) Crafting Efficiency compatibility
---------------------------------------------------------------------------------------------------
Version: 0.7.6
Date: 2022-12-24
Fixes:

View file

@ -0,0 +1,25 @@
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] and not eff_data[recipe] and
(data.raw.recipe[recipe].main_product or util.get_result_count(recipe) == 1) then
eff_data[recipe] = {
max = 15,
icon = data.raw.item[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

View file

@ -5,6 +5,7 @@ require("map-gen-preset-updates")
require("tungsten-recipe-5d")
require("strange-matter")
require("compatibility/248k")
require("compatibility/crafting-efficiency")
local util = require("data-util");

View file

@ -1,6 +1,6 @@
{
"name": "bztungsten",
"version": "0.7.6",
"version": "0.7.7",
"factorio_version": "1.1",
"title": "Tungsten",
"author": "Brevven",

8
me.lua
View file

@ -4,6 +4,13 @@ me.name = "bztungsten"
me.tungsten_ore = "tungsten-ore"
me.tungsten_plate = "tungsten-plate"
me.tungsten_carbide_recipe = "tungsten-carbide"
me.recipes = {me.tungsten_plate, me.tungsten_carbide_recipe, "rocket-engine-nozzle",
"enriched-tungsten-plate",
"enriched-tungsten",
"tungsten-smelting-vulcanite",
"molten-tungsten",
"enriched-tungsten-smelting-vulcanite",
"tungsten-carbide-coal",}
me.tungsten_processing = "tungsten-processing"
if mods.bobplates then
@ -41,7 +48,6 @@ function me.get_setting(name)
end
return settings.startup[name].value
end
me.bypass = {}
if me.get_setting(me.name.."-recipe-bypass") then
for recipe in string.gmatch(me.get_setting(me.name.."-recipe-bypass"), '[^",%s]+') do

View file

@ -1,22 +1,8 @@
-- Enable prod modules for all tungsten plate and ore recipes
local util = require("data-util");
recipes = {"tungsten-plate", "tungsten-carbide", "rocket-engine-nozzle"}
if mods["Krastorio2"] then
table.insert(recipes, "enriched-tungsten-plate")
table.insert(recipes, "enriched-tungsten")
end
if mods["space-exploration"] then
table.insert(recipes, "tungsten-smelting-vulcanite")
table.insert(recipes, "molten-tungsten")
if mods["Krastorio2"] then
table.insert(recipes, "enriched-tungsten-smelting-vulcanite")
end
end
if data.raw.recipe["tungsten-carbide-coal"] then
table.insert(recipes, "tungsten-carbide-coal")
end
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