From b1f4f38483d19efa88346244e7526abe2a026b27 Mon Sep 17 00:00:00 2001 From: Brevven Date: Sat, 13 Mar 2021 00:18:17 -0800 Subject: [PATCH] change stone usage, add wafer to red circuit --- changelog.txt | 9 +++-- data-updates.lua | 7 ++++ info.json | 2 +- recipe-updates.lua | 9 +++-- recipes/silicon-vulcanite.lua | 5 ++- util.lua | 62 +++++++++++++++++++++++++++++++++++ 6 files changed, 85 insertions(+), 9 deletions(-) diff --git a/changelog.txt b/changelog.txt index d095093..d9e1541 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,8 +1,11 @@ --------------------------------------------------------------------------------------------------- -Version: 0.5.3 -Date: 2021-03-11 +Version: 0.6.0 +Date: 2021-03-13 Changes: - - Bio industries, crushed stone -> silica recipe is smelting now. + - Less silicon (or wafers) needed in processing units + - If using intermediates, wafers now required for advanced circuits + - Increase map's richness of stone slightly. + - Bio industries, crushed stone -> silica recipe is smelting now. More changes to come... --------------------------------------------------------------------------------------------------- Version: 0.5.2 Date: 2021-03-11 diff --git a/data-updates.lua b/data-updates.lua index f178bad..f293176 100644 --- a/data-updates.lua +++ b/data-updates.lua @@ -1,2 +1,9 @@ require("recipe-updates") require("recipes/silicon-vulcanite") + + +local noise = require('noise'); +-- Increase richness of stone a bit +data.raw.resource["stone"].autoplace.richness_expression = + data.raw.resource["stone"].autoplace.richness_expression * noise.to_noise_expression(4/3) + diff --git a/info.json b/info.json index ba25e28..b8d12fc 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bzsilicon", - "version": "0.5.3", + "version": "0.6.0", "factorio_version": "1.1", "title": "Silica & Silicon", "author": "Brevven", diff --git a/recipe-updates.lua b/recipe-updates.lua index 439b512..173dcf5 100644 --- a/recipe-updates.lua +++ b/recipe-updates.lua @@ -11,7 +11,7 @@ if not mods["Krastorio2"] then util.add_prerequisite("concrete", "silica-processing") if util.more_intermediates() then - util.replace_some_ingredient("processing-unit", "electronic-circuit", 10, "silicon-wafer", 5) + util.replace_some_ingredient("processing-unit", "electronic-circuit", 10, "silicon-wafer", 3) util.replace_ingredient("effectivity-module", "electronic-circuit", "silicon-wafer") util.replace_ingredient("productivity-module", "electronic-circuit", "silicon-wafer") util.replace_ingredient("speed-module", "electronic-circuit", "silicon-wafer") @@ -19,10 +19,15 @@ if not mods["Krastorio2"] then util.replace_ingredient("solar-panel", "electronic-circuit", "solar-cell") util.replace_ingredient("solar-panel-equipment", "solar-panel", "solar-cell") util.add_effect("solar-energy", {type = "unlock-recipe", recipe="solar-cell"}) + + + util.multiply_recipe("advanced-circuit", 3) + util.replace_some_ingredient("advanced-circuit", "electronic-circuit", 3, "silicon-wafer", 1) + else util.replace_some_ingredient("solar-panel", "electronic-circuit", 10, "silicon", 10) - util.replace_some_ingredient("processing-unit", "electronic-circuit", 10, "silicon", 10) + util.replace_some_ingredient("processing-unit", "electronic-circuit", 10, "silicon", 6) util.replace_ingredient("effectivity-module", "electronic-circuit", "silicon") util.replace_ingredient("productivity-module", "electronic-circuit", "silicon") util.replace_ingredient("speed-module", "electronic-circuit", "silicon") diff --git a/recipes/silicon-vulcanite.lua b/recipes/silicon-vulcanite.lua index bd7fc3f..9c23be1 100644 --- a/recipes/silicon-vulcanite.lua +++ b/recipes/silicon-vulcanite.lua @@ -29,9 +29,8 @@ if mods["space-exploration"] then results = { {name = "silicon", amount = 3}, }, - icons = - { - { icon = "__bzsilicon__/graphics/icons/silicon.png", icon_size = 64, icon_mipmaps = 3 }, + icons = { + { icon = "__bzsilicon__/graphics/icons/silicon.png", icon_size = 64, icon_mipmaps = 3 }, { icon = "__space-exploration-graphics__/graphics/icons/vulcanite-block.png", icon_size = 64, scale=0.25, shift= {-10, -10}}, }, }, diff --git a/util.lua b/util.lua index b2f72cf..59f6d63 100644 --- a/util.lua +++ b/util.lua @@ -131,4 +131,66 @@ function util.add_effect(technology_name, effect) end end +-- check if a table contains a sought value +function util.contains(table, sought) + for i, value in pairs(table) do + if value == sought then + return true + end + end + return false +end + + +-- multiply the cost, energy, and results of a recipe by a multiple +function util.multiply_recipe(recipe_name, multiple) + multiply_recipe(data.raw.recipe[recipe_name], multiple) + multiply_recipe(data.raw.recipe[recipe_name].normal, multiple) + multiply_recipe(data.raw.recipe[recipe_name].expensive, multiple) +end + +function multiply_recipe(recipe, multiple) + if recipe then + if recipe.energy_required then + recipe.energy_required = recipe.energy_required * multiple + end + if recipe.result_count then + recipe.result_count = recipe.result_count * multiple + end + if recipe.results then + for i, result in pairs(recipe.results) do + if result.name then + if result.amount then + result.amount = result.amount * multiple + end + if result.amount_min ~= nil then + result.amount_min = result.amount_min * multiple + result.amount_max = result.amount_max * multiple + end + if result.catalyst_amount then + result.catalyst_amount = result.catalyst_amount * multiple + end + end + if result[1] then + result[2] = result[2] * multiple + end + end + end + if not recipe.results and not recipe.result_count then + -- implicit one item result + recipe.result_count = multiple + end + if recipe.ingredients then + for i, ingredient in pairs(recipe.ingredients) do + if ingredient.name then + ingredient.amount = ingredient.amount * multiple + end + if ingredient[1] then + ingredient[2] = ingredient[2] * multiple + end + end + end + end +end + return util