diff --git a/me.lua b/me.lua index 030788f..e56de61 100644 --- a/me.lua +++ b/me.lua @@ -12,6 +12,10 @@ function me.byproduct() return me.get_setting("bzgold-byproduct") and not me.get_setting("bz-no-byproduct") end +function me.lead_byproduct() + return me.get_setting("bzlead-byproduct") and not me.get_setting("bz-no-byproduct") +end + function me.silver() if me.get_setting("bz-all-intermediates") then return true end return me.get_setting("bzgold-silver") diff --git a/prototypes/gold.lua b/prototypes/gold.lua index 393e50b..513145b 100644 --- a/prototypes/gold.lua +++ b/prototypes/gold.lua @@ -1,5 +1,14 @@ local util = require("data-util"); +local results = {{"gold-ingot", 1}} + +if util.me.silver() and util.me.byproduct() then + results = { + {type = "item", name="gold-ingot", amount=1, probability=.9}, + {type = "item", name="silver-ore", amount=1, probability=.1}, + } +end + data:extend({ { type = "item", @@ -13,12 +22,13 @@ data:extend({ { type = "recipe", name = "gold-ingot", + main_product = "gold-ingot", category = "smelting", order = "d[gold-ingot]", enabled = false, energy_required = 1.6, ingredients = {{"gold-ore", 1}}, - results = {{"gold-ingot", 1}}, + results = results, }, { type = "technology", diff --git a/prototypes/recipe-updates.lua b/prototypes/recipe-updates.lua index b8b9051..8b773ed 100644 --- a/prototypes/recipe-updates.lua +++ b/prototypes/recipe-updates.lua @@ -1,5 +1,11 @@ local util = require("data-util") +-- K2 silver from copper +if mods.Krastorio2 then + util.replace_some_product("copper-plate", "copper-plate", 1, "silver-ore", 1) + util.add_product("enriched-copper", {"silver-ore", 1}) +end + if mods.bztitanium then util.replace_ingredient("heat-exchanger", util.titanium_plate, "titanium-palladium-flange") util.replace_some_ingredient("steam-turbine", util.titanium_plate, 10, "titanium-palladium-flange", 10) diff --git a/prototypes/silver.lua b/prototypes/silver.lua index 88dc9b3..d076cdc 100644 --- a/prototypes/silver.lua +++ b/prototypes/silver.lua @@ -118,4 +118,21 @@ if util.me.silver() then order = "b-b", }, }) + + -- replace lead byproducts, set copper byproducts + util.set_main_product("copper-plate", "copper-plate") + if mods.bzlead and util.me.lead_byproduct() then + util.replace_product("lead-plate", "copper-ore", "silver-ore") + util.replace_product("enriched-lead", "copper-ore", "silver-ore") + + -- small silver byproduct on copper, even if lead is enabled + if not mods.Krastorio2 and util.me.byproduct() then + util.add_product("copper-plate", {type=item, name="silver-ore", amount=1, probability=0.1}) + end + else + if not mods.Krastorio2 then + util.multiply_recipe("copper-plate", 4) + util.replace_some_product("copper-plate", "copper-plate", 1, "silver-ore", 1) + end + end end