From 7b9f0362eb636ec3913b4ca8c31af06541d6fab6 Mon Sep 17 00:00:00 2001 From: Brevven Date: Sat, 22 May 2021 23:54:50 -0700 Subject: [PATCH] recycling --- changelog.txt | 7 +++++++ info.json | 2 +- lead-recipe-updates.lua | 3 ++- util.lua | 16 ++++++++++++++++ 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index df360f6..5428236 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,8 +1,15 @@ --------------------------------------------------------------------------------------------------- +Version: 0.4.4 +Date: 2021-05-21 + Features: + - SE: Lead ore in scrap recycling +--------------------------------------------------------------------------------------------------- Version: 0.4.3 Date: 2021-05-21 Features: - Add option for lead in sulfuric acid introduced on 0.4.0. To be removed in 2022 + Changes: + - Minor pl l10n per TheoMarque --------------------------------------------------------------------------------------------------- Version: 0.4.2 Date: 2021-05-21 diff --git a/info.json b/info.json index 90b5c90..3381c38 100644 --- a/info.json +++ b/info.json @@ -1,6 +1,6 @@ { "name": "bzlead", - "version": "0.4.3", + "version": "0.4.4", "factorio_version": "1.1", "title": "Lead", "author": "Brevven", diff --git a/lead-recipe-updates.lua b/lead-recipe-updates.lua index 352f51f..93f28c0 100644 --- a/lead-recipe-updates.lua +++ b/lead-recipe-updates.lua @@ -29,7 +29,6 @@ if (not mods["pyrawores"] and not mods["bobplates"] and not mods["angelssmelting util.replace_ingredient("shotgun-shell", "iron-plate", "lead-plate") end - -- Krastorio 2 changes if mods["Krastorio2"] then util.add_ingredient("kr-laser-artillery-turret", "lead-plate", 10) @@ -37,6 +36,8 @@ if mods["Krastorio2"] then util.add_ingredient("kr-rocket-turret", "lead-plate", 10) end +util.add_product("se-scrap-recycling", {name="lead-ore", amount=1, probability=0.1}) + if mods["WeaponPack"] then util.replace_ingredient("9x18", "iron-plate", "lead-plate") util.replace_some_ingredient("9x19", "iron-plate", "lead-plate", 1) diff --git a/util.lua b/util.lua index f1ce58b..8963656 100644 --- a/util.lua +++ b/util.lua @@ -133,4 +133,20 @@ function replace_some_ingredient(recipe, old, new, amount) end end +-- Add a given quantity of product to a given recipe. +-- Only works for recipes with multiple products +function util.add_product(recipe_name, product) + if data.raw.recipe[recipe_name] then + add_product(data.raw.recipe[recipe_name], product) + add_product(data.raw.recipe[recipe_name].normal, product) + add_product(data.raw.recipe[recipe_name].expensive, product) + end +end + +function add_product(recipe, product) + if recipe ~= nil and recipe.results ~= nil then + table.insert(recipe.results, product) + end +end + return util