k2 beta recipes

This commit is contained in:
Brevven 2021-12-31 04:19:32 -08:00
parent 56b5ee5fc1
commit 2a33af6b9b
4 changed files with 50 additions and 2 deletions

View file

@ -1,4 +1,9 @@
--------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------
Version: 0.8.0
Date: 2021-12-31
Changes:
- K2 1.2 alternate electronic components recipe
---------------------------------------------------------------------------------------------------
Version: 0.7.4 Version: 0.7.4
Date: 2021-07-26 Date: 2021-07-26
Changes: Changes:

View file

@ -8,6 +8,15 @@ local util = {}
util.me = me util.me = me
util.get_setting = util.me.get_setting util.get_setting = util.me.get_setting
util.titanium_plate = ""
util.titanium_processing = ""
if mods["FactorioExtended-Plus-Core"] then
util.titanium_plate = "titanium-alloy"
else
util.titanium_plate = "titanium-plate"
end
function util.fe_plus(sub) function util.fe_plus(sub)
if mods["FactorioExtended-Plus-"..sub] then if mods["FactorioExtended-Plus-"..sub] then
return true return true
@ -109,7 +118,7 @@ end
-- Add a given quantity of product to a given recipe. -- Add a given quantity of product to a given recipe.
-- Only works for recipes with multiple products -- Only works for recipes with multiple products
function util.add_product(recipe_name, product) function util.add_product(recipe_name, product)
if data.raw.recipe[recipe_name] and data.raw.item[product] then if data.raw.recipe[recipe_name] and (data.raw.item[product[1]] or data.raw.item[product.name]) then
add_product(data.raw.recipe[recipe_name], product) add_product(data.raw.recipe[recipe_name], product)
add_product(data.raw.recipe[recipe_name].normal, product) add_product(data.raw.recipe[recipe_name].normal, product)
add_product(data.raw.recipe[recipe_name].expensive, product) add_product(data.raw.recipe[recipe_name].expensive, product)
@ -274,6 +283,31 @@ function has_ingredient(recipe, ingredient)
return false return false
end end
-- Remove a product from a recipe, WILL NOT remove the only product
function util.remove_product(recipe_name, old)
if me.bypass[recipe_name] then return end
if data.raw.recipe[recipe_name] then
remove_product(data.raw.recipe[recipe_name], old)
remove_product(data.raw.recipe[recipe_name].normal, old)
remove_product(data.raw.recipe[recipe_name].expensive, old)
end
end
function remove_product(recipe, old)
index = -1
if recipe ~= nil and recipe.results ~= nil then
for i, result in pairs(recipe.results) do
if result.name == old or result[1] == old then
index = i
break
end
end
if index > -1 then
table.remove(recipe.results, index)
end
end
end
-- Replace one product with another in a recipe -- Replace one product with another in a recipe
function util.replace_product(recipe_name, old, new) function util.replace_product(recipe_name, old, new)
if data.raw.recipe[recipe_name] then if data.raw.recipe[recipe_name] then
@ -410,4 +444,10 @@ function add_to_product(recipe, product, amount)
end end
end end
function util.add_minable_result(t, name, result)
if data.raw[t] and data.raw[t][name] and data.raw[t][name].minable and data.raw[t][name].minable.results then
table.insert(data.raw[t][name].minable.results, result)
end
end
return util return util

View file

@ -1,6 +1,6 @@
{ {
"name": "bzsilicon", "name": "bzsilicon",
"version": "0.7.4", "version": "0.8.0",
"factorio_version": "1.1", "factorio_version": "1.1",
"title": "Silica & Silicon", "title": "Silica & Silicon",
"author": "Brevven", "author": "Brevven",

View file

@ -139,6 +139,9 @@ if mods["Krastorio2"] then
util.add_effect(util.me.silicon_processing, {type = "unlock-recipe", recipe="silicon-wafer"}) util.add_effect(util.me.silicon_processing, {type = "unlock-recipe", recipe="silicon-wafer"})
util.remove_ingredient("electronic-components", "silicon") util.remove_ingredient("electronic-components", "silicon")
util.add_ingredient("electronic-components", "silicon-wafer", 1) util.add_ingredient("electronic-components", "silicon-wafer", 1)
util.multiply_recipe("electronic-components-lithium", 2)
util.remove_ingredient("electronic-components-lithium", "silicon")
util.add_ingredient("electronic-components-lithium", "silicon-wafer", 3)
util.replace_ingredient("solar-panel", "electronic-circuit", "solar-cell") util.replace_ingredient("solar-panel", "electronic-circuit", "solar-cell")
util.remove_ingredient("solar-panel", "silicon") util.remove_ingredient("solar-panel", "silicon")